career
general
September 21, 2013· 2 min read

Running Ghost on Heroku

Learn how to effortlessly deploy Ghost on Heroku with a few simple tweaks in your config.js file. Follow our step-by-step guide to set up, test, and push your Ghost blog live in no time!

Running Ghost (http://ghost.org) on Heroku is so easy, I’m suprised I didn’t find instructions already.

TL;DR

If you already know how to implement Node.js on Heroku, there is only one change to make:

In config.js:

Change all instances of:

port: 2368

To:

port: process.env.PORT || 3000

This will call the heroku dynamic port variable or if none exists, use port 3000.

Step-by-Step Instructions

Installing Node.js

Ghost requires node 0.10.* (latest stable version).

To get it visit http://nodejs.org and press ‘install’ to download the latest stable version of Node.js.

Windows The install button will download an .msi installer file. Double click this and follow the instructions to install Node.js as you would any other software. Mac The install button will download a .dmg. Install this as you would any other software.

Installing Ghost

Download the latest version of Ghost from Ghost.org. Unzip the archive to a memorable location.

Local workstation setup

Install the Heroku Toolbelt on your local workstation. This ensures that you have access to the Heroku command-line client, Foreman, and the Git revision control system.

Declare process types with Procfile

Use a Procfile, a text file in the root directory of your application, to explicitly declare what command should be executed to start a web dyno. In this case, you simply need to execute the Node script using node. Here’s a Procfile for Ghost:

web: node index.js

Edit Config.js for Heroku

In config.js:

Change all instances of:

port: 2368

To:

port: process.env.PORT || 3000

This will call the heroku dynamic port variable, or if none exists use port 3000.

Test that it works locally

Run:

foreman start

This will start Ghost locally on your workstation running on port 3000.

Store your app in Git

Let’s put it into Git:

$ git init$ git add .$ git commit -m "init"

Deploy your application to Heroku

Create the app:

$ heroku create

Deploy your code:

$ git push heroku master

Open on Heroku

Ghost should now be running on Heroku.

To load Ghost from Heroku, go to your unique Heroku URL or type:

heroku open

Good luck!

Get More Insights
Join thousands of professionals getting strategic insights on blockchain and AI.

More Career Posts

October 15, 2024

Zcash Enterprise Privacy: Business Applications Guide | Advanced Cryptocurrency Privacy Solutions

Comprehensive guide to Zcash enterprise privacy applications - leveraging advanced cryptocurrency privacy technology for...

October 01, 2014

3 Reasons to Always Take the Interview

Discover why you should always seize the chance to interview, regardless of hesitations. Gain insight, practice your ski...

July 17, 2015

Security Longreads for July 17, 2015

Explore the latest in security with insights on stolen fingerprints, the rising role of Chief Security Architects, and t...