Published on

Migrating to Ghost 1.x.x from 0.x.x on DigitalOcean

Authors

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

  1. Backup via the admin panel
  2. Go to www.yourghostdomain.com/admin
  3. Click Labs
  4. Click Export
  5. Back up images
  6. scp -r yourUser@yourhost:/var/www/ghost/content .
  7. Themes
  8. 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

  1. Create the droplet in DigitalOcean using the one-click app option
  2. Choose the version that uses the newest LTS of Ubuntu
  3. Choose the smallest $5/month droplet size
  4. Associate your machine's ssh key with the app so you do not need to setup a password to login to the droplet
  5. To login use ssh root@yourDropletsIp
  6. 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

  1. In your browser navigate to http://yourDropletsIp
  2. Follow the Ghost setup
    1. As you are migrating use the same full name and email address as your previous blog
  3. You do not have to add a team
  4. Delete all the sample posts
  5. Import your backed up blog
    1. Go to http://yourDropletsIp/admin
    2. Click Labs
    3. Then click Import
  6. Importing should import code injections as well
  7. Go to http://yourDropletsIp/admin
  8. Go to the Content section and set Home to your domain name - your actual host not the droplet's IP address
  9. Stop the ghost service: systemctl stop ghost_dropletIp 10.Rename the ghost service file under /etc/systemd/system
  10. DigitalOcean names this ghost_dropletIp.service so rather rename this to just ghost mv ghost_dropletIp.service ghost.service
  11. Make a folder in your home directory on the droplet to scp the images you backed up previously
  12. mkdir ~/drop
  13. From your host machine run: scp -r content root@yourDropletIp:/root/drop
  14. Then on the droplet run: cp -r ~/drop/content/images/* /var/www/ghost/content/images
  15. Then start up your blog again: systemctl start ghost
  16. Check it is running: systemctl status ghost

Clean up

  1. Delete the Ghost user under Team in the admin section

Nginx Update

  1. Update your Nginx settings as per this blog post
  2. Where it has the line server_name your_domain_or_ip_address; use your domain name so in my case I used www.8bitzen.com

Sanity Check

  1. Go to your blog's site in the browser by navigating to the droplet's IP address and check everything is fine
  2. Go to any post that has images to make sure the import was successfull for your images
  3. Go to Labs and choose Send under Test email configuration to ensure that emails are sending properly from Ghost (in case you need to recover your password)
    1. As you are sending this from a domain without an IP the mails sent by Ghost may appear in your spam folder.
  4. Update your DNS record to point to the new droplet's IP.
  5. 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).
  6. Once you have confirmed that the DNS record has been updated and navigates to your new site, shutdown and delete the old droplet.