Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
210 lines (198 loc) · 7.61 KB
/
Copy pathdocker-compose.yml
File metadata and controls
210 lines (198 loc) · 7.61 KB
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# Full stack: Postgres, MinIO for file storage, the API and the dashboard,
# behind a Caddy reverse proxy on port 80. Caddy serves plain HTTP only. For
# HTTPS, put your own TLS-terminating proxy in front of it. Each of these
# needs a DNS record that points at this server, set in .env:
# SITE_ADDRESS API (PUBLIC_API_URL is http://<SITE_ADDRESS>)
# WEB_SITE_ADDRESS dashboard (WEB_ORIGIN is http://<WEB_SITE_ADDRESS>)
# S3_SITE_ADDRESS MinIO API (browsers and the CLI download files from it)
# MINIO_ROOT_USER and MINIO_ROOT_PASSWORD are the MinIO credentials.
version: "3"
x-minio-env: &minio-env
MINIO_ROOT_USER: ${MINIO_ROOT_USER?'MINIO_ROOT_USER is required'}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD?'MINIO_ROOT_PASSWORD is required'}
services:
postgres:
image: postgres:17
restart: on-failure
environment:
POSTGRES_USER: medialit
POSTGRES_PASSWORD: medialit
POSTGRES_DB: medialit
# Reachable only from this machine. Do not publish it on all interfaces: the
# password is the default one.
ports:
- "127.0.0.1:5433:5432"
volumes:
- medialit-postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U medialit -d medialit"]
interval: 5s
timeout: 5s
retries: 12
minio:
image: cgr.dev/chainguard/minio:latest
restart: on-failure
command: server /data --console-address ":9001"
environment:
<<: *minio-env
volumes:
- medialit-minio-data:/data
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 5s
timeout: 5s
retries: 12
minio-init:
image: cgr.dev/chainguard/minio:latest
restart: "no"
depends_on:
minio:
condition: service_healthy
environment:
<<: *minio-env
entrypoint: /bin/sh
command:
- -ec
- |
mc alias set local http://minio:9000 "$$MINIO_ROOT_USER" "$$MINIO_ROOT_PASSWORD"
mc mb --ignore-existing local/medialit
mc mb --ignore-existing local/medialit-public
mc anonymous set download local/medialit-public
init:
image: codelit/medialit
restart: "no"
environment:
- DATABASE_URL=postgresql://medialit:medialit@postgres:5432/medialit
depends_on:
postgres:
condition: service_healthy
command: ["bun", "apps/api/src/db/migrate.ts"]
medialit:
image: codelit/medialit
restart: on-failure
environment: &medialit-env
# The API requires https:// URLs when this is production. The local trial
# in .env.example sets development so that it can use http://.
- NODE_ENV=${NODE_ENV:-production}
- EMAIL=${EMAIL?'Email is required to set up a user'}
# Optional key for EMAIL's default app, created at startup. See .env.example.
- MEDIALIT_BOOTSTRAP_API_KEY=${MEDIALIT_BOOTSTRAP_API_KEY:-}
- DATABASE_URL=postgresql://medialit:medialit@postgres:5432/medialit
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET?'BETTER_AUTH_SECRET is required'}
# MinIO. The endpoint is its public address because the API signs
# download URLs with it.
# In production, replace these MinIO settings with your AWS S3
# credentials and bucket names.
- CLOUD_ENDPOINT=http://${S3_SITE_ADDRESS?'S3_SITE_ADDRESS is required, for example s3.medialit.example.com'}
- CLOUD_ENDPOINT_PUBLIC=http://${S3_SITE_ADDRESS}
- CLOUD_REGION=us-east-1
- CLOUD_KEY=${MINIO_ROOT_USER}
- CLOUD_SECRET=${MINIO_ROOT_PASSWORD}
- CLOUD_BUCKET_NAME=medialit
- CLOUD_PUBLIC_BUCKET_NAME=medialit-public
- CDN_ENDPOINT=http://${S3_SITE_ADDRESS}/medialit-public
- PATH_PREFIX=${PATH_PREFIX?'Cloud prefix is required'}
- TEMP_FILE_DIR_FOR_UPLOADS=${TEMP_FILE_DIR_FOR_UPLOADS?'A temporary directory for uploads transformations is required'}
- PORT=8000
# Self-hosted MediaLit has no billing: every account is unlimited.
- MEDIALIT_DEPLOYMENT_MODE=${MEDIALIT_DEPLOYMENT_MODE:-oss}
# OAuth and sign-in redirects use these, so set them to the public URLs.
- PUBLIC_API_URL=${PUBLIC_API_URL?'Public API URL is required, for example http://medialit.example.com'}
- WEB_ORIGIN=${WEB_ORIGIN?'Web origin is required, for example http://app.medialit.example.com'}
# SMTP server that sends sign-in codes. Without EMAIL_HOST nobody can
# sign in to the dashboard.
- EMAIL_HOST=${EMAIL_HOST}
- EMAIL_PORT=${EMAIL_PORT}
- EMAIL_USER=${EMAIL_USER}
- EMAIL_PASS=${EMAIL_PASS}
- EMAIL_FROM=${EMAIL_FROM}
- ENABLE_TRUST_PROXY=${ENABLE_TRUST_PROXY}
- TRUST_PROXY=${TRUST_PROXY}
- CDN_MAX_AGE=${CDN_MAX_AGE}
# true lets webhooks reach private and internal addresses, for
# receivers on your own network. See the self-hosting docs.
- WEBHOOK_ALLOW_PRIVATE_NETWORKS=${WEBHOOK_ALLOW_PRIVATE_NETWORKS:-false}
expose:
- 8000
depends_on:
init:
condition: service_completed_successfully
minio-init:
condition: service_completed_successfully
# Runs background jobs: publishing sealed files, video posters and encodes,
# webhook deliveries and cleanup. Same image and settings as the API.
medialit-worker:
image: codelit/medialit
restart: on-failure
command: ["bun", "apps/api/src/worker.ts"]
environment: *medialit-env
# Lets running jobs finish before the worker stops.
stop_grace_period: 15s
depends_on:
init:
condition: service_completed_successfully
minio-init:
condition: service_completed_successfully
# Captions (optional): a worker for the transcribe job class, from the
# transcription image (the API image plus Whisper and its model, about 3
# GB). Start it with `docker compose --profile captions up -d`. It runs one
# transcription at a time and uses up to 2 CPU cores and about 2.5 GB of
# memory while it works.
medialit-transcribe:
image: codelit/medialit-transcribe
profiles: ["captions"]
restart: on-failure
environment: *medialit-env
stop_grace_period: 15s
depends_on:
init:
condition: service_completed_successfully
minio-init:
condition: service_completed_successfully
web:
image: codelit/medialit-web
restart: on-failure
environment:
- NODE_ENV=production
# The dashboard's server calls the API over the Compose network, and the
# browser calls it at its public URL.
- API_SERVER=http://medialit:8000
- PUBLIC_API_URL=${PUBLIC_API_URL?'Public API URL is required, for example http://medialit.example.com'}
- SITE_NAME=${SITE_NAME:-MediaLit}
expose:
- 3000
depends_on:
- medialit
# Catches the sign-in emails, which you can read at http://localhost:8025.
# In production, point EMAIL_HOST at a real SMTP server and remove this.
mailpit:
image: axllent/mailpit:latest
restart: on-failure
ports:
- "127.0.0.1:8025:8025"
proxy:
image: caddy
restart: on-failure
environment:
- SITE_ADDRESS=${SITE_ADDRESS}
- WEB_SITE_ADDRESS=${WEB_SITE_ADDRESS?'Web site address is required, for example app.medialit.example.com'}
- S3_SITE_ADDRESS=${S3_SITE_ADDRESS}
ports:
- "80:80"
volumes:
- "./Caddyfile:/etc/caddy/Caddyfile"
depends_on:
- medialit
- web
- minio
networks:
default:
# Lets the API reach its own public address and MinIO's without
# leaving the Docker network. The API verifies OAuth tokens by
# fetching its signing keys from its public URL.
aliases:
- ${SITE_ADDRESS}
- ${S3_SITE_ADDRESS}
volumes:
medialit-postgres-data:
medialit-minio-data: