Skip to content

Commit

Permalink
Fix Docker image for debugging. (#1080)
Browse files Browse the repository at this point in the history
* Fix Docker image for debugging.

* Updates to GHAs.

* This gets things working locally...

* But I forgot to turn off the local-only thing...

* Oops.
  • Loading branch information
SpacemanPaul authored Oct 22, 2024
1 parent 11f6787 commit fc499cf
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .env_ows_root
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ DB_DATABASE=opendatacube
#################
# OWS CFG Config
#################
PYTHONPATH=/env/config
PYTHONPATH=/src/config
DATACUBE_OWS_CFG=ows_refactored.ows_root_cfg.ows_cfg

################
Expand All @@ -21,7 +21,7 @@ DATACUBE_OWS_CFG=ows_refactored.ows_root_cfg.ows_cfg
# OWS_CFG_DIR config enables mounting an external CFG folder
OWS_CFG_DIR=~/dea-config/dev/services/wms/ows_refactored
# OWS_CFG_MOUNT_DIR defines the mount inside docker container
OWS_CFG_MOUNT_DIR=/env/config/ows_refactored
OWS_CFG_MOUNT_DIR=/src/config/ows_refactored

################
# AWS S3 Config
Expand Down
4 changes: 2 additions & 2 deletions .env_simple
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ DB_DATABASE=opendatacube
# OWS CFG Config
#################
DATACUBE_OWS_CFG=config.ows_test_cfg.ows_cfg
PYTHONPATH=/env
PYTHONPATH=/src

################
# Docker Volume
################
# OWS_CFG_DIR config enables mounting an external CFG folder
OWS_CFG_DIR=./integration_tests/cfg
# OWS_CFG_MOUNT_DIR defines the mount inside docker container
OWS_CFG_MOUNT_DIR=/env/config
OWS_CFG_MOUNT_DIR=/src/config

################
# AWS S3 Config
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/complementary-config-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ jobs:
docker compose -f docker-compose.yaml -f docker-compose.cleandb.yaml up -d --wait
docker compose -f docker-compose.yaml -f docker-compose.cleandb.yaml exec -T ows_18 /bin/sh -c "datacube system init; datacube system check"
docker compose -f docker-compose.yaml -f docker-compose.cleandb.yaml exec -T ows_18 /bin/sh -c "curl https://raw.githubusercontent.com/GeoscienceAustralia/dea-config/master/dev/services/wms/inventory.json -o /tmp/inventory.json"
docker compose -f docker-compose.yaml -f docker-compose.db.yaml exec -T ows_18 /bin/sh -c "cd /code && ./compare-cfg.sh"
docker compose -f docker-compose.yaml -f docker-compose.db.yaml exec -T ows_18 /bin/sh -c "cd /src && ./compare-cfg.sh"
docker compose -f docker-compose.yaml -f docker-compose.cleandb.yaml down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Test and lint dev OWS image
run: |
mkdir artifacts
docker run -e LOCAL_UID=$(id -u $USER) -e LOCAL_GID=$(id -g $USER) -v ${PWD}/artifacts:/mnt/artifacts ${ORG}/${IMAGE}:_builder /bin/sh -c "cd /code && ./check-code.sh"
docker run -e LOCAL_UID=$(id -u $USER) -e LOCAL_GID=$(id -g $USER) -v ${PWD}/artifacts:/mnt/artifacts ${ORG}/${IMAGE}:_builder /bin/sh -c "cd /src && ./check-code.sh"
mv ./artifacts/coverage.xml ./artifacts/coverage-unit.xml
- name: Dockerized Integration Pytest
Expand All @@ -63,7 +63,7 @@ jobs:
export LOCAL_GID=$(id -g $USER)
export $(grep -v '^#' .env_simple | xargs)
docker compose -f docker-compose.yaml -f docker-compose.db.yaml up -d --wait --build
docker compose -f docker-compose.yaml -f docker-compose.db.yaml exec -T ows_18 /bin/sh -c "cd /code && ./check-code-all.sh"
docker compose -f docker-compose.yaml -f docker-compose.db.yaml exec -T ows_18 /bin/sh -c "cd /src && ./check-code-all.sh"
docker compose -f docker-compose.yaml -f docker-compose.db.yaml down
- name: Upload All coverage to Codecov
Expand Down
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@ RUN export DEBIAN_FRONTEND=noninteractive \
&& ([ "$ENVIRONMENT" = "deployment" ] || \
apt-get install -y --no-install-recommends \
proj-bin) \
&& apt-get upgrade -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /var/dpkg/* /var/tmp/* /var/log/dpkg.log

# Add login-script for UID/GID-remapping.
COPY --chown=root:root --link docker/files/remap-user.sh /usr/local/bin/remap-user.sh

# Copy source code and install it
WORKDIR /code
COPY . /code
WORKDIR /src
COPY . /src

## Only install pydev requirements if arg PYDEV_DEBUG is set to 'yes'
ARG PYDEV_DEBUG="no"
Expand All @@ -62,7 +63,7 @@ RUN EXTRAS=$([ "$ENVIRONMENT" = "deployment" ] || echo ",test") && \
python3 -m pip --disable-pip-version-check install --no-cache-dir .[dev] --break-system-packages) && \
python3 -m pip freeze && \
([ "$ENVIRONMENT" != "deployment" ] || \
(rm -rf /code/* /code/.git* && \
(rm -rf /src/* /src/.git* && \
apt-get purge -y \
git \
git-man \
Expand Down
2 changes: 1 addition & 1 deletion datacube_ows/startup_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def parse_config_file(log=None):


def initialise_flask(name):
app = Flask(name.split('.')[0])
app = Flask(name)
return app

def pass_through(undecorated):
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:
DB_USERNAME: ${DB_USERNAME}
DB_PASSWORD: ${DB_PASSWORD}
DB_DATABASE: ${DB_DATABASE}
# Path from the PYTHONPATH to the config object (default PYTHONPATH is /env)
# Path from the PYTHONPATH to the config object (default PYTHONPATH is /src)
PYTHONPATH: ${PYTHONPATH}
DATACUBE_OWS_CFG: ${DATACUBE_OWS_CFG}
AWS_DEFAULT_REGION: ${AWS_REGION}
Expand All @@ -33,13 +33,13 @@ services:
# Enable Metrics
prometheus_multiproc_dir: ${prometheus_multiproc_dir}
# Dev flags
FLASK_APP: /code/datacube_ows/ogc.py
FLASK_APP: /src/datacube_ows/ogc.py
FLASK_ENV: ${FLASK_ENV}
PYDEV_DEBUG: "${PYDEV_DEBUG}"
SENTRY_DSN: "${SENTRY_DSN}"
volumes:
- ${OWS_CFG_DIR}:${OWS_CFG_MOUNT_DIR}
- ./:/code/
- ./:/src/
- ./artifacts:/mnt/artifacts
restart: always
command: ["flask", "run", "--host=0.0.0.0", "--port=8000"]
2 changes: 1 addition & 1 deletion integration_tests/cfg/ows_test_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
trans_dir = "."
else:
cfgbase = "config."
trans_dir = "/code"
trans_dir = "/src"


# THIS IS A TESTING FILE
Expand Down
10 changes: 4 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This file is part of datacube-ows, part of the Open Data Cube project.
# See https://opendatacube.org for more information.
#
# Copyright (c) 2017-2023 OWS Contributors
# Copyright (c) 2017-2024 OWS Contributors
# SPDX-License-Identifier: Apache-2.0

from setuptools import find_packages, setup
Expand Down Expand Up @@ -49,11 +49,9 @@
]

dev_requirements = [
'pydevd-pycharm~=221.5921.27', # For Pycharm 2022.1.3
'pylint==3.2.3',
'pydevd-pycharm~=242.23339.19', # For Pycharm 2024.2.3
'pylint',
'sphinx_click',
'pre-commit==2.13.0',
'pipdeptree'
]

operational_requirements = [
Expand Down Expand Up @@ -115,7 +113,7 @@
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.8',
],
setup_requires=setup_requirements,
use_scm_version={
Expand Down

0 comments on commit fc499cf

Please sign in to comment.