forked from WordPress/openverse-catalog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.override.yml
101 lines (96 loc) · 3.06 KB
/
docker-compose.override.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
version: "3"
services:
# Services only needed for local development
postgres:
build: docker/local_postgres
environment:
- POSTGRES_USER=deploy
- POSTGRES_PASSWORD=deploy
- POSTGRES_DB=openledger
- PGUSER=deploy
- PGDATABASE=openledger
env_file: .env
ports:
- "5434:5432"
volumes:
- postgres:/var/lib/postgresql/data
s3:
image: minio/minio:latest
ports:
- "5010:5000"
- "5011:5001"
env_file:
- .env
environment:
MINIO_ROOT_USER: ${AWS_ACCESS_KEY}
MINIO_ROOT_PASSWORD: ${AWS_SECRET_KEY}
# Comma separated list of buckets to create on startup
BUCKETS_TO_CREATE: ${OPENVERSE_BUCKET},openverse-airflow-logs
# Create empty buckets on every container startup
# Note: $0 is included in the exec because "/bin/bash -c" swallows the first
# argument, so it must be re-added at the beginning of the exec call
entrypoint: >-
/bin/bash -c
"for b in $${BUCKETS_TO_CREATE//,/ }; do
echo \"Making bucket $$b\" && mkdir -p /data/$$b;
done &&
exec $$0 \"$$@\""
command: minio server /data --address :5000 --console-address :5001
volumes:
- minio:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5010/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
load_to_s3:
image: minio/mc:latest
env_file:
- .env
depends_on:
- s3
volumes:
# Buckets for testing provider data imported from s3 are subdirectories under
# /tests/s3-data/
- ./tests/s3-data:/data:rw
# Loop through subdirectories mounted to the volume and load them to s3/minio.
# This takes care of filesystem delays on some local dev environments that may make
# minio miss files included directly in the minio volume.
# More info here: https://stackoverflow.com/questions/72867045
# This does *not* allow for testing permissions issues that may come up in real AWS.
# And, if you remove files from /tests/s3-data, you will need to use `just down -v`
# and `just up` or `just recreate` to see the minio bucket without those files.
entrypoint: >
/bin/sh -c "
/usr/bin/mc config host add s3 http://s3:5000 ${AWS_ACCESS_KEY} ${AWS_SECRET_KEY};
cd /data;
for b in */ ; do
echo \"Loading bucket $$b\"
/usr/bin/mc mb --ignore-existing s3/$$b
/usr/bin/mc cp --r $$b s3/$$b
/usr/bin/mc ls s3/$$b;
done ;
exit 0;
"
# Dev changes for the webserver container
webserver:
depends_on:
- postgres
- s3
build:
context: .
args:
- REQUIREMENTS_FILE=requirements_dev.txt
- PROJECT_PY_VERSION=${PROJECT_PY_VERSION}
- PROJECT_AIRFLOW_VERSION=${PROJECT_AIRFLOW_VERSION}
dockerfile: docker/airflow/Dockerfile
restart: on-failure
# This command ensures an admin account is created on startup
command: init
volumes:
- ./openverse_catalog:/usr/local/airflow/openverse_catalog
stdin_open: true
tty: true
volumes:
postgres:
minio: