Here’s my response to the challenge. To make things really complicated, lets do an overkill and utilize docker containers instead of a VM.
If you are using an VM previously, I would suggest you to explore creating a clone on Web App. Vice-versa for those who are started on Web App, create a clone on VM.

Docker has its advantage in terms of service recovery and service healing. By itself it is a tedious task to setup such feature, hence the common orchestrators would be Docker Swarm, DC/OS and Kubernetes (also known as K8s). Here is the TLDR of what I’m going to achieve.

  • Install docker
  • Prepare Ubuntu + Nginx + PHP container
  • Create Azure Container Registry, and commit previously created container.
  • Create a visualstudio.com code repository
  • Run a webjob on existing Azure Web App which does git push of my wordpress source code daily.
  • Trigger (daily) a “container build” base on the prepared container in 2nd step of this bullet list, and add the daily code base into nginx starting directory in /var/www/html
  • Setup a k8s cluster with dockerfile to start 2 services, nginx and phpfm

 

Installing Docker

        <li>
          Once you have finished installation, there will be a whale tray icon on your taskbar.<br /> <a href="https://www.tanchunsiong.com/wp-content/uploads/2018/08/taskbar.jpg"><img decoding="async" loading="lazy" class="alignnone size-thumbnail wp-image-166" src="https://www.tanchunsiong.com/wp-content/uploads/2018/08/taskbar-150x150.jpg" alt="" width="150" height="150" /></a><a href="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.2-switch-to-windows.jpg"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-147" src="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.2-switch-to-windows.jpg" alt="" width="242" height="267" /></a><br /> Right click on the docker icon. You will be able to see a context menu. If you are intending to host your CMS on Windows based container, click switch to Windows. I&#8217;m going to use Linux based, and will be leave this as default. No action needed if you are following this guide.</p> <h1>
            Preparing Ubuntu, Nginx and PHP Docker Container Image
          </h1>
        </li>
        
        <li>
          Fire up your command prompt and download the base image of your intended host operating system. I&#8217;m going to use Ubuntu and will be doing a <code>"&lt;em>docker pull ubuntu&lt;/em>"</code>. If you are going to use Windows, do a <code>&lt;em>“docker pull microsoft/windowsservercore”&lt;/em></code>.What is &#8220;layer&#8221;? <a href="https://www.linkedin.com/in/voiddragon/">Gerald Goh</a> once put it in an interesting analogy, of thinking it like <a href="https://en.wikipedia.org/wiki/Kue_lapis">kuah lapis</a> (an asian dessert), where it is made layer by layer. Every-time you commit a change, you will be adding an additional layer to the dessert. Unlike dessert, you can always undo the top layers, make sure your bottom layers are foundation done well, and your top layers are those which are always changing such as your code base.<br /> <a href="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.3-command-line-docker-pull.jpg"><img decoding="async" loading="lazy" class="alignnone size-large wp-image-148" src="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.3-command-line-docker-pull-1024x565.jpg" alt="" width="720" height="397" /></a></p> <h6>
            prompt after doing docker pull ubuntu command
          </h6>
        </li>
        
        <li>
          Let&#8217;s start with our base layer of the dessert, which would be Ubuntu + Nginx (or Apache if you would like) with all the PHP dependencies necessary.<br /> I&#8217;ll start by running <code>"&lt;em>docker run -d -it -p 8080:80 ubuntu /bin/bash".&lt;/em></code> The <code>-d</code> flag specifies detach, and the <code>-p</code> flag specifies port mapping from your local machine to your docker container. <code>-it</code> mode allows you to run in interactive mode, and brings you directly into the bash shell.*hint* You can follow this <a href="https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04">digital ocean guide</a> if you would like.<br /> Just ensure you check your docker image of Ubuntu&#8217;s operating system version via the command &#8220;cat /etc/*release&#8221;.<br /> <a href="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.4-docker-run-interactive-ubuntu.jpg"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-149" src="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.4-docker-run-interactive-ubuntu.jpg" alt="" width="977" height="509" srcset="http://www.tanchunsiong.com/wp-content/uploads/2018/08/1.4-docker-run-interactive-ubuntu.jpg 977w, http://www.tanchunsiong.com/wp-content/uploads/2018/08/1.4-docker-run-interactive-ubuntu-768x400.jpg 768w" sizes="(max-width: 977px) 100vw, 977px" /></a></p> <h6>
            prompt after doing docker run -it ubuntu
          </h6>
          
          <p>
            Here are the list of commands (without explanation) below. If you are already root, you do not need to pre-pend &#8220;sudo&#8221; in front of your commands<br /> <code>docker run -it (your container id, without the round bracket)&lt;br />

