-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
122 lines (118 loc) · 3.91 KB
/
docker-compose.yaml
File metadata and controls
122 lines (118 loc) · 3.91 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
# DataJoint Documentation Environment
#
# MODE="LIVE" docker compose up --build # Live dev server at http://localhost:8000/
# MODE="BUILD" docker compose up --build # Build static site
# MODE="EXECUTE" docker compose up --build # Execute notebooks against MySQL
# MODE="EXECUTE_PG" docker compose up --build # Execute notebooks against PostgreSQL
#
services:
mysql:
image: mysql:8.0
environment:
MYSQL_ROOT_PASSWORD: tutorial
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-ptutorial"]
interval: 5s
timeout: 5s
retries: 10
postgres:
image: postgres:15
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: tutorial
POSTGRES_DB: datajoint
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 10
minio:
image: minio/minio:latest
environment:
MINIO_ROOT_USER: datajoint
MINIO_ROOT_PASSWORD: datajoint
ports:
- "9002:9000"
- "9003:9001"
volumes:
- minio_data:/data
command: server /data --console-address ":9001"
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 5s
timeout: 5s
retries: 5
docs:
build:
context: .
dockerfile: Dockerfile
environment:
- MODE
- DJ_HOST=${DJ_HOST:-mysql}
- DJ_USER=${DJ_USER:-root}
- DJ_PASS=${DJ_PASS:-tutorial}
- DJ_BACKEND=${DJ_BACKEND:-mysql}
volumes:
- .:/main
- ${DJ_PYTHON_PATH:-../datajoint-python}:/datajoint-python
ports:
- 8000:8000
depends_on:
mysql:
condition: service_healthy
postgres:
condition: service_healthy
minio:
condition: service_healthy
command:
- sh
- -c
- |
set -e
if echo "$${MODE}" | grep -i live &>/dev/null; then
# LIVE mode: install datajoint and notebook dependencies for interactive development
pip install -e /datajoint-python
pip install scikit-image pooch
mkdocs serve --config-file ./mkdocs.yaml -a 0.0.0.0:8000
elif echo "$${MODE}" | grep -i build &>/dev/null; then
# BUILD mode: build static site from pre-executed notebooks
# Install datajoint-python for mkdocstrings (needs to import for API docs)
pip install -e /datajoint-python
# Generate llms-full.txt with current git info
python scripts/gen_llms_full.py
mkdocs build --config-file ./mkdocs.yaml
elif echo "$${MODE}" | grep -i execute_pg &>/dev/null; then
# EXECUTE_PG mode: execute notebooks against PostgreSQL
pip install -e "/datajoint-python[postgres]"
pip install scikit-image pooch nbconvert matplotlib faker zarr
mkdir -p /tmp/datajoint-tutorials
echo "Executing notebooks against PostgreSQL..."
export DJ_HOST=postgres
python scripts/execute_notebooks.py --backend postgresql
elif echo "$${MODE}" | grep -i execute &>/dev/null; then
# EXECUTE mode: execute notebooks against MySQL (default)
pip install -e /datajoint-python
pip install scikit-image pooch nbconvert matplotlib faker zarr
mkdir -p /tmp/datajoint-tutorials
echo "Executing notebooks against MySQL..."
python scripts/execute_notebooks.py --backend mysql
else
echo "Unexpected mode. Use: LIVE, BUILD, EXECUTE, or EXECUTE_PG"
exit 1
fi
volumes:
mysql_data:
# Persistent storage for tutorial databases
# Use `docker compose down -v` to reset
postgres_data:
# Persistent storage for PostgreSQL databases
minio_data:
# Persistent storage for external objects