Last month, I wrote a post about how to change the maximum file uploads with WordPress hosted on Coolify. You can read more about Coolify in that article. Today I am going to write about how you can migrate your self-hosted Ghost instance to Coolify.
Create a subdomain on Coolify
For starters, I recommend creating a subdomain to use with your initial Ghost install at Coolify. You then will set up your Ghost service with that subdomain. Anything like ghost.domain.com will work. This way you can test the Coolify Ghost instance first before pointing the main domain to your Coolify server.
Once installed, set it up like any other Ghost install.
Export and download your content
The next thing you will need to do is export your content. The Ghost documentation will explain how to do this. In short, go to Settings and Labs. Then click the Export button (see below) and download. After that, you will need to download your Redirects and Routes if you have any.
Download your theme
After that, you will need to download your theme.
Compress and download your images
Now you will need to SSH to your server. Once there, go to the Ghost content folder:
$ cd /var/www/ghost/content
Once there you will need to compress your images folder:
$ zip zip -r images.zip images/*
Since Coolify uses Docker containers, it will be hard to upload the files to Ghost as mentioned in the Docker's documentation. What you will need to do is move it to a public folder that you can access with wget. I put my images.zip with another website.
$ mv images.zip /var/www/activewebsite.com/
If is up to you where you want to move your files.
Migrate all content and theme to Coolify
This next part is simple. Just upload your JSONs for the content, redirects, and routes to the new Ghost installation on Coolify. Once you upload it, you will see the content minus the images.
Then upload the theme. The site should look familiar now.
Log into your Coolify Server
Now you will transfer images.zip from your current server to Coolify. Remember that Coolify uses Docker containers. This means you will need to access your the actual Ghost container.
The first thing you will need to do is find the container ID for your Ghost install:
$ docker ps
You should see something like this:
You can connect to your Docker container with the following command:
$ sudo docker exec -it <container name> /bin/bash
Yes, you will need to use sudo. With the above container ID that would be:
$ sudo docker exec -it 2e7872g82eef /bin/bash
Once inside, update the packages first and then install both the wget and unzip packages.
$ apt update $ apt install wget unzip
Then you need to cd into the content folder and remove the images folder:
$ cd content $ rm -rf images
After this you can use wget to fetch images.zip from your server:
$ wget activewebsite.com/images.zip
Unzip the folder:
$ unzip images.zip
After this, you will need to change ownership to node:
$ chown -Rf node:node images
Check to see if the images load on your Coolify Ghost instance. When you see them, you can remove images.zip and exit the container:
$ rm images.zip $ exit
Point your domain to Coolify
The last step you need to do is point your main domain to your Coolify server. Wait until it is fully pointed then go to your Coolify Service and Stop the service. You can then change the URL of your main domain. After you saving the domain changes, you can click Deploy and your Ghost site will work with your domain.
You site is now fully migrated to Coolify!
I hope this guide helps those wondering how hard it will be to migrate a Ghost install to Coolify. I still need to re-setup Zapier and Mailgun, but it is a low priority to me at this time.