ghost heroku developer

Upgrading to Ghost v4 on Heroku

If you've read any of my earlier posts you'll know that I have been running the administrative side of my blog (using Ghost) on Heroku. But in this age, things move quickly and Ghost has since updated to v4 but looking at their docs the supported upgrade path is all around the ghost-cli tooling...

Shaun Wilde
a skeletal figure holding a brightly light orb

If you've read any of my earlier posts you'll know that I have been running the administrative side of my blog (using Ghost) on Heroku. But in this age, things move quickly and Ghost has since updated to v4 but looking at their docs the supported upgrade path is all around the ghost-cli tooling. However, as I didn't use the ghost-cli to create this installation then I'll need to resort to some manual steps.

As I had already trimmed the installation down to the bare bones that I required for headless operation, updating to the latest v3 flavour (as mentioned in the upgrade docs) of Ghost was trivial. Throwing caution to the wind, I forced the ghost version to the latest version and gave it a go. And... nope.

A quick delve and it seems all that that is required is a small change in to how Ghost is launched.

ie change server.js (as used in v3)

var ghost = require('ghost');

// Run a single Ghost process
ghost()
  .then( ghostServer => ghostServer.start() )
  .catch( error => {
console.error(`Ghost server error: ${error.message} ${error.stack}`);
process.exit(1);
  });

to now be

require('ghost');

Try again and the blog part of the site now launches. Now let's try the admin side and have a look at the new features. Uh-oh.

admin error

No solution forthcoming from the only other similar issue raised several months ago (that I could find). That number `3.0.0` just looks suspicious and the only place I could find it was in the package.json (version), a quick tweak and the message changed to match the version. So the final changes to my package.json was

package.json changes

And now I have a working v4 blog that I can push to Heroku.

Well other than that subtle issue with accessing the admin side of things that was relatively painless.

Heroku Pipelines

Up until now, I have been pushing direct to Heroku and then pushing a backup to Github. I am lazy (as well as cheap) and I only want to push once so I have now switched to using a Heroku pipeline and now when any changes are pushed to Github they are picked up by Heroku.

Heroku pipeline

A cute thing that this enables is that I can now see my Heroku environment on Github.

As usual, these posts are to remind my future self of what I was doing at the time, but your feedback is nonetheless still appreciated.