Just spent a chunk of the weekend updating my Ghost install, that was "fun".
I started at version 2.something, updated to 2.83.3 (the last 2.x version), as instructed, then attempted to update to 4.x (latest version), which is supposed to "Just Work"(tm). Turns out it doesn't if your ghost install is sufficiently old/weird?
After much faffing, I discovered:
- Ghost 2.x likes a node of v10 or so.
- Ghost 4.x prefers current node (and don't mix and match!)
- Ghost likes my non-systemd system even less than it used to..
- .. but one can run it with "ghost run", ignoring the warnings that I shouldn't.
- Ghost didn't (doesn't?) support MySQL v8 (it claims to now, but the migration system can't quite cope). My MySQL ghost db had a bunch of tables with: COLLATE=utf8mb4_general_ci set, but the default is now COLLATE=utf8mb4_general_ci. This causes havoc because MySQL won't let you create foreign keys using two string columns with different collations.
- To debug said migration system, set environment vars: DEBUG="knex-migrator:*,knex:query"
- Then run the ghost run command approximately 97 times to get it to attempt an upgrade, then read the logs to see where it failed, correct/prod the tables into shape, and retry.
- ALSO change the default database collation to utf8mb4_general_ci and set it in the config.production.json file as well.
- This should work, as long as you drop+recreate the following tables (they were all empty!): members, labels, members_stripe_customers, emails.
In the process I learnt a fair bit about what makes Ghost tick, or at least the database side of things. Weirdly I'm still getting warned that "Ghost 2.0 is now end-of-life as of January 2021" ... I wonder why it still thinks that I'm on 2.x?