Lots of ways to do this out there, ranging from “too much code” to “but, why?”. Here’s how I chose to do mine:
Somewhat recently I reduced the size of the virtual machine in which I host this blog. It is quite short on memory, but for the price I pay, can’t really complain.
Just now I was looking on memory usage on the machine, and noticed ps reporting over 100MB being help by npm:
andre@webserver ~]$ ps aux --sort -rss
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
ghost 247 0.0 23.2 1328872 117468 ? Sl Jun06 2:58 node index.js
ghost 199 0.0 7.5 1031804 37868 ? Ssl Jun06 0:00 npm
root 152 0.0 3.5 77340 17868 ? Ss Jun06 0:08 systemd-journald
As you can see, only about 38 MB is actually in RAM (RSS), the rest (VSZ) is either shared libs or in the swap. As you can see by the relative memory usage, I don’t have that much, so why not free those forty megabytes that are not really necessary?
Ghost’s out of the box import/export backup mechanism works well, but doesn’t backup images.
I wanted a simple command line I could call to backup my blog and move the backup file out of the server’s file system. Also, I didn’t want to stop Ghost’s node process to create the backup.
By default, Ghost uses sqlite as a database, which provides an easy way to perform online backups.
Below is a Gist of a small Bash script I put together to login to the blog’s server, perform the online backup of the database, gzip that together with the image folder and then copy over to the local machine.
Finally I got the blog setup with an HTTPS endpoint on Azure. I thought I would write up on the points that weren’t that straight forward.
Get a free SSL certificate
I used Let’s encrypt to generate me a free SSL certificate for the blog. It will provide you with a domain-validated certificate, which only vouches for the domain identity (good enough for a blog, if you ask me).
To issue a certificate to a domain, they will challenge you to prove that you control the domain. They generate a string and request you to set it up as a DNS TXT record or as a page in your web server.