October 29, 2018 · ghost

Upgrade Ghost 1.22 to 2.1.3

A few months ago I wrote about upgrading this blog's Ghost version from version 0.x to 1.x. Since version 2 has been out, here is how the upgrade went.

Since I am using ghost in a docker container, I did'nt use the ghost cli tool. I need to update the docker containers, which is much easier.

First lets check what docker images we have running currently:

hacksaw% docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ghost               2.1.3               cf385d0ac3f4        3 days ago          566MBhacksaw%

Ghost does not have a way to easily view what version you running. You need to peek into the config for that, so in my case I needed to log into the container first:

Here is the running container:

docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                                PORTS                    NAMES
b7703cf1baae        ghost               "docker-entrypoint.s…"   10 seconds ago      Up 9 seconds                          0.0.0.0:4431->2368/tcp   ghost-v1-2

and this is how we log into the running container to verify the version of ghost:

docker exec -it ghost-v1-2 /bin/[email protected]:/var/lib/ghost# lsconfig.development.json  config.production.json  content  content.orig	current  versions
[email protected]:/var/lib/ghost# cat versions/cat: versions/: Is a directory
[email protected]:/var/lib/ghost# cd versions/
[email protected]:/var/lib/ghost/versions# ls 1.22.0

[email protected]:/var/lib/ghost/versions/1.22.0# lsGruntfile.js  LICENSE  MigratorConfig.js  PRIVACY.md  README.md  content  core	index.js  node_modules	package.json  yarn.lock
[email protected]:/var/lib/ghost/versions/1.22.0# less package.jsonbash: less: command not found
[email protected]:/var/lib/ghost/versions/1.22.0# cat package.json
{"name": "ghost",
"version": "1.22.0",

Before we go straight to v2, we need to be on the latest v1, which was 1.25.5.

So lets get that container, by running it. This command will pull that version, and run it:

docker run -d --name ghost-v1.25.5 -p 4431:2368 --restart always -v /home/yusufm/gitwork/ghost-data-v1:/var/lib/ghost/content -e url=http://aws.hacksaw.co.za/blog/ ghost:1.25.5
Unable to find image 'ghost:1.25.5' locally1.25.5: Pulling from library/ghost
57936531d1ee: Already exists
b186cf19f9ed: Already exists
eadbf8312262: Already exists
cf528b18b6ce: Already exists
075c4f074e90: Already exists
04fbcf905a62: Already exists
da260e2dcb3c: Already exists
80663c954c93: Pull complete
2bf0676774fe: Pull complete
c1ca87ee684a: Pull complete
Digest: sha256:9deaf2b09494868bb15fab57385ed2811edea800efc7acdca7aaabc3ec20d7ad

After verifying that ghost is up and running, we can now go to version 2.1.3

docker run -d --name ghost-v2.1.3-1 -p 4431:2368 --restart always -v /home/yusufm/gitwork/ghost-data-v1:/var/lib/ghost/content -e url=http://gcp.hacksaw.co.za/blog/ ghost:2.1.3

hacksaw% docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZEghost               2.1.3               cf385d0ac3f4        3 days ago          566MBghost               1.25.5              258abfca2c6f        9 days ago          531MBghost               latest              2fd6cb13169a        5 months ago        561MB 

hacksaw% docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMESc640eb561a51        ghost:2.1.3         "docker-entrypoint.s…"   16 minutes ago      Up 16 minutes       0.0.0.0:4431->2368/tcp   ghost-v2.1.3-1hacksaw%

In my case, I have two VMs, in AWS and GCP, and I run the ghost data files in git. I upgraded the AWS site first, which went fine. But on the GCP site, I forgot to to the intermediary step of going to v1.15.5 first, rather I went straight to v2.1.3. The ghost container refused to start, even when trying to go back to the original version. I resolved it by pulling the updated config via git, and then running 2.1.3.

  • LinkedIn
  • Reddit
  • Google+
  • Pinterest
  • Pocket