Miguel Piedrafita

Miguel Piedrafita

Installing Ghost on Heroku

Ghost is undoubtedly one of the best blog platforms out there. One of its downsides, however, is that it's more difficult to get it up and running due to their technology choices.

Where to host your Ghost instance

There are three main hosting options for Ghost: you can either use Ghost's own hosting, which guarantees you high-quality hosting and automatic updates with a high price tag; host it on a DigitalOcean droplet or on Heroku. The easiest option (and also the cheapest one) is Heroku.

Deploying Ghost to Heroku is very simple: Just click the button above, fill in the name and URL and click Deploy.

Here's a quick GIF to illustrate the process

Configuring your blog

After your app finishes its first deployment (can take up to five minutes), you'll be redirected to your blog's dashboard, where you'll be guided on the rest of the setup (naming the blog and creating an admin user). At this point, we already have our Ghost blog up and running, but with an annoying limitation: we're using a herokuapp.com subdomain. Let's see how we can fix it.

Using a custom domain on Heroku

Heroku offers free custom domains once you verify your account. This means that if you add a credit card to your Heroku account, you'll be able to configure a custom domain for your blog. Don't worry, the entire process is free and you won't be billed.

To verify your account and add a custom domain, access your blog from your Heroku dashboard and go to the settings tab. If you scroll down, you'll find a section called Domains and Certificates, where you can add a custom domain. After pointing your DNS to Heroku, you'll also have to update your PUBLIC_URL variable. To do this, scroll back up and click on the Reveal Config Vars button, then find thePUBLIC_URL variable and change it to point to your new domain. After you've done this, restart all your dynos.

Here's another GIF illustrating the entire custom domain process.

Preventing your Heroku Dyno from sleeping

In the Heroku free plan, dynos (the programs that serve your blog) are temporarily disabled when there are no requests to your blog in a short period of time (around 15 minutes), and enabled again on new requests. A commonly known hack around this is to use an uptime checker service that pings your site every ~10 minutes to keep your dyno up.

Growing & Scaling

Although Heroku is the cheapest option to get started, you might consider moving off it when your blog starts growing. You might want to consider switching to Ghost's official hosting or, if the price is too expensive, a DigitalOcean droplet.