Merge pull request #5921 from gsiv/dev/yml-image-override

Docker: Allow overriding image names from .env
This commit is contained in:
Finn Stutzenstein 2021-04-26 10:16:02 +02:00 committed by GitHub
commit ee8702aff1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 32 deletions

View File

@ -17,13 +17,13 @@ DEFAULT_DOCKER_REGISTRY=
# Docker Images # Docker Images
# ------------- # -------------
DOCKER_OPENSLIDES_PROXY_NAME= DOCKER_OPENSLIDES_PROXY_REGISTRY=
DOCKER_OPENSLIDES_PROXY_TAG= DOCKER_OPENSLIDES_PROXY_TAG=
DOCKER_OPENSLIDES_BACKEND_NAME= DOCKER_OPENSLIDES_BACKEND_REGISTRY=
DOCKER_OPENSLIDES_BACKEND_TAG= DOCKER_OPENSLIDES_BACKEND_TAG=
DOCKER_OPENSLIDES_FRONTEND_NAME= DOCKER_OPENSLIDES_FRONTEND_REGISTRY=
DOCKER_OPENSLIDES_FRONTEND_TAG= DOCKER_OPENSLIDES_FRONTEND_TAG=
DOCKER_OPENSLIDES_AUTOUPDATE_NAME= DOCKER_OPENSLIDES_AUTOUPDATE_REGISTRY=
DOCKER_OPENSLIDES_AUTOUPDATE_TAG= DOCKER_OPENSLIDES_AUTOUPDATE_TAG=
# Database # Database

View File

@ -13,22 +13,25 @@ define(`read_env', `esyscmd(`printf "\`%s'" "$$1"')')
dnl return env variable if set; otherwise, return given alternative value dnl return env variable if set; otherwise, return given alternative value
define(`ifenvelse', `ifelse(read_env(`$1'),, `$2', read_env(`$1'))') define(`ifenvelse', `ifelse(read_env(`$1'),, `$2', read_env(`$1'))')
define(`PROXY_IMAGE', define(`DEFAULT_DOCKER_REGISTRY', ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides))
ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/dnl
ifenvelse(`DOCKER_OPENSLIDES_PROXY_NAME', openslides-proxy):dnl dnl Parse image versions that can be configured through .env
ifenvelse(`DOCKER_OPENSLIDES_PROXY_TAG', latest))
define(`BACKEND_IMAGE', define(`BACKEND_IMAGE',
ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/dnl ifenvelse(`DOCKER_OPENSLIDES_BACKEND_REGISTRY', DEFAULT_DOCKER_REGISTRY)/dnl
ifenvelse(`DOCKER_OPENSLIDES_BACKEND_NAME', openslides-server):dnl openslides-server:dnl
ifenvelse(`DOCKER_OPENSLIDES_BACKEND_TAG', latest)) ifenvelse(`DOCKER_OPENSLIDES_BACKEND_TAG', latest))
define(`FRONTEND_IMAGE', define(`FRONTEND_IMAGE',
ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/dnl ifenvelse(`DOCKER_OPENSLIDES_FRONTEND_REGISTRY', DEFAULT_DOCKER_REGISTRY)/dnl
ifenvelse(`DOCKER_OPENSLIDES_FRONTEND_NAME', openslides-client):dnl openslides-client:dnl
ifenvelse(`DOCKER_OPENSLIDES_FRONTEND_TAG', latest)) ifenvelse(`DOCKER_OPENSLIDES_FRONTEND_TAG', latest))
define(`AUTOUPDATE_IMAGE', define(`AUTOUPDATE_IMAGE',
ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/dnl ifenvelse(`DOCKER_OPENSLIDES_AUTOUPDATE_REGISTRY', DEFAULT_DOCKER_REGISTRY)/dnl
ifenvelse(`DOCKER_OPENSLIDES_AUTOUPDATE_NAME', openslides-autoupdate):dnl openslides-autoupdate:dnl
ifenvelse(`DOCKER_OPENSLIDES_AUTOUPDATE_TAG', latest)) ifenvelse(`DOCKER_OPENSLIDES_AUTOUPDATE_TAG', latest))
define(`PROXY_IMAGE',
ifenvelse(`DOCKER_OPENSLIDES_PROXY_REGISTRY', DEFAULT_DOCKER_REGISTRY)/dnl
openslides-proxy:dnl
ifenvelse(`DOCKER_OPENSLIDES_PROXY_TAG', latest))
define(`PRIMARY_DB', `ifenvelse(`PGNODE_REPMGR_PRIMARY', pgnode1)') define(`PRIMARY_DB', `ifenvelse(`PGNODE_REPMGR_PRIMARY', pgnode1)')
@ -86,7 +89,7 @@ x-osserver-env: &default-osserver-env
SERVER_SETUP_PORT: ifenvelse(`SERVER_SETUP_PORT', 8000) SERVER_SETUP_PORT: ifenvelse(`SERVER_SETUP_PORT', 8000)
RESET_PASSWORD_VERBOSE_ERRORS: "ifenvelse(`RESET_PASSWORD_VERBOSE_ERRORS', False)" RESET_PASSWORD_VERBOSE_ERRORS: "ifenvelse(`RESET_PASSWORD_VERBOSE_ERRORS', False)"
x-pgnode: &default-pgnode x-pgnode: &default-pgnode
image: ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/openslides-repmgr:latest image: DEFAULT_DOCKER_REGISTRY/openslides-repmgr:latest
networks: networks:
- dbnet - dbnet
labels: labels:
@ -192,7 +195,7 @@ ifelse(read_env(`PGNODE_3_ENABLED'), 1, `'
pgbouncer: pgbouncer:
environment: environment:
- PG_NODE_LIST=pgnode1`'PGBOUNCER_NODELIST - PG_NODE_LIST=pgnode1`'PGBOUNCER_NODELIST
image: ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/openslides-pgbouncer:latest image: DEFAULT_DOCKER_REGISTRY/openslides-pgbouncer:latest
restart: always restart: always
networks: networks:
back: back:
@ -201,7 +204,7 @@ ifelse(read_env(`PGNODE_3_ENABLED'), 1, `'
- postgres - postgres
dbnet: dbnet:
postfix: postfix:
image: ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/openslides-postfix:latest image: DEFAULT_DOCKER_REGISTRY/openslides-postfix:latest
restart: always restart: always
environment: environment:
MYHOSTNAME: "ifenvelse(`POSTFIX_MYHOSTNAME', localhost)" MYHOSTNAME: "ifenvelse(`POSTFIX_MYHOSTNAME', localhost)"
@ -224,7 +227,7 @@ ifelse(read_env(`PGNODE_3_ENABLED'), 1, `'
ifelse(read_env(`REDIS_RO_SERVICE_REPLICAS'),,,deploy: ifelse(read_env(`REDIS_RO_SERVICE_REPLICAS'),,,deploy:
replicas: ifenvelse(`REDIS_RO_SERVICE_REPLICAS', 1)) replicas: ifenvelse(`REDIS_RO_SERVICE_REPLICAS', 1))
media: media:
image: ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/openslides-media:latest image: DEFAULT_DOCKER_REGISTRY/openslides-media:latest
environment: environment:
- CHECK_REQUEST_URL=server:8000/check-media/ - CHECK_REQUEST_URL=server:8000/check-media/
- CACHE_SIZE=ifenvelse(`CACHE_SIZE', 10) - CACHE_SIZE=ifenvelse(`CACHE_SIZE', 10)

View File

@ -13,22 +13,25 @@ define(`read_env', `esyscmd(`printf "\`%s'" "$$1"')')
dnl return env variable if set; otherwise, return given alternative value dnl return env variable if set; otherwise, return given alternative value
define(`ifenvelse', `ifelse(read_env(`$1'),, `$2', read_env(`$1'))') define(`ifenvelse', `ifelse(read_env(`$1'),, `$2', read_env(`$1'))')
define(`PROXY_IMAGE', define(`DEFAULT_DOCKER_REGISTRY', ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides))
ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/dnl
ifenvelse(`DOCKER_OPENSLIDES_PROXY_NAME', openslides-proxy):dnl dnl Parse image versions that can be configured through .env
ifenvelse(`DOCKER_OPENSLIDES_PROXY_TAG', latest))
define(`BACKEND_IMAGE', define(`BACKEND_IMAGE',
ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/dnl ifenvelse(`DOCKER_OPENSLIDES_BACKEND_REGISTRY', DEFAULT_DOCKER_REGISTRY)/dnl
ifenvelse(`DOCKER_OPENSLIDES_BACKEND_NAME', openslides-server):dnl openslides-server:dnl
ifenvelse(`DOCKER_OPENSLIDES_BACKEND_TAG', latest)) ifenvelse(`DOCKER_OPENSLIDES_BACKEND_TAG', latest))
define(`FRONTEND_IMAGE', define(`FRONTEND_IMAGE',
ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/dnl ifenvelse(`DOCKER_OPENSLIDES_FRONTEND_REGISTRY', DEFAULT_DOCKER_REGISTRY)/dnl
ifenvelse(`DOCKER_OPENSLIDES_FRONTEND_NAME', openslides-client):dnl openslides-client:dnl
ifenvelse(`DOCKER_OPENSLIDES_FRONTEND_TAG', latest)) ifenvelse(`DOCKER_OPENSLIDES_FRONTEND_TAG', latest))
define(`AUTOUPDATE_IMAGE', define(`AUTOUPDATE_IMAGE',
ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/dnl ifenvelse(`DOCKER_OPENSLIDES_AUTOUPDATE_REGISTRY', DEFAULT_DOCKER_REGISTRY)/dnl
ifenvelse(`DOCKER_OPENSLIDES_AUTOUPDATE_NAME', openslides-autoupdate):dnl openslides-autoupdate:dnl
ifenvelse(`DOCKER_OPENSLIDES_AUTOUPDATE_TAG', latest)) ifenvelse(`DOCKER_OPENSLIDES_AUTOUPDATE_TAG', latest))
define(`PROXY_IMAGE',
ifenvelse(`DOCKER_OPENSLIDES_PROXY_REGISTRY', DEFAULT_DOCKER_REGISTRY)/dnl
openslides-proxy:dnl
ifenvelse(`DOCKER_OPENSLIDES_PROXY_TAG', latest))
define(`PRIMARY_DB', `ifenvelse(`PGNODE_REPMGR_PRIMARY', pgnode1)') define(`PRIMARY_DB', `ifenvelse(`PGNODE_REPMGR_PRIMARY', pgnode1)')
@ -83,7 +86,7 @@ x-osserver-env: &default-osserver-env
REDIS_SLAVE_PORT: ifenvelse(`REDIS_SLAVE_PORT', 6379) REDIS_SLAVE_PORT: ifenvelse(`REDIS_SLAVE_PORT', 6379)
RESET_PASSWORD_VERBOSE_ERRORS: "ifenvelse(`RESET_PASSWORD_VERBOSE_ERRORS', False)" RESET_PASSWORD_VERBOSE_ERRORS: "ifenvelse(`RESET_PASSWORD_VERBOSE_ERRORS', False)"
x-pgnode: &default-pgnode x-pgnode: &default-pgnode
image: ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/openslides-repmgr:latest image: DEFAULT_DOCKER_REGISTRY/openslides-repmgr:latest
networks: networks:
- dbnet - dbnet
labels: labels:
@ -200,7 +203,7 @@ ifelse(read_env(`PGNODE_3_ENABLED'), 1, `'
pgbouncer: pgbouncer:
environment: environment:
- PG_NODE_LIST=pgnode1`'PGBOUNCER_NODELIST - PG_NODE_LIST=pgnode1`'PGBOUNCER_NODELIST
image: ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/openslides-pgbouncer:latest image: DEFAULT_DOCKER_REGISTRY/openslides-pgbouncer:latest
networks: networks:
back: back:
aliases: aliases:
@ -214,7 +217,7 @@ ifelse(read_env(`PGNODE_3_ENABLED'), 1, `'
placement: placement:
constraints: ifenvelse(`PGBOUNCER_PLACEMENT_CONSTR', [node.role == manager]) constraints: ifenvelse(`PGBOUNCER_PLACEMENT_CONSTR', [node.role == manager])
postfix: postfix:
image: ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/openslides-postfix:latest image: DEFAULT_DOCKER_REGISTRY/openslides-postfix:latest
environment: environment:
MYHOSTNAME: "ifenvelse(`POSTFIX_MYHOSTNAME', localhost)" MYHOSTNAME: "ifenvelse(`POSTFIX_MYHOSTNAME', localhost)"
RELAYHOST: "ifenvelse(`POSTFIX_RELAYHOST', localhost)" RELAYHOST: "ifenvelse(`POSTFIX_RELAYHOST', localhost)"
@ -247,7 +250,7 @@ ifelse(read_env(`PGNODE_3_ENABLED'), 1, `'
condition: on-failure condition: on-failure
delay: 5s delay: 5s
media: media:
image: ifenvelse(`DEFAULT_DOCKER_REGISTRY', openslides)/openslides-media:latest image: DEFAULT_DOCKER_REGISTRY/openslides-media:latest
environment: environment:
- CHECK_REQUEST_URL=server:8000/check-media/ - CHECK_REQUEST_URL=server:8000/check-media/
- CACHE_SIZE=ifenvelse(`CACHE_SIZE', 10) - CACHE_SIZE=ifenvelse(`CACHE_SIZE', 10)