This repository has been archived by the owner on Aug 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
/
docker-compose.yml
138 lines (131 loc) · 3.78 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
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
version: "3"
# Common build configuration for Airflow
# Extension field, see https://docs.docker.com/compose/compose-file/compose-file-v3/#extension-fields
x-airflow-common: &airflow-common
profiles:
- catalog
restart: on-failure
depends_on:
- postgres
- s3
image: openverse_catalog
env_file:
- .env
- catalog/.env
build:
context: ./catalog/
args:
- REQUIREMENTS_FILE=requirements_dev.txt
- PROJECT_PY_VERSION=${PROJECT_PY_VERSION}
- PROJECT_AIRFLOW_VERSION=${PROJECT_AIRFLOW_VERSION}
volumes:
- ./catalog:/opt/airflow/catalog
- ipython:/home/airflow/.ipython
- pytest_cache:/home/airflow/.cache/pytest
services:
# Services only needed for local development
postgres:
profiles:
- catalog_dependencies
- catalog
build: docker/local_postgres
env_file:
- docker/local_postgres/.env
ports:
- "5434:5432"
volumes:
- postgres:/var/lib/postgresql/data
s3:
profiles:
- catalog_dependencies
- catalog
image: minio/minio:latest
ports:
- "5010:5000"
- "5011:5001"
env_file:
- .env
- docker/minio/.env
# 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:
profiles:
- catalog_dependencies
- catalog
image: minio/mc:latest
env_file:
- .env
- docker/minio/.env
depends_on:
- s3
volumes:
# Buckets for testing provider data imported from s3 are subdirectories under
# /tests/s3-data/
- ./catalog/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 scheduler
scheduler:
<<: *airflow-common
depends_on:
- postgres
- s3
command: scheduler
expose:
- "8793" # Used for fetching logs
environment:
# Upgrade the DB on startup
_AIRFLOW_DB_UPGRADE: "true"
_AIRFLOW_WWW_USER_CREATE: "true"
_AIRFLOW_WWW_USER_USERNAME: airflow
_AIRFLOW_WWW_USER_PASSWORD: airflow
_AIRFLOW_WWW_USER_FIRSTNAME: Air
_AIRFLOW_WWW_USER_LASTNAME: Flow
_AIRFLOW_WWW_USER_EMAIL: [email protected]
# Dev changes for the webserver container
webserver:
<<: *airflow-common
depends_on:
- postgres
- s3
- scheduler
command: webserver
ports:
- "${AIRFLOW_PORT}:8080"
volumes:
postgres:
minio:
ipython:
pytest_cache: