Migrating from Vosao & APPEngine to Ghost CMS and Raspberry PI

Google has been evolving Appengine for long time and now, they changed some of the Terms Of Service for it. Now, you need to include a billing method even to use the free tiers and I would prefer not to risk to unwanted charges.

For some time, I've been thinking on evolving to another blog solution. Time has change, and now, many people, like me will have a 24x7 Raspberry Pi at home.

This computing wonder allow us to evolve to our own hosted blog platform.

I would like to use this first post to document and describe how I configured Ghost in docker in my Raspberry. I have several services running on it and I prefer all of them to be dockerized (this way, they are OS version independent and gives additional layers of security).

Following, I detail the step I've followed to have Ghost working this way.

  1. Check prebuilt docker images available and select a version.
    You can see in your browser using DockerHub
  1. Predownload the image. Altought this step can be avoided and will be automatically downloaded when we do the docker run below, I always prefer to ensure manual image preloading.

Execute:

docker pull ghost:3.40.4-alpine

And, after a while, you will get an output similar to:

3.40.4-alpine: Pulling from library/ghost
c58e8a26a840: Pull complete
11349be5853d: Pull complete
7b0d5f9228ff: Pull complete
4bf7dcdc3956: Pull complete
129c46fed0ed: Pull complete
fc05e34f99ff: Pull complete
02266fbbd074: Pull complete
23048f263933: Pull complete
f30021ef7671: Pull complete
Digest: sha256:95f54fd8ca13df328f54e39879a729cfb122504f4bfb897c6c3a658f230a4e5a
Status: Downloaded newer image for ghost:3.40.4-alpine
  1. Prepare the persistence folder. As we will be running ghost from a dockerized service, we want to ensure our posts and data is persisted even if the container is detroyed (or upgraded) and so, create a folder that will store the Ghosts DBs.
mkdir ~/ghost

This will create a folder in your home folder named "ghost"

  1. We're ready to drop the systemd script to control this docker as any other service (I'm running Raspbian 10, but the script should be similar for your distribution).
sudo vi /etc/systemd/system/ghost-docker.service

Insert the following in the file (edit the values you may want to be different like TCP port and similar):

[Unit]
Description=Ghost docker
Requires=docker.service
After=docker.service

[Service]
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStart=/usr/bin/docker run --name=%n \
  -v <PERSISTENT_FOLDER>:/var/lib/ghost/content \
  -e url=http://<YOUR_HOST_NAME>:2368 \
  -p 2368:2368 \
  ghost:3.40.4-alpine

ExecStop=/usr/bin/docker rm -f %n

Please ensure you set the values for <PERSISTENT_FOLDER> (with full path) and <YOUR_HOST_NAME> correctly

  1. Start the service:
sudo systemctl start ghost-docker

You can check if the docker container has correctly started using docker ps command. You should see something similar to:

 docker ps
CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS              PORTS                                       NAMES
1857012d8c3c        ghost:3.40.4-alpine     "docker-entrypoint.s…"   2 seconds ago       Up 1 second         0.0.0.0:2368->2368/tcp                      ghost-docker.service
  1. Check access to the ghost service and to the management API. In your browser check that you can access:

http://<YOUR_HOST_NAME>:2368

And

http://<YOUR_HOST_NAME>:2368/ghost

  1. Now you can configure and create your admin user for ghost. I recommend reading the official Ghost documentation

  2. Finally, I've not found any automated means to migrate Vosao content to Ghost and so, I "copied & pasted" the content from the old site to the new one.