#If you need to find your container ID, type “docker ps -a”<br /> apt-get update<br /> DEBIAN_FRONTEND=“noninteractive” apt-get install -y vim curl wget nano dialog<br /> #you can docker commit <container> <container>:<date>in another cli if you want)<br /> apt-get upgrade<br /> apt-get install nginx<br /> apt-get install php-fpm<br /> update-rc.d nginx defaults<br /> update-rc.d php7.2-fpm defaults you can follow most of the guide here https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04 *(Should I create the above from devops processes such as my docker compose yaml file instead?) Well it depends. There are some things which doesn’t change, example apt update, installing nginx. Just remember about your dessert.

            <h2>
              Creating Azure Container Registry and Commiting your first Container Image
            </h2>
            
            <ol>
              <li style="list-style-type: none;">
                <ol>
                  <li>
                    Next we would need to setup an <a href="https://azure.microsoft.com/en-us/services/container-registry/">Azure Container Registry</a> (ACR). Think of it as a GitHub, but for docker containers. Alternative to ACR, you may choose to use the free container registry from www.docker.com. Fire up your <strong>another</strong> command line shell and do the following. This is important as you do not want to use the same shell (which is still running) in step 4. You might need to install the <a href="https://docs.microsoft.com/en-us/cli/azure/install-azure-cli">Azure CLI</a> before proceeding.<code>REM</code> refers to comment in windows command line shell<br /> <code>&lt;br />

REM “login to Azure”<br /> az login<br /> REM “set default subscription”<br /> az account set –subscription “your subscription name”<br /> REM “Create a service principle to manage your Azure Subscription” #credentialsSPRBAC<br /> az ad sp create-for-rbac<br /> REM “Create an ACR for your subscription”<br /> az acr create –resource-group yourRGName –name YourRegistry932 –sku Basic<br /> REM “Enable admin login with username and password”<br /> az acr update -n 30DOAContainerRegistry932 –admin-enabled true<br /> REM “Login to ACR with your docker command line client”<br /> docker login 30DOAContainerRegistry932.azurecr.io -u username -p password<br /> REM “Continue from Step 4, get the running container ID”<br /> docker ps -a (this will help you get 903d6fec4cba below)<br /> REM “Commit your container (with Nginx and PHP installed) into ACR”<br /> docker commit 903d6fec4cba 30DOAContainerRegistry932.azurecr.io/ubuntu:php-serviceonboot<br /> docker push 30DOAContainerRegistry932.azurecr.io/ubuntu:php-serviceonboot<br /> If you remember the layering example, I’ve done multiple commits before my final commit of ubuntu:php-serviceonboot

            <h2>
              Creating a VSTS / VSOnline code repository
            </h2>
            
            <ol>
              <li style="list-style-type: none;">
                <ol>
                  <li>
                    Next head over to <a href="https://app.vssps.visualstudio.com">visual studio online (previously known as visual studio team services or vsts)</a> ,create your free account and add a new project. I&#8217;ve added my project name as &#8220;Project Nami WordPress on Azure&#8221;.<br /> <a href="https://www.tanchunsiong.com/wp-content/uploads/2018/08/2.1-setting-up-build-docker-vsts.jpg"><img decoding="async" loading="lazy" class="alignnone size-large wp-image-152" src="https://www.tanchunsiong.com/wp-content/uploads/2018/08/2.1-setting-up-build-docker-vsts-1024x546.jpg" alt="" width="720" height="384" /></a>
                  </li>
                  <li>
                    Take this opportunity to setup an alternative credential which is needed for later part of this guide. Click on your name on the top right hand side of the portal, in my case in CT > Security > Alternative Authentication Credentials. If you cannot find the page below, goto <a href="https://abcxyz.visualstudio.com/_details/security/altcreds">https://<strong>abcxyz</strong>.visualstudio.com/_details/security/altcreds</a>. Replace <strong>abcxyz</strong> with your own vsonline&#8217;s name. Let&#8217;s call this credentialAAT for easy searching later.<br /> <a href="https://www.tanchunsiong.com/wp-content/uploads/2018/08/setting-up-AAT.jpg"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-171" src="https://www.tanchunsiong.com/wp-content/uploads/2018/08/setting-up-AAT.jpg" alt="" width="1165" height="765" /></a>
                  </li>
                  <li>
                    You would also need to link up your VSTS / VSOnline to your Azure Subscription. This will allow pulling of containers from your ACR. On the Dashboard of your Project, click on the settings &#8220;Gear&#8221; icon.<br /> <a href="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.2-vsts-landing-page.jpg"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-173" src="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.2-vsts-landing-page.jpg" alt="" width="1264" height="764" srcset="http://www.tanchunsiong.com/wp-content/uploads/2018/08/1.2-vsts-landing-page.jpg 1264w, http://www.tanchunsiong.com/wp-content/uploads/2018/08/1.2-vsts-landing-page-768x464.jpg 768w" sizes="(max-width: 1264px) 100vw, 1264px" /></a>
                  </li>
                  <li>
                    Next click on &#8220;New Service Connection&#8221;, select &#8220;Azure Resource Manager&#8221; from the drop down list, and you will see the prompt below. Click on &#8220;use the full version of the service connection dialog&#8221;, if you cannot find your subscription from the drop down list. As I&#8217;m using a different subscription, I will be clicking on the link as illustrated below.<br /> <a href="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.3-vsts-add-azure-resource-manager-service-connection.jpg"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-179" src="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.3-vsts-add-azure-resource-manager-service-connection.jpg" alt="" width="1280" height="766" srcset="http://www.tanchunsiong.com/wp-content/uploads/2018/08/1.3-vsts-add-azure-resource-manager-service-connection.jpg 1280w, http://www.tanchunsiong.com/wp-content/uploads/2018/08/1.3-vsts-add-azure-resource-manager-service-connection-768x460.jpg 768w" sizes="(max-width: 1280px) 100vw, 1280px" /></a>
                  </li>
                  <li>
                    For Connection Name, you can give it anyname which you want.<br /> For Environment, leave it as AzureCloud, unless you are using Cloud in special regions.<br /> For <a href="https://blogs.msdn.microsoft.com/mschray/2016/03/18/getting-your-azure-subscription-guid-new-portal/">Subscription ID, Name</a> and <a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-create-new-tenant">Tenant ID</a>, refer to the link inline.<br /> For Service Principal Client ID and Service Principal Key, you may reuse the service principal from Day 1&#8217;s guide when creating a Let&#8217;s Encrypt extension, or you may reuse the service principal from above <code>#credentialsSPRBAC</code>. Hit verify connection and OK to add the connection.<a href="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.4-vsts-landing-page.jpg"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-175" src="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.4-vsts-landing-page.jpg" alt="" width="1267" height="762" srcset="http://www.tanchunsiong.com/wp-content/uploads/2018/08/1.4-vsts-landing-page.jpg 1267w, http://www.tanchunsiong.com/wp-content/uploads/2018/08/1.4-vsts-landing-page-768x462.jpg 768w" sizes="(max-width: 1267px) 100vw, 1267px" /></a>
                  </li>
                </ol>
              </li>
            </ol>
            
            <h2>
              Setting up Git Webjob to commit code from Azure Web App to VSTS / VSOnline daily
            </h2>
            
            <ol>
              <li style="list-style-type: none;">
                <ol>
                  <li>
                    Azure Web App comes with an environment called Kudu, providing tools and some environment for common debugging and task. I&#8217;ll be using the CMD command line interface to work on Git services. I&#8217;ll <code>git init</code> the root directory of my wordpress, where all my php source code resides.<br /> <a href="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.1-git-init.jpg"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-138" src="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.1-git-init.jpg" alt="" width="1063" height="936" srcset="http://www.tanchunsiong.com/wp-content/uploads/2018/08/1.1-git-init.jpg 1063w, http://www.tanchunsiong.com/wp-content/uploads/2018/08/1.1-git-init-768x676.jpg 768w" sizes="(max-width: 1063px) 100vw, 1063px" /></a>
                  </li>
                  <li>
                    Specify your username by doing<code> git config --global user.mail cstan@contoso.com</code> and<code> git config --global user.name cstan</code><br /> Your username might be different from mine, which is &#8220;cstan&#8221; in the above example<br /> <a href="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.2-git-commit-2.jpg"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-182" src="https://www.tanchunsiong.com/wp-content/uploads/2018/08/1.2-git-commit-2.jpg" alt="" width="1039" height="889" srcset="http://www.tanchunsiong.com/wp-content/uploads/2018/08/1.2-git-commit-2.jpg 1039w, http://www.tanchunsiong.com/wp-content/uploads/2018/08/1.2-git-commit-2-768x657.jpg 768w" sizes="(max-width: 1039px) 100vw, 1039px" /></a>
                  </li>
                  <li>
                    Next add all the files and commit your files<br /> <code>Git add .&lt;br />

