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

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