Vikunja on Docker with Caddy labels

I’m trying to spin up Vikunja on docker with this caddy container (slightly modified, but this doesn’t matter). It’s using labels to set up reverse proxies and I just can’t figure out how to set up them properly. Can anyone help me with it? As far as I understand this it should work, but frontend can’t connect to the api.

  vikunja_api:
    image: vikunja/api
    environment:
      VIKUNJA_DATABASE_HOST: vikunja_db
      VIKUNJA_DATABASE_PASSWORD: supersecret
      VIKUNJA_DATABASE_TYPE: mysql
      VIKUNJA_DATABASE_USER: root
    volumes:
      - /media/seagate/vikunja/files:/app/vikunja/files
    networks: [caddy, vikunja]
    depends_on: [vikunja_db]
    labels:
      caddy: tasks.some.tld:3456
      caddy.0_reverse_proxy: "/api/* {{upstreams 3456}}"
      caddy.1_reverse_proxy: "/.known-hosts/* {{upstreams 3456}}"
      caddy.2_reverse_proxy: "/dav/* {{upstreams 3456}}"
  vikunja_db:
    image: linuxserver/mariadb
    environment:
      MYSQL_PASSWORD: supersecret
      MYSQL_DATABASE: vikunja
      MYSQL_ROOT_PASSWORD: supersecret
    volumes:
      - /media/seagate/vikunja/db:/var/lib/mysql
    networks: [vikunja]
  vikunja_fe:
    image: vikunja/frontend
    restart: unless-stopped
    networks: [caddy, vikunja]
    labels:
      caddy: tasks.some.tld
      caddy.3_reverse_proxy: "{{upstreams 80}}"

Can you reach the api at tasks.some.tld:3456/api/v1/info?

I can reach it via curl after prefixing url in docker-compose.yml with http://, nonetheless frontend still can’t access it

As I can see in the dev tools when trying to change api it’s trying to connect api:3456 instead of http://tasks.some.tld:3456 should it be like that?
image

okay, somehow adding https:// prefix instead of http:// fixed the issue. Thanks for trying to help!

Nope that shouldn’t be the case.

Glad you figured it out!

There’s some docs about running with caddy at Full docker example | Vikunja
Do you want to send a PR to add the configuration with caddy lables?

I’ll definetly add it to my to-do list. I’ll probably do it at the end of the month, because I don’t have enough time to write it now.

1 Like