Vikunja and SWAG

I am trying to get vikunja to work with SWAG so that I can access my instance from anywhere. There is no template for this service so I am trying to modify the _template subdomain conf sample.
The Vikunja installation directions include their own Nginx proxy but I was hoping that I could eliminate that container from the overall stack via swag rather than having SWAG point to their proxy container.
Right now I have the swag proxy setup as follows:

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

    server_name vikunja.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 20;

    location / {

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

    }

     location ~ (/vikunja_api)?/api {
         include /config/nginx/proxy.conf;
         include /config/nginx/resolver.conf;
         set $upstream_app vikunja_api;
         set $upstream_port 80;
         set $upstream_proto http;
         proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    
     }
}

Vikunja has a frontend, backend and API container to tie everything all together. My compose file for Vikunja currently looks like this:

version: '3'

services:
  db:
    image: mariadb:10
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_ROOT_PASSWORD: ###
      MYSQL_USER: ###
      MYSQL_PASSWORD: ###
      MYSQL_DATABASE: ###
    volumes:
      - ./db:/var/lib/mysql
    restart: unless-stopped
  api:
    image: vikunja/api
    container_name: vikunja_api
    environment:
      VIKUNJA_DATABASE_HOST: db
      VIKUNJA_DATABASE_PASSWORD: ###
      VIKUNJA_DATABASE_TYPE: mysql
      VIKUNJA_DATABASE_USER: vikunja
      VIKUNJA_DATABASE_DATABASE: vikunja
#      VIKUNJA_SERVICE_ENABLEREGISTRATION: "True" 
      VIKUNJA_SERVICE_TIMEZONE: America/Chicago
    volumes: 
      - ./files:/app/vikunja/files
    ports:
      - 8095:3456
    depends_on:
      - db
    restart: unless-stopped
  frontend:
    image: vikunja/frontend
    container_name: vikunja
    restart: unless-stopped
    ports:
      - 8094:80
networks:
  default:
    external:
      name: rastacalavera_default

I can hit the login page but can’t login (that is a different issue altogether) but can’t hit the /api from my domain. It just redirects to the login.

In their example proxy config they use something that looks different compared to the LSIO example:

server {
    listen 80;

    location / {
        proxy_pass http://frontend:80;
    }

    location ~* ^/(api|dav|\.well-known)/ {
        proxy_pass http://api:3456;
        client_max_body_size 20M;
    }
}

The second location looks like some reg reference. Can that text be placed in the LSIO template or will it break it?

Is anyone else using Vikunja with SWAG currently?

The upstream port for api in your proxy conf is incorrect. It should be 3456

1 Like

ah duh thanks! Now I can reach both but still can’t login. That’s more of an issue for their project though, I was just trying to get SWAG to fully function with it. Thanks!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.