-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
112 lines (112 loc) · 3.57 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
services:
load_balancer:
image: nginx:alpine
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./certs:/etc/ssl:ro
ports:
- "443:443"
- "80:80"
depends_on:
stela:
condition: service_healthy
web-app:
condition: service_started
web-app:
build:
context: ../
dockerfile: web-app/Dockerfile.local
command: npm run dev:docker
image: web-app
volumes:
- ../web-app/src:/usr/app/src:rw
back-end:
build:
context: ../
dockerfile: back-end/Dockerfile.dev
args:
# these args are available because of the .env file located next to the docker-compose.yml file
# which is automatically incorporated by docker
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_ACCESS_SECRET: ${AWS_ACCESS_SECRET}
AWS_REGION: ${AWS_REGION}
SQS_IDENT: ${SQS_IDENT}
UPLOAD_SERVICE_SENTRY_DSN: ${UPLOAD_SERVICE_SENTRY_DSN}
NOTIFICATION_DATABASE_URL: ${NOTIFICATION_DATABASE_URL}
NOTIFICATION_FIREBASE_CREDENTIALS: ${NOTIFICATION_FIREBASE_CREDENTIALS}
image: back-end
env_file:
# env file path is relative to docker-compose file
# Availability of env vars at build and during run requires separate configs.
- ./.env
volumes:
- ../back-end/api:/data/www/api
- ../back-end/library:/data/www/library
- ../back-end/daemon:/data/www/daemon
- ../log:/var/log/permanent
depends_on:
database:
condition: service_healthy
deploy:
resources:
limits:
cpus: "2.0"
reservations:
cpus: "1.0"
stela:
restart: always
build:
context: ../stela
dockerfile: packages/api/Dockerfile.dev
ports:
- "8080:8080"
env_file:
- ../stela/.env
volumes:
- ../stela/packages/api/src:/usr/local/apps/stela/packages/api/src
- ../stela/packages/logger/src:/usr/local/apps/stela/packages/logger/src
- ../stela/packages/archivematica_cleanup/src:/usr/local/apps/stela/packages/archivematica_cleanup/src
- ../stela/packages/account_space_updater/src:/usr/local/apps/stela/packages/account_space_updater/src
depends_on:
database:
condition: service_healthy
healthcheck:
test: curl http://localhost:8080/api/v2/health
cache:
image: memcached:1.5.6-alpine
ports:
- "11211:11211"
database:
image: postgres:14-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: permanent
healthcheck:
test: ["CMD-SHELL", "sh -c 'pg_isready -U postgres -d permanent'"]
interval: 10s
timeout: 3s
retries: 3
ports:
- "5432:5432"
database_setup:
image: postgres:14-alpine
volumes:
- ../stela/database/base.sql:/base.sql:ro
- ../back-end/library/db:/db:ro
entrypoint: ["/bin/sh", "-c"]
command:
- |
echo "SELECT 'CREATE DATABASE permanent' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'permanent')\gexec" | psql postgresql://postgres:permanent@database:5432
psql postgresql://postgres:permanent@database:5432/permanent -f /base.sql
apk add curl
curl -L -o /usr/local/bin/dbmate https://github.com/amacneil/dbmate/releases/download/v1.16.0/dbmate-linux-amd64
chmod +x /usr/local/bin/dbmate
(dbmate --url postgresql://postgres:permanent@database:5432/permanent?sslmode=disable up)
depends_on:
database:
condition: service_healthy
volumes:
ignore_module:
ignore_api:
ignore_logger: