WordPress in Azure WebApps with Azure Sql Database3 min read

Estimated Reading Time: 2 minutes

I’ve not done a lot of blogging recently.. With the last post on my OLD blog being from 2010.

image
One of the reasons for this was me wanting to run my own blog in Azure…
While WordPress did work well so far on Azure Web Sites / Web Apps, the big painpoint so far had been DATABASE support.. WordPress being a PHP application, it’s Data Access Layer had been written to target MYSQL.

Now FINALLY we do have a version of WordPress (again) that works with SQL Server and Azure SQL DB.
You can go and download it from http://projectnami.org/.

Setting it up is somewhat bumpy, because some files are missing, some I had to do a few undocumented steps.
The missing files are JavaScript files (e.g. widget.js), that are only included in the MINIFIED version.
When I first tried WordPress it failed unexpectedly, which was to do the .JS files missing – and me getting 404.
Solution is to copy the files – e.g. widget.min.js –-> widget.js. This way WordPress will then get the URLs right and work.

Here’s the steps to get it running…

  1. Download the latest release from https://github.com/ProjectNami/projectnami/releases
    I downloaded v 1.2.2  using Powershell
    wget https://github.com/ProjectNami/projectnami/archive/1.2.2.zip -OutFile 1.2.2.zip
  2. Extract it locally
  3. Use powershell to copy all *.min.js files to *.js (this is the FIX and might be obsolete in the future)
    Get-ChildItem *.min.js -Recurse | Copy-Item  -Destination {$_.FullName.Replace("min.","")}</li>
  4. Next create a new Azure Web App in the new portal.
    image
  5. Create a new Azure SQL Database (ideally in the same Resource Group as the Web App).
    image
    Use Pricing Tier S0 or higher.
    Make sure that Azure services can access the Azure SQL DB Server (under Firewall Settings of the server)
    image
    Remember username / password of the server as well as it’s full server name (xx.database.windows.net)
  6. Now I’m using GIT to deploy the locally changed sources into the Azure WebApp.
    Click on the WebApp and pick “Continuous Deployment” under Settings to configure the GIT Endpoint for your WebApp.
    image
  7. Pick “Local Git Repository” as the source.
  8. Go back out to Settings and pick “Deployment Credentials”
    image
  9. Configure username and password for the GIT endpoint created.
  10. Go back to the main blade of your WebApp and copy the GIT Clone URL.
    image
  11. Open the folder where you previously extracted ProjectNami WordPress in Commandline.
  12. Upload everything to your Azure WebApp using GIT using the following commands:
    git init
    git add .
    git commit -m Initial
    git remote add origin <gitCloneUrl>
    git push origin master
  13. Visit your Azure WebApp through the browser
  14. Voila! You should see the WordPress config wizard coming up…
    image

    (/wp-admin/setup-config.php)
  15. Configure the database using…
    Database Name = The name of your Azure SQL DB (not server!)
    User Name, Password = What you configured just a minute ago.
    Database Host = The server host name (xx.database.windows.net)

Congratulations!
You’ve made it!

Now pick a nice theme and enjoy Smile

5 thoughts on “WordPress in Azure WebApps with Azure Sql Database3 min read

  1. Could you please give me some more information on the missing JS files? I looked at both our repo and the release you mentioned, and within the JS folders for wp-admin and wp-includes, and I didn’t notice anything missing right off. For example, both widgets.js and widgets.min.js are present.

    Thanks.

    1. When I first ran project nami, the wordpress site did behave strangely..
      Checking the dev console I found a lot of 404s all for JS files..

      E.g.
      /wp-includes/js/jquery/ui/widget.js

      Even in your GitHub Repo I can see https://github.com/ProjectNami/projectnami/blob/master/wp-includes/js/jquery/ui/widget.min.js
      but not https://github.com/ProjectNami/projectnami/blob/master/wp-includes/js/jquery/ui/widget.js

      Same was true for the ZIP file with the release..

    2. Interesting, those are jQuery files and not WP itself. Seems those files are missing in WP Core as well. Have you seen the same issue with standard WordPress?

      1. I haven’t installed standard WordPress..
        I’m not familiar with WordPress code base, but maybe there’s a way to force minified files..

Leave a Reply

Your email address will not be published. Required fields are marked *