Update ghost to latest version

Last time i received critical security note https://github.com/TryGhost/Ghost/security/advisories/GHSA-7v28-g2pq-ggg8 , therefore it was require to upgrade Ghost to patched version.

Moreover i found that MariaDB will not be supported in near feature, and should be replaced by MySQL.

Then i decided to go with update both.

Backup Database

Since database is running on docker then i will execute mysql dump with docker command. Note, string 8c68319c084a represents database container id, to figure which one to take, just run docker ps)

docker exec 8c68319c084a /usr/bin/mysqldump -u root --password=1234 ghostdb > backup.sql

Remove current database volumes

This step is require, since in final docker-compose.yml we change only database engine (mariadb -> mysqldb). In my case database volumes are stored in directory /opt/docker-volumes/ghost/mysql, therefore i just backup it by moving directory to different name one (not really deleted yet).

Docker-compose.yml modifications

This is really straight forward step, since my current setup actually was oriented already to mysql except the engine name, switching to mysql is pretty easy, i did the following modifications:

From

  db:
    image: mariadb:latest
    restart: always

To

  db:
    image: mysql:latest
    restart: always

Reinstall containers

This step i performed using portainer in order to delete the containers and corresponding images to be sure that latest tag will effectively works. To install both ghost and mysql i used docker-compose command.

docker-compose -f docker-compose.yml up -d

Import database from backup

As a last step is importing database from the backup we've created in step 1. Executing the following command should do the job ( b4daa0b51d76 is a newly created mysql container id)

cat backup.sql | docker exec -i b4daa0b51d76 /usr/bin/mysql -u root --password=1234 ghostdb

And that's it, service and database is up to date.

Show Comments
AbuseIPDB Contributor Badge LinkedIn Profile