Enable SSH on Azure AppService - Wordpress - wordpress

I can't ssh to the Azure App Service wordpress site and seems it has been disabled within it.
Referred following url to setup the Site.
https://learn.microsoft.com/en-us/azure/app-service/quickstart-wordpress
Any idea on how can i enable this ?

Enable SSH on Azure AppService - Wordpress
Any idea on how can i enable this ?
To enable ssh for WordPress settings you first need to create normal webapp with docker container and then we need to deploy WordPress image in container.
After creating the docker container find the command for deploying WordPress docker image.
Check this document for more information on docker deployment.
for Docker image deployment check the official website
``console
$ docker run --name some-wordpress --network some-network -d wordpress
- *Here are the commands for installing SSH config file*
cat sshd_config
```
Here is the output

Related

How can I package and run a React Single Page App using Bitnami?

I have a react SPA (Single Page Application) and want to deploy it to a Kubernetes environment.
For the sake of keeping it simple, assume the SPA is stand alone.
I've been told Bitnami's repo for Helm Charts are a good place to start to solve this problem.
So my question is what Bitnami chart should I use to deploy a react SPA to a Kubernetes cluster? And where can I find the steps explained?
What I want
The desired solution should be a Helm Chart that serves up static content. Typically app.js and index.html page, and other static content. And lets me specify the sub-directory to use as the contents of the website. In react, the build subdirectory holds the website.
What I currently do (How to deploy a SPA to K8S my steps)
What I currently do is described below. I'm starting from a new app created by create-react-app so that others could follow along and do this if needed to helm answer the question.
This assumes you have Docker, Kubernetes and helm installed (as well as node and npm for React).
The following commands do the following:
Create a new React application
Create a docker container for it.
Build and test the SPA running in a local docker image .
Create a helm chart to deploy the image to K8S.
Configure the helm chart so it uses the docker image created in step 3.
Using the helm CLI deploy the SPA app to the k8s cluster.
Test the SPA running in k8s cluster.
#1 Create a new React application
npx create-react-app spatok8s
cd spatok8s
npm run build
At this point the static SPA website is created an is in the build directory.
2. Create a docker container for it.
Next, create Dockerfile with the following. For example, vi Dockerfile and put the following in it. The Dockerfile was what is described here https://hub.docker.com/_/nginx.
FROM nginx
copy build /usr/share/nginx/html
These commands say to use the NGINX docker image (from dockerhub) and copy my website onto the image so my website will be self contained within the image. When the image starts (nginx starts) and the only content to be served will be my index.html file in the /usr/share/nginx/html/index.html file.
3. Build and test the SPA running in a local docker image .
Next build the docker image spatok8s and run it locally, and open your browser to http://localhost:8082 (used in this example).
docker build -t spatok8s .
docker run -d -p8082:80 spatok8s
After you've verified it works stop it using docker stop # where the # is the container number from docker ps -q --filter ancestor=spatok8s.
4. Create a helm chart to deploy the image to K8S.
Now create a helm chart so I can deploy this docker image to Kubernetes:
helm create spatok8schart
5. Configure the helm chart so it uses the docker image created in step 3.
Update the helm chart for this application vi spatok8schart
The lines changed are included below:
# Update the repo to use the Docker image just built
repository: spatok8s
. . .
# Update the URL to use to access the SPA when it is deployed to Kubernetes
- host: spatok8s.local
. . .
serviceName: spatok8s.local
6. Using the helm CLI deploy the SPA app to the k8s cluster.
Deploy it
helm install spatok8s spatok8schart
The output for the last command is:
NAME: spatok8s
LAST DEPLOYED: Thu Apr 8 22:50:26 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
http://spatok8s.local/
7. Test the SPA running in k8s cluster.
Open the browser to http://spatok8s.local.
If you are doing local development and your Kubernetes environment is not automatically setting up your DNS names, then you'll have to manually set the hostname spatok8s.local to the IP address of the kubernetes cluster.
The files /etc/hosts or c:\Windows\System32\Drivers\etc\hosts can be used to hold that information.
Searching for a solution
So it works but it isn't as easy as I've been told it could be, so I'm searching for the Bitnami chart that will make this easier.
I searched helm chart for deploying a single page app? and found:
https://developer.ibm.com/depmodels/cloud/tutorials/convert-sample-web-app-to-helmchart/ - Which requires an IBM private cloud (a non-starter for me).
https://wkrzywiec.medium.com/how-to-deploy-application-on-kubernetes-with-helm-39f545ad33b8 - A medium article which looked overly complicated for what I want to do.
https://opensource.com/article/20/5/helm-charts - Good article but not what I'm looking for
A search for "What bitnami chart should I use to deploy a React SPA?" is what worked for me.
See https://docs.bitnami.com/tutorials/deploy-react-application-kubernetes-helm/.
I'll summarize the steps below but this website should be around for a while.
The Binami Approach
Step 1: Build and test a custom Docker image
Step 2: Publish the Docker image
Step 3: Deploy the application on Kubernetes
Step 1: Build and test a custom Docker image
The website provides a sample react app
git clone https://github.com/pankajladhar/GFontsSpace.git
cd GFontsSpace
npm install
Create a Dockerfile with the following:
FROM bitnami/apache:latest
COPY build /app
Build and test it. Build the Docker image, replacing the USERNAME placeholder in the command below with your Docker Hub username:
docker build -t USERNAME/react-app .
Run it to verify it works:
docker run -p 8080:8080 USERNAME/react-app
Step 2: Publish the Docker image
docker login
docker push USERNAME/react-app
Again use your Docker hub username
Step 3: Deploy the application on Kubernetes
Make sure that you can to connect to your Kubernetes cluster by executing the command below:
kubectl cluster-info
Update your Helm repository list:
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
Deploy the application by executing the following (replace the USERNAME placeholder with your Docker username):
helm install apache bitnami/apache \
--set image.repository=USERNAME/react-app \
--set image.tag=latest \
--set image.pullPolicy=Always
If you wish to access the application externally through a domain name and you have installed the NGINX Ingress controller, use this command instead and replace the DOMAIN placeholder with your domain name:
helm install apache bitnami/apache \
--set image.repository=USERNAME/react-app \
--set image.tag=latest \
--set image.pullPolicy=Always \
--set ingress.enabled=true \
--set ingress.hosts[0].name=DOMAIN
You were actually doing the same steps, so your manual approach was "spot on"!
Thanks again to Vikram Vaswani, and this website https://docs.bitnami.com/tutorials/deploy-react-application-kubernetes-helm that had this answer!

How to work with wordpress dévelopment server?

I'm testing WordPress for personnal project but i would like to install locally my development WordPress website and install on my Personnal production server the final website.
In order to do that, i search a plugin or program for syncronising wordpress dévelopment with new pages, templates, and configurations inside my production wordpress.
Is there a program or plugin to do that? How is much better to work with wordpress?
Thanks :)
There are two topics you can try:
-.By schedule copy files to production like linux CLI with crontab (every min):
* * * * * scp local_file remote_username#remote_ip:remote_file
But I don't recommend this way , and for you to easy understand.
-.By CICD, here is a blog link for you to know the concept first if you don't know this:
https://thecodingmachine.io/continuous-delivery-on-a-dedicated-server
Briefly, you can push your project to private repo on gitlab or github,
then make development(=development server),production(=production server) branches, the automate job will deploy to the servers if you have git push.
Here's an example main part from the link on the file .gitlab-ci.yml:
deploy_staging:
stage: deploy
image: kroniak/ssh-client:3.6
script:
# add the server as a known host
- mkdir ~/.ssh
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
# add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
# log into Docker registry
- ssh deployer#thecodingmachine.io "docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.thecodingmachine.com"
# stop container, remove image.
- ssh deployer#thecodingmachine.io "docker stop thecodingmachine.io_${CI_COMMIT_REF_SLUG}" || true
- ssh deployer#thecodingmachine.io "docker rm thecodingmachine.io_${CI_COMMIT_REF_SLUG}" || true
- ssh deployer#thecodingmachine.io "docker rmi registry.thecodingmachine.com/tcm-projects/thecodingmachine.io:${CI_COMMIT_REF_SLUG}" || true
# start new container
- ssh deployer#thecodingmachine.io "docker run --name thecodingmachine.io_${CI_COMMIT_REF_SLUG} --network=web -d registry.thecodingmachine.com/tcm-projects/thecodingmachine.io:${CI_COMMIT_REF_SLUG}"
only:
- branches
except:
- master
It maybe hard for you to read this, but you can know there is a way which can work you need and you may take times to learn this part.
Hope it work for you.
Thanks for David Négrier sharing.

Web App for Containers - Wordpress Https

I can't seem to get Web App for Containers (S1) to deploy a Wordpress image from Azure Container Instance with HTTPS working for the admin section. The wp-config.php configuration file are taken from the samples on github provided by microsoft and the Dockerfile is extended from wordpress:4.9.5-php7.2-apache
# Pull image from official source with version specified
FROM wordpress:4.9.5-php7.2-apache
# Overwrite Wordpress configuration
COPY ./wp-config.php /usr/src/wordpress/
# Add permissions needed for wordpress to run
RUN chown -R www-data:www-data /usr/src/wordpress/
WORKDIR /var/www/html
I can build the image, push it, and deploy it to Web App for Containers, but when I try to log into the admin portal using https I am redirected to the non-https login.
The docker logs on Web App during container invokation looks like below
2018-04-23 07:57:21.751 INFO - Starting container for site
2018-04-23 07:57:21.751 INFO - docker run -d -p 58688:80 --name my-test-website__c20c_2 -e WEBSITE_SITE_NAME=my-test-website-name -e WEBSITE_AUTH_ENABLED=False -e PORT=80 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_INSTANCE_ID=...3cfaeb147447885bccba4565fb6192f -e HTTP_LOGGING_ENABLED=1 myacrregsitryhere.azurecr.io/wordpressdocker:21483
Things that I have tried:
allow http/s in wp-config like so:
define('WP_HOME', '//'. filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING));
define('WP_SITEURL', '//'. filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING));
define('WP_CONTENT_URL', '/wp-content');
define('DOMAIN_CURRENT_SITE', filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING));
which results in redirect loop that is stopped by the browser.
Azure Web app enforce https
results in redirect loop that is stopped by the browser.
Enforce ssl via wp-config.php
define('FORCE_SSL_ADMIN', true);
How am I supposed to get https working with slots in Azure Web App for Containers?
You can enforce SSL for that web app in the portal, i.e. as per https://learn.microsoft.com/en-gb/azure/app-service/app-service-web-tutorial-custom-ssl#enforce-https

Manage wordpress files in google container Engine and kubernetes

I am in the middle of no where. Following this tutorial https://cloud.google.com/container-engine/docs/tutorials/persistent-disk
I deployed wordpress to google container engine. Now i have no idea how to access wordpress files on this Persistent Disks either with ftp or sftp. I can access project files with sftp on filezilla but can't find wordpress core files in it. Is there any way i can access these wordpress files?
The persistent disk containing the wordpress files are attached to the wordpress pod. This disk is mounted on /var/www/html folder under the wordpress pod. You can access these files by connecting to the wordpress pod. First get the name of the running pod by executing the following command,
kubectl get pods
Now use the name of the wordpress pod in the following command. This runs a remote shell on the wordpress pod,
kubectl exec -it <POD_NAME> sh
In the shell, run the ls command to see the list of wordpress files,
# ls
This will list the wordpress files. If you want to edit these files, you need to install vim or nano.
# apt-get update
# apt-get install vim
# apt-get install nano
# vi wp-config.php
Note that the vim/nano will be removed if the wordpress pod is restarted. If you really want them inside your pod, you will need to create a custom container.
First take a look here: https://stackoverflow.com/a/46011597/1197205
This plugin uses Google Cloud Storage so it's easy to access via the UI
Another solution (only if you run 1 pod because otherwise you'd need to sync between disks): use an sftp container as a sidecar for the wordpress pod

Running Drupal in Docker container

I want to run a Drupal website in a docker container but everytime i change the web folder in the drupal container into a volume i run into issues.
docker run --name some-drupal -v /data/web:/var/www/html -p 8080:80 -d drupal
If I use a volume the website won't load anymore and refuses the connection.
I'm using this respository for my drupal image.

Resources