Deploying Vikunja with Traefik Labels and Using It Under a DNS Entry
Lewin Grunenberg 4 Minuten Lesezeit

Deploying Vikunja with Traefik Labels and Using It Under a DNS Entry

This post shows how to deploy Vikunja with Docker Compose and Traefik and access it via a DNS entry.
vikunja traefik docker on-premise self-hosted

Vikunja and Traefik - Easy Integration with Network Configuration

Introduction

In this post, we will show you how to deploy the to-do app Vikunja with Docker Compose and Traefik and access it via a DNS entry like https://do.your-domain.org. This configuration allows for easy and secure management of your task lists.

Introduction to Traefik

Traefik is a dynamic reverse proxy and load balancer designed specifically for modern applications. It enables automatic service discovery and easy management of SSL/TLS certificates. You can find more details in our Traefik tutorial.

Introduction to Vikunja

Vikunja is an open-source task management platform that allows you to efficiently organize and track your tasks. It offers features like creating to-do lists, assigning tasks, and setting deadlines. Vikunja is ideal for teams and individuals looking for a flexible and powerful solution for task management.

Setting the DNS Entry

Before proceeding with the setup, ensure that the DNS entry for do.your-domain.org is correctly set. This entry should point to the IP address of the server where Traefik is running. Use your DNS management service, such as Cloudflare, to add the appropriate entry.

Introduction to Docker and Docker Compose

Docker is a platform that allows applications to run in isolated containers, significantly simplifying their deployment and scaling. Docker Compose is a tool for defining and running multi-container applications. It helps manage complex application environments with a few commands.

Docker Compose Presentation for Vikunja

Vikunja

The Vikunja service provides the task management interface and is made accessible via Traefik:


services:
  vikunja:
    image: vikunja/api
    environment:
      VIKUNJA_SERVICE_PUBLICURL: https://do.your-domain.org  # Replace 'your-domain.org' with your actual domain
      VIKUNJA_DATABASE_HOST: db
      VIKUNJA_DATABASE_PASSWORD: changeme  # Replace 'changeme' with a strong password
      VIKUNJA_DATABASE_TYPE: mysql
      VIKUNJA_DATABASE_USER: vikunja
      VIKUNJA_DATABASE_DATABASE: vikunja
      VIKUNJA_SERVICE_JWTSECRET: supersecuresecret  # Replace 'supersecuresecret' with a secure, random value
    volumes:
      - ./files:/app/vikunja/files
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.vikunja.rule=Host(`do.your-domain.org`)"  # Replace 'your-domain.org' with your actual domain
      - "traefik.http.routers.vikunja.entrypoints=websecure"
      - "traefik.http.routers.vikunja.tls.certresolver=lets-encrypt"
      - "traefik.http.services.vikunja.loadbalancer.server.port=3456"
      - "traefik.docker.network=web"
    networks:
      - web
      - default

This section defines the Vikunja service, which listens on port 3456. The configuration includes database connectivity and the necessary environment variables.

Traefik

The Traefik labels are crucial for correctly configuring the service and routing traffic accordingly:

  • traefik.enable=true: Enables Traefik for this service, allowing Traefik to monitor the service and forward requests.
  • traefik.http.routers.vikunja.rule=Host('do.your-domain.org'): Defines the URL mapping condition, specifying that requests to do.your-domain.org are forwarded to the Vikunja service.
  • traefik.http.routers.vikunja.entrypoints=websecure: Instructs Traefik to serve this service via the websecure entry point, used for HTTPS traffic.
  • traefik.http.routers.vikunja.tls.certresolver=lets-encrypt: Indicates that Traefik uses Let’s Encrypt to secure HTTPS traffic.
  • traefik.http.services.vikunja.loadbalancer.server.port=3456: Specifies the internal port of the Vikunja service to which Traefik forwards traffic.
  • traefik.docker.network=web: Specifies the Docker network used by Traefik to manage connections.

Database (DB)

The database service (DB) provides the necessary database for Vikunja:

  db:
    image: mariadb:10
    environment:
      MYSQL_ROOT_PASSWORD: supersupersecret  # Replace 'supersupersecret' with a strong password
      MYSQL_USER: vikunja
      MYSQL_PASSWORD: changeme  # Replace 'changeme' with a strong password
      MYSQL_DATABASE: vikunja
    volumes:
      - ./db:/var/lib/mysql
    networks:
      - default

This section defines the database service, which provides a MariaDB database. The configuration includes the necessary environment variables for database usage and data storage locations.

Networks

The network settings define the network Traefik uses to connect the services:


networks:
  web:
    external: true  # Uses an external network managed by Traefik
  default:
    driver: bridge

This section defines the network used by Traefik to connect the various services and manage connections.

Conclusion

With this guide, you can efficiently and securely deploy Vikunja with Traefik and Docker. The configuration is flexible and can be easily adapted to individual requirements. For further questions or professional support, check out our Discord channel. We are happy to assist you in the optimal setup and management of your applications.

Complete Docker Compose

Here is the complete docker-compose.yml file for the Vikunja installation:


version: '3.4'

services:
  vikunja:
    image: vikunja/api
    environment:
      VIKUNJA_SERVICE_PUBLICURL: https://do.your-domain.org  # Replace 'your-domain.org' with your actual domain
      VIKUNJA_DATABASE_HOST: db
      VIKUNJA_DATABASE_PASSWORD: changeme  # Replace 'changeme' with a strong password
      VIKUNJA_DATABASE_TYPE: mysql
      VIKUNJA_DATABASE_USER: vikunja
      VIKUNJA_DATABASE_DATABASE: vikunja
      VIKUNJA_SERVICE_JWTSECRET: supersecuresecret  # Replace 'supersecuresecret' with a secure, random value
    volumes:
      - ./files:/app/vikunja/files
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.vikunja.rule=Host(`do.your-domain.org`)"  # Replace 'your-domain.org' with your actual domain
      - "traefik.http.routers.vikunja.entrypoints=websecure"
      - "traefik.http.routers.vikunja.tls.certresolver=lets-encrypt"
      - "traefik.http.services.vikunja.loadbalancer.server.port=3456"
      - "traefik.docker.network=web"
    networks:
      - web
      - default

  db:
    image: mariadb:10
    environment:
      MYSQL_ROOT_PASSWORD: supersupersecret  # Replace 'supersupersecret' with a strong password
      MYSQL_USER: vikunja
      MYSQL_PASSWORD: changeme  # Replace 'changeme' with a strong password
      MYSQL_DATABASE: vikunja
    volumes:
      - ./db:/var/lib/mysql
    networks:
      - default

networks:
  web:
    external: true  # Uses an external network managed by Traefik
  default:
    driver: bridge

Ähnliche Artikel