- Published on
Migrating to Ghost 1.x.x from 0.x.x on DigitalOcean
- Authors
- Name
- Yair Mark
- @yairmark
I use the Ghost platform to manage my blog. This runs on DigitalOcean. Ghost 1.0.0 was release about a year ago and I have been wanting to upgrade for a while. Looking at the upgrade guide I simply followed the steps laid out there:
Backup
- Backup via the admin panel
- Go to www.yourghostdomain.com/admin
- Click
Labs
- Click
Export
- Back up images
scp -r yourUser@yourhost:/var/www/ghost/content .
- Themes
- It can get tricky at this step apparently but in my case I used the standard Casper theme.
Migrating Across
The upgrade to 1.x.x is a major upgrade and the upgrade guide recommends installing a new instance, setting it up and restoring your backup there to get fully up and running.
As I am doing this on DigitalOcean the easiest way to do this is spin up a Ghost 1.x.x One Click app, migrate to there, once I am happy it is working change my DNS record to point to there then shutdown the old droplet. At $0.007/hour the cost is basically negligible (if DigitalOcean rounds numbers like this down I may not even be charged extra)
The steps I used are as follows:
Create a new One-Click App
- Create the droplet in DigitalOcean using the one-click app option
- Choose the version that uses the newest LTS of Ubuntu
- Choose the smallest $5/month droplet size
- Associate your machine's ssh key with the app so you do not need to setup a password to login to the droplet
- To login use
ssh root@yourDropletsIp
- Note: In DigitalOcean the IP will remain associated with the droplet (i.e. it is a static IP). The only way to change the IP is to create a new droplet.
Setup Ghost
- In your browser navigate to http://yourDropletsIp
- Follow the Ghost setup
- As you are migrating use the same full name and email address as your previous blog
- You do not have to add a team
- Delete all the sample posts
- Import your backed up blog
- Go to http://yourDropletsIp/admin
- Click
Labs
- Then click
Import
- Importing should import code injections as well
- Go to http://yourDropletsIp/admin
- Go to the
Content
section and setHome
to your domain name - your actual host not the droplet's IP address - Stop the ghost service:
systemctl stop ghost_dropletIp
10.Rename the ghost service file under/etc/systemd/system
- DigitalOcean names this ghost_dropletIp.service so rather rename this to just ghost
mv ghost_dropletIp.service ghost.service
- Make a folder in your home directory on the droplet to scp the images you backed up previously
mkdir ~/drop
- From your host machine run:
scp -r content root@yourDropletIp:/root/drop
- Then on the droplet run:
cp -r ~/drop/content/images/* /var/www/ghost/content/images
- Then start up your blog again:
systemctl start ghost
- Check it is running:
systemctl status ghost
Clean up
- Delete the Ghost user under
Team
in the admin section
Nginx Update
- Update your Nginx settings as per this blog post
- Where it has the line
server_name your_domain_or_ip_address;
use your domain name so in my case I usedwww.8bitzen.com
Sanity Check
- Go to your blog's site in the browser by navigating to the droplet's IP address and check everything is fine
- Go to any post that has images to make sure the import was successfull for your images
- Go to
Labs
and chooseSend
underTest email configuration
to ensure that emails are sending properly from Ghost (in case you need to recover your password)- As you are sending this from a domain without an IP the mails sent by Ghost may appear in your spam folder.
- Update your DNS record to point to the new droplet's IP.
- On your DNS provider temporarily make a new sub-domain like blog2 to point to your new blog (this is to test that the DNS portion is working correctly without breaking your existing working blog instance).
- Once you have confirmed that the DNS record has been updated and navigates to your new site, shutdown and delete the old droplet.