Hosting // Ghost
Ghost is a really cool blogging platform I discovered several years ago. I have been toying with the platform for a while, but only in the past couple years have I really started to take it seriously. I had used Wordpress before and for other projects, but for many cases I dislike the setup and configuration of Wordpress to do simple things or just to get information out there. Ghost helped a lot to solve some issues I had with Wordpress and made it feel more enjoyable to blog.
Setting up a Ghost site in the past took me a lot of time and configuration. In recent years I had finally decided to start learning docker and I had come to learn that there is a docker image for Ghost. To keep up with my current trend, I decided to host my Ghost sites myself using docker. Doing so was actually very easy! Setting up the docker compose configuration was very simple.
networks:
ghost_net:
external: false
services:
ghost:
image: ghost:latest
container_name: ghost
volumes:
- /DATA/AppData/ghost/config.production.json:/var/lib/ghost/config.production.json:z #overwrite default settings
- /DATA/AppData/ghost/content/:/var/lib/ghost/content:z
ports:
- 2360:2360
environment: # this section can be commented to start in dev mode by default
- NODE_ENV=production # set either production or development, then it will load the respective config
- GHOST_CONTENT=/var/lib/ghost/content
- GHOST_INSTALL=/var/lib/ghost
- PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
restart: always
networks:
- ghost_netAfter deploying Ghost using my docker-compose config, it will only be accessible through your local network. You will need to configure Ghost to help expose it to the internet and pair it to a domain. Ghost does require email to be setup for production use however. You can use your own Google account for this (application credentials only) or make a new email on your domain for it and put those credentials instead.
{
"url": "https://your-domain.com",
"server": {
"port": 2360,
"host": "0.0.0.0"
},
"database": {
"client": "sqlite3",
"connection": {
"filename": "content/data/ghost.db"
},
"useNullAsDefault": true,
"debug": false
},
"mail": {
"transport": "SMTP",
"options": {
"service": "Google",
"host": "smtp.gmail.com",
"port": 587,
"auth": {
"user": "your-smtp-user",
"pass": "your-smtp-password"
}
}
},
"logging": {
"transports": [
"stdout"
]
},
"paths": {
"contentPath": "/var/lib/ghost/content"
}
}Once you have configured Ghost, and restarted it you will just need to configure your reverse proxy. Using a reverse proxy like Caddy we can configure our Ghost site adding the following to our Caddyfile.
#Caddyfile
your-domain.com {
reverse_proxy ghost-ip-or-hostname:2360
}After applying your new Caddy config your should now have a publicly accessible blog using Ghost! Happy blogging!