-
Notifications
You must be signed in to change notification settings - Fork 22
/
docker-compose.yml
92 lines (86 loc) · 3.11 KB
/
docker-compose.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
version: "3.7"
services:
# Reverse proxy
traefik:
image: "traefik:v2.8"
command:
- "--api.insecure=true" # allows accessing a Traefik dashboard, disable in production
- "--providers.docker=true" # enables the Docker configuration discovery
- "--providers.docker.exposedbydefault=false" # do not expose Docker services by default
- "--entrypoints.web.address=:5000" # create an entrypoint called web, listening on :5000
- "--entrypoints.admin.address=:3333" # create an entrypoint called web, listening on :5000
ports:
- "5000:5000"
- "3333:3333"
- "8765:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
# Prisma sqlite migration utility
migrate:
build:
context: ./server/prisma
dockerfile: Dockerfile
volumes:
- sqlite:/database/
environment:
- DATABASE_URL=file:/database/db.sqlite
# Backend server for managing saved notes
backend:
build:
context: ./server
dockerfile: Dockerfile
volumes:
- sqlite:/database/
environment:
- DATABASE_URL=file:/database/db.sqlite
- FRONTEND_URL=http://localhost:5000
- CLEANUP_INTERVAL_SECONDS=600
- NODE_ENV=production
# Rate limit for uploading notes
- POST_LIMIT_WINDOW_SECONDS=86400
- POST_LIMIT=50
# Rate limit for downloading notes
- GET_LIMIT_WINDOW_SECONDS=60
- GET_LIMIT=20
depends_on:
migrate:
condition: service_completed_successfully
restart: unless-stopped
labels:
- "traefik.enable=true" # tell Traefik this is something we would like to expose
- "traefik.http.routers.backend.entrypoints=web" # what entrypoint should be used for the backend service.
- "traefik.http.routers.backend.rule=Host(`localhost`) && PathPrefix(`/api`) && (Method(`POST`) || Method(`DELETE`))" #
# Frontend for serving encrypted notes over HTML (SvelteKit)
frontend:
build:
context: ./webapp
dockerfile: Dockerfile
args:
- VITE_SERVER_INTERNAL=http://backend:8080
- VITE_BRANDING=Noteshare.space [preview]
environment:
- NODE_ENV=production
depends_on:
- backend
restart: unless-stopped
labels:
- "traefik.enable=true" # tell Traefik this is something we would like to expose
- "traefik.http.routers.frontend.entrypoints=web" # what entrypoint should be used for the frontend service.
- "traefik.http.routers.frontend.rule=Host(`localhost`)" #
# grafana dashboard
grafana:
image: grafana/grafana:9.1.0
restart: unless-stopped
volumes:
- ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
- grafana-data:/var/lib/grafana
- sqlite:/database/
environment:
- GF_INSTALL_PLUGINS=frser-sqlite-datasource
labels:
- "traefik.enable=true" # tell Traefik this is something we would like to expose
- "traefik.http.routers.grafana.entrypoints=admin" # what entrypoint should be used for the frontend service.
- "traefik.http.routers.grafana.rule=Host(`localhost`)" #
volumes:
sqlite:
grafana-data: