How to set up Kanboard with SWAG

Here’s how I managed to get Kanboard up and running, with SWAG as a reverse proxy that manages TLS certificates from letsencrypt.

First, since I’m using subdomains in SWAG, I set up an A-level subdomain with my domain name hosting service, called “kanboard.mysite.net” (Well, not quite, but you get the idea). Then I waited for about a day to ensure that this new URL had propagated globally. (In fact I don’t know how long this takes, but a day is certainly long enough. Maybe a few hours would do it.)

Second, in my SWAG settings in docker-compose.yml, I had the line

  environment:
    -- subdomains=kanboard

In fact I have several subdomains, whose names are listed here, separated by commas.

Third, I simply copied the kanboard docker-compose file and made some changes:

  1. I left out the “443:443” ports line: this port is used by SWAG.
  2. I left out the kanboard_ssl volume, as ssl is handled by SWAG.

This left:

kanboard:
    container_name: kanboard
    image: kanboard/kanboard:latest
    ports:
      - "8080:80"
    volumes:
      - kanboard_data:/var/www/app/data
      - kanboard_plugins:/var/www/app/plugins
    environment:
      DATABASE_URL: mysql://kanboard:kanboard-secret@db/kanboard
      PLUGIN_INSTALLER: true 

The database lines, starting with db: I left untouched.

Fourth, I needed to create a kanboard config file in my swag/nginx/proxy-confs directory. SWAG provides a template for this, and so it’s just a matter of filling out a few fields. Without all the comment lines, the final file, called kanboard.subdomain.conf is:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name kanboard.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;


    location / {

        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app kanboard;
        set $upstream_port 80;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }
}

Then I restarted SWAG with docker restart swag. This needs to be done after any change to a config file.

And that’s it! I started my containers with the usual

docker compose -f docker-compose.yml up -d

and I was good to go. (Note that I’m using the “compose” tool of docker, instead of the deprecated “docker-compose”. If you’re still using docker-compose, you need to update.)

Hope this helps someone.