Blog updated - Ghost 3.0 on Azure

Ghost Dec 31, 2019

So it is that time of the year when I take some time to revisit my personal tech stuff. One of the things in my To Do list is to update my blogging platform. The last update was almost an year ago, where I updated my Ghost 0.x blog to 2.x. That was a painful story. There were no major releases of Ghost till recently and I didn't have time to care about my blog as well. Recently Ghost announced a major update - Ghost 3.0 - and I was excited about the new features - especially the integrations.

"Deploy to Azure" button please?

I was searching if someone has already tried out deploying Ghost 3.0 on Azure and has a ready-made "Deploy to Azure" button. The last thing I want to do is manually deploy ghost on my Azure subscription. Given that Ghost 3.0 is only 3 months old, I wasn't too hopeful. Thankfully, I came across a few blogs which tried it already.

Thanks to my old blog post about Ghost 2.x migration which made the search easier this time (see, I told you a year ago that this would be handy! Always document your efforts!). Following the cues from my old blog, I checked the Radoslav Gatev's blog to see if he updated it to Ghost 3.x. Unfortunately he didn't, but then I came across Yannick Reekmans' repo which he apparently cloned from Radoslav and updated it. It has "Deploy to Azure" button. I forked Yannick's repo and it works!

The pain of redeploying a web app!

My last deployment didn't rely on CI/CD (so does the current deployment) as I was not sure if the Radoslav's repo will receive newer updates . So what happens when you don't have a CI/CD pipeline setup and you have to redeploy a web app using "Deploy to Azure" button? Well, you will end up deleting the web app (after taking a backup of course), create a new web app, do a fresh deployment, map custom domain in DNS settings, reconfigure TLS cert & binding. Phew! Mapping a custom domain doesn't take much time, but I was worried about re-configuring TLS as my last year's deployment wasn't that hassle-free.

Informing Ghost about your custom domain

While the deployment to Azure and configuring custom domain was smooth, the site's URL at various locations was still pointing to my Azure App Service domain (novogeek.azurewebsites.net) instead of my custom domain (blog.novogeek.com). Since Ghost was deployed on a new Azure app service (even before mapping a custom domain), it does not know anything about the custom domain. You can verify this by clicking on the blog's logo in the top navigation and it would point to the Azure App Service and not the custom domain. You can also verify the same under Ghost Admin section (Settings -> General -> Site Meta Settings -> Search Engine Result Preview). Turns out that to inform Ghost about your custom domain, you need to do the following: Navigate to Azure App Service -> Configuration -> Application Settings and set a new application setting called url pointing to your custom domain. Restart the website and Ghost automatically honors the custom domain everywhere!

App Service Managed Certificates!

Azure App Service recently launched App Service Managed Certificates (in preview). It lets you secure custom domains on your Windows and Linux apps at no additional charge (it is available only on Basic and above app service plans). In just 3-4 clicks you can get a new standard certificate (not wild card one). The certificate is valid for 6 months but the best part is, it will be automatically renewed by Azure App Service about a month before expiry. So if you are procrastinating about enabling TLS coz it is a time consuming thing, think no more!

Ghost Integrations - Disqus, Formspree

The thing I missed the most after switching to Ghost is comments system. Ghost does not come with an integrated comments system  and it wasn't easy to integrate one. Ghost 3.0 comes with a bunch of integrations - some are available by default while some can be configured with minimal code changes to the template files. I have configured Disqus for comments (you can see this at the bottom of every blog post) and Formspree for contact form (you can see this on the Contact link in the top navigation bar). I have an Office 365 subscription which I used to setup a dedicated email account for my blog and used it for Formspree contact form. So yeah, now more power with my Ghost blog!

Future updates

Lack of CI/CD slows the deployment of future updates of Ghost platform. However, given the stability of the current version and the ease of new manual deployments, I think it is more of a trade-off between effort spent on setting up CI/CD vs manual updates. I don't have immediate CI/CD plans, but Chris Tjoumas' blog may serve as a handy reference if someone wants to setup.

Why did I blog about this?

Citing the section from my last year's blog post :)

Firstly, the references in this post will serve as a quick start when I plan for future upgrades. More importantly, like all the good blog posts that helped me setup this blog, this post might help someone who is facing similar challenges in upgrading Ghost on Azure. Always good to give it back to the community!