Skip to content

Commit

Permalink
Introduce a simple volume init helper container to create and instant…
Browse files Browse the repository at this point in the history
…iate all

the necessary volumes and force it to complete before launching any of the
actual service containers so that they are guaranteed to have the required
state/X subdirs available for bind mount.
Sync configurable SMTP port to development_gdp setup.
  • Loading branch information
jonasbardino committed Mar 27, 2024
1 parent db13102 commit da209f8
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 4 deletions.
43 changes: 42 additions & 1 deletion docker-compose_development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,43 @@ services:
TZ: ${TZ}
NETWORK: ${DOCKER_NETWORK:-docker-migrid_default}

# NOTE: we use a shared volume init helper container to make sure volumes
# are fully created and instantiated before we try to bind mount
# subdirs from e.g. the state volume in the service containers.
migrid-volume-init:
container_name: migrid-volume-init
image: ucphhpc/migrid${CONTAINER_TAG}
extends:
file: docker-compose_shared.yml
service: migrid-shared
environment:
TZ: ${TZ}
# RUN_SERVICES specifies which daemons to launch
# Available target service names follow migrid init script and are:
# httpd script monitor sshmux events cron transfers
# openid sftp sftpsubsys webdavs ftps notify imnotify vmproxy
RUN_SERVICES:
volumes:
- type: volume
source: httpd
target: /etc/httpd
- type: volume
source: mig
target: /home/mig/mig
- type: volume
source: certs
target: /etc/httpd/MiG-certificates
- type: volume
source: migrid-syslog
target: /var/log
- type: volume
source: state
target: /home/mig/state
env_file:
- migrid-httpd.env
# NOTE: public hosts should create users through sign up and run like this
command: /app/docker-entry.sh -V

# The migrid core services including httpd and tightly integrated services
# like job handling (grid script, monitor, sshmux, imnoty and vmproxy)

Expand All @@ -53,7 +90,11 @@ services:
# openid sftp sftpsubsys webdavs ftps notify imnotify vmproxy
RUN_SERVICES: httpd script monitor sshmux events cron transfers imnotify vmproxy notify crond rsyslogd
depends_on:
- devdns
devdns:
condition: service_started
# IMPORTANT: finish volume init before migrid launch as explained above
migrid-volume-init:
condition: service_completed_successfully
networks:
default:
aliases:
Expand Down
45 changes: 43 additions & 2 deletions docker-compose_development_gdp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
depends_on:
- devdns
ports:
- "127.0.0.1:25:25"
- "127.0.0.1:${SMTP_LISTEN_PORT}:25"
environment:
POSTFIX_myhostname: ${SMTP_SERVER}
networks:
Expand All @@ -27,6 +27,43 @@ services:
TZ: ${TZ}
NETWORK: ${DOCKER_NETWORK:-docker-migrid_default}

# NOTE: we use a shared volume init helper container to make sure volumes
# are fully created and instantiated before we try to bind mount
# subdirs from e.g. the state volume in the service containers.
migrid-volume-init:
container_name: migrid-volume-init
image: ucphhpc/migrid${CONTAINER_TAG}
extends:
file: docker-compose_shared.yml
service: migrid-shared
environment:
TZ: ${TZ}
# RUN_SERVICES specifies which daemons to launch
# Available target service names follow migrid init script and are:
# httpd script monitor sshmux events cron transfers
# openid sftp sftpsubsys webdavs ftps notify imnotify vmproxy
RUN_SERVICES:
volumes:
- type: volume
source: httpd
target: /etc/httpd
- type: volume
source: mig
target: /home/mig/mig
- type: volume
source: certs
target: /etc/httpd/MiG-certificates
- type: volume
source: migrid-syslog
target: /var/log
- type: volume
source: state
target: /home/mig/state
env_file:
- migrid-httpd.env
# NOTE: public hosts should create users through sign up and run like this
command: /app/docker-entry.sh -V

# The migrid core services including httpd and tightly integrated services
# like job handling (grid script, monitor, sshmux, imnoty and vmproxy)

Expand All @@ -53,7 +90,11 @@ services:
# openid sftp sftpsubsys webdavs ftps notify imnotify vmproxy
RUN_SERVICES: httpd script monitor sshmux events cron transfers imnotify vmproxy notify crond rsyslogd
depends_on:
- devdns
devdns:
condition: service_started
# IMPORTANT: finish volume init before migrid launch as explained above
migrid-volume-init:
condition: service_completed_successfully
networks:
default:
aliases:
Expand Down
41 changes: 41 additions & 0 deletions docker-compose_production_bind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,43 @@ services:
# environment:
# TZ: ${TZ}

# NOTE: we use a shared volume init helper container to make sure volumes
# are fully created and instantiated before we try to bind mount
# subdirs from e.g. the state volume in the service containers.
migrid-volume-init:
container_name: migrid-volume-init
image: ucphhpc/migrid${CONTAINER_TAG}
extends:
file: docker-compose_shared.yml
service: migrid-shared
environment:
TZ: ${TZ}
# RUN_SERVICES specifies which daemons to launch
# Available target service names follow migrid init script and are:
# httpd script monitor sshmux events cron transfers
# openid sftp sftpsubsys webdavs ftps notify imnotify vmproxy
RUN_SERVICES:
volumes:
- type: volume
source: httpd
target: /etc/httpd
- type: volume
source: mig
target: /home/mig/mig
- type: volume
source: certs
target: /etc/httpd/MiG-certificates
- type: volume
source: migrid-syslog
target: /var/log
- type: volume
source: state
target: /home/mig/state
env_file:
- migrid-httpd.env
# NOTE: public hosts should create users through sign up and run like this
command: /app/docker-entry.sh -V

# The migrid core services including httpd and tightly integrated services
# like job handling (grid script, monitor, sshmux, imnoty and vmproxy)

Expand All @@ -39,6 +76,10 @@ services:
# httpd script monitor sshmux events cron transfers
# openid sftp sftpsubsys webdavs ftps notify imnotify vmproxy
RUN_SERVICES: httpd script monitor sshmux events cron transfers imnotify vmproxy notify crond rsyslogd
depends_on:
# IMPORTANT: finish volume init before migrid launch as explained above
migrid-volume-init:
condition: service_completed_successfully
volumes:
- type: volume
source: httpd
Expand Down
6 changes: 5 additions & 1 deletion docker-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ for svc in ${RUN_SERVICES}; do
done

# Keep monitoring any active services
KEEP_RUNNING=1
if [ -z "${CHK_SERVICES}" ]; then
KEEP_RUNNING=0
else
KEEP_RUNNING=1
fi
EXIT_CODE=0
# Check launched services
while [ ${KEEP_RUNNING} -eq 1 ]; do
Expand Down

0 comments on commit da209f8

Please sign in to comment.