Deploying Ghost on Digital Ocean

Initial Setup ref

  1. create a Droplet on your DigitalOcean account, using an image from the Marketplace Ghost on 18.04.
  2. don't get conned and assume the VM requires costs $40/month. $5/month has the 1GB RAM required to host Ghost.
  3. enable backup if you want, and choose a datacenter close enough to you.
  4. add an ssh key if you can, makes it easy to do the next steps.
  5. click create and wait for the droplet to be provisioned
  6. when it's ready, click on the IP address.
  7. if you've been following along, you will be faced with a "Please log into your Droplet with SSH to configure the Ghost Installation" message. the link serves as a reference.
  8. on your terminal, ssh root@use_your_droplet_ip (the ip address from 6. just the ip address, no http://)

fix the failed installation (as of June 03 2019)

  1. on my initial login, the Ghost installation failed (with a TypeError: Parameter "url" must be a string, not undefined).
  2. if that's the case for you, after it fails, login to the ghost-mgr user with sudo -i -u ghost-mgr.
  3. go to /var/www/ghost and run ghost uninstall then ghost install (to jump to that directory, cd /var/www/ghost)

finishing the installation process ref

  1. when "Enter your blog URL:" pops up, type in your ip address URL eg http://165.22.199.121/ (or your domain, if you have one) note that if you input your domain here, you have the option to setup SSL while setting up ghost late (I haven't tested it)
  2. for all mysql settings, you can go with defaults because we are going to delete them later:
MySQL hostname: localhost
MySQL username: root
MySQL password:
Ghost database name: ghost_prod
  1. when "Do you wish to set up "ghost" mysql user?" pops up, pick no: n
  2. Settup up Nginx (Y)
  3. Setting up SSL (Y) // if you have a domain name, otherwise skipped
  4. Setting up Systemd (Y)
  5. Start Ghost (Y)
  6. it should fail with an error message like this:
Message: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
Help: Unknown database error

Install Ghost with sqlite3

  1. time to ssh into the ghost config file! go to /var/www/ghost/config.production.json (if you installed development, it would be reflected in the name, but in that case it will already have an sqlite3 db setup) and edit it with your favourite editor. (I don't like the terminal, so i remote ssh-ed into the server with VsCode using the 'SSH FS' plugin. you can for example type nano /var/www/ghost/config.production.json).
  2. the config.production.json file should look something like this:
{
  "url": "http://159.89.193.37",
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  },
  "database": {
"client": "mysql",
"connection": {
"host": "127.0.0.1",
"user": "ghost_user",
"password": "your_ghost_user_password",
"database": "ghost_db",
"charset": "utf8"
} }, "mail": { "transport": "Direct" }, "logging": { "transports": ["file", "stdout"] }, "process": "systemd", "paths": { "contentPath": "/var/www/ghost/content" }, "bootstrap-socket": { "port": 8000, "host": "localhost" } }
  1. edit the highlighted bits so that it looks like this:
{
  "url": "http://159.89.193.37",
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  },
  "database": {
"client": "sqlite3",
"connection": {
"filename": "/var/www/ghost/content/data/ghost.db"
} }, "mail": { "transport": "Direct" }, "logging": { "transports": ["file", "stdout"] }, "process": "systemd", "paths": { "contentPath": "/var/www/ghost/content" }, "bootstrap-socket": { "port": 8000, "host": "localhost" } }
  1. type ghost restart and you should be golden!
  2. now visit your spanking new Ghost deployment running on sqlite3!

refs

coming up: https