author

Grahn.io

Ramblings of a madman on the topics of technology

Hosting Ghost With Docker

Jacob Grahn

Ghost

Ghost is open source blogging sofware that kind-of sort-of competes with WordPress, which is open source world domination software.

Let someone else host it

It is absolutely worth the extra bit of money to have someone else go through the trouble of hosting Ghost for you. For those of you who are smart (unlike myself), here are a couple of great options.

  • ghost.org
    Hosting by the people who wrote Ghost. Cool! Their cheapest plan is $29 a month, or $19 a month if you pay yearly.
  • runkite.com
    Hosting by some people who like kites. Cool! Their cheapest plan is $5 a month. As of right now they are running an old version of Ghost. This is a great cheap option if you don't share my phobia of outdated software.

Host it yourself

Ghost's installation instructions aren't too bad if you're used to doing this sort of thing. But it's not exactly the easist thing ever.

Instead, a simpler solution is to install docker, and then run the ghost image.

docker run --name ghost -d \
-p 80:3268 \
-v /data/ghost:/var/lib/ghost/content \
ghost:alpine

Done!

Add SSL

If you want to go the extra mile, here's a docker setup that adds automatic ssl via Let's Encrypt.

docker run --name nginx -d \
-p 80:80 \
-p 443:443 \
-e ENABLE_IPV6=true \
-e DEFAULT_HOST=yourdomain.com \
-v /data/certs:/etc/nginx/certs:ro \
-v /etc/nginx/vhost.d \
-v /usr/share/nginx/html \
-v /var/run/docker.sock:/tmp/docker.sock:ro \
--label com.github.jrcs.letsencyprt_nginx_proxy_companion.nginx_proxy \
jwilder/nginx-proxy:alpine
docker run --name certs -d \
-v /data/certs:/etc/nginx/certs:rw \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
--volumes-from nginx \
jrcs/letsencrypt-nginx-proxy-companion
docker run --name ghost -d \
-e VIRTUAL_HOST=yourdomain.com \
-e LETSENCRYPT_HOST=yourdomain.com \
-e LETSENCRYPT_EMAIL=2@2.com \
-e url=https://yourdomain.com \
-v /data/ghost:/var/lib/ghost/content \
ghost:alpine

The final step is to set theses scripts up to run whenever the server reboots. I just added them to my crontab with the @reboot command.

Have fun Ghosting!