Profile picture Schedule a Meeting
c a n d l a n d . n e t

Ghost on Dokku with Sqlite

Dusty Candland | | ghost, dokku, sqlite

I'm using the Ghost modern publishing platform for my daily newsletter. It has a great UI, email support, and it's self hosted. I'm using Dokku for the hosting and Sqlite for the DB.

Setup

Setup the Dokku appplication to use Sqlite (not actually supported), and install via Docker image.

dokku apps:create candland-cms
 
dokku domains:add cms.candland.net

dokku config:set --no-restart database__client=sqlite3 database__connection__filename=/var/lib/ghost/content/data/ghost.db database__useNullAsDefault=true database__debug=false

dokku config:set --no-restart NODE_ENV=production

dokku git:from-image ghost:latest

dokku proxy:ports-add http:80:2368

dokku proxy:ports-remove http:2368:2368

Setup pesistent storage for the database and content files.

dokku storage:ensure-directory

dokku storage:mount /var/lib/dokku/data/storage/candland-cms:/var/lib/ghost/content

dokku ps:rebuild

Setup the domain and SSL

dokku config:set --no-restart DOKKU_LETSENCRYPT_EMAIL=dusty@domain.net

dokku letsencrypt

dokku config:set url=https://cms.candland.com

Database backups

Setup Litestream on the server

dokku plugin:install https://github.com/axelthegerman/dokku-litestream litestream

dokku litestream:auth

dokku litestream:create candland-cms /var/lib/dokku/data/storage/candland-cms/data ghost.db s3://candland-cms-litestream.sfo3.digitaloceanspaces.com/

dokku litestream:start candland-cms

Email Setup

I set up Mailgun for the newsletter sending, so I'm going to use that for the transactional email config too.

dokku config:set mail__transport=SMTP \
mail__options__service=Mailgun \
mail__options__host=smtp.mailgun.org \
mail__options__port=465 \
mail__options__secure=true \
mail__options__auth__user=user@domain.net \
mail__options__auth__pass=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
mail__from=dusty@domain.net

dokku ps:rebuild

Check out the final result https://news.candland.net (yeah, I changed the subdomain).

Upgrading

I'm not sure export/import are needed for minor version upgrades.

  1. Export everything

  2. Upgrade docker image

dokku git:from-image ghost:latest
  1. Import everything

References

Latest docker images

https://bitkidd.dev/posts/deploy-ghost-using-dokku

https://github.com/AxelTheGerman/dokku-litestream

https://github.com/zutrinken/attila

https://dani.gg/en/blog/create-a-ghost-theme-with-tailwind-css/

Webmentions

These are webmentions via the IndieWeb and webmention.io. Mention this post from your site: