503 error after upgrade from 2.15.0 to 2.18.1

At least for me that didn’t change/fix anything. I also tried it before your fix without the init.
Is there a way to force a new complete new migration from 2.15 to 2.18?
What do you think about the different currentVersion entries in the database (see screenshot above)?

Same here, I haven’t seen any change in behavior after trying to upgrade with knex-migrator 3.2.6.

Can somebody provide me exact steps to reproduce this?
Thanks!

@Kate Thanks for helping out! Just to remove Cloudron package out of the equation, I tried to reproduce this using the CLI. It seems the problem is something to do with ghost setup migrate.

Attempt 1 (ok)

  • ghost install 2.16.3
  • I can access ghost blog from browser now
  • ghost update 2.18.2 . This works, I can see canonical_url in the posts table.

Attempt 2 (not working)

  • npm install -g ghost-cli@1.9.9 knex-migrator@3.2.6
  • In ~/ghost, do ghost install 2.16.3. Ghost is now accessible via browser.
  • In ~/ghost2, ghost install 2.18.2 --no-prompt --no-stack --no-setup --no-start --dbhost notlocalhost
    • cp ~/ghost/config.production.json ~/ghost2/config.production.json
  • In ~/ghost2, DEBUG=* ghost setup migrate -v
    • The migration succeeds. The migration table has the canonical-url migration but the table itself does not have this field.
    • This result in hastebin . In the session, I install ghost 2.18.2 and then I show the migration table and posts table before and after migrate.

Please let me know how I can help debug this further. I took snapshot of the digitalocean VPS at various points. If it helps, I can give access to them.

Edit: also, this problem specifically started from 2.17 where the 2-posts-add-canonical-url.js was introduced.

Another way to reproduce is to follow this tutorial with Ghost 2.15.0 for the installation and then update to 2.18.x via knex-migrator: https://lab.uberspace.de/guide_ghost.html

The problem still exists after an update to 2.19.
@Kate Is the --init flag recommended for an update or what is the purpose?

The flag is not recommended in general. It was designed/added for the CLI.
The CLI doesn’t have to check whether the database needs initialisation or migration.

Thanks. Any other suggestions how to fix the problem?

I was able to make it work with not calling --init. Calling knex-migrator migrate --mgpath versions/2.18.2 works.

1 Like

If I run that command with NODE_ENV=production at the beginning it works but does not fix the problem.
If I run that command exactly like you did (without NODE_ENV=production) I get this error:

knex-migrator migrate --mgpath /home/pelek
e7/ghost/current
[2019-03-28 20:19:18] ERROR

NAME: DatabaseIsNotOkError
CODE: MIGRATION_TABLE_IS_MISSING
MESSAGE: Please run knex-migrator init

level:normal

empty
“If knex-migrator is not installed, please run "npm install -g knex
-migrator" \nRead more here: https://github.com/TryGhost/knex-migra
tor”
ERROR DETAILS:
empty

DatabaseIsNotOkError: Please run knex-migrator init

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.