I am building my vikunya container step by step in my server, which already has other docker containers running and default ports like 80, are being used by other process. I am having some difficulty following the documentation when it comes to using custom ports for the proxy service. What should be the ports to configure on the yml and on the nginx.conf?
This is what I did:
First, I only the api service using the yml below, and it works great (it can be accessed from a desktop app)
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: supersecret
VIKUNJA_SERVICE_FRONTENDURL: http://192.168.40.200/ # this is the add of my localhost
ports:
- 3456:3456
volumes:
- ./files:/app/vikunja/files
depends_on:
- db
restart: unless-stopped
Second, I configured the frontend with a custom port in the host (8081). it is accessible from http://192.168.40.200:8081 in the sense that the welcome page loads, but I get an error “AxiosError: Network Error” which must be because the proxy server is not yet configured?
frontend:
image: vikunja/frontend
ports:
- 8081:80
environment:
VIKUNJA_API_URL: http:/192.168.40.200:3456/api/v1
restart: unless-stopped
So given this, what should be the ports for the proxy service in this container? and what would be the ports in the nginx.conf file?
So far I have in the yml:
proxy:
image: nginx
ports:
- 75:80 #<== custom port on host, keeping 80 on container
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- api
- frontend
restart: unless-stopped
and in the nginx.conf:
server {
listen 75; # <== custom port on host
server_name localhost;
location / {
proxy_pass http://frontend:75; #<== what port to use here, the host or the container?
}
location ~* ^/(api|dav|\.well-known)/ {
proxy_pass http://api:3456;
client_max_body_size 20M;
}
}