-
Notifications
You must be signed in to change notification settings - Fork 6
/
compose.prod.yml
135 lines (129 loc) · 4.4 KB
/
compose.prod.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
version: '3.8'
services:
web:
build:
context: .
dockerfile: Dockerfile.prod
restart: always
expose:
- "80"
depends_on:
- mongo
- redis
labels:
- traefik.enable=true
- traefik.http.routers.llms-ctf.rule=Host(`${HOSTNAME}`)
- traefik.http.routers.llms-ctf.tls=true
- traefik.http.routers.llms-ctf.tls.certresolver=letsencrypt
# https-redirect middleware to redirect HTTP to HTTPS
- traefik.http.middlewares.https-redirect.redirectscheme.scheme=https
- traefik.http.middlewares.https-redirect.redirectscheme.permanent=true
# Middleware to redirect HTTP to HTTPS
- traefik.http.routers.llms-ctf.middlewares=https-redirect
environment:
HOSTNAME: ${HOSTNAME}
DATABASE_URL: mongo:27017/${MONGO_INITDB_DATABASE}?retryWrites=true&w=majority&authSource=admin
MONGODB_ROOT_USERNAME: ${MONGO_ROOT_USER}
REDIS_HOST: redis
REDIS_PORT: 6379
CHAT_MODELS: ${CHAT_MODELS}
GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID}
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
OPENAI_ORGANIZATION: ${OPENAI_ORGANIZATION}
FORWARDED_ALLOW_IPS: "*"
USE_EMAILS_ALLOWLIST: ${USE_EMAILS_ALLOWLIST}
ALLOWED_EMAILS: ${ALLOWED_EMAILS}
COMP_PHASE: ${COMP_PHASE}
LEADERBOARD_CACHE_EXPIRATION: 60
secrets:
- secret_key
- openai_api_key
- together_api_key
- github_client_secret
- google_client_secret
- mongodb_root_password
- redis_password
mongo:
image: mongo:7.0.2-jammy
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_ROOT_USER}
MONGO_INITDB_ROOT_PASSWORD_FILE: /run/secrets/mongodb_root_password
MONGO_INITDB_DATABASE: ${MONGO_INITDB_DATABASE}
volumes:
- .volumes/prod/mongo:/data/db
secrets:
- mongodb_root_password
mongo-express:
image: mongo-express:1.0.0-20
restart: always
depends_on:
- mongo
ports:
- "8082:8081"
environment:
ME_CONFIG_MONGODB_SERVER: mongo
ME_CONFIG_MONGODB_PORT: 27017
ME_CONFIG_MONGODB_ENABLE_ADMIN: true
ME_CONFIG_MONGODB_AUTH_DATABASE: admin
ME_CONFIG_MONGODB_AUTH_USERNAME: ${MONGO_ROOT_USER}
ME_CONFIG_MONGODB_AUTH_PASSWORD_FILE: /run/secrets/mongodb_root_password
ME_CONFIG_BASICAUTH_USERNAME: ${MONGOEXPRESS_LOGIN}
ME_CONFIG_BASICAUTH_PASSWORD_FILE: /run/secrets/mongo_express_admin_password
secrets:
- mongodb_root_password
- mongo_express_admin_password
redis:
image: redis/redis-stack-server:7.2.0-v4
restart: always
volumes:
- .volumes/prod/redis:/data
command: >
bash -c 'redis-server --requirepass "$$(cat /run/secrets/redis_password)"'
secrets:
- redis_password
traefik:
restart: always
build:
context: .
dockerfile: Dockerfile.traefik
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./traefik-public-certificates:/certificates"
labels:
- traefik.enable=true
- traefik.http.routers.dashboard.rule=Host(`traefik.${HOSTNAME}`) && PathPrefix(`/api`, `/dashboard`)
- traefik.http.routers.dashboard.tls.certresolver=letsencrypt
- traefik.http.routers.dashboard.tls=true
- traefik.http.routers.dashboard.service=api@internal
- traefik.http.routers.dashboard.middlewares=auth
- traefik.http.middlewares.auth.basicauth.usersfile=/run/secrets/traefik_usersfile
# https-redirect middleware to redirect HTTP to HTTPS
- traefik.http.middlewares.https-redirect.redirectscheme.scheme=https
- traefik.http.middlewares.https-redirect.redirectscheme.permanent=true
# traefik-http set up only to use the middleware to redirect to https
- traefik.http.routers.dashboard.middlewares=https-redirect
secrets:
- traefik_usersfile
secrets:
secret_key:
file: .secrets/prod/secret_key
mongodb_root_password:
file: .secrets/prod/mongodb_root_password
mongo_express_admin_password:
file: .secrets/prod/mongo_express_admin_password
redis_password:
file: .secrets/prod/redis_password
openai_api_key:
file: .secrets/openai_api_key
together_api_key:
file: .secrets/together_api_key
traefik_usersfile:
file: .secrets/prod/traefik_usersfile
github_client_secret:
file: .secrets/prod/github_client_secret
google_client_secret:
file: .secrets/prod/google_client_secret