From 8584d7478165cd277f801d07d2f08b98fdaa11a2 Mon Sep 17 00:00:00 2001 From: Paige Williams Date: Mon, 15 Jun 2026 15:18:57 -0700 Subject: [PATCH 1/9] add bash script to install docker and TEKDB on Linux --- docker/common.yaml | 7 ++- scripts/Linux/install-docker-env.sh | 81 +++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 scripts/Linux/install-docker-env.sh diff --git a/docker/common.yaml b/docker/common.yaml index 67297f73..52f75c17 100644 --- a/docker/common.yaml +++ b/docker/common.yaml @@ -1,5 +1,6 @@ services: db: + container_name: db image: postgis/postgis:15-3.4 restart: always platform: linux/amd64 @@ -18,8 +19,10 @@ services: timeout: 5s retries: 5 redis: + container_name: redis image: redis:alpine web: + container_name: tekdb_web build: context: ../TEKDB/ dockerfile: ../TEKDB/Dockerfile @@ -37,7 +40,8 @@ services: retries: 5 start_period: 30s - celery: + celery: + container_name: tekdb_celery entrypoint: [] command: celery -A TEKDB worker -l info environment: @@ -50,6 +54,7 @@ services: redis: condition: service_started celery-beat: + container_name: tekdb_celery_beat entrypoint: [] command: celery -A TEKDB beat -l info environment: diff --git a/scripts/Linux/install-docker-env.sh b/scripts/Linux/install-docker-env.sh new file mode 100644 index 00000000..b6eb116a --- /dev/null +++ b/scripts/Linux/install-docker-env.sh @@ -0,0 +1,81 @@ +#!/bin/bash +ENV_FILE="${1:-.env.prod}" + +if [ ! -f "$ENV_FILE" ]; then + echo "Environment file $ENV_FILE not found!" + exit 1 +fi + +# Add Docker’s official GPG Key: +echo "Adding Docker's official GPG key..." +sudo apt update +sudo apt install ca-certificates curl +sudo install -m 0755 -d /etc/apt/keyrings +sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc +sudo chmod a+r /etc/apt/keyrings/docker.asc + +# Add the repository to apt sources: +echo "Adding Docker's official repository..." +sudo tee /etc/apt/sources.list.d/docker.sources < Date: Mon, 15 Jun 2026 15:31:52 -0700 Subject: [PATCH 2/9] change install script to pull develop branch --- scripts/Linux/install-docker-env.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/Linux/install-docker-env.sh b/scripts/Linux/install-docker-env.sh index b6eb116a..abfd0067 100644 --- a/scripts/Linux/install-docker-env.sh +++ b/scripts/Linux/install-docker-env.sh @@ -57,10 +57,11 @@ mkdir tekdb cd tekdb git clone https://github.com/Ecotrust/TEKDB.git -echo "Checking out the main branch..." +# TODO: change to the main branch once the develop branch is merged into main!! +echo "Checking out the develop branch..." cd TEKDB -git checkout main -git pull origin main +git checkout develop +git pull origin develop echo "Moving the .env.prod file to the Docker directory..." mv $ENV_FILE docker/.env.prod From 58a82a6a71851f3e2162433dfa496c839fca1f75 Mon Sep 17 00:00:00 2001 From: Paige Williams Date: Thu, 18 Jun 2026 16:20:29 -0700 Subject: [PATCH 3/9] use nginx for prod.local environment --- docker/docker-compose.prod.local.yaml | 1 + proxy/Dockerfile.local | 4 ++-- proxy/default.local.conf | 16 +++++++++++----- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/docker/docker-compose.prod.local.yaml b/docker/docker-compose.prod.local.yaml index 70ea3133..38b9fc22 100644 --- a/docker/docker-compose.prod.local.yaml +++ b/docker/docker-compose.prod.local.yaml @@ -30,6 +30,7 @@ services: depends_on: - web ports: + - "80:8080" - "8080:8080" volumes: - static_volume:/vol/static/static:ro diff --git a/proxy/Dockerfile.local b/proxy/Dockerfile.local index 16e53fe2..6bd200e4 100644 --- a/proxy/Dockerfile.local +++ b/proxy/Dockerfile.local @@ -2,10 +2,10 @@ FROM nginxinc/nginx-unprivileged:1-alpine USER root -COPY ./default.local.conf /etc/nginx/templates/default.local.conf +COPY ./default.local.conf /etc/nginx/conf.d/default.conf COPY ./uwsgi_params /etc/nginx/uwsgi_params -RUN chmod 644 /etc/nginx/templates/default.local.conf /etc/nginx/uwsgi_params && \ +RUN chmod 644 /etc/nginx/conf.d/default.conf /etc/nginx/uwsgi_params && \ mkdir -p /vol/static && \ chmod 755 /vol/static diff --git a/proxy/default.local.conf b/proxy/default.local.conf index 23767951..8d99b56e 100644 --- a/proxy/default.local.conf +++ b/proxy/default.local.conf @@ -9,13 +9,19 @@ server { alias /vol/static/media; } location /import_database/ { - uwsgi_request_buffering off; - uwsgi_pass web:8000; - include /etc/nginx/uwsgi_params; + proxy_request_buffering off; + proxy_pass http://web:8000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; } location / { - uwsgi_pass web:8000; - include /etc/nginx/uwsgi_params; + proxy_pass http://web:8000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; } } \ No newline at end of file From dfe14bfe4949b558211606d7b02c3392ca67056a Mon Sep 17 00:00:00 2001 From: Paige Williams Date: Thu, 18 Jun 2026 16:38:43 -0700 Subject: [PATCH 4/9] fix check for docker container status --- scripts/Linux/install-docker-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Linux/install-docker-env.sh b/scripts/Linux/install-docker-env.sh index abfd0067..337d70ca 100644 --- a/scripts/Linux/install-docker-env.sh +++ b/scripts/Linux/install-docker-env.sh @@ -73,7 +73,7 @@ echo "Starting the Docker containers..." docker compose --env-file docker/.env.prod -f docker/docker-compose.prod.local.yaml up -d echo "Verifying that the containers are running..." -if docker ps --filter "name=tekdb_web" --filter "status=running" | grep -q "tekdb_web"; then +if [ "$(docker container inspect -f '{{.State.Status}}' "tekdb_web" 2>/dev/null)" = "running" ]; then echo "TEKDB containers are running successfully." else echo "Failed to start TEKDB containers. Please check the Docker logs for more information." From b3b6ffd47d1a46d0b582ff676daa8b5d2bca308b Mon Sep 17 00:00:00 2001 From: Paige Williams Date: Mon, 22 Jun 2026 09:53:40 -0700 Subject: [PATCH 5/9] remove print for no local_settings in docker deployment --- TEKDB/TEKDB/settings.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/TEKDB/TEKDB/settings.py b/TEKDB/TEKDB/settings.py index ca2a7f40..de026b40 100644 --- a/TEKDB/TEKDB/settings.py +++ b/TEKDB/TEKDB/settings.py @@ -413,9 +413,4 @@ try: from TEKDB.local_settings import * # noqa: F403 except Exception: - import sys - - print( - "ERROR: Unable to load local_settings.py. This is expected for docker deployment", - file=sys.stderr, - ) + pass From 2c4c031c85a1152ea309f2ed500a37cf38965e14 Mon Sep 17 00:00:00 2001 From: Paige Williams Date: Mon, 22 Jun 2026 12:51:08 -0700 Subject: [PATCH 6/9] remove proxy port mapping for 8080:8080 --- docker/docker-compose.prod.local.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/docker-compose.prod.local.yaml b/docker/docker-compose.prod.local.yaml index 38b9fc22..8bc64b8c 100644 --- a/docker/docker-compose.prod.local.yaml +++ b/docker/docker-compose.prod.local.yaml @@ -31,7 +31,6 @@ services: - web ports: - "80:8080" - - "8080:8080" volumes: - static_volume:/vol/static/static:ro - media_volume:/vol/static/media:ro From fb4b165005fc389410ebfa3f62f616361dd5b0ab Mon Sep 17 00:00:00 2001 From: Paige Williams Date: Mon, 22 Jun 2026 17:38:31 -0700 Subject: [PATCH 7/9] add script to tear down containers --- scripts/Linux/teardown-docker-env.sh | 58 ++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 scripts/Linux/teardown-docker-env.sh diff --git a/scripts/Linux/teardown-docker-env.sh b/scripts/Linux/teardown-docker-env.sh new file mode 100755 index 00000000..c8983bfd --- /dev/null +++ b/scripts/Linux/teardown-docker-env.sh @@ -0,0 +1,58 @@ +#!/bin/bash +set -euo pipefail + +ENV_FILE="${1:-docker/.env.prod}" +COMPOSE_FILE="${2:-docker/docker-compose.prod.local.yaml}" + +REMOVE_VOLUMES="${REMOVE_VOLUMES:-0}" +REMOVE_IMAGES="${REMOVE_IMAGES:-0}" + +# Optional flags can be passed after positional args. +# --volumes => remove named/anonymous volumes +# --rmi-local => remove images built locally by compose +shift $(( $# > 2 ? 2 : $# )) || true +for arg in "$@"; do + case "$arg" in + --volumes) + REMOVE_VOLUMES=1 + ;; + --rmi-local) + REMOVE_IMAGES=1 + ;; + *) + echo "Unknown option: $arg" + echo "Usage: $0 [env_file] [compose_file] [--volumes] [--rmi-local]" + exit 1 + ;; + esac +done + +if ! command -v docker >/dev/null 2>&1; then + echo "Docker CLI not found. Install Docker first." + exit 1 +fi + +if [ ! -f "$ENV_FILE" ]; then + echo "Environment file not found: $ENV_FILE" + exit 1 +fi + +if [ ! -f "$COMPOSE_FILE" ]; then + echo "Compose file not found: $COMPOSE_FILE" + exit 1 +fi + +echo "Stopping and removing TEKDB containers..." +DOWN_CMD=(docker compose --env-file "$ENV_FILE" -f "$COMPOSE_FILE" down) + +if [ "$REMOVE_VOLUMES" = "1" ]; then + DOWN_CMD+=(--volumes) +fi + +if [ "$REMOVE_IMAGES" = "1" ]; then + DOWN_CMD+=(--rmi local) +fi + +"${DOWN_CMD[@]}" + +echo "TEKDB stack has been brought down successfully." \ No newline at end of file From d8eb72e1c1530dcd4fff282e780c85d9e151bf0f Mon Sep 17 00:00:00 2001 From: Paige Williams Date: Tue, 23 Jun 2026 10:09:53 -0700 Subject: [PATCH 8/9] fix typos in import error messages --- TEKDB/TEKDB/static/admin/js/admin_index.js | 4 ++-- TEKDB/TEKDB/views.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TEKDB/TEKDB/static/admin/js/admin_index.js b/TEKDB/TEKDB/static/admin/js/admin_index.js index 98485d93..f61d17e5 100644 --- a/TEKDB/TEKDB/static/admin/js/admin_index.js +++ b/TEKDB/TEKDB/static/admin/js/admin_index.js @@ -1,6 +1,6 @@ const importText = ` This process will remove all data and files from your current - database and replace it with data from the provided zip file. + database and replace it with data from the provided zipfile.

This process CANNOT be undone.

It is recommended that you use the 'Export to .zip' button above to export @@ -14,7 +14,7 @@ const importText = ` `; const importInfoText = `The Import Database Tool is designed to support restoring your Traditional Knowledge Database back to a prior state. This is best used in conjunction with the 'Export Database' tool above.

- To use the Import Database tool is simple: select a properly formatted zip file to upload and then click 'Import'. All of your data will be reverted back to the state it was when that zipfile was created.

+ To use the Import Database tool is simple: select a properly formatted zipfile to upload and then click 'Import'. All of your data will be reverted back to the state it was when that zipfile was created.

This is VERY DANGEROUS! For this to work, all of the data currently in your database, including your users, your records, and your page contents will be removed, and then replaced. Also, any files diff --git a/TEKDB/TEKDB/views.py b/TEKDB/TEKDB/views.py index 0ca76b94..9fa04bba 100644 --- a/TEKDB/TEKDB/views.py +++ b/TEKDB/TEKDB/views.py @@ -245,7 +245,7 @@ def ImportDatabase(request): # Validate Zip Contents if not len(non_media) == 1 or len(zip.namelist()) < 2: status_code = 500 - status_message = "Received malformed import file. Must be a zipfile contailing one JSON file and a directory named 'media'" + status_message = "Received malformed import file. Must be a zipfile containing one JSON file and a directory named 'media'" return JsonResponse( { "status_code": status_code, From a2d0e53532745a4f39e1cf636974fa38fb99598f Mon Sep 17 00:00:00 2001 From: Paige Williams Date: Tue, 23 Jun 2026 10:21:21 -0700 Subject: [PATCH 9/9] bump version to 2.13.1 --- TEKDB/TEKDB/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TEKDB/TEKDB/settings.py b/TEKDB/TEKDB/settings.py index fd550ae7..762a84d9 100644 --- a/TEKDB/TEKDB/settings.py +++ b/TEKDB/TEKDB/settings.py @@ -262,7 +262,7 @@ TINYMCE_FILEBROWSER = False # Add Version to the admin site header -VERSION = "2.13.0" +VERSION = "2.13.1" ADMIN_SITE_HEADER = os.environ.get( "ADMIN_SITE_HEADER", default="ITK DB Admin v{}".format(VERSION) )