the easiest blog you have ever deployed

requirements

  • a server somewhere
  • docker installed on this server
  • a domain

preparation

create a DNS entry for your blog. caddy (if you donโ€™t know it, you will meet soon) manages SSL certificates by itself, but it needs DNS right to solve letsencrypt's challenge.

the deploy

our deploy will be split in 2 parts: one is the blog itself, this will run on docker. the other part is caddy, that in this case will run installed on the server itself, but it could very much be another docker container.

caddy

my server is running debian, but yours can be running pretty much anything else. just follow the instructions from the caddy official guide.

with caddy installed, we need a caddyfile to tell it instructions of what to serve. so create a new directory (for the sake of organisation, this step is not really needed) and create a file there with the following contents:

example.com {
        reverse_proxy localhost:3000
}

this is what we need from caddy. ideally, you should be able to caddy start --config caddyfile

fx

our blogging platform of choice is FX. it's tiny, it's easy to manage, it's easy to read, it is really just a weblog, no extras.

we will be ripping a page out of their own manual. go back to home and create a new directory for the blog. inside that page, create a docker-compose.yml file. slap this inside of it:

services:
  fx:
    image: 'rikhuijzer/fx:1'
    container_name: 'fx'
    environment:
      FX_USERNAME: 'john'
      FX_DOMAIN: 'example.com'
    env_file:
      # Contains `FX_PASSWORD="<PASSWORD>"`.
      - '.env'
    ports:
      - '3000:3000'
    volumes:
      # Stores the SQLite database.
      - './data:/data:rw'
    healthcheck:
      test: ['CMD', '/fx', 'check-health']
    restart: 'unless-stopped'

on the same directory create a .env file, and inside it add FX_PASSWORD=YOUR_PASSWORD.

now spin the containers with docker compose up and give it a test drive. if everything works, running the command again but with -d at the end runs the container without blocking the terminal.

conclusion

this is it. you can blog. time to become famous. in 2006 or something. you can use caddy to reverse proxy as many blogs and applications you want. this + docker give you a shit ton of options to run your own stuff.

luv ya. byyye <3