Git commit -m “Initial Commit”<br /> git remote set-url origin https://cstan:@contoson-tenantname.visualstudio.com/Project%20Nami%20Wordpress%20on%20Azure/_git/Project%20Nami%20Wordpress%20on%20Azure or git remote set-url origin https://cstan:@contoson-tenantname.visualstudio.com/Project%20Nami%20Wordpress%20on%20Azure/_git/Project%20Nami%20Wordpress%20on%20Azure<br /> git push -u origin master –all or git push -u origin master – <br /> Note that your password ********* has to be URL encoded. Your username might be different from mine, which is “cstan” in my example. Once the code has been pushed, you should be able to see a list of code updated on your VSTS or VSOnline portal Now that the push is tested to be working, we will create a batch file which commits the code into VSTS / VSOnline on a daily basis. If you are using a VM, you will be creating a powershell script or shell script which will run the similar git commands below. Go to your web app -> WebJobs> Add. Name: gitpushwebjob File upload: https://github.com/tanchunsiong/30-days-of-azure/blob/master/day2/gitpushwebjob.bat Type: Trigger Triggers: Scheduled Cron Expression: 0 30 9 * * *My cron expression will run this script every day at 930am. For troubleshoot, occasionally check your logs for errors. For my case, I realised I needed to do a Git pull before the entire command.

            <h2>
              Trigger a container build.
            </h2>
            
            <ol>
              <li style="list-style-type: none;">
                <ol>
                  <li style="list-style-type: none;">
                    <ol>
                      <li>
                        Now create a file named &#8220;DockerFile&#8221; in your code repository. The contents of the <a href="https://github.com/tanchunsiong/30-days-of-azure/blob/master/day2/Dockerfile">dockerfile are located over at github.</a> For convenience sake, I&#8217;ll be pasting them below.<a href="https://www.tanchunsiong.com/wp-content/uploads/2018/08/2.4-adding-docker-file-2.jpg"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-180" src="https://www.tanchunsiong.com/wp-content/uploads/2018/08/2.4-adding-docker-file-2.jpg" alt="" width="1920" height="1050" srcset="http://www.tanchunsiong.com/wp-content/uploads/2018/08/2.4-adding-docker-file-2.jpg 1920w, http://www.tanchunsiong.com/wp-content/uploads/2018/08/2.4-adding-docker-file-2-768x420.jpg 768w" sizes="(max-width: 1920px) 100vw, 1920px" /></a><br /> <code>&lt;br />

#base on https://github.com/fideloper/docker-nginx-php&lt;br /> FROM 30doacontainerregistry932.azurecr.io/ubuntu:php-serviceonboot<br /> #commands already executed in the image above<br /> #apt-get update<br /> #DEBIAN_FRONTEND=“noninteractive” apt-get install -y vim curl wget nano dialog<br /> #apt-get upgrade<br /> #apt-get install nginx<br /> #apt-get install php-fpm<br /> #update-rc.d nginx defaults<br /> #update-rc.d php7.2-fpm defaults<br /> CMD ["/sbin/my_init"] WORKDIR /var/www/html<br /> COPY / /var/www/html<br /> RUN ls -la /<br /> EXPOSE 80<br /> CMD service php7.2-fpm start<br /> CMD service nginx start<br /> RUN apt-get clean && rm -rf /var/lib/apt/lists/ /tmp/* /var/tmp/*<br /> Create a new build process and with 3 task. They are below, and should have similar parameters Copy Files Build an Image. Important note, you need to “Link” Azure Container Registry before you can successfully pull the prepared image for building. Push an Image If you have successfully Build and Push the Image, you should see something similar on your Azure Portal

            <h2>
              Creating K8s Cluster on Azure
            </h2>
            
            <p>
              If you would like, you may follow the <a href="https://docs.microsoft.com/en-us/azure/container-service/kubernetes/container-service-kubernetes-walkthrough">guide here on creating k8s cluster on Azure</a>
            </p>
            
            <ol>
              <li style="list-style-type: none;">
                <ol>
                  <li style="list-style-type: none;">
                    <ol>
                      <li>
                        <code>&lt;br />

az aks create –resource-group projectnamirg –name=myK8sCluster –node-count=2 –node-vm-size=Standard_B2s –kubernetes-version 1.11.1 –generate-ssh-keys –service-principal b44xxxx1-xxxx-xxxx-xxxx-cba7xxxx67b52 –client-secret Jxxxvn23xxxx/uxGGxxxxU23q/xxxxxxxx5R/1Txxxx=<br /> <a href=“https://www.tanchunsiong.com/wp-content/uploads/2018/08/create-k8s-from-command-line.jpg">&lt;img decoding=“async” loading=“lazy” class=“alignnone size-large wp-image-195” src=“https://www.tanchunsiong.com/wp-content/uploads/2018/08/create-k8s-from-command-line-1024x661.jpg" alt=”” width=“720” height=“465” /></a><br /> <a href=“https://www.tanchunsiong.com/wp-content/uploads/2018/08/creating-k8s-on-portal-pending.jpg">&lt;img decoding=“async” loading=“lazy” class=“alignnone size-full wp-image-196” src=“https://www.tanchunsiong.com/wp-content/uploads/2018/08/creating-k8s-on-portal-pending.jpg" alt=”” width=“931” height=“781” srcset=“http://www.tanchunsiong.com/wp-content/uploads/2018/08/creating-k8s-on-portal-pending.jpg 931w, http://www.tanchunsiong.com/wp-content/uploads/2018/08/creating-k8s-on-portal-pending-768x644.jpg 768w” sizes="(max-width: 931px) 100vw, 931px" /></a> az aks install-cli will install the cli for kubernetes If you are using windows, you might need to do set PATH=%PATH%;C:\program files (x86)</code> to allow global path variable connect kubectl to your cluster by az aks get-credentials –resource-group=projectnamirg –name=myK8sCluster create acr login via kubectl create secret docker-registry <strong>mysupersecret</strong>–docker-server=REGISTRY_NAME.azurecr.io –docker-username=USERNAME –docker-password=PASSWORD –docker-email=ANY_VALID_EMAIL. Make sure you remember the variable name mysupersecretas you will need to use it later kubectl get nodes will help you check your nodes az aks browse –resource-group projectnamirg –name myK8sCluster connect to your cluster via Web UI. By default, you need to setup this tunnel to get into the management UI. If this does not work try Kubectl proxy. If you are getting some errors on the management portal, check out https://pascalnaber.wordpress.com/2018/06/17/access-dashboard-on-aks-with-rbac-enabled/ Want to start testing out K8S with your image? Try kubectl exec -it 30doacontainerregistry932.azurecr.io/projectnamiwordpressonazure:latest /bin/bash

            <h2>
              Installing msodbc driver on Linux based docker
            </h2>
            
            <p>
              This gave me days of fun, as the container version Ubuntu 18, PHP 7.2 are of latest version.
            </p>
            
            <p>
              Some reference are done inline, and highlight the changes in bold
            </p>
            
            <p>
              <a href="https://stackoverflow.com/questions/48651225/cant-get-sqlsrv-pdo-to-connect-to-remote-sql-server">https://stackoverflow.com/questions/48651225/cant-get-sqlsrv-pdo-to-connect-to-remote-sql-server</a><br /> <code>&lt;br />

