forked from mathesar-foundation/mathesar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
144 lines (143 loc) · 4.31 KB
/
docker-compose.yml
File metadata and controls
144 lines (143 loc) · 4.31 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
version: "3.9"
services:
db:
profiles: ["dev", "prod", "test"]
image: postgres:13
container_name: mathesar_db
environment:
- POSTGRES_DB=${POSTGRES_DB-mathesar_django}
- POSTGRES_USER=${POSTGRES_USER-mathesar}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD-mathesar}
# db container is exposed to the other containers, and the host.
ports:
- "${POSTGRES_PORT-5432}:5432"
expose:
- "5432"
volumes:
- postgresql_data:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -d $${POSTGRES_DB-mathesar_django} -U $${POSTGRES_USER-mathesar}"]
interval: 5s
timeout: 1s
retries: 30
start_period: 5s
caddy-reverse-proxy:
profiles: ["prod"]
image: mathesar/mathesar-caddy:latest
environment:
- DOMAIN_NAME=${DOMAIN_NAME}
# caddy container is exposed to the other containers, and the host.
ports:
- "${HTTP_PORT-80}:80"
- "${HTTPS_PORT-443}:443"
volumes:
- media:/mathesar/media
- static:/mathesar/static
- caddy_data:/data
- caddy_config:/config
labels:
- "com.centurylinklabs.watchtower.enable=true"
base-service:
profiles: ["web-server"]
container_name: mathesar_service
image: mathesar/mathesar-prod:latest
environment:
- MODE=${MODE-PRODUCTION}
- DEBUG=${DEBUG-False}
- DJANGO_ALLOW_ASYNC_UNSAFE=true
- DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE-config.settings.production}
- ALLOWED_HOSTS=${ALLOWED_HOSTS-*}
- SECRET_KEY=${SECRET_KEY}
- DJANGO_DATABASE_KEY=${DJANGO_DATABASE_KEY-default}
- DJANGO_DATABASE_URL=${DJANGO_DATABASE_URL-postgres://mathesar:mathesar@mathesar_db:5432/mathesar_django}
- MATHESAR_DATABASES=${MATHESAR_DATABASES-(mathesar_tables|postgresql://mathesar:mathesar@mathesar_db:5432/mathesar)}
- DJANGO_SUPERUSER_PASSWORD=${DJANGO_SUPERUSER_PASSWORD}
command: ./run.sh
volumes:
- static:/code/static
- media:/code/media
labels:
- "com.centurylinklabs.watchtower.enable=true"
service:
profiles: ["prod"]
extends: base-service
image: mathesar/mathesar-prod:latest
# Volumes are not shared when extending
volumes:
- static:/code/static
- media:/code/media
depends_on:
db:
condition: service_healthy
labels:
- "com.centurylinklabs.watchtower.enable=true"
healthcheck:
test: curl -f http://localhost:8000
interval: 10s
timeout: 5s
retries: 30
start_period: 5s
# On prod, the HTTP port is exposed to other containers, but not the host.
expose:
- "8000"
test-service:
profiles: ["test"]
extends: base-service
container_name: mathesar_service_test
image: mathesar/mathesar-test:latest
build:
context: .
dockerfile: Dockerfile
args:
PYTHON_REQUIREMENTS: requirements-dev.txt
depends_on:
- db
# On testing, the HTTP port is exposed to other containers, and the host.
ports:
- "8000:8000"
dev-service:
profiles: ["dev"]
container_name: mathesar_service_dev
image: mathesar/mathesar-dev:latest
build:
context: .
dockerfile: Dockerfile
args:
PYTHON_REQUIREMENTS: requirements-dev.txt
extends: base-service
environment:
- MODE=${MODE-DEVELOPMENT}
- DEBUG=${DEBUG-True}
- DJANGO_ALLOW_ASYNC_UNSAFE=true
- DJANGO_SUPERUSER_PASSWORD=password
- DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE-config.settings.development}
command: dockerize -wait tcp://mathesar_db:5432 -timeout 30s ./dev-run.sh
volumes:
- .:/code/
- ui_node_modules:/code/mathesar_ui/node_modules/
depends_on:
- db
# On dev, following ports are exposed to other containers, and the host.
ports:
- "8000:8000"
- "3000:3000"
- "6006:6006"
watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --http-api-update --label-enable --debug
environment:
- WATCHTOWER_HTTP_API_TOKEN=mytoken
labels:
- "com.centurylinklabs.watchtower.enable=false"
# Watchtower HTTP API is exposed to other containers, but not the host.
expose:
- "8080"
volumes:
postgresql_data:
ui_node_modules:
media:
static:
caddy_data:
caddy_config: