From 9fda1d5b2aafb9cba1f3a6422db0c4db4e64f909 Mon Sep 17 00:00:00 2001 From: MarkCalvert <37602611+MarkCalvert@users.noreply.github.com> Date: Thu, 23 Nov 2023 14:34:49 +1300 Subject: [PATCH 1/7] Initial commit of Project updates for DBCA which include: - ahoy commands for common docker and dev workflows - VSCode devcontainer and debugger configurations - A readme for developers on the DBCA project `README_DBCA.md - Updated Docker files and Docker compose for the DBCA project - DBCA specific requirements, startup scripts, env files and overrides --- .ahoy.yml | 152 ++++++++++++++++++ .devcontainer/devcontainer.json | 82 ++++++++++ .devcontainer/docker-compose.yml | 25 +++ .env.dbca | 87 ++++++++++ .vscode/launch.json | 40 +++++ README_DBCA.md | 60 +++++++ ckan/Dockerfile | 4 + ckan/Dockerfile.dev | 10 ++ ckan/Dockerfile.worker | 16 ++ ckan/docker-entrypoint.d/02_setup_dbca.sh | 24 +++ ckan/setup/dbca_requirements.sh | 44 +++++ .../dbca_start_ckan_development.sh.override | 104 ++++++++++++ ckan/supervisor/ckan_worker_default.conf | 42 +++++ docker-compose.dev.yml | 38 ++++- docker-compose.yml | 34 +++- postgresql/Dockerfile | 2 +- src/dbca_install_extensions.sh | 27 ++++ 17 files changed, 783 insertions(+), 8 deletions(-) create mode 100644 .ahoy.yml create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/docker-compose.yml create mode 100644 .env.dbca create mode 100644 .vscode/launch.json create mode 100644 README_DBCA.md create mode 100644 ckan/Dockerfile.worker create mode 100644 ckan/docker-entrypoint.d/02_setup_dbca.sh create mode 100644 ckan/setup/dbca_requirements.sh create mode 100644 ckan/setup/dbca_start_ckan_development.sh.override create mode 100644 ckan/supervisor/ckan_worker_default.conf create mode 100644 src/dbca_install_extensions.sh diff --git a/.ahoy.yml b/.ahoy.yml new file mode 100644 index 00000000..e94f57f5 --- /dev/null +++ b/.ahoy.yml @@ -0,0 +1,152 @@ +--- +ahoyapi: v2 + +entrypoint: + - bash + - "-c" + - "-e" + - | + [ -f .env ] && [ -s .env ] && export $(grep -v '^#' .env | xargs) && if [ -f .env.local ] && [ -s .env.local ]; then export $(grep -v '^#' .env.local | xargs); fi + bash -e -c "$0" "$@" + - "{{cmd}}" + - "{{name}}" + +commands: + init: + usage: Initialise the codebase on first-time setup (ahoy init) + cmd : | + echo "Creating project variables." + cp dbca.env .env + + echo "Install local development extensions." + sh src/dbca_install_extensions.sh + up: + usage: Build project. + cmd: | + docker compose -f $DOCKER_COMPOSE up -d "$@" + ahoy info; + + down: + usage: Delete project (CAUTION). + cmd: | + if [ "$1" == "y" ]; then + docker compose -f $DOCKER_COMPOSE down --volumes + else + ahoy confirm "Running this command will destroy your current site, database and build? Are you sure you didn't mean ahoy stop?" && + # Run this if confirm returns true + docker compose -f $DOCKER_COMPOSE down --volumes || + # Run this if confirm returns false + echo "OK, probably a wise choice..." + fi + + build: + usage: Build project. + cmd: | + if [ "$DOCKER_COMPOSE" = "docker-compose.dev.yml" ]; then + CKAN_CONTAINER_NAME=ckan-dev + WORKER_CONTAINER_NAME=ckan-dev-worker + fi + docker compose -f $DOCKER_COMPOSE build "$@" + + cli: + usage: Start a shell inside container. + cmd: | + if [ "$DOCKER_COMPOSE" = "docker-compose.dev.yml" ]; then + CKAN_CONTAINER_NAME=ckan-dev + fi + docker compose -f $DOCKER_COMPOSE exec ${1:-$CKAN_CONTAINER_NAME} sh + + run: + usage: Run command inside container. + cmd: | + if [[ $# -eq 2 ]]; then + SERVICE=$1 + COMMAND=$2 + else + if [ "$DOCKER_COMPOSE" = "docker-compose.dev.yml" ]; then + CKAN_CONTAINER_NAME=ckan-dev + fi + SERVICE=$CKAN_CONTAINER_NAME + COMMAND=$1 + fi; + docker compose -f $DOCKER_COMPOSE exec -T $SERVICE sh -c "$COMMAND" + + logs: + usage: Show Docker logs. + cmd: | + if [[ $# -eq 2 ]]; then + SERVICE=$1 + TAIL=$2 + else + SERVICE=$1 + TAIL=100 + fi; + docker compose -f $DOCKER_COMPOSE logs -f --tail=$TAIL $SERVICE + + ps: + usage: List running Docker containers. + cmd: docker compose -f $DOCKER_COMPOSE ps + + restart: + usage: Restart Docker containers. + cmd: | + docker compose -f $DOCKER_COMPOSE restart "$@" + ahoy info; + + stop: + usage: Stop Docker containers. + cmd: docker compose -f $DOCKER_COMPOSE stop "$@" + + attach: + usage: Attach to a running container + cmd: docker attach $(docker compose -f $DOCKER_COMPOSE ps -q "$@") + + recreate: + usage: Recreate a local container | ahoy recreate ckan + cmd: | + docker compose -f $DOCKER_COMPOSE up -d --force-recreate --no-deps --build "${1}" + + info: + usage: Print information about this project. + cmd: | + if [ "$DOCKER_COMPOSE" = "docker-compose.dev.yml" ]; then + SITE_URL="http://localhost:${CKAN_PORT_HOST}" + else + SITE_URL="https://localhost:${NGINX_SSLPORT_HOST}" + fi + echo "Site local URL : ${SITE_URL}" + if [ "$DOCKER_COMPOSE" = "docker-compose.dev.yml" ]; then + echo "CKAN DB port on host : $(docker port $(docker compose -f $DOCKER_COMPOSE ps -q $POSTGRESQL_CONTAINER_NAME) 5432 | cut -d : -f 2)" + echo "SOLR port on host : $(docker port $(docker compose -f $DOCKER_COMPOSE ps -q $SOLR_CONTAINER_NAME) 8983 | cut -d : -f 2)" + fi + + db-import: + usage: Pipe in a postgres dump file. `ahoy db-import local.dump` + cmd: | + if [ -e "$@" ] ; then + docker compose -f $DOCKER_COMPOSE exec -T $POSTGRESQL_CONTAINER_NAME sh -c 'pg_restore -U $CKAN_DB_USER -d $CKAN_DB --clean --if-exists -v' < "$@" + else echo "Provided sql file" "$@" "does not exist" + fi + + db-dump: + usage: Dump data out into a file. `ahoy db-dump local.dump` + cmd: docker compose -f $DOCKER_COMPOSE exec -T $POSTGRESQL_CONTAINER_NAME sh -c 'pg_dump -U $CKAN_DB_USER -d $CKAN_DB --format=custom -v' > "$@" + + confirm: + cmd: read -r -p "${@} [y/N] " response; [ ${response} = "y" ] + hide: true + + generate-extension: + usage: Generates a new CKAN extension into the src directory + cmd: ahoy run cli 'ckan generate extension -o ${SRC_DIR}' + + open: + usage: Open the site in your default browser + cmd: | + if [ "$DOCKER_COMPOSE" = "docker-compose.dev.yml" ]; then + SITE_URL="http://localhost:${CKAN_PORT_HOST}" + else + SITE_URL="http://localhost:${NGINX_PORT_HOST}" + fi + open $SITE_URL + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..edb45725 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,82 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose +{ + "name": "CKAN DBCA 2.10", + + // Update the 'dockerComposeFile' list if you have more compose files or use different names. + // The .devcontainer/docker-compose.yml file contains any overrides you need/want to make. + "dockerComposeFile": [ + "../docker-compose.dev.yml", + "docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "ckan-dev", + + // The optional 'workspaceFolder' property is the path VS Code should open by default when + // connected. This is typically a file mount in .devcontainer/docker-compose.yml + "workspaceFolder": "/srv", + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "ms-python.autopep8", + "ms-python.flake8", + "VisualStudioExptTeam.vscodeintellicode", + "GitHub.vscode-pull-request-github", + "eamodio.gitlens", + "streetsidesoftware.code-spell-checker", + "wholroyd.jinja", + "GitHub.copilot", + "GitHub.copilot-chat" + ], + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.profiles.linux": { + "bash": { + "path": "/bin/bash" + } + }, + "python.languageServer": "Pylance", + "python.linting.enabled": true, + "python.linting.flake8Enabled": true, + "flake8.args": [ + "--max-line-length", + "120" + ], + "python.formatting.provider": "autopep8", + "autopep8.args": [ + "--max-line-length", + "120" + ], + "cSpell.language": "en-GB", + "python.analysis.extraPaths": [ + "./app/src" + ] + } + } + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Uncomment the next line if you want start specific services in your Docker Compose config. + // "runServices": [], + + // Uncomment the next line if you want to keep your containers running after VS Code shuts down. + // "shutdownAction": "none", + + // Uncomment the next line to run commands after the container is created. + "postStartCommand": "${APP_DIR}/start_ckan_development.sh", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "devcontainer" +} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 00000000..c9359625 --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3' +services: + # Update this to the name of the service you want to work with in your docker-compose.yml file + ckan-dev: + # Uncomment if you want to override the service's Dockerfile to one in the .devcontainer + # folder. Note that the path of the Dockerfile and context is relative to the *primary* + # docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile" + # array). The sample below assumes your primary file is in the root of your project. + # + # build: + # context: . + # dockerfile: .devcontainer/Dockerfile + + volumes: + # Update this to wherever you want VS Code to mount the folder of your project + - .:/srv/workspace:cached + - .vscode:/srv/.vscode:cached + # Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust. + # cap_add: + # - SYS_PTRACE + # security_opt: + # - seccomp:unconfined + + # Overrides default command so things don't shut down after the process ends. + command: /bin/sh -c "while sleep 1000; do :; done" diff --git a/.env.dbca b/.env.dbca new file mode 100644 index 00000000..e1f5b74f --- /dev/null +++ b/.env.dbca @@ -0,0 +1,87 @@ +# Container names +NGINX_CONTAINER_NAME=nginx +REDIS_CONTAINER_NAME=redis +POSTGRESQL_CONTAINER_NAME=db +SOLR_CONTAINER_NAME=solr +DATAPUSHER_CONTAINER_NAME=datapusher +CKAN_CONTAINER_NAME=ckan +WORKER_CONTAINER_NAME=ckan-worker + +# Host Ports +CKAN_PORT_HOST=5000 +NGINX_PORT_HOST=81 +NGINX_SSLPORT_HOST=8443 + +# CKAN databases +POSTGRES_USER=postgres +POSTGRES_PASSWORD=postgres +POSTGRES_DB=postgres +POSTGRES_HOST=db +CKAN_DB_USER=ckandbuser +CKAN_DB_PASSWORD=ckandbpassword +CKAN_DB=ckandb +DATASTORE_READONLY_USER=datastore_ro +DATASTORE_READONLY_PASSWORD=datastore +DATASTORE_DB=datastore +CKAN_SQLALCHEMY_URL=postgresql://ckandbuser:ckandbpassword@db/ckandb +CKAN_DATASTORE_WRITE_URL=postgresql://ckandbuser:ckandbpassword@db/datastore +CKAN_DATASTORE_READ_URL=postgresql://datastore_ro:datastore@db/datastore + +# Test database connections +TEST_CKAN_SQLALCHEMY_URL=postgres://ckan:ckan@db/ckan_test +TEST_CKAN_DATASTORE_WRITE_URL=postgresql://ckan:ckan@db/datastore_test +TEST_CKAN_DATASTORE_READ_URL=postgresql://datastore_ro:datastore@db/datastore_test + +# Dev settings +USE_HTTPS_FOR_DEV=false + +# CKAN core +CKAN_VERSION=2.10.0 +CKAN_SITE_ID=default +CKAN_SITE_URL=http://localhost:5000 +CKAN_PORT=5000 + +CKAN___BEAKER__SESSION__SECRET=CHANGE_ME +# See https://docs.ckan.org/en/latest/maintaining/configuration.html#api-token-settings +CKAN___API_TOKEN__JWT__ENCODE__SECRET=string:CHANGE_ME +CKAN___API_TOKEN__JWT__DECODE__SECRET=string:CHANGE_ME +CKAN_SYSADMIN_NAME=ckan_admin +CKAN_SYSADMIN_PASSWORD=test1234 +CKAN_SYSADMIN_EMAIL=your_email@example.com +CKAN_STORAGE_PATH=/var/lib/ckan +CKAN_SMTP_SERVER=smtp.corporateict.domain:25 +CKAN_SMTP_STARTTLS=True +CKAN_SMTP_USER=user +CKAN_SMTP_PASSWORD=pass +CKAN_SMTP_MAIL_FROM=ckan@localhost +TZ=UTC + +# Solr +SOLR_IMAGE_VERSION=2.10-solr9 +CKAN_SOLR_URL=http://solr:8983/solr/ckan +TEST_CKAN_SOLR_URL=http://solr:8983/solr/ckan + +# Redis +REDIS_VERSION=7 +CKAN_REDIS_URL=redis://redis:6379/1 +TEST_CKAN_REDIS_URL=redis://redis:6379/1 + +# Xloader +CKANEXT__XLOADER__JOBS_DB__URI=$CKAN_SQLALCHEMY_URL + +# NGINX +NGINX_PORT=80 +NGINX_SSLPORT=443 + +# Extensions +CKAN__PLUGINS="envvars image_view text_view datatables_view datastore xloader" +CKAN__HARVEST__MQ__TYPE=redis +CKAN__HARVEST__MQ__HOSTNAME=redis +CKAN__HARVEST__MQ__PORT=6379 +CKAN__HARVEST__MQ__REDIS_DB=1 + +## WA DBCA Config ## +# Docker compose project name +COMPOSE_PROJECT_NAME=dbca +# The docker compose file to use. Options are docker-compose.dev.yml (The default for local development) or docker-compose.prod.yml (To test production builds) +DOCKER_COMPOSE=docker-compose.dev.yml diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..8fd14651 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,40 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: CKAN Run & Debug", + "type": "python", + "request": "launch", + "module": "pdb", + "args": [ + "-c continue", + "/usr/bin/ckan", + "--config", + "/srv/app/ckan.ini", + "run", + "--host", + "0.0.0.0", + ], + "jinja": true, + "justMyCode": true + }, + { + "name": "Python: CKAN Jobs Worker Run & Debug", + "type": "python", + "request": "launch", + "module": "pdb", + "args": [ + "-c continue", + "/usr/bin/ckan", + "--config", + "/srv/app/ckan.ini", + "jobs", + "worker", + ], + "justMyCode": true + } + ] +} \ No newline at end of file diff --git a/README_DBCA.md b/README_DBCA.md new file mode 100644 index 00000000..3e737d82 --- /dev/null +++ b/README_DBCA.md @@ -0,0 +1,60 @@ +# Docker Compose setup for DBCA CKAN + +## Install Dependencies +- docker +- git +- ahoy (https://github.com/ahoy-cli/ahoy) + +## Configure extensions that will be worked on + - Add any extensions you will be modifying in the file `src/dbca_install_extensions.sh` + +## Init and build local dev environment +- ahoy init + - This will clone the extensions from `dbca_install_extensions.sh` to the `src` folder which will be a mounted folder to the ckan docker containers + - Copy the `.env.dbca` to `.env` which is the env file uses for the CKAN docker containers + - Update the `.env` file to. The extension https://github.com/okfn/ckanext-envvars reads this file on CKAN startup and require to be in a certain format. Please read the readme file https://github.com/okfn/ckanext-envvars#ckanext-envvars + - Enable plugins via `CKAN__PLUGINS` + - Add/Update CKAN core configuration values + - Add/Update CKAN extensions configuration values + - Any updates to this file will recreate the container service to use the updates values when `ahoy up` is used +- ahoy build (Build the projects docker images) +- ahoy up (Starts the projects container services) + - The first time the CKAN Dev containers are created the mapped volume will look in the `src:/srv/app/src_extensions` folder to install any extensions cloned from the `ahoy init` step and will pip install the extension and any any requirements file if they exists +- To see the list of available commands with short descriptions run ahoy +``` +ahoy +NAME: + ahoy - Creates a configurable cli app for running commands. +USAGE: + ahoy [global options] command [command options] [arguments...] + +COMMANDS: + attach Attach to a running container + build Build project. + cli Start a shell inside container. + db-dump Dump data out into a file. `ahoy db-dump local.dump` + db-import Pipe in a postgres dump file. `ahoy db-import local.dump` + down Delete project (CAUTION). + generate-extension Generates a new CKAN extension into the src directory + info Print information about this project. + init Initialise the codebase on first-time setup (ahoy init) + logs Show Docker logs. + open Open the site in your default browser + ps List running Docker containers. + recreate Recreate a local container | ahoy recreate ckan + restart Restart Docker containers. + run Run command inside container. + stop Stop Docker containers. + up Build project. + +GLOBAL OPTIONS: + --verbose, -v Output extra details like the commands to be run. [$AHOY_VERBOSE] + --file value, -f value Use a specific ahoy file. + --help, -h show help + --version print the version + --generate-bash-completion + +VERSION: + 2.0.2-homebrew + +[fatal] Missing flag or argument.``` \ No newline at end of file diff --git a/ckan/Dockerfile b/ckan/Dockerfile index ea891057..f3d0184b 100644 --- a/ckan/Dockerfile +++ b/ckan/Dockerfile @@ -2,6 +2,10 @@ FROM ckan/ckan-base:2.10.1 # Install any extensions needed by your CKAN instance # See Dockerfile.dev for more details and examples +COPY setup/dbca_requirements.sh ${APP_DIR} +RUN pip3 install pip --upgrade && \ + chmod +x ${APP_DIR}/dbca_requirements.sh && \ + ${APP_DIR}/dbca_requirements.sh # Copy custom initialization scripts COPY docker-entrypoint.d/* /docker-entrypoint.d/ diff --git a/ckan/Dockerfile.dev b/ckan/Dockerfile.dev index 58dacebb..9a7403db 100644 --- a/ckan/Dockerfile.dev +++ b/ckan/Dockerfile.dev @@ -31,6 +31,16 @@ FROM ckan/ckan-dev:2.10.1 #RUN pip3 install -e git+https://github.com/ckan/ckanext-dcat.git@v0.0.6#egg=ckanext-dcat && \ # pip3 install -r https://raw.githubusercontent.com/ckan/ckanext-dcat/v0.0.6/requirements.txt + +# Install any extensions needed by your CKAN instance +COPY setup/dbca_requirements.sh ${APP_DIR} +RUN pip3 install pip --upgrade && \ + chmod +x ${APP_DIR}/dbca_requirements.sh && \ + ${APP_DIR}/dbca_requirements.sh + +COPY setup/dbca_start_ckan_development.sh.override ${APP_DIR}/start_ckan_development.sh +RUN chmod +x ${APP_DIR}/start_ckan_development.sh + # Clone the extension(s) your are writing for your own project in the `src` folder # to get them mounted in this image at runtime diff --git a/ckan/Dockerfile.worker b/ckan/Dockerfile.worker new file mode 100644 index 00000000..4c8a4657 --- /dev/null +++ b/ckan/Dockerfile.worker @@ -0,0 +1,16 @@ +ARG CKAN_IMAGE +FROM ${CKAN_IMAGE} + +## Create logs folder +RUN mkdir -p $APP_DIR/logs && \ + touch $APP_DIR/logs/ckan-cron-jobs.log && \ + chown -R ckan:ckan $APP_DIR/logs && \ + chmod -R 755 $APP_DIR/logs + +## Supervisor config +COPY supervisor/*.conf /etc/supervisord.d + +## Cron jobs config +COPY setup/dbca_ckan_cron_jobs $APP_DIR +RUN chmod -x $APP_DIR/dbca_ckan_cron_jobs +RUN crontab -u ckan $APP_DIR/dbca_ckan_cron_jobs diff --git a/ckan/docker-entrypoint.d/02_setup_dbca.sh b/ckan/docker-entrypoint.d/02_setup_dbca.sh new file mode 100644 index 00000000..ac828e3b --- /dev/null +++ b/ckan/docker-entrypoint.d/02_setup_dbca.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +if [[ $CKAN__PLUGINS == *"xloader"* ]]; then + # Add ckan.xloader.api_token to the CKAN config file (updated with corrected value later) + echo "Setting a temporary value for ckanext.xloader.api_token" + ckan config-tool $CKAN_INI "ckanext.xloader.api_token=$(ckan -c $CKAN_INI user token add $CKAN_SYSADMIN_NAME xloader | tail -n 1 | tr -d '\t')" +fi + +## Examples of how to initialise DB for the extensions +# if [[ $CKAN__PLUGINS == *"archiver"* ]]; then +# ckan -c $CKAN_INI archiver init +# fi + +# if [[ $CKAN__PLUGINS == *"report"* ]]; then +# ckan -c $CKAN_INI report initdb +# fi + +# if [[ $CKAN__PLUGINS == *"harvest"* ]]; then +# ckan -c $CKAN_INI db upgrade -p harvest +# fi + +# if [[ $CKAN__PLUGINS == *"pages"* ]]; then +# ckan -c $CKAN_INI pages initdb +# fi \ No newline at end of file diff --git a/ckan/setup/dbca_requirements.sh b/ckan/setup/dbca_requirements.sh new file mode 100644 index 00000000..b93b8f97 --- /dev/null +++ b/ckan/setup/dbca_requirements.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +## Must Have ## +# Archiver +pip3 install -e 'git+https://github.com/ckan/ckanext-archiver.git@master#egg=ckanext-archiver' +pip3 install -r ${SRC_DIR}/ckanext-archiver/requirements.txt + +# DCAT +pip3 install -e git+https://github.com/ckan/ckanext-dcat.git@v1.5.1#egg=ckanext-dcat +pip3 install -r ${SRC_DIR}/ckanext-dcat/requirements.txt + +# Harvester +pip3 install -e 'git+https://github.com/ckan/ckanext-harvest.git@v1.5.6#egg=ckanext-harvest' +pip3 install -r ${SRC_DIR}/ckanext-harvest/requirements.txt + +# Hierarchy +pip3 install -e git+https://github.com/ckan/ckanext-hierarchy.git@v1.2.1#egg=ckanext-hierarchy +pip3 install -r ${SRC_DIR}/ckanext-hierarchy/requirements.txt + +# Pages +pip3 install -e git+https://github.com/ckan/ckanext-pages.git@v0.5.2#egg=ckanext-pages + +# Report +pip3 install -e git+http://github.com/ckan/ckanext-report.git@master#egg=ckanext-report +pip3 install -r ${SRC_DIR}/ckanext-report/requirements.txt + +# Showcase +pip3 install -e git+https://github.com/ckan/ckanext-showcase.git@v1.6.1#egg=ckanext-showcase +pip3 install -r ${SRC_DIR}/ckanext-showcase/requirements.txt + +# Scheming +pip3 install -e 'git+https://github.com/ckan/ckanext-scheming.git@release-3.0.0#egg=ckanext-scheming' + +# Spatial +pip3 install -e git+https://github.com/ckan/ckanext-spatial.git@v2.1.1#egg=ckanext-spatial +pip3 install -r ${SRC_DIR}/ckanext-spatial/requirements.txt + +# XLoader +pip3 install -e 'git+https://github.com/ckan/ckanext-xloader.git@1.0.1#egg=ckanext-xloader' +pip3 install -r ${SRC_DIR}/ckanext-xloader/requirements.txt + +# 3rd Party # +# DOI +pip3 install -e git+https://github.com/NaturalHistoryMuseum/ckanext-doi@v3.1.9#egg=ckanext-doi \ No newline at end of file diff --git a/ckan/setup/dbca_start_ckan_development.sh.override b/ckan/setup/dbca_start_ckan_development.sh.override new file mode 100644 index 00000000..2af71a3e --- /dev/null +++ b/ckan/setup/dbca_start_ckan_development.sh.override @@ -0,0 +1,104 @@ +#!/bin/sh + +# Only run these start up scripts the first time the container is created +if [ ! -f /tmp/container_ready ]; then + # Install any local extensions in the src_extensions volume + echo "Looking for local extensions to install..." + echo "Extension dir contents:" + ls -la $SRC_EXTENSIONS_DIR + for i in $SRC_EXTENSIONS_DIR/* + do + if [ -d $i ]; + then + + if [ -f $i/pip-requirements.txt ]; + then + pip install -r $i/pip-requirements.txt + echo "Found requirements file in $i" + fi + if [ -f $i/requirements.txt ]; + then + pip install -r $i/requirements.txt + echo "Found requirements file in $i" + fi + if [ -f $i/dev-requirements.txt ]; + then + pip install -r $i/dev-requirements.txt + echo "Found dev-requirements file in $i" + fi + if [ -f $i/setup.py ]; + then + cd $i + python3 $i/setup.py develop + echo "Found setup.py file in $i" + cd $APP_DIR + fi + + # Point `use` in test.ini to location of `test-core.ini` + if [ -f $i/test.ini ]; + then + echo "Updating \`test.ini\` reference to \`test-core.ini\` for plugin $i" + ckan config-tool $i/test.ini "use = config:../../src/ckan/test-core.ini" + fi + fi + done + + # Set debug to true + echo "Enabling debug mode" + ckan config-tool $CKAN_INI -s DEFAULT "debug = true" + + # Set up the Secret key used by Beaker and Flask + # This can be overriden using a CKAN___BEAKER__SESSION__SECRET env var + if grep -E "beaker.session.secret ?= ?$" ckan.ini + then + echo "Setting beaker.session.secret in ini file" + ckan config-tool $CKAN_INI "beaker.session.secret=$(python3 -c 'import secrets; print(secrets.token_urlsafe())')" + ckan config-tool $CKAN_INI "WTF_CSRF_SECRET_KEY=$(python3 -c 'import secrets; print(secrets.token_urlsafe())')" + JWT_SECRET=$(python3 -c 'import secrets; print("string:" + secrets.token_urlsafe())') + ckan config-tool $CKAN_INI "api_token.jwt.encode.secret=${JWT_SECRET}" + ckan config-tool $CKAN_INI "api_token.jwt.decode.secret=${JWT_SECRET}" + fi + + # Update the plugins setting in the ini file with the values defined in the env var + echo "Loading the following plugins: $CKAN__PLUGINS" + ckan config-tool $CKAN_INI "ckan.plugins = $CKAN__PLUGINS" + + # Update test-core.ini DB, SOLR & Redis settings + echo "Loading test settings into test-core.ini" + ckan config-tool $SRC_DIR/ckan/test-core.ini \ + "sqlalchemy.url = $TEST_CKAN_SQLALCHEMY_URL" \ + "ckan.datastore.write_url = $TEST_CKAN_DATASTORE_WRITE_URL" \ + "ckan.datastore.read_url = $TEST_CKAN_DATASTORE_READ_URL" \ + "solr_url = $TEST_CKAN_SOLR_URL" \ + "ckan.redis.url = $TEST_CKAN_REDIS_URL" + + # Run the prerun script to init CKAN and create the default admin user + python3 prerun.py + + # Run any startup scripts provided by images extending this one + if [[ -d "/docker-entrypoint.d" ]] + then + for f in /docker-entrypoint.d/*; do + case "$f" in + *.sh) echo "$0: Running init file $f"; bash "$f" ;; + *.py) echo "$0: Running init file $f"; python3 "$f"; echo ;; + *) echo "$0: Ignoring $f (not an sh or py file)" ;; + esac + echo + done + fi + + # Set the container as ready so the startup scripts are not run again + touch /tmp/container_ready +fi + +# Start supervisord +supervisord --configuration /etc/supervisord.conf & + +# Start the development server as the ckan user with automatic reload +if [ "$USE_HTTPS_FOR_DEV" = true ] ; then + su ckan -c "/usr/bin/ckan -c $CKAN_INI run -H 0.0.0.0 -C unsafe.cert -K unsafe.key" +else + su ckan -c "/usr/bin/ckan -c $CKAN_INI run -H 0.0.0.0" +fi + diff --git a/ckan/supervisor/ckan_worker_default.conf b/ckan/supervisor/ckan_worker_default.conf new file mode 100644 index 00000000..f30bf16d --- /dev/null +++ b/ckan/supervisor/ckan_worker_default.conf @@ -0,0 +1,42 @@ +; ======================================================= +; Supervisor configuration for CKAN background job worker +; ======================================================= + +; 1. Copy this file to /etc/supervisor/conf.d +; 2. Make sure the paths below match your setup + + +[program:ckan-worker-default] + +; Use the full paths to the virtualenv and your configuration file here. +command=/usr/bin/ckan -c /srv/app/ckan.ini jobs worker + + +; User the worker runs as. +user=ckan + + +; Start just a single worker. Increase this number if you have many or +; particularly long running background jobs. +numprocs=1 +process_name=%(program_name)s-%(process_num)02d + + +; Log files. +stdout_logfile=/srv/app/logs/ckan-worker.stdout.log +stderr_logfile=/srv/app/logs/ckan-worker.stderr.log + + +; Make sure that the worker is started on system start and automatically +; restarted if it crashes unexpectedly. +autostart=true +autorestart=true + + +; Number of seconds the process has to run before it is considered to have +; started successfully. +startsecs=10 + +; Need to wait for currently executing tasks to finish at shutdown. +; Increase this if you have very long running tasks. +stopwaitsecs = 600 diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index dc2ecdf9..1caa7d4c 100755 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -13,6 +13,9 @@ services: dockerfile: Dockerfile.dev args: - TZ=${TZ} + platforms: + - linux/amd64 + image: ${COMPOSE_PROJECT_NAME}-ckan-dev env_file: - .env depends_on: @@ -30,12 +33,37 @@ services: restart: unless-stopped healthcheck: test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:5000"] + stdin_open: true + tty: true - datapusher: - image: ckan/ckan-base-datapusher:${DATAPUSHER_VERSION} + ckan-dev-worker: + build: + context: ckan/ + dockerfile: Dockerfile.worker + args: + - TZ=${TZ} + - CKAN_IMAGE=${COMPOSE_PROJECT_NAME}-ckan-dev + platforms: + - linux/amd64 + env_file: + - .env + depends_on: + db: + condition: service_healthy + solr: + condition: service_healthy + redis: + condition: service_healthy + ckan-dev: + condition: service_started + volumes: + - ckan_storage:/var/lib/ckan + - ./src:/srv/app/src_extensions restart: unless-stopped healthcheck: - test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:8800"] + test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:5000"] + stdin_open: true + tty: true db: build: @@ -55,6 +83,8 @@ services: restart: unless-stopped healthcheck: test: ["CMD", "pg_isready", "-U", "${POSTGRES_USER}", "-d", "${POSTGRES_DB}"] + ports: + - :5432 solr: image: ckan/ckan-solr:${SOLR_IMAGE_VERSION} @@ -63,6 +93,8 @@ services: restart: unless-stopped healthcheck: test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:8983/solr/"] + ports: + - :8983 redis: image: redis:${REDIS_VERSION} diff --git a/docker-compose.yml b/docker-compose.yml index 0f5330fb..7e35e82f 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,11 +24,14 @@ services: ckan: container_name: ${CKAN_CONTAINER_NAME} + image: ${COMPOSE_PROJECT_NAME}-${CKAN_CONTAINER_NAME} build: context: ckan/ dockerfile: Dockerfile args: - TZ=${TZ} + platforms: + - linux/amd64 networks: - ckannet - dbnet @@ -49,15 +52,38 @@ services: healthcheck: test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:5000"] - datapusher: - container_name: ${DATAPUSHER_CONTAINER_NAME} + ckan-worker: + container_name: ${WORKER_CONTAINER_NAME} + image: ${COMPOSE_PROJECT_NAME}-${WORKER_CONTAINER_NAME} + build: + context: ckan/ + dockerfile: Dockerfile.worker + args: + - TZ=${TZ} + - CKAN_IMAGE=${COMPOSE_PROJECT_NAME}-${CKAN_CONTAINER_NAME} + platforms: + - linux/amd64 networks: - ckannet - dbnet - image: ckan/ckan-base-datapusher:${DATAPUSHER_VERSION} + - solrnet + - redisnet + env_file: + - .env + depends_on: + db: + condition: service_healthy + solr: + condition: service_healthy + redis: + condition: service_healthy + ckan: + condition: service_started + volumes: + - ckan_storage:/var/lib/ckan restart: unless-stopped healthcheck: - test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:8800"] + test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:5000"] db: container_name: ${POSTGRESQL_CONTAINER_NAME} diff --git a/postgresql/Dockerfile b/postgresql/Dockerfile index f69e0da9..63699491 100755 --- a/postgresql/Dockerfile +++ b/postgresql/Dockerfile @@ -1,4 +1,4 @@ -FROM postgres:12-alpine +FROM postgres:16-alpine # Include extra setup scripts (eg datastore) COPY docker-entrypoint-initdb.d /docker-entrypoint-initdb.d \ No newline at end of file diff --git a/src/dbca_install_extensions.sh b/src/dbca_install_extensions.sh new file mode 100644 index 00000000..c9e94cea --- /dev/null +++ b/src/dbca_install_extensions.sh @@ -0,0 +1,27 @@ + +#!/bin/sh + +### Extensions that need upgrading to be compatiable with CKAN 2.10 ### +# Uncomment the following lines to install these extension you are working on to upgrade to CKAN 2.10 + +cd src/ + +## Must Have ## +# QA +# git clone https://github.com/dbca-wa/ckanext-qa.git +# These extensions will be installed by default, but we don't want them +# sed -i".$(date +%Y%m%d_%H%M%S).bak" -e '/ckanext-report/d' -e '/ckanext-archiver/d' ckanext-qa/dev-requirements.txt +# Office Docs +# git clone https://github.com/dbca-wa/ckanext-officedocs + +## Should have ## +# Geopusher +# git clone https://github.com/dbca-wa/ckanext-geopusher.git + +## Could have ## +# Cesium Preview +# git clone https://github.com/dbca-wa/ckanext-cesiumpreview.git +# Featured Views +# git clone https://github.com/dbca-wa/ckanext-featuredviews + +echo "Ready to build project: ahoy build" \ No newline at end of file From 8d681cacfd72989dfd2195ccd358babb7a700a4c Mon Sep 17 00:00:00 2001 From: MarkCalvert <37602611+MarkCalvert@users.noreply.github.com> Date: Thu, 23 Nov 2023 14:47:39 +1300 Subject: [PATCH 2/7] Updated to correct file name --- .ahoy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ahoy.yml b/.ahoy.yml index e94f57f5..c7248f98 100644 --- a/.ahoy.yml +++ b/.ahoy.yml @@ -16,7 +16,7 @@ commands: usage: Initialise the codebase on first-time setup (ahoy init) cmd : | echo "Creating project variables." - cp dbca.env .env + cp .env.dbca .env echo "Install local development extensions." sh src/dbca_install_extensions.sh From 8bc4c23419798d284524bd994e48b44c3249fe6f Mon Sep 17 00:00:00 2001 From: MarkCalvert <37602611+MarkCalvert@users.noreply.github.com> Date: Thu, 23 Nov 2023 14:48:07 +1300 Subject: [PATCH 3/7] Added ckan cron jobs --- ckan/setup/dbca_ckan_cron_jobs | 3 +++ ckan/supervisor/ckan_cron_jobs.conf | 42 +++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 ckan/setup/dbca_ckan_cron_jobs create mode 100644 ckan/supervisor/ckan_cron_jobs.conf diff --git a/ckan/setup/dbca_ckan_cron_jobs b/ckan/setup/dbca_ckan_cron_jobs new file mode 100644 index 00000000..a4bec897 --- /dev/null +++ b/ckan/setup/dbca_ckan_cron_jobs @@ -0,0 +1,3 @@ +# Crontab for CKAN cron jobs +# Example cron job runs the harvester run command every 15 mins +#*/15 * * * * /usr/bin/ckan -c /srv/app/ckan.ini harvester run >> $APP_DIR/logs/ckan-cron-jobs.log 2>&1 \ No newline at end of file diff --git a/ckan/supervisor/ckan_cron_jobs.conf b/ckan/supervisor/ckan_cron_jobs.conf new file mode 100644 index 00000000..d3268a40 --- /dev/null +++ b/ckan/supervisor/ckan_cron_jobs.conf @@ -0,0 +1,42 @@ +; ======================================================= +; Supervisor configuration for CKAN cron jobs +; ======================================================= + +; 1. Copy this file to /etc/supervisor/conf.d +; 2. Make sure the paths below match your setup + + +[program:ckan-cron-jobs] + +; Use the full paths to the virtualenv and your configuration file here. +command=/usr/sbin/crond -f -L /srv/app/logs/ckan-cron-jobs.log + + +; User the worker runs as. +user=root + + +; Start just a single worker. Increase this number if you have many or +; particularly long running background jobs. +numprocs=1 +process_name=%(program_name)s-%(process_num)02d + + +; Log files. +stdout_logfile=/srv/app/logs/ckan-crons-jobs.stdout.log +stderr_logfile=/srv/app/logs/ckan-crons-jobs.stderr.log + + +; Make sure that the worker is started on system start and automatically +; restarted if it crashes unexpectedly. +autostart=true +autorestart=true + + +; Number of seconds the process has to run before it is considered to have +; started successfully. +startsecs=10 + +; Need to wait for currently executing tasks to finish at shutdown. +; Increase this if you have very long running tasks. +stopwaitsecs = 600 From e279694b4664602b4cf2dbd73d85d8a58e953ee1 Mon Sep 17 00:00:00 2001 From: MarkCalvert <37602611+MarkCalvert@users.noreply.github.com> Date: Mon, 27 Nov 2023 11:07:58 +1300 Subject: [PATCH 4/7] Initial commit of workflow to build and push docker images --- .github/workflows/dbca_build.yml | 69 ++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/dbca_build.yml diff --git a/.github/workflows/dbca_build.yml b/.github/workflows/dbca_build.yml new file mode 100644 index 00000000..948feb5f --- /dev/null +++ b/.github/workflows/dbca_build.yml @@ -0,0 +1,69 @@ +name: Create and publish a Docker image + +on: + # Trigger the workflow on push on master, develop and tags + push: + branches: + - master + - develop + - tags/* + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: NGINX Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: ./nginx + file: ./nginx/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + + - name: PostgreSQL Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: ./postgresql + file: ./postgresql/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + + - name: CKAN Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: ./ckan + file: ./ckan/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + + - name: CKAN Worker Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: ./ckan + file: ./ckan/Dockerfile.worker + push: true + tags: ${{ steps.meta.outputs.tags }} + \ No newline at end of file From 3f3fccb6f8c629151a1df8b78d187b4b58490ccd Mon Sep 17 00:00:00 2001 From: MarkCalvert <37602611+MarkCalvert@users.noreply.github.com> Date: Mon, 27 Nov 2023 11:34:09 +1300 Subject: [PATCH 5/7] Added extract metadata for each docker image build Added build-arg CKAN_IMAGE for ckan worker --- .github/workflows/dbca_build.yml | 33 +++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dbca_build.yml b/.github/workflows/dbca_build.yml index 948feb5f..bd93b877 100644 --- a/.github/workflows/dbca_build.yml +++ b/.github/workflows/dbca_build.yml @@ -29,11 +29,29 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta + - name: Extract metadata (tags, labels) for Docker nginx image + id: meta_nginx uses: docker/metadata-action@v5 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-nginx + + - name: Extract metadata (tags, labels) for Docker postgres image + id: meta_postgres + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-postgres + + - name: Extract metadata (tags, labels) for Docker ckan image + id: meta_ckan + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ckan + + - name: Extract metadata (tags, labels) for Docker ckan worker image + id: meta_ckan_worker + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ckan-worker - name: NGINX Build and push Docker image uses: docker/build-push-action@v5 @@ -41,7 +59,7 @@ jobs: context: ./nginx file: ./nginx/Dockerfile push: true - tags: ${{ steps.meta.outputs.tags }} + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-nginx:${{ steps.meta_nginx.outputs.tags }} - name: PostgreSQL Build and push Docker image uses: docker/build-push-action@v5 @@ -49,7 +67,7 @@ jobs: context: ./postgresql file: ./postgresql/Dockerfile push: true - tags: ${{ steps.meta.outputs.tags }} + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-postgres:${{ steps.meta_postgres.outputs.tags }} - name: CKAN Build and push Docker image uses: docker/build-push-action@v5 @@ -57,7 +75,7 @@ jobs: context: ./ckan file: ./ckan/Dockerfile push: true - tags: ${{ steps.meta.outputs.tags }} + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ckan:${{ steps.meta_ckan.outputs.tags }} - name: CKAN Worker Build and push Docker image uses: docker/build-push-action@v5 @@ -65,5 +83,6 @@ jobs: context: ./ckan file: ./ckan/Dockerfile.worker push: true - tags: ${{ steps.meta.outputs.tags }} + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ckan-worker:${{ steps.meta_ckan_worker.outputs.tags }} + build-args: CKAN_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ckan:${{ steps.meta_ckan.outputs.tags }} \ No newline at end of file From 7cb67f48ac6d434b938b1f413cb0b50323127f6d Mon Sep 17 00:00:00 2001 From: MarkCalvert <37602611+MarkCalvert@users.noreply.github.com> Date: Mon, 27 Nov 2023 11:36:48 +1300 Subject: [PATCH 6/7] Updated tags --- .github/workflows/dbca_build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dbca_build.yml b/.github/workflows/dbca_build.yml index bd93b877..72459033 100644 --- a/.github/workflows/dbca_build.yml +++ b/.github/workflows/dbca_build.yml @@ -59,7 +59,7 @@ jobs: context: ./nginx file: ./nginx/Dockerfile push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-nginx:${{ steps.meta_nginx.outputs.tags }} + tags: ${{ steps.meta_nginx.outputs.tags }} - name: PostgreSQL Build and push Docker image uses: docker/build-push-action@v5 @@ -67,7 +67,7 @@ jobs: context: ./postgresql file: ./postgresql/Dockerfile push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-postgres:${{ steps.meta_postgres.outputs.tags }} + tags: ${{ steps.meta_postgres.outputs.tags }} - name: CKAN Build and push Docker image uses: docker/build-push-action@v5 @@ -75,7 +75,7 @@ jobs: context: ./ckan file: ./ckan/Dockerfile push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ckan:${{ steps.meta_ckan.outputs.tags }} + tags: ${{ steps.meta_ckan.outputs.tags }} - name: CKAN Worker Build and push Docker image uses: docker/build-push-action@v5 @@ -83,6 +83,6 @@ jobs: context: ./ckan file: ./ckan/Dockerfile.worker push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ckan-worker:${{ steps.meta_ckan_worker.outputs.tags }} - build-args: CKAN_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ckan:${{ steps.meta_ckan.outputs.tags }} + tags: ${{ steps.meta_ckan_worker.outputs.tags }} + build-args: CKAN_IMAGE=${{ steps.meta_ckan.outputs.tags }} \ No newline at end of file From 1656b2dfe6029157835cac4782a2c9a41fd84e1e Mon Sep 17 00:00:00 2001 From: MarkCalvert <37602611+MarkCalvert@users.noreply.github.com> Date: Tue, 28 Nov 2023 10:51:58 +1300 Subject: [PATCH 7/7] Added platform linux/amd64 to docker services --- docker-compose.dev.yml | 3 +++ docker-compose.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 1caa7d4c..521a8112 100755 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -16,6 +16,7 @@ services: platforms: - linux/amd64 image: ${COMPOSE_PROJECT_NAME}-ckan-dev + platform: linux/amd64 env_file: - .env depends_on: @@ -45,6 +46,7 @@ services: - CKAN_IMAGE=${COMPOSE_PROJECT_NAME}-ckan-dev platforms: - linux/amd64 + platform: linux/amd64 env_file: - .env depends_on: @@ -88,6 +90,7 @@ services: solr: image: ckan/ckan-solr:${SOLR_IMAGE_VERSION} + platform: linux/amd64 volumes: - solr_data:/var/solr restart: unless-stopped diff --git a/docker-compose.yml b/docker-compose.yml index 7e35e82f..2064ac86 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,6 +25,7 @@ services: ckan: container_name: ${CKAN_CONTAINER_NAME} image: ${COMPOSE_PROJECT_NAME}-${CKAN_CONTAINER_NAME} + platform: linux/amd64 build: context: ckan/ dockerfile: Dockerfile @@ -55,6 +56,7 @@ services: ckan-worker: container_name: ${WORKER_CONTAINER_NAME} image: ${COMPOSE_PROJECT_NAME}-${WORKER_CONTAINER_NAME} + platform: linux/amd64 build: context: ckan/ dockerfile: Dockerfile.worker @@ -112,6 +114,7 @@ services: networks: - solrnet image: ckan/ckan-solr:${SOLR_IMAGE_VERSION} + platform: linux/amd64 volumes: - solr_data:/var/solr restart: unless-stopped