How to install in docker-compose on custom port

Hello,
I try first time install Vikunja with docker-compose. I have many apps on my server and Vikunja don’t work on default configuration. How can I change port in docker-compose? Tu run in browser: http://ip:port?

version: '3'

services:
  db:
    image: mariadb:10
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_ROOT_PASSWORD: supersecret
      MYSQL_USER: vikunja
      MYSQL_PASSWORD: secret
      MYSQL_DATABASE: vikunja
    volumes:
      - ./db:/var/lib/mysql
    restart: unless-stopped
  api:
    image: vikunja/api
    environment:
      VIKUNJA_DATABASE_HOST: db
      VIKUNJA_DATABASE_PASSWORD: secret
      VIKUNJA_DATABASE_TYPE: mysql
      VIKUNJA_DATABASE_USER: vikunja
      VIKUNJA_DATABASE_DATABASE: vikunja
      VIKUNJA_SERVICE_JWTSECRET: <a super secure random secret>
      VIKUNJA_SERVICE_FRONTENDURL: https://<your public frontend url with slash>/
    volumes: 
      - ./files:/app/vikunja/files
    depends_on:
      - db
    restart: unless-stopped
  frontend:
    image: vikunja/frontend
    restart: unless-stopped
#  proxy:
#    image: nginx
#    ports:
#      - 80:80
#    volumes:
#      - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
#    depends_on:
#      - api
#      - frontend
#    restart: unless-stopped

I disable nginx because I will use Nginx Proxy Manager.

Regards,
Przemek

Hi,
thanks for answer. I cannot install on port 80 because it’s already in use. What port I can use to make it work because when I choose: 80:8077 or 8077:80 it shows errors.

ERROR: for vikunja_proxy_1  Cannot start service proxy: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/home/dietpi/vikunja/nginx.conf" to rootfs at "/etc/nginx/conf.d/default.conf": mount /home/dietpi/vikunja/nginx.conf:/etc/nginx/conf.d/default.conf (via /proc/self/fd/6), flags: 0x5001: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

ERROR: for proxy  Cannot start service proxy: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/home/dietpi/vikunja/nginx.conf" to rootfs at "/etc/nginx/conf.d/default.conf": mount /home/dietpi/vikunja/nginx.conf:/etc/nginx/conf.d/default.conf (via /proc/self/fd/6), flags: 0x5001: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.

The error you get is unrelated.

Why do you want to change the ports if you’re planning to host with mom anyway?

Did you check out the npm example? Reverse Proxy | Vikunja

I need to change ports because it don’t work when install degfault example.

You didn’t specify a port in your docker-compose.
Try something like this:

version: '3.3'

services:
  db:
    image: mariadb:10
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_ROOT_PASSWORD: xxxxxxx
      MYSQL_USER: vikunja
      MYSQL_PASSWORD: xxxxxx
      MYSQL_DATABASE: vikunja
    volumes:
      - ./Vikunjadb:/var/lib/mysql
    restart: unless-stopped
  api:
    image: vikunja/api
    environment:
      VIKUNJA_DATABASE_HOST: db
      VIKUNJA_DATABASE_PASSWORD: xxxxxx
      VIKUNJA_DATABASE_TYPE: mysql
      VIKUNJA_DATABASE_USER: vikunja
      VIKUNJA_DATABASE_DATABASE: vikunja
      VIKUNJA_SERVICE_FRONTENDURL: https://<your public frontend url with slash>/
      VIKUNJA_SERVICE_TIMEZONE: Europe/Paris
    ports:
      - 3456:3456
    volumes:
      - ./files:/app/vikunja/files
    depends_on:
      - db
    restart: unless-stopped
  frontend:
    image: vikunja/frontend
    ports:
      - 9990:80 #or 9546:80 or 2354:80 or whatever
    environment:
      VIKUNJA_API_URL: http://ip:3456/api/v1
    restart: unless-stopped
1 Like

Thanks, that works but when I enter first login screen on my https://my-vikunja.duckdns.org site I get error:
AxiosError: Network Error check that API address is correct
I try both:
http://192.168.0.19:3456/api/v1
and
http://127.0.0.1:3456/api/v1
but error is the same.
regards.

OK, I # environment: VIKUNJA_API_URL: http://ip:3456/api/v1
No there’s no error :slight_smile:
Thanks for help.
Regards.

1 Like

Hmm, now I cannot register account because error:
Request failed with status code 405

I change also port 3456 to 3333 but API still don’t work. I try in browser.
I see in Portainer that container is running but no IP and ports in that position.

Any help with that?
@kolaente
@Tiritibambix

If you’re using a reverse proxy (npm as you said), you need to also put your api behind it.

Not sure this is the proper way as I’m a noob, but it works for me:

ip:9000 → vikunja.yourdomain.com
ip:3456 → vijunjaapi.yourdomain.com
Use the ports of your liking.

Then

 environment:
      VIKUNJA_API_URL: https://vijunjaapi.yourdomain.com/api/v1

Can this API bo on subdomain in Nginx Proxy Manager? Like:
https://my-vikunja.dyndns.org/some-subdomain-name
and then in docker-compose.yml:
VIKUNJA_API_URL: https://my-vikunja.dyndns.org/some-subdomain-name/api/v1/?

Edit. OK I add also new domain on duckdns but API still don’t work.
I think I will give up with Vikunja and try something else.
Regards

1 Like

The api should work on a subdomain. The frontend won’t though.

I’ve tried what @Tiritibambix indicated above, but I’m still not able to access the frontend on the new port.

  frontend:
    image: vikunja/frontend
    ports:
      - 2501:80
    environment:
      VIKUNJA_API_URL: http:debian:3456/api/v1
      start: unless-stopped

Do I need to update anything on the nginx.conf file?

I believe there is a typo : http://

1 Like

That fixed it, thank you!

I install one more time on new device on default port 80 and now work. But I try in Firefox. When I open in Brave or Google Chrome I still have that error. I clear cookies, cache.

Does it work in an incognito tab?

No, I have similar problem with Tipi. I remove it and install again. In chrome and brave it shows registration screen and cannot register because error but on firefox I login and everything works fine :confused:

Can you check if you can reach the api at https://my-vikunja.dyndns.org/some-subdomain-name/api/v1/info in every browser?

I already remove Vikunja because I noticed there’s no Android app.
I can test it in local IP address without https://domain. OK? It’s possible?

There is an app: GitHub - go-vikunja/app

That should work.