Install dependencies<br />

apt-get install libc6 libstdc++6 libkrb5-3 <strong>libcurl4</strong> openssl debconf unixodbc unixodbc-dev<br />

Manually install <strong>msodbcsql 17</strong> and <strong>mssql-tools 17</strong><br />

ODBC .deb found here -> https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server&lt;br />

Tools .deb found here -> https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools&lt;br />

… Are they compatible?<br />

#<br /> mkdir /debs<br /> cd /debs<br /> <strong>wget https://packages.microsoft.com/ubuntu/18.04/prod/pool/main/m/msodbcsql17/msodbcsql17_17.2.0.1-1_amd64.deb&lt;/strong>&lt;br /> <strong><br /> wget https://packages.microsoft.com/ubuntu/18.04/prod/pool/main/m/mssql-tools/mssql-tools_17.2.0.1-1_amd64.deb&lt;/strong>&lt;br /> <strong><br /> dpkg -i msodbcsql17_17.2.0.1-1_amd64.deb</strong><br /> <strong><br /> dpkg -i mssql-tools_17.2.0.1-1_amd64.deb</strong><br />

Link tools to sqlcmd<br />

#<br /> echo ’export PATH="$PATH:/opt/mssql-tools/bin"’ >> ~/.bash_profile<br /> echo ’export PATH="$PATH:/opt/mssql-tools/bin"’ >> ~/.bashrc<br /> source ~/.bashrc<br />

PHP 7.2 sqlsrv pdo extension<br />

#<br /> <strong>apt-get install php-pear php7.2-dev</strong><br /> pecl install sqlsrv<br /> pecl install pdo_sqlsrv<br />

Config php.ini for CLI & NGINX<br />

#<br /> phpversion=“7.2”<br /> phpini="/etc/php/$phpversion/fpm/php.ini"<br /> echo "" >> $phpini<br /> echo “# Extensions for Microsoft SQL Server Driver” >> $phpini<br /> echo “extension=sqlsrv.so” >> $phpini<br /> <strong>#echo “extension=pdo_sqlsrv.so” >> $phpini</strong><br /> <strong><br /> #I’ve removed the line above as there are some dependencies which need sqlsrv.so to</strong> load before pdo_sqlsrv.so<br /> echo "" >> $phpini<br /> phpini="/etc/php/"$phpversion"/cli/php.ini"<br /> echo "" >> $phpini<br /> echo “# Extensions for Microsoft SQL Server Driver” >> $phpini<br /> echo “extension=sqlsrv.so” >> $phpini<br /> <strong>#echo “extension=pdo_sqlsrv.so” >> $phpini</strong><br /> <strong><br /> #I’ve removed the line above as there are some dependencies which need sqlsrv.so to</strong> load before pdo_sqlsrv.so<br /> echo "" >> $phpini<br />

Restart NGINX and PHP-FPM<br />

#<br /> service php7.2-fpm restart<br /> service nginx restart<br />

            <h6>
              <code>&lt;br />

<strong>#some dependencies of SQLCMD</strong><br /> <strong><br /> apt-get install -y locales && echo “en_US.UTF-8 UTF-8” > /etc/locale.gen && locale-gen</strong><br /> #if you encounter /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.2.so not found error, try to look for missing files by typing ldd /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.2.so

            <h6>
              PHP Startup: Unable to load dynamic library &#8216;pdo_sqlsrv.so&#8217; (tried: /usr/lib/php/20170718/pdo_sqlsrv.so (/usr/lib/php/20170718/pdo_sqlsrv.so: undefined symbol: php_pdo_register_driver)
            </h6>
            
            <p>
              <a href="https://askubuntu.com/questions/339364/libssl-so-10-cannot-open-shared-object-file-no-such-file-or-directory">https://askubuntu.com/questions/339364/libssl-so-10-cannot-open-shared-object-file-no-such-file-or-directory</a><br /> <code>&lt;br />

#Lets make sure that you have your SSL installed and updated:<br /> apt-get update<br /> apt-get install libssl1.0.0 libssl-dev<br /> #Now lets fix the naming of the file by creating a link:<br /> cd /lib/x86_64-linux-gnu<br /> ln -s libssl.so.1.0.0 libssl.so.10<br /> ln -s libcrypto.so.1.0.0 libcrypto.so.10<br /> #try out to connection<br /> sqlcmd -S 30daysofazure-sqlserver.database.windows.net -U chunsiongtan<br /> #make sure that “extension=pdo_sqlsrv.so” found in /etc/php/7.2/cli/conf.d/30-pdo_sqlsrv.ini instead of php.ini

            <p>
              &nbsp;
            </p>
            
            <p>
              <code>echo "extension=pdo_sqlsrv.so" &gt;&gt; /etc/php/7.2/cli/conf.d/30-pdo_sqlsrv.ini</code>
            </p>
            
            <p>
              <code>&lt;br />

#lastly copy the same config file to fpm directory<br /> cp /etc/php/7.2/cli/conf.d/30-pdo_sqlsrv.ini /etc/php/7.2/fpm/conf.d<br />

            <p>
              if you need to check for php error, try <code>php --info | grep error&lt;br />
            <p>
              lastly
            </p>
            
            <p>
              <code>docker commit 903d6fec4cba 30DOAContainerRegistry932.azurecr.io/ubuntu:serviceonboot-mssqlodbc&lt;br />

docker push 30DOAContainerRegistry932.azurecr.io/ubuntu:serviceonboot-mssqlodbc

            <h2>
              configuring php-fpm with nginx
            </h2>
            
            <p>
              https://www.1and1.com/cloud-community/index.php?id=1399#id1
            </p>
            
            <p>
              &nbsp;
            </p>
            
            <h2>
              deploy image using kubernetes dashboard
            </h2>
            
            <p>
              &nbsp;
            </p>
            
            <p>
              &nbsp;
            </p>
            
            <p>
              &nbsp;
            </p>
            
            <h2>
              pointing traffic manager to new service IP
            </h2>
            
            <h3>
              updating dns name before using traffic manager
            </h3>
            
            <p>
              az network public-ip list
            </p>
            
            <p>
              <a href="https://www.tanchunsiong.com/wp-content/uploads/2018/08/public-ip-address-resource-id.jpg"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-214" src="https://www.tanchunsiong.com/wp-content/uploads/2018/08/public-ip-address-resource-id.jpg" alt="" width="961" height="727" srcset="http://www.tanchunsiong.com/wp-content/uploads/2018/08/public-ip-address-resource-id.jpg 961w, http://www.tanchunsiong.com/wp-content/uploads/2018/08/public-ip-address-resource-id-768x581.jpg 768w" sizes="(max-width: 961px) 100vw, 961px" /></a>
            </p>
            
            <p>
              az network public-ip update &#8211;ids /subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/MC_projectnamirg_myK8sCluster_southeastasia/providers/Microsoft.Network/publicIPAddresses/kubernetes-ad0xxxxxxxfa411exxxx56aa5bd8xxxx &#8211;dns-name &#8220;myk8sclusterip&#8221;
            </p>
            
            <p>
              &nbsp;
            </p>
            
            <p>
              <a href="https://www.tanchunsiong.com/wp-content/uploads/2018/08/adding-k8s-endpoint-for-traffic-manager.jpg"><img decoding="async" loading="lazy" class="alignnone size-large wp-image-215" src="https://www.tanchunsiong.com/wp-content/uploads/2018/08/adding-k8s-endpoint-for-traffic-manager-1024x765.jpg" alt="" width="720" height="538" /></a>
            </p>
            
            <p>
              <a href="https://www.tanchunsiong.com/wp-content/uploads/2018/08/stopping-web-app.jpg"><img decoding="async" loading="lazy" class="alignnone size-large wp-image-217" src="https://www.tanchunsiong.com/wp-content/uploads/2018/08/stopping-web-app-1024x619.jpg" alt="" width="720" height="435" /></a>
            </p>
            
            <h2>
              Ingress and TLS
            </h2>
            
            <p>
              https://docs.microsoft.com/en-us/azure/aks/ingress
            </p>