Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With minichris-cube-dev.sh #18

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
.vagrant/
.idea/
/docker-compose-cube-dev.env
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ _miniChRIS_ does not replace `make.sh`. However, for most users
looking for how to run _ChRIS_ and have it "just work," _miniChRIS_
is right for you.

- _miniChRIS_ has 109 lines of shell code --- *ChRIS_ultron_backEnd* has 3,200
- _miniChRIS_ has 140 lines of shell code (103 lines in `test.sh`) --- *ChRIS_ultron_backEnd* has 3,200
- _miniChRIS_ does not create files on host outside of named docker volumes
- `make.sh` runs arbitrary `chmod 755` and `chmod -R 777` on the host filesystem.
- _miniChRIS_ is fully containerized.
Expand All @@ -232,3 +232,16 @@ is right for you.
`./minichris.sh` takes 30-60 seconds on a decent laptop (quad-core, 16 GB, SSD)
and takes 2-3 minutes in [Github Actions' Ubuntu VMs](https://github.com/FNNDSC/miniChRIS/actions).
It is strongly recommended that you use an SSD!


## For [ChRIS_ultron_backEnd](https://github.com/FNNDSC/ChRIS_ultron_backEnd) Development

We can use `minichris-cube-dev.sh` for [ChRIS_ultron_backEnd](https://github.com/FNNDSC/ChRIS_ultron_backEnd) development:

* Copy `docker-compose-cube-dev.env.tmpl` to `docker-compose-cube-dev.env` and setup your `ChRIS_ultron_backEnd` path.
* `./minichris-cube-dev.sh`
* We can use the same `unmake.sh` to shutdown the docker containers.

### _CAVEAT_ for mac or linux/arm64 users:
* Some docker images are not available yet. You need to compile the docker images on your own and tag the images as specified in `docker-compose-cube-dev.yml`.
* `oxidicom` seems not compilable in the aarch64 environment (because of [openjp2](https://crates.io/crates/openjp2)). Please comment out the `oxidicom` block in `docker-compose-cube-dev.yml`.
1 change: 1 addition & 0 deletions docker-compose-cube-dev.env.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CUBE_SRC=${CHRIS_ULTRON_BACKEND_DIR}
334 changes: 334 additions & 0 deletions docker-compose-cube-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,334 @@
# an ephemeral instance of ChRIS backend services for local development
#
# warning: /var/run/docker.sock is mounted into some services (notably pman)

services:
chrisomatic:
image: ghcr.io/fnndsc/chrisomatic:0.8.2
profiles:
- tools
volumes:
- "./chrisomatic.yml:/chrisomatic.yml:ro"
- "/var/run/docker.sock:/var/run/docker.sock:rw"
userns_mode: host
depends_on:
- chris
networks:
- local

db_migrate:
image: ghcr.io/fnndsc/cube:5.0.0
command:
- sh
- -c
- pip install -r /opt/ChRIS_ultron_backEnd/requirements/production.txt && python manage.py migrate --noinput
env_file: secrets.env
volumes:
- chris_files:/data:rw
- ${CUBE_SRC}/chris_backend:/opt/app-root/src
- ${CUBE_SRC}:/opt/ChRIS_ultron_backEnd
depends_on:
db:
condition: service_healthy
networks:
- local

chris:
container_name: chris
image: ghcr.io/fnndsc/cube:5.0.0
command:
- sh
- -c
- pip install -r /opt/ChRIS_ultron_backEnd/requirements/production.txt && gunicorn -b 0.0.0.0:8000 -w 4 config.wsgi:application
ports:
- "8000:8000"
volumes:
- chris_files:/data:rw
- ${CUBE_SRC}/chris_backend:/opt/app-root/src
- ${CUBE_SRC}:/opt/ChRIS_ultron_backEnd
depends_on:
db_migrate:
condition: service_completed_successfully
queue:
condition: service_started
networks:
- local
env_file: secrets.env
labels:
org.chrisproject.role: "ChRIS_ultron_backEnd"
org.chrisproject.miniChRIS: "miniChRIS"
worker:
image: ghcr.io/fnndsc/cube:5.0.0
command:
- sh
- -c
- pip install -r /opt/ChRIS_ultron_backEnd/requirements/production.txt && celery -A core worker -c 4 -l info -Q main1,main2
volumes:
- chris_files:/data:rw
- ${CUBE_SRC}/chris_backend:/opt/app-root/src
- ${CUBE_SRC}:/opt/ChRIS_ultron_backEnd
env_file: secrets.env
depends_on:
db_migrate:
condition: service_completed_successfully
queue:
condition: service_started
pfcon:
condition: service_started
restart: unless-stopped
networks:
- local
worker_periodic:
image: ghcr.io/fnndsc/cube:5.0.0
command:
- sh
- -c
- pip install -r /opt/ChRIS_ultron_backEnd/requirements/production.txt && celery -A core worker -c 2 -l info -Q periodic
volumes:
- chris_files:/data:rw
- ${CUBE_SRC}/chris_backend:/opt/app-root/src
- ${CUBE_SRC}:/opt/ChRIS_ultron_backEnd
env_file: secrets.env
depends_on:
db_migrate:
condition: service_completed_successfully
queue:
condition: service_started
restart: unless-stopped
networks:
- local
scheduler:
image: ghcr.io/fnndsc/cube:5.0.0
command:
- sh
- -c
- pip install -r /opt/ChRIS_ultron_backEnd/requirements/production.txt && celery -A core beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
volumes:
- chris_files:/data:rw
- ${CUBE_SRC}/chris_backend:/opt/app-root/src
- ${CUBE_SRC}:/opt/ChRIS_ultron_backEnd
env_file: secrets.env
depends_on:
db_migrate:
condition: service_completed_successfully
queue:
condition: service_started
restart: unless-stopped
networks:
- local
db:
image: docker.io/library/postgres:16
env_file: secrets.env
restart: unless-stopped
volumes:
- db_data:/var/lib/postgresql/data
networks:
- local
healthcheck:
test: ["CMD", "pg_isready"]
interval: 2s
timeout: 4s
retries: 3
start_period: 60s
queue:
image: docker.io/library/rabbitmq:3
restart: unless-stopped
networks:
- local

pfcon:
container_name: pfcon
image: ghcr.io/fnndsc/pfcon:5.2.2
environment:
COMPUTE_SERVICE_URL: http://pman:5010/api/v1/
SECRET_KEY: secret
PFCON_USER: pfcon
PFCON_PASSWORD: pfcon1234
PFCON_INNETWORK: "true"
STORAGE_ENV: filesystem
STOREBASE_MOUNT: /var/local/storeBase
ports:
- "5005:5005"
volumes:
- chris_files:/var/local/storeBase
networks:
local:
aliases:
- pfcon.host
remote:
labels:
org.chrisproject.role: "pfcon"
user: "1001"

pman:
image: ghcr.io/fnndsc/pman:6.0.1
container_name: pman
environment:
CONTAINER_ENV: docker
CONTAINER_USER: "1001:"
ENABLE_HOME_WORKAROUND: "yes"
JOB_LABELS: "org.chrisproject.miniChRIS=plugininstance"
SECRET_KEY: secret
REMOVE_JOBS: "yes"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw
depends_on:
- pfcon
ports:
- "5010:5010"
networks:
remote:
userns_mode: "host"
labels:
org.chrisproject.role: "pman"

chris_ui:
image: ghcr.io/fnndsc/chris_ui:20240410.445-c5ca2f65
command: sirv --host --single
environment:
REACT_APP_CHRIS_UI_URL: http://localhost:8000/api/v1/
REACT_APP_PFDCM_URL: http://localhost:4005/
ports:
- "8020:3000"

orthanc:
image: docker.io/jodogne/orthanc-plugins:1.12.3
volumes:
- ./orthanc.json:/etc/orthanc/orthanc.json:ro
- orthanc:/var/lib/orthanc/db
ports:
- "4242:4242"
- "8042:8042"
networks:
- pacs
profiles:
- pacs
- orthanc

pfdcm:
image: ghcr.io/fnndsc/pfdcm:3.1.22
container_name: pfdcm
environment:
MAX_WORKERS: 1
volumes:
- pfdcm:/home/dicom:rw
- ./pfdcm-services:/home/dicom/services:ro
- chris_files:/chris_files:rw
ports:
- "4005:4005"
networks:
- pacs
user: "1001"
profiles:
- pacs

oxidicom:
image: ghcr.io/fnndsc/oxidicom:v1.0.1
container_name: oxidicom
environment:
CHRIS_URL: http://chris:8000/api/v1/
CHRIS_USERNAME: chris
CHRIS_PASSWORD: chris1234
CHRIS_FILES_ROOT: /data
CHRIS_SCP_AET: ChRIS
CHRIS_PACS_ADDRESS: orthanc:4242
PORT: 11111
CHRIS_LISTENER_THREADS: 8
CHRIS_PUSHER_THREADS: 2
CHRIS_VERBOSE: "yes"
# OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector:4318"
# OTEL_RESOURCE_ATTRIBUTES: service.name=oxidicom-test
volumes:
- chris_files:/data:rw
ports:
- "11111:11111"
networks:
- pacs
- local
profiles:
- pacs
pfbridge:
image: docker.io/fnndsc/pfbridge:3.7.8
container_name: pfbridge
environment:
MAX_WORKERS: 1
PFLINK_USERNAME: pflink
PFLINK_PASSWORD: pflink1234
NAME: PFDCMLOCAL
PACSNAME: orthanc
CUBEANDSWIFTKEY: local
ports:
- "33333:33333"
networks:
local:
pflink:
profiles:
- pflink

pflink:
image: docker.io/fnndsc/pflink:4.0.6
container_name: pflink
restart: unless-stopped
environment:
PFDCM_NAME: "NOTPFDCMLOCAL" # work around for hard-coded edge case
PFLINK_MONGODB: "mongodb://pflink-db:27017"
PFLINK_PFDCM: "http://pfdcm:4005"
PFLINK_PORT: "4010"
ports:
- "4010:4010"
networks:
local:
pflink:
depends_on:
- pflink-db
profiles:
- pflink

pflink-db:
image: mongo
environment:
- PUID=1000
- PGID=1000
volumes:
- pflink-db-data:/data/db
restart: unless-stopped
networks:
pflink:
profiles:
- pflink

# Non-root container user workarounds

cube-nonroot-user-volume-fix:
image: docker.io/library/alpine:latest
volumes:
- chris_files:/data:rw
user: root
command: chmod g+rwx /data
restart: "no"

pfdcm-nonroot-user-volume-fix:
image: docker.io/library/alpine:latest
volumes:
- pfdcm:/home/dicom:rw
user: root
command: chown 1001 /home/dicom
restart: "no"

networks:
local:
name: minichris-local
remote:
pacs:
monitoring:
pflink:

volumes:
chris_files:
name: minichris-files
db_data:
orthanc:
pfdcm:
grafana_data:
openobserve_data:
pflink-db-data:
Loading