Self-Host planka with docker-compose and traefik

Self-Host planka with docker-compose and traefik
Create as many projects as you like

First of all, what is planka?

According to their own website it's a free open source kanban board for work groups.

Cool Story - what the hell is kanban?

Kanban is a lean productivity method. Lean meaning, you do the smallest possible and least amount of steps you can to solve the current problem. Instead of lean you could also call it lazy in the most positive way possible.

That was kind of abstract, can you speak human?

The most basic version of kanban is a whiteboard. On this whiteboard there are 3 sections:

  • ToDo
  • Doing
  • Done

In ToDo you put

  • all the things you think you need to do to achieve your project goal
  • in as small chunks as you can
  • with your current knowledge

Once you actually start on the project you pick one single thing from ToDo and move it to Doing.
Once done - you guessed it, move it to Done.

Why don't I just use a classic todo-list?

Your choice really, but a kanban

  • forces you to think atomic
  • You can also collaborate
  • others can always tell what you are currently working on,
  • until when you plan to finish,
  • what tasks are still open.

I also just really like the process of moving things as I progress and it helps me with my infinite-choice-dilemma (seeing several interpretations and variations of any given subject but having difficulties to pick one).

Multiple Sub-Projects

Why Planka specifically though?

Well first of all - Open Source right ;)
Of course there are several Open Source Kanban Boards out there, so here is why I picked Planka.

Simplicity

Some people go for the oldest and most established software around - some people call it "mature".
The thing is, there is a sweetspot.

You don't want the newborn bug-riddled project with security holes so big you can see the fan spin.

You also really don't want the old-man can-do-it-all project with a million patches and configurations.

Why not the "old man"?

If you want to put a nail into your favourite wall you would not study engineering just to be able to swing the hammer right?
The "old man" is a piece of software that has been added to so many times that the learning curve, just to even set it up is so steap it's not worth the effort just for being allowed to use a hammer. Actually using it usually is another hurdle, because a highly specialized and focused tool has a very intuitive user-friendly design, while the tool that can do everything does not, simply because of its intrinsic complexity.

So what do we want?

Metaphorically speaking - we want a rock. A rock we can pick up from the wayside to bash in our nail.
Technically speaking the software should

  • be easy to setup
  • need barely any or no instruction to use (discoverability)
  • be old enough to not cause problems during everyday use
  • be big enough that there is enough community to ask your questions to
  • be actively updated (at least once a month)

My choice fell on Planka.

You pick how many steps to go through for each task

Finally - the Setup

Like in my previous howtos I will set this up with traefik (another great choice vs the "old man" nginx for a reverse proxy). Planka itself needs a postgreSQL database but we will get to that and finally we will need some .env-files for our containers

The Structure

.
├── data
│   ├── attachments
│   ├── db-data
│   ├── project-background-images
│   └── user-avatars
├── docker-compose.planka.yml
├── kanban_db.env
└── planka.env

docker-compose.traefik.yml

Nothing changed, don't forget to insert your email. If you don't have it already from another project, create another folder for it, no need to put it in the planka folder. Here you go:

version: '3.7'

services:
  traefik:
    image: traefik
    command: 
      - "--providers.docker"
      - "--providers.docker.exposedByDefault=false"
      - "--providers.docker.network=traefik"
      - "--entrypoints.http.address=:80"
      - "--entrypoints.http.http.redirections.entrypoint.to=https"
      - "--entrypoints.http.http.redirections.entrypoint.scheme=https"
      - "--entrypoints.https.address=:443"
      - "--entrypoints.https.http.tls.certResolver=le"
      - "--certificatesresolvers.le.acme.tlschallenge=true"
      - "--certificatesresolvers.le.acme.email=your@mail.com"
      - "--certificatesresolvers.le.acme.storage=/letsencrypt/acme.json"
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./letsencrypt:/letsencrypt
    networks:
      - web

networks:
  web: 
    name: traefik

docker-compose.planka.yml

Now it gets more interesting. Don't forget to insert your (sub)domain

version: '3.9'

services:
  planka:
    image: ghcr.io/plankanban/planka:latest
    command: >
      bash -c
        "for i in `seq 1 30`; do
          ./start.sh &&
          s=$$? && break || s=$$?;
          echo \"Tried $$i times. Waiting 5 seconds...\";
          sleep 5;
        done; (exit $$s)"
    restart: unless-stopped
    volumes:
      - ./data/user-avatars/:/app/public/user-avatars/
      - ./data/project-background-images/:/app/public/project-background-images/
      - ./data/attachments/:/app/private/attachments/
    env_file:
      - planka.env
    depends_on:
      - postgres
    networks:
      - kanban_db
      - traefik
    labels:
      - 'traefik.enable=true'
      - 'traefik.http.routers.kanban.rule=Host(`yourdomain.com`)'
      - 'traefik.http.services.kanban.loadbalancer.server.port=1337'

  postgres:
    image: postgres:14-alpine
    restart: unless-stopped
    volumes:
      - ./data/db-data:/var/lib/postgresql/data
    env_file:
      - kanban_db.env
    networks:
      - kanban_db

networks:
  kanban_db: 
  traefik:
    external: true

kanban_db.env

POSTGRES_DB=planka
POSTGRES_HOST_AUTH_METHOD=trust

planka.env

Again, don't forget to insert your (sub)domain and also this time set the secret key:

BASE_URL=https://yourdomain.com
TRUST_PROXY=0
DATABASE_URL=postgresql://postgres@postgres/planka
SECRET_KEY=insertsecrethere

To generate the secret key, you can use this:

openssl rand -hex 64

Run it

docker compose -f /path/to/traefik/folder/docker-compose.traefik.yml up -d
docker compose -f /path/to/planka/folder/docker-compose.planka.yml up -d

It's ALIVE

Now go to your (sub)domain, and log in with
User: demo@demo.demo
Password: demo

In the top right corner there should be an icon depicting several heads.

  • Click it,
  • create your actual user,
  • make it an admin (slider),
  • logout,
  • login with your new admin account
  • delete the demo account

Now you are good to go :)

Trouble-Shooting

Bug #1 - I can't upload avatars/background-images/attachements

We can easily fix this :)
Go to the folder where your docker-compose.planka.yml file is.
There should be a data folder there, if not you have either not run the containers yet or you changed the volume-mapping you bad boy/girl :)

Assuming you have the data folder:

docker compose -f docker-compose.planka.yml down
cd data/
sudo chown -R 1000:1000 user-avatars/ attachments/ project-background-images/
docker compose -f ../docker-compose.planka.yml up -d
Photo by Minh Pham / Unsplash