Migrating Ghost blog/data to a new server (droplet)

Hi!
I am currently using Digital Ocean as the main host and wanted to migrate from ubuntu 14 to 16. My question is: is there any simple way to back up everything and “migrate”?

As far as I know, I should:

  • Export the JSON file (Labs)
  • Back up Media / Content folder (and paste that in the new droplet)
  • Back up code injection content.

Are these steps enough? Am I missing something or some tool that may do the process easier?

Just in case, I’m using ghost 2.17.2 with latest Casper.

Hey!

You’re correct, there really should be a tool or at least a guide for how to do this somewhere. We’re painfully aware of how difficult this stuff is right now, and from next week we’re going to be starting on a whole set of projects in this area.

Assuming you’re starting with a new droplet, the steps right now are something like:

  1. setup the new droplet
  2. install Ghost
  3. copy across the contents (lol) of the /content/ folder
  4. export your JSON on your old site
  5. import your JSON on your new site
  6. manually fix anything to do with the API or integrations, as no api clients or keys are copied over at the moment
  7. double check everything looks ok, particularly around newer features like routing or redirects
  8. switch your DNS & configure your domain on the new droplet

Alternatively, sack this off for a month, come back and do it just in time for Ubuntu 14 EOL and hopefully we’ll have at the very least fixed a few more importer issues so that you have less manual steps and more clarity on what exactly happens.

4 Likes

Thank you so much for taking the time to answer!
A guide could be a great first step. Also, a tool would be definitely better but I think you have features with more value and priority in your roadmap.
As I’m using a pure ghost with a pure Casper, no need to worry about API or complex integrations.
I will wait just a few weeks and then maybe investing a few hours to do everything.
Again, Thank you!!

Question, cause I keep holding on doing the same thing as well:

  • if you have redirects.json this needs to be moved over as well, right?
  • assume the same with routes and other stuff as well?

Thanks!

Yes, you’ll have to download your current redirects.json before moving and upload it in the new droplet. Same thing goes for routes as well.

The redirects and routes files live in content/settings.

If you do step 3, and copy across the full contents of your /content/ folder, then they will automatically be brought across.

1 Like

Oooh… I did not know that. Thanks for the pro tip! :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

Preparing to migrate some sites from DO to AWS and will report here if this flow is still current. One question I have is if the site title/description is migrated or not or if there are other components that need special care (i.e. members as this is a newer feature).

The process went as follows:

  • I’ve setup a new EC2 server and installed nginx (1.16, not the standard ubuntu one) and nodejs 10
  • I’ve installed ghost cli
  • I’ve exported the json file with the content of the existing blog
  • I’ve changed the DNS in Cloudflare to point to the new server
  • I’ve tried to install the first Ghost but it failed because the nginx setup didn’t have some of the basic requirements (i.e. /etc/nginx/sites-available and sites-enabled/ folders nor the snipets/ folder) so I had to create those manually
  • Eventually I’ve managed to get the ghost install completed (had some
  • I’ve imported the json with the content (had to delete existing demo content though)
  • I’ve tried to copy over the content/ folder (didn’t copy completely due to some permission error - see below)
  • However, it did import the code injection (i.e. tag manager code) and blog title & description

Few issues:

  • the nginx setup mentioned above (probably on the standard nginx this isn’t the case, but not sure why the official nginx install doesn’t do this setup)
  • since the blog and the content folders are owned by different users (i.e. ubuntu & ghost), the scp failed to copy the installed themes (content//themes/liebling: Permission denied - even though the user used to scp was the one owning the Ghost blog folder)
  • I’ve tried copying the other way around as well (from DO to AWS, with sudo scp to bypass the permission denied issue, but the same error was generated, with the double “//” between the content folder and all of its subfolders, such as images, for example)
  • Eventually solved the issue with the scp by using sudo :slight_smile: (that was easy lol)
  • Importing the content generated the error about the theme (Settings: Theme not imported, please upload in Settings - Design)

Some recommendations:

  • I would first export the content from the existing blog before installing the new version on the new server (so you can do it in one go, including ssl setup which needs domain to point to new server - downtime is just a couple of minutes)
  • If using Cloudflare make sure you disable the proxy functionality (orange cloud) so that let’s encrypt sees the origin server’s ip address
  • Make sure you use sudo with your scp so that you bypass the issues with content folder permissions I ran into
  • You need to redo the integrations (i.e. for theme, maybe github actions, etc.) after your migration

PS I initially tried to install the blogs onto a server managed via a cloud service (for wordpress sites) which didn’t allow me to change the user running nginx so I didn’t manage to make a test site there (i.e. user was www-data, tried to add ubuntu to www-data group but it still didn’t work, didn’t waste time to check all details though).

1 Like

One more issue I ran into… when I setup the Ghost blog URL as http://domain.com the nginx setup didn’t add the www as alias/redirect for it, thus www.domain.com gives an error (and I have to edit the nginx config files manually as only domain.com is setup there as server name). Any idea why this happens? As far as I remember this used to work previously. Thanks.

which better DO or AWS Lightsail for best price and feature??

I used both and I think both have similar pricing and performance. I am now on AWS as I have some startup credits and I use this cloud infrastructure mainly for my clients as well.

1 Like