Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Nginx and Certbot with Traefik in Docker Compose #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions .docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ services:
LANGFUSE_SECRET_KEY: ${LF_SECRET_KEY}
ENFORCE_MODEL: ${ENFORCE_MODEL}
USER_REGISTRATION_ENABLED: ${USER_REGISTRATION_ENABLED}
ports:
- "8000:8000"
volumes:
- cli_creds:/app/.openapi_cli/
labels:
- "traefik.http.routers.ollama-x-app.rule=Host(`${DOMAIN_NAME}`)"
- "traefik.http.routers.ollama-x-app.entrypoints=websecure"
- "traefik.http.routers.ollama-x-app.tls=true"
- "traefik.http.services.ollama-x-app.loadbalancer.server.port=8000"
scheduler:
container_name: ollama-x-scheduler
image: ollama-x:latest
Expand All @@ -37,24 +40,26 @@ services:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
volumes:
- database:/data/db
nginx:
container_name: ollama-x-nginx
image: nginx:latest
traefik:
container_name: ollama-x-traefik
image: traefik:v2.5
ports:
- "80:80"
- "443:443"
volumes:
- letsencrypt:/etc/letsencrypt/
- ../nginx/template-variables.conf:/etc/nginx/templates/10-variables.conf.template:ro
- ../nginx/proxy.conf:/etc/nginx/nginx.conf
environment:
DOMAIN_NAME: ${DOMAIN_NAME}
certbot:
container_name: ollama-x-certbot
image: certbot/certbot
volumes:
- letsencrypt:/etc/letsencrypt/
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do letsencrypt renew; sleep 12h & wait $${!}; done;'"
- /var/run/docker.sock:/var/run/docker.sock
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entryPoint.scheme=https"
labels:
- "traefik.http.routers.ollama-x-app.rule=Host(`${DOMAIN_NAME}`)"
- "traefik.http.routers.ollama-x-app.entrypoints=websecure"
- "traefik.http.routers.ollama-x-app.tls=true"
- "traefik.http.services.ollama-x-app.loadbalancer.server.port=8000"

volumes:
letsencrypt:
Expand Down
37 changes: 21 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ services:
ANONYMOUS_ALLOWED: ${ANONYMOUS_ALLOWED}
ANONYMOUS_MODEL: ${ANONYMOUS_MODEL}
USER_REGISTRATION_ENABLED: ${USER_REGISTRATION_ENABLED}
ports:
- "8000:8000"
volumes:
- ~/.openapi_cli:/app/.openapi_cli/
labels:
- "traefik.http.routers.${PROJECT_NAME}-app.rule=Host(`${DOMAIN_NAME}`)"
- "traefik.http.routers.${PROJECT_NAME}-app.entrypoints=websecure"
- "traefik.http.routers.${PROJECT_NAME}-app.tls=true"
- "traefik.http.services.${PROJECT_NAME}-app.loadbalancer.server.port=8000"
scheduler:
container_name: ${PROJECT_NAME}-scheduler
image: ghcr.io/yurzs/ollama-x:latest
Expand All @@ -38,21 +41,23 @@ services:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
volumes:
- ./database:/data/db
nginx:
container_name: ${PROJECT_NAME}-nginx
image: nginx:latest
traefik:
container_name: ${PROJECT_NAME}-traefik
image: traefik:v2.5
ports:
- "80:80"
- "443:443"
volumes:
- /etc/letsencrypt:/etc/letsencrypt/
- ./nginx/template-variables.conf:/etc/nginx/templates/10-variables.conf.template:ro
- ./nginx/proxy.conf:/etc/nginx/conf.d/proxy.conf
environment:
DOMAIN_NAME: ${DOMAIN_NAME}
certbot:
container_name: ${PROJECT_NAME}-certbot
image: certbot/certbot
volumes:
- /etc/letsencrypt:/etc/letsencrypt/
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do letsencrypt renew; sleep 12h & wait $${!}; done;'"
- /var/run/docker.sock:/var/run/docker.sock
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entryPoint.scheme=https"
labels:
- "traefik.http.routers.${PROJECT_NAME}-app.rule=Host(`${DOMAIN_NAME}`)"
- "traefik.http.routers.${PROJECT_NAME}-app.entrypoints=websecure"
- "traefik.http.routers.${PROJECT_NAME}-app.tls=true"
- "traefik.http.services.${PROJECT_NAME}-app.loadbalancer.server.port=8000"
24 changes: 0 additions & 24 deletions nginx/proxy.conf

This file was deleted.

3 changes: 0 additions & 3 deletions nginx/template-variables.conf

This file was deleted.