From 5cf25667f473ff68122524bbafe855298cb18bc8 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Thu, 1 Aug 2024 19:56:30 +0100 Subject: [PATCH 1/5] build: add odm to the compose stack --- docker-compose.yml | 68 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index c32cd5da..63ff8782 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,8 @@ networks: volumes: db-data: name: drone-tm-db-data + odm-media: + odm-db-data: services: backend: @@ -102,3 +104,69 @@ services: - dtm-network entrypoint: ["pdm", "run", "alembic", "upgrade", "head"] restart: "no" + + odm-db: + image: docker.io/opendronemap/webodm_db:latest + container_name: odm-db + volumes: + - odm-db-data:/var/lib/postgresql/data:Z + ports: + - 5999:5432 + networks: + - dtm-network + restart: unless-stopped + oom_score_adj: -100 + + odm-api: + image: docker.io/opendronemap/nodeodm:3.5.3 + container_name: odm-api + networks: + - dtm-network + restart: unless-stopped + oom_score_adj: 500 + + odm-web: + image: docker.io/opendronemap/webodm_webapp:2.5.4 + container_name: odm-web + entrypoint: /bin/bash -c "chmod +x /webodm/*.sh && /bin/bash -c \"/webodm/wait-for-postgres.sh odm-db /webodm/wait-for-it.sh -t 0 odm-broker:6379 -- /webodm/start.sh\"" + volumes: + - odm-media:/webodm/app/media:z + ports: + - "${WO_PORT}:8000" + depends_on: + odm-worker: + condition: service_started + odm-set-password: + condition: service_completed_successfully + env_file: + - .env + networks: + - dtm-network + restart: unless-stopped + oom_score_adj: 0 + + odm-broker: + image: docker.io/redis:7.0.10 + container_name: odm-broker + networks: + - dtm-network + restart: unless-stopped + oom_score_adj: -500 + + odm-worker: + image: docker.io/opendronemap/webodm_webapp:2.5.4 + container_name: odm-worker + entrypoint: /bin/bash -c "/webodm/wait-for-postgres.sh odm-db /webodm/wait-for-it.sh -t 0 odm-broker:6379 -- /webodm/wait-for-it.sh -t 0 odm-web:8000 -- /webodm/worker.sh start" + volumes: + - odm-media:/webodm/app/media:z + depends_on: + odm-db: + condition: service_started + odm-broker: + condition: service_started + env_file: + - .env + networks: + - dtm-network + restart: unless-stopped + oom_score_adj: 250 From bae8c513589e9cbf4b45ccfd4e2769b6b2a27cb1 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Thu, 1 Aug 2024 19:57:36 +0100 Subject: [PATCH 2/5] docs: add example odm environment var config to .env.sample --- .env.sample | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.env.sample b/.env.sample index aaaa406b..bbd460a1 100644 --- a/.env.sample +++ b/.env.sample @@ -43,3 +43,22 @@ SMTP_HOST=smtp.gmail.com SMTP_USER=xxx@gmail.com SMTP_PASSWORD=xxxxxxxxxx EMAILS_FROM_EMAIL=xxxxxxxx@gmail.com + +# ODM +WO_ADMIN_PASSWORD=password +WO_HOST=localhost +WO_PORT=9900 +WO_DATABASE_HOST=odm-db +# WO_DATABASE_NAME=webodm_dev +# WO_DATABASE_PASSWORD=postgres +# WO_DATABASE_USER=postgres +WO_SECRET_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +WO_SSL=NO +WO_SSL_KEY= +WO_SSL_CERT= +WO_SSL_INSECURE_PORT_REDIRECT=80 +WO_DEBUG=NO +WO_DEV=NO +WO_BROKER=redis://odm-broker +WO_DEFAULT_NODES=1 +WO_SETTINGS= From 7f889b8c6783b3fe43e4c77cc51031ec56c68859 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Thu, 1 Aug 2024 19:58:23 +0100 Subject: [PATCH 3/5] docs: rename .env.sample --> .env.example --- .env.sample => .env.example | 0 .github/workflows/docs.yml | 2 +- src/frontend/README.md | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename .env.sample => .env.example (100%) diff --git a/.env.sample b/.env.example similarity index 100% rename from .env.sample rename to .env.example diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 1ce5273e..92532c15 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -15,7 +15,7 @@ jobs: # uses: hotosm/gh-workflows/.github/workflows/openapi_build.yml@1.6.0 # with: # image: ghcr.io/${{ github.repository }}/backend:ci-${{ github.ref_name }} - # example_env_file_path: ".env.sample" + # example_env_file_path: ".env.example" # output_path: docs/openapi.json publish_docs: diff --git a/src/frontend/README.md b/src/frontend/README.md index 331490d3..84ac62fe 100644 --- a/src/frontend/README.md +++ b/src/frontend/README.md @@ -2,7 +2,7 @@ 1. Do not use npm to install packages, use yarn. If you want to run `npm install` then delete the `yarn.lock` file and install the packages using npm. -2. Create a .env file and copy .env.sample to .env +2. Create a .env file and copy .env.example to .env 3. Run `yarn dev` to start the development server. From 8ae14caaf3e46a28ed2a6bfa9cc8866bbb6eebbc Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Thu, 1 Aug 2024 20:24:47 +0100 Subject: [PATCH 4/5] build: use required hostname for nodeodm container --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 63ff8782..f70f8c73 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -119,6 +119,8 @@ services: odm-api: image: docker.io/opendronemap/nodeodm:3.5.3 + # This is hardcoded by default + hostname: webodm-node-odm-1 container_name: odm-api networks: - dtm-network @@ -136,8 +138,6 @@ services: depends_on: odm-worker: condition: service_started - odm-set-password: - condition: service_completed_successfully env_file: - .env networks: From 6feee83e8b1652b928aa7ad447efeaac37af3cbb Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Fri, 2 Aug 2024 11:07:00 +0100 Subject: [PATCH 5/5] build: separate odm compose from main file --- docker-compose.odm.yml | 74 ++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 68 -------------------------------------- 2 files changed, 74 insertions(+), 68 deletions(-) create mode 100644 docker-compose.odm.yml diff --git a/docker-compose.odm.yml b/docker-compose.odm.yml new file mode 100644 index 00000000..b7fa108e --- /dev/null +++ b/docker-compose.odm.yml @@ -0,0 +1,74 @@ +networks: + dtm-network: + name: dtm-network + +volumes: + odm-media: + odm-db-data: + +services: + odm-db: + image: docker.io/opendronemap/webodm_db:latest + container_name: odm-db + volumes: + - odm-db-data:/var/lib/postgresql/data:Z + ports: + - 5999:5432 + networks: + - dtm-network + restart: unless-stopped + oom_score_adj: -100 + + odm-api: + image: docker.io/opendronemap/nodeodm:3.5.3 + # This is hardcoded by default + hostname: webodm-node-odm-1 + container_name: odm-api + networks: + - dtm-network + restart: unless-stopped + oom_score_adj: 500 + + odm-web: + image: docker.io/opendronemap/webodm_webapp:2.5.4 + container_name: odm-web + entrypoint: /bin/bash -c "chmod +x /webodm/*.sh && /bin/bash -c \"/webodm/wait-for-postgres.sh odm-db /webodm/wait-for-it.sh -t 0 odm-broker:6379 -- /webodm/start.sh\"" + volumes: + - odm-media:/webodm/app/media:z + ports: + - "${WO_PORT}:8000" + depends_on: + odm-worker: + condition: service_started + env_file: + - .env + networks: + - dtm-network + restart: unless-stopped + oom_score_adj: 0 + + odm-broker: + image: docker.io/redis:7.0.10 + container_name: odm-broker + networks: + - dtm-network + restart: unless-stopped + oom_score_adj: -500 + + odm-worker: + image: docker.io/opendronemap/webodm_webapp:2.5.4 + container_name: odm-worker + entrypoint: /bin/bash -c "/webodm/wait-for-postgres.sh odm-db /webodm/wait-for-it.sh -t 0 odm-broker:6379 -- /webodm/wait-for-it.sh -t 0 odm-web:8000 -- /webodm/worker.sh start" + volumes: + - odm-media:/webodm/app/media:z + depends_on: + odm-db: + condition: service_started + odm-broker: + condition: service_started + env_file: + - .env + networks: + - dtm-network + restart: unless-stopped + oom_score_adj: 250 diff --git a/docker-compose.yml b/docker-compose.yml index f70f8c73..c32cd5da 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,8 +5,6 @@ networks: volumes: db-data: name: drone-tm-db-data - odm-media: - odm-db-data: services: backend: @@ -104,69 +102,3 @@ services: - dtm-network entrypoint: ["pdm", "run", "alembic", "upgrade", "head"] restart: "no" - - odm-db: - image: docker.io/opendronemap/webodm_db:latest - container_name: odm-db - volumes: - - odm-db-data:/var/lib/postgresql/data:Z - ports: - - 5999:5432 - networks: - - dtm-network - restart: unless-stopped - oom_score_adj: -100 - - odm-api: - image: docker.io/opendronemap/nodeodm:3.5.3 - # This is hardcoded by default - hostname: webodm-node-odm-1 - container_name: odm-api - networks: - - dtm-network - restart: unless-stopped - oom_score_adj: 500 - - odm-web: - image: docker.io/opendronemap/webodm_webapp:2.5.4 - container_name: odm-web - entrypoint: /bin/bash -c "chmod +x /webodm/*.sh && /bin/bash -c \"/webodm/wait-for-postgres.sh odm-db /webodm/wait-for-it.sh -t 0 odm-broker:6379 -- /webodm/start.sh\"" - volumes: - - odm-media:/webodm/app/media:z - ports: - - "${WO_PORT}:8000" - depends_on: - odm-worker: - condition: service_started - env_file: - - .env - networks: - - dtm-network - restart: unless-stopped - oom_score_adj: 0 - - odm-broker: - image: docker.io/redis:7.0.10 - container_name: odm-broker - networks: - - dtm-network - restart: unless-stopped - oom_score_adj: -500 - - odm-worker: - image: docker.io/opendronemap/webodm_webapp:2.5.4 - container_name: odm-worker - entrypoint: /bin/bash -c "/webodm/wait-for-postgres.sh odm-db /webodm/wait-for-it.sh -t 0 odm-broker:6379 -- /webodm/wait-for-it.sh -t 0 odm-web:8000 -- /webodm/worker.sh start" - volumes: - - odm-media:/webodm/app/media:z - depends_on: - odm-db: - condition: service_started - odm-broker: - condition: service_started - env_file: - - .env - networks: - - dtm-network - restart: unless-stopped - oom_score_adj: 250