Ghost Update Take Two – 64-bit NodeJS
App Dev Manager Chris Tjoumas provides an update to his previous post on how to setup continuous deployment of a blog using Ghost, Azure Functions, and Azure App Services.
In my previous post, I explained how to deploy Ghost on Azure Web Apps; however, Ghost v2.25.5 now requires Node.JS 64-bit to support the sharp package v0.22.1. If you followed my initial instructions to create the free App Service, you will notice that this build will break your post images. The sharp package is used to convert those posted images into optimized formats for performance. Without a functional sharp package, the Web App performance will be noticeably slower.
I did a bit of research into this and posted blog listing steps needed to configure your Windows Web App Service to use 64-bit Node.js. However, it turned out that while this seemed to work, node was still running in 32-bit. You can check this by running node -p “process.arch” would return x32.
While I was looking into this, Jessica Deen reached out to me to ask how I was able to get this configured – of course, I had recently found out that I hadn’t gotten this 100% correct. We worked together a bit to figure out how we could accomplish this and a little after we started, Jessica told me that she spoke with the product group to uncover what is needed, which isn’t documented yet. While I had gone into Kudu to pull out the supported NodeJS and NPM versions (which would change over time and cause you to continue running through this exercise), you simply need to set a single environment variable, as shown below. The only pre-requisite is that you must have an app service plan SKU of Basic or higher, which supports 64-bit. Without further ado, here’s what you need to do:
- Make sure you don’t have any customizations! Delete any environment variables, custom kudu deployments (deploy.cmd), and anything in iisnode.yml
- Set the Node.JS version
- Navigate to your Web App in the Azure Portal
- Click on Configuration
- Under Application settings, edit the WEBSITE_NODE_DEFAULT_VERSION and enter ~10 and click Save
- Set your web app Platform to 64-Bit
- Click General settings and change Platform to 64 Bit
As noted above, once you complete these updates, you can run the node -p “process.arch” command to see that it will now return x64.
Please give Jessica’s 64-bit blog post a read as there are a few more details there as well as instructions on how to create an ARM template which will create everything you need.