From 79b862b734b9036658334ca30c2682bf44e2c2da Mon Sep 17 00:00:00 2001 From: "pin.jin@ga.gov.au" Date: Thu, 29 Jul 2021 02:02:24 +0000 Subject: [PATCH 1/3] enable docker-compose to mnt external config --- .env_ows_root | 10 +++++++--- .env_simple | 8 ++++++-- docker-compose.yaml | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.env_ows_root b/.env_ows_root index ab20aac9b..5fe0d56c7 100644 --- a/.env_ows_root +++ b/.env_ows_root @@ -6,7 +6,11 @@ DB_PORT=5432 DB_USERNAME=opendatacubeusername DB_PASSWORD=opendatacubepassword DB_DATABASE=opendatacube -OWS_CFG_FILE=./ows_refactored/dev_af_ows_root_cfg.py +OWS_CFG_FILE=ows_refactored/ows_root_cfg.py +# OWS_CFG_FOLDER config enables mounting an external CFG folder +OWS_CFG_FOLDER=~/dea-config/dev/services/wms/ows_refactored +# OWS_CFG_COUNTAINER_FOLDER defines the mount inside docker container +OWS_CFG_COUNTAINER_FOLDER=/env/config/ows_refactored AWS_NO_SIGN_REQUEST=yes AWS_S3_ENDPOINT= # If you want to use pydev for interactive debugging @@ -14,5 +18,5 @@ PYDEV_DEBUG= # Will not work with pydev FLASK_ENV=development prometheus_multiproc_dir=/tmp -PYTHONPATH=/code -DATACUBE_OWS_CFG=ows_refactored.dev_af_ows_root_cfg.ows_cfg +PYTHONPATH=/env/config +DATACUBE_OWS_CFG=ows_refactored.ows_root_cfg.ows_cfg \ No newline at end of file diff --git a/.env_simple b/.env_simple index afe9cf3d4..d0a38c23c 100644 --- a/.env_simple +++ b/.env_simple @@ -6,7 +6,11 @@ DB_PORT=5432 DB_USERNAME=opendatacubeusername DB_PASSWORD=opendatacubepassword DB_DATABASE=opendatacube -OWS_CFG_FILE=./integration_tests/cfg/ows_test_cfg.py +OWS_CFG_FILE=config/ows_test_cfg.py +# OWS_CFG_FOLDER config enables mounting an external CFG folder +OWS_CFG_FOLDER=./integration_tests/cfg +# OWS_CFG_COUNTAINER_FOLDER defines the mount inside docker container +OWS_CFG_COUNTAINER_FOLDER=/env/config AWS_NO_SIGN_REQUEST=yes AWS_S3_ENDPOINT= # If you want to use pydev for interactive debugging @@ -15,4 +19,4 @@ PYDEV_DEBUG= FLASK_ENV=development prometheus_multiproc_dir=/tmp PYTHONPATH=/env -DATACUBE_OWS_CFG=config.ows_cfg.ows_cfg +DATACUBE_OWS_CFG=config.ows_test_cfg.ows_cfg \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index e71513d13..953333efb 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -24,7 +24,7 @@ services: DB_PASSWORD: ${DB_PASSWORD} DB_DATABASE: ${DB_DATABASE} # Where the config file is (must match the volume mount) - WMS_CONFIG_PATH: /env/config/ows_cfg.py + WMS_CONFIG_PATH: /env/config/${OWS_CFG_FILE} # Path from the PYTHONPATH to the config object (default PYTHONPATH is /env) PYTHONPATH: ${PYTHONPATH} DATACUBE_OWS_CFG: ${DATACUBE_OWS_CFG} @@ -40,7 +40,7 @@ services: ports: - "8000:8000" volumes: - - ${OWS_CFG_FILE}:/env/config/ows_cfg.py + - ${OWS_CFG_FOLDER}:${OWS_CFG_COUNTAINER_FOLDER} - ./docker/ows/wait-for-db:/usr/local/bin/wait-for-db - ./:/code/ - ./artifacts:/mnt/artifacts From 318de17c891e39c1f1e9cdf533dc852b3620c32f Mon Sep 17 00:00:00 2001 From: "pin.jin@ga.gov.au" Date: Thu, 29 Jul 2021 23:02:00 +0000 Subject: [PATCH 2/3] update doc and fix typo --- .env_ows_root | 6 +++--- .env_simple | 2 +- docker-compose.yaml | 4 ++-- docs/environment_variables.rst | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.env_ows_root b/.env_ows_root index 5fe0d56c7..9949914b0 100644 --- a/.env_ows_root +++ b/.env_ows_root @@ -6,11 +6,11 @@ DB_PORT=5432 DB_USERNAME=opendatacubeusername DB_PASSWORD=opendatacubepassword DB_DATABASE=opendatacube -OWS_CFG_FILE=ows_refactored/ows_root_cfg.py +OWS_CFG_FILE=/env/config/ows_refactored/ows_root_cfg.py # OWS_CFG_FOLDER config enables mounting an external CFG folder OWS_CFG_FOLDER=~/dea-config/dev/services/wms/ows_refactored -# OWS_CFG_COUNTAINER_FOLDER defines the mount inside docker container -OWS_CFG_COUNTAINER_FOLDER=/env/config/ows_refactored +# OWS_CFG_CONTAINER_FOLDER defines the mount inside docker container +OWS_CFG_CONTAINER_FOLDER=/env/config/ows_refactored AWS_NO_SIGN_REQUEST=yes AWS_S3_ENDPOINT= # If you want to use pydev for interactive debugging diff --git a/.env_simple b/.env_simple index d0a38c23c..43477ab0f 100644 --- a/.env_simple +++ b/.env_simple @@ -6,7 +6,7 @@ DB_PORT=5432 DB_USERNAME=opendatacubeusername DB_PASSWORD=opendatacubepassword DB_DATABASE=opendatacube -OWS_CFG_FILE=config/ows_test_cfg.py +OWS_CFG_FILE=/env/config/ows_test_cfg.py # OWS_CFG_FOLDER config enables mounting an external CFG folder OWS_CFG_FOLDER=./integration_tests/cfg # OWS_CFG_COUNTAINER_FOLDER defines the mount inside docker container diff --git a/docker-compose.yaml b/docker-compose.yaml index 953333efb..e1165926f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -24,7 +24,7 @@ services: DB_PASSWORD: ${DB_PASSWORD} DB_DATABASE: ${DB_DATABASE} # Where the config file is (must match the volume mount) - WMS_CONFIG_PATH: /env/config/${OWS_CFG_FILE} + WMS_CONFIG_PATH: ${OWS_CFG_FILE} # Path from the PYTHONPATH to the config object (default PYTHONPATH is /env) PYTHONPATH: ${PYTHONPATH} DATACUBE_OWS_CFG: ${DATACUBE_OWS_CFG} @@ -40,7 +40,7 @@ services: ports: - "8000:8000" volumes: - - ${OWS_CFG_FOLDER}:${OWS_CFG_COUNTAINER_FOLDER} + - ${OWS_CFG_FOLDER}:${OWS_CFG_CONTAINER_FOLDER} - ./docker/ows/wait-for-db:/usr/local/bin/wait-for-db - ./:/code/ - ./artifacts:/mnt/artifacts diff --git a/docs/environment_variables.rst b/docs/environment_variables.rst index 6cb0bbd81..aaf1ebd53 100644 --- a/docs/environment_variables.rst +++ b/docs/environment_variables.rst @@ -107,3 +107,18 @@ Docker and Docker-compose The provided ``Dockerfile`` and ``docker-compose.yaml`` read additional environment variables at build time. Please refer to the `README `_ for further details. + +environment variables exclusive for docker-compose +-------------------------------------------------- +OWS_CFG_FILE: + for multiple files ows config structure, the root level ows config file path inside docker container + for single file ows config structure, the ows config file path inside docker container + +OWS_CFG_FOLDER: + path to a folder containing ows config files anywhere on the local machine + +OWS_CFG_COUNTAINER_FOLDER: + path the OWS_CFG_FOLDER will mount to inside docker container + +PYTHONPATH: + PYTHONPATH to ows config file \ No newline at end of file From 8ae99e9a57ef7cda7a8d2ec8e95e986ee8bc9939 Mon Sep 17 00:00:00 2001 From: "pin.jin@ga.gov.au" Date: Thu, 29 Jul 2021 23:27:51 +0000 Subject: [PATCH 3/3] fix typo --- .env_ows_root | 4 ++-- .env_simple | 6 +++--- docker-compose.yaml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.env_ows_root b/.env_ows_root index 9949914b0..781944683 100644 --- a/.env_ows_root +++ b/.env_ows_root @@ -6,11 +6,11 @@ DB_PORT=5432 DB_USERNAME=opendatacubeusername DB_PASSWORD=opendatacubepassword DB_DATABASE=opendatacube -OWS_CFG_FILE=/env/config/ows_refactored/ows_root_cfg.py +OWS_CFG_FILE=ows_refactored/ows_root_cfg.py # OWS_CFG_FOLDER config enables mounting an external CFG folder OWS_CFG_FOLDER=~/dea-config/dev/services/wms/ows_refactored # OWS_CFG_CONTAINER_FOLDER defines the mount inside docker container -OWS_CFG_CONTAINER_FOLDER=/env/config/ows_refactored +OWS_CFG_COUNTAINER_FOLDER=/env/config/ows_refactored AWS_NO_SIGN_REQUEST=yes AWS_S3_ENDPOINT= # If you want to use pydev for interactive debugging diff --git a/.env_simple b/.env_simple index 43477ab0f..6aa3e1daa 100644 --- a/.env_simple +++ b/.env_simple @@ -6,11 +6,11 @@ DB_PORT=5432 DB_USERNAME=opendatacubeusername DB_PASSWORD=opendatacubepassword DB_DATABASE=opendatacube -OWS_CFG_FILE=/env/config/ows_test_cfg.py +OWS_CFG_FILE=config/ows_test_cfg.py # OWS_CFG_FOLDER config enables mounting an external CFG folder OWS_CFG_FOLDER=./integration_tests/cfg -# OWS_CFG_COUNTAINER_FOLDER defines the mount inside docker container -OWS_CFG_COUNTAINER_FOLDER=/env/config +# OWS_CFG_CONTAINER_FOLDER defines the mount inside docker container +OWS_CFG_CONTAINER_FOLDER=/env/config AWS_NO_SIGN_REQUEST=yes AWS_S3_ENDPOINT= # If you want to use pydev for interactive debugging diff --git a/docker-compose.yaml b/docker-compose.yaml index e1165926f..7379d5b7e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -24,7 +24,7 @@ services: DB_PASSWORD: ${DB_PASSWORD} DB_DATABASE: ${DB_DATABASE} # Where the config file is (must match the volume mount) - WMS_CONFIG_PATH: ${OWS_CFG_FILE} + WMS_CONFIG_PATH: /env/config/${OWS_CFG_FILE} # Path from the PYTHONPATH to the config object (default PYTHONPATH is /env) PYTHONPATH: ${PYTHONPATH} DATACUBE_OWS_CFG: ${DATACUBE_OWS_CFG}