Installing Ghost 1.x on a Raspberry Pi - A Production Blog
Now we have a development blog let's turn our thoughts to production. A production blog needs to restart automatically at reboot or in the event of a failure and really ought use SSL.
Colour me impressed - ghost-cli does both of these things out of the box without any further work from the installer. It configures systemd to provide automatic failure restarting and it acquires certificates from letsencrypt.org and automatically configures nginx to use these to provide SSL security. This means that post-install configuration of Ghost is now much simpler than the previous 0.x versions.
One decision needs to be made before installation. Do you want ot run with an sqlite3 database or do you need the robustness that mysql offers. Personally I think that a Raspberry Pi is best suited to sqlite3 but if you prefer mysql you will need to install it prior to installing Ghost. I didn't so don't have install instructions here.
Additionally, since Ghost is going to set up SSL keys via Letsencrypt then you must have all of the DNS entries set up correctly in advance so that Letsencrypt can find DNS entries for your blog.
To create a production system then follow the steps in the previous post detailing creating a Test, Development Blog except for the final ghost install local
step. Of course, if you've actually created such a blog on your server already then you don't need to re-install the software again, just start at the point where you need to create a var/www folder for your new blog.
Once you have the folder, with the revised owner and have navigated to it then you can simply install Ghost with
ghost install --db sqlite3
if you decided to use mysql then you just need ghost install
And that's it
The installation process will warn that you are not running Ubuntu 16.04 but you can simply ignore that warning. It will then install Ghost which takes quite a while and ask do you want nginx, systemd and SSL configured before finally asking whether you want Ghost started. Be aware that generating the keys for SSL takes a long time, over 30 minutes on my un-overclocked Raspberry Pi 3. Also be aware that the response from Ghost starting occurs several seconds before Ghost has successfully started - so should you received a 502 Bad Gateway error it may just be that we were a little eager in trying out your new system. Wait a few seconds before retrying.