Skip to content

Commit f449b4b

Browse files
author
Jennings Zhang
committed
ChRIS 2.1.0
- pfioh removed - migrations manually specified - separate celery worker for periodic tasks - pman entrypoint wrapper script to resolve STOREBASE from compose-managed volume is back because the feature was rejected upstream
1 parent 597560a commit f449b4b

File tree

4 files changed

+95
-33
lines changed

4 files changed

+95
-33
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ json=$(
6868
url=$(jq -r '.results[0].url' <<< "$json")
6969
dock_image=$(jq -r '.results[0].dock_image' <<< "$json")
7070
docker exec chris python plugins/services/manager.py register host --pluginurl "$url"
71-
docker pull $dock_image
7271
```
7372

7473
For more examples, see https://github.com/FNNDSC/miniChRIS/wiki/Add-Plugins
@@ -130,6 +129,7 @@ https://github.com/FNNDSC/pman/pull/142
130129

131130
`./minichris.sh` takes 50 seconds on an okay laptop (quad-core, 16 GB, SSD)
132131
and takes 2-3 minutes in [Github Actions' Ubuntu VMs](https://github.com/FNNDSC/miniChRIS/actions).
132+
It is strongly recommended that you use an SSD!
133133

134134
### Goals
135135

docker-compose.yml

Lines changed: 49 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ version: '3.7'
77
services:
88
chris:
99
container_name: chris
10-
image: fnndsc/chris:2.0.0-rc.1
10+
image: fnndsc/chris:2.1.0
1111
ports:
1212
- "127.0.0.1:8000:8000"
1313
depends_on:
@@ -17,11 +17,16 @@ services:
1717
networks:
1818
- local
1919
env_file: secrets.env
20+
environment:
21+
DJANGO_DB_MIGRATE: "on"
22+
DJANGO_COLLECTSTATIC: "on"
2023
worker:
21-
image: fnndsc/chris:2.0.0-rc.1
22-
entrypoint: ''
23-
command: celery -A core worker -c 4 -l info -Q main
24+
image: fnndsc/chris:2.1.0
25+
command: celery -A core worker -c 4 -l info -Q main1,main2
2426
env_file: secrets.env
27+
environment:
28+
DJANGO_DB_MIGRATE: "off"
29+
DJANGO_COLLECTSTATIC: "off"
2530
depends_on:
2631
- chris_db
2732
- swift
@@ -30,14 +35,28 @@ services:
3035
restart: on-failure
3136
networks:
3237
- local
38+
worker_periodic:
39+
image: fnndsc/chris:2.1.0
40+
environment:
41+
DJANGO_DB_MIGRATE: "off"
42+
DJANGO_COLLECTSTATIC: "off"
43+
command: celery -A core worker -c 2 -l info -Q periodic
44+
env_file: secrets.env
45+
depends_on:
46+
- chris_db
47+
- queue
48+
restart: on-failure
49+
networks:
50+
- local
3351
scheduler:
34-
image: fnndsc/chris:2.0.0-rc.1
35-
entrypoint: ''
52+
image: fnndsc/chris:2.1.0
3653
command: celery -A core beat -l info --pidfile /home/localuser/celerybeat.pid --scheduler django_celery_beat.schedulers:DatabaseScheduler
3754
env_file: secrets.env
55+
environment:
56+
DJANGO_DB_MIGRATE: "off"
57+
DJANGO_COLLECTSTATIC: "off"
3858
depends_on:
3959
- chris_db
40-
- swift
4160
- queue
4261
restart: on-failure
4362
networks:
@@ -46,6 +65,8 @@ services:
4665
image: mysql:5
4766
env_file: secrets.env
4867
restart: on-failure
68+
volumes:
69+
- chris_db_data:/var/lib/mysql
4970
networks:
5071
- local
5172
queue:
@@ -56,8 +77,9 @@ services:
5677

5778
chris_store:
5879
container_name: chris_store
59-
image: fnndsc/chris_store
80+
image: fnndsc/chris_store:1.1.0
6081
environment:
82+
- DJANGO_DB_MIGRATE=on
6183
- DJANGO_SETTINGS_MODULE=config.settings.production
6284
- DJANGO_ALLOWED_HOSTS=*
6385
- DJANGO_SECRET_KEY=secret
@@ -91,6 +113,8 @@ services:
91113
- MYSQL_DATABASE=chris_store
92114
- MYSQL_USER=chris
93115
- MYSQL_PASSWORD=Chris1234
116+
volumes:
117+
- chris_store_db_data:/var/lib/mysql
94118
networks:
95119
- local
96120
labels:
@@ -104,47 +128,40 @@ services:
104128
- SWIFT_KEY=testing
105129
ports:
106130
- "127.0.0.1:8080:8080"
131+
volumes:
132+
- swift_storage:/srv
107133
networks:
108134
- local
109135

110136
pfcon:
111137
container_name: pfcon
112-
image: fnndsc/pfcon:3.0.0.0-rc.1
138+
image: fnndsc/pfcon:3.2.0
113139
environment:
114140
COMPUTE_SERVICE_URL: http://pman:5010/api/v1/
115-
DATA_SERVICE_URL: http://pfioh:5055/api/v1/cmd
116141
SECRET_KEY: secret
117142
ports:
118143
- "127.0.0.1:5005:5005"
119144
depends_on:
120145
- pman
121-
- pfioh
146+
volumes:
147+
- remote:/home/localuser/storeBase
122148
networks:
123149
local:
124150
aliases:
125151
- pfcon.local
126152
remote:
127153

128-
pfioh:
129-
container_name: pfioh
130-
image: fnndsc/pfioh:3.0.2
131-
command: ["--forever", "--httpResponse", "--createDirsAsNeeded", "--storeBase", "/hostFS/storeBase"]
132-
volumes:
133-
- pfioh-remote:/hostFS/storeBase
134-
ports:
135-
- "127.0.0.1:5055:5055"
136-
networks:
137-
- remote
138-
139154
pman:
140-
image: fnndsc/pman:3.1.0-rc.1
155+
image: fnndsc/pman:3.0.0
141156
container_name: pman
142157
environment:
143-
PMAN_DOCKER_VOLUME: minichris-pfioh-remote
144158
CONTAINER_ENV: swarm
145159
SECRET_KEY: secret
160+
entrypoint: /entrypoint.sh
146161
volumes:
147162
- /var/run/docker.sock:/var/run/docker.sock
163+
- ./provision/volume_mapper.sh:/entrypoint.sh:ro
164+
userns_mode: "host"
148165
depends_on:
149166
- swarm-status
150167
ports:
@@ -172,8 +189,9 @@ services:
172189
volumes:
173190
- /var/run/docker.sock:/var/run/docker.sock
174191
- ./provision/swarm.sh:/entrypoint.sh
192+
userns_mode: "host"
175193
entrypoint: /entrypoint.sh
176-
194+
177195
# wait for CUBE to come online
178196
cube-starting:
179197
image: curlimages/curl:latest
@@ -195,18 +213,17 @@ services:
195213
volumes:
196214
- /var/run/docker.sock:/var/run/docker.sock
197215
- ./provision/setup.sh:/entrypoint.sh
216+
userns_mode: "host"
198217
entrypoint: /entrypoint.sh
199218

200-
# If we needed to pull containers which aren't used, we can do a no-op like this
201-
# But why, that doesn't make sense? Apparently tests fail w/o fnndsc/pfdcm
202-
#noop-pfdcm:
203-
# image: fnndsc/pfdcm
204-
# entrypoint: /bin/true
205219

206220
networks:
207221
local:
208222
remote:
209223

210224
volumes:
211-
pfioh-remote:
212-
name: minichris-pfioh-remote
225+
chris_db_data:
226+
chris_store_db_data:
227+
swift_storage:
228+
remote:
229+
name: minichris-remote-data

provision/setup.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@
55
# 3. register pl-dircopy
66

77
docker wait cube-starting
8+
res=$(docker inspect --format '{{ .State.ExitCode }}' cube-starting)
9+
if [ "$res" != "0" ]; then
10+
echo "Timed out waiting for ChRIS backend."
11+
exit 1
12+
fi
813

914
if [ -f .setup ]; then
1015
echo "Already set up"
16+
exit 1
1117
fi
1218

1319

provision/volume_mapper.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash -e
2+
#
3+
# STOREBASE environment variable is a workaround in pman.
4+
# It is supposed to be the mount point on the host of a
5+
# network filesystem so that some data can be visible to
6+
# all nodes in a docker swarm cluster.
7+
#
8+
# For a single machine ChRIS, we use a volume managed by
9+
# docker-compose. Its name is hard-coded.
10+
11+
py="
12+
import docker
13+
import os
14+
15+
d = docker.from_env()
16+
17+
v = d.volumes.get('minichris-remote-data')
18+
print(v.attrs['Mountpoint'])
19+
20+
image = d.containers.get('pman').image
21+
22+
print(' '.join(image.attrs['Config']['Entrypoint']))
23+
print(' '.join(image.attrs['Config']['Cmd']))
24+
"
25+
26+
data="$(python -c "$py")"
27+
mountpoint=$(sed -n 1p <<< "$data")
28+
entrypoint=$(sed -n 2p <<< "$data")
29+
cmd=$(sed -n 3p <<< "$data")
30+
31+
if [ "$#" -gt 0 ]; then
32+
cmd=$@
33+
fi
34+
35+
if [ -z "$STOREBASE" ]; then
36+
export STOREBASE=$mountpoint
37+
fi
38+
39+
exec $entrypoint $cmd

0 commit comments

Comments
 (0)