cobyism/ghost-on-heroku

Upgrading from to 1.x (PostgreSQL > JawsDB) warning

jevawin opened this issue · 4 comments

This isn't really an issue in the code, but it's created an issue so more of a docs suggestion. I pulled the latest changes, which include the upgrade to Ghost 1.x.

However, because I pulled the latest version into my local git and deployed to Heroku from there, none of the automatic install processes took place and there was no migration from PostgreSQL to JawsDB. I've manually installed JawsDB but I'm not sure how to migrate from PostgreSQL to it.

For me it's not a huge problem because I have my Ghost DB backed up so I'll just delete the app, redeploy with the button and import my database and themes. But if I were running this as my full production number it'd be much more difficult to recover.

Is there anything you can do for people who have been using ghost-on-heroku for a while and might need support pulling the version that switches database addons?

mars commented

We definitely welcome Upgrade documentation [README] contribution/PR based on your experience. Even explaining more about your upgrade process/pains here would probably help out other folks trying to do the same.

I believe the way to "upgrade to 1.x" is to create a whole new Ghost blog app using the current version, and then import the data from your previous installation using the built-in export & import features. Ghost itself does not provide any other way to migrate between database backends. Once the new Ghost app is production ready, then switch over the host/domain name from the previous Ghost app.

Ah, it didn't occur to me that this is really a Ghost thing, not a Ghost on Heroku thing. Good point. I think you're right, the simplest way is a new Ghost blog, then migrate using JSON export. There was something in my errors about a "knex migrator" but I didn't investigate. Not sure if there's margin in trying that, I feel like it might be more complicated if we're running on Heroku.

mars commented

knex migrator is the tool used to apply Ghost's database schema upgrades/changes to existing installations as new versions are released. It is not a database-to-database transition tool.

I had to do this migration. It was after upgrading to Ghost >=1. The error would occur on start as:

> node server.js
> Unhandled rejection DatabaseError: connect ECONNREFUSED 127.0.0.1:3306

This is how I migrated:

  1. Export your content
  2. Update to Ghost >=1
  3. Delete postgres database in Heroku admin
  4. Add JawsDB MySQL add-on in Heroku admin
  5. Restart dynos
  6. Visit youblog.com/ghost and setup site
  7. Import your content