Dockerized ghost and upgrade from 4 to 5

Hi,
until now I run a self hosted ghost version 4.48.9 (latest 4 version) via docker-compose.

Now I observed that ghost-5 requires a database. BTW: Is it true or can I still run ghost-5 without database?

I have 2 major questions.

  1. When I upgrade to dockerized ghost-5 image is the content from /var/lib/ghost/content, all images etc., automatically imported into the (mysql)database? With other words: When I upgrade the docker-image from 4.48.9 to 5 and add a mysql-service in the docker-compose file can I expect that the migration is done magically?
  2. Until now I did run a some compression-job over the images in /var/lib/ghost/content to save disk-space. Some users uploaded images are much to large for my small webstorage. When in the future the images are in the database this manually workaround seems not longer possible? Is there another way in ghost-5 to limit the picture-size of images?

Best regards
Thomas

1 Like

No one idea/answer?

Have a nice Advent
Thomas

Regarding the database question:

Ghost always used a database.
What changed is that the only database which is supported as of recently is MySQL 8.

I guess you where using the sqlite file database option.
You should be able to create a dump from that sqlite and then import that to your MySQL 8 instance.

Images and other assets where never part of the database.
They are stored on the filesystem in /var/lib/ghost/content.
Database just reference the filesystem path because it is not recommended to store such large files in database.
You can copy this folder to your new ghost instance as well for a migration. Or mount the path when using docker.

You can check out how I ran my ghost blog with docker-compose:

1 Like

Thank you. Indeed my docker-compose file has until now no database service just an entry for the ghost-service itself. How can this be the case? Does sqlite not require a separate service entry?
Will test it later.

Thomas

Sqlite is not running as a service, correct.
It’s just a file on the filesystem and the application (in this case ghost) is configured to use sqlite and will do all its database command against that file.

I am however not sure if sqlite was dropped in docker.
The ghost docker file is not maintained by ghost. It’s maintained by the docker community.

2 Likes

May be it is a good idea just to introduce the mysql8-service to my “old” 4-ghost version. And when this is working do the migration to ghost-5. What do you think?

I think that is a good idea.

  1. Make a backup.
  2. Create a dump from the SQL lite somehow
  3. start ghost MySQL 8
  4. Import the the dump
  5. start ghost

That would be my approach.
Maybe the ghost 4 container allows easy switching, but you have to check that yourself. Never used the sqlite version.