fix: make DTF compose stack Swarm compatible
All checks were successful
Build and deploy / Validate source (push) Successful in 7s
Build and deploy / Publish images and notify Portainer (push) Successful in 39s

This commit is contained in:
Cauê Faleiros
2026-09-18 11:27:36 -03:00
parent 6db107f0fc
commit dabb4db2e3

View File

@@ -1,8 +1,5 @@
name: ${COMPOSE_PROJECT_NAME:-dtf-cloud}
x-app: &app x-app: &app
build: image: ${API_IMAGE:-gitea.blyzer.com.br/blyzer/dtf-api}:${IMAGE_TAG:-latest}
context: .
dockerfile: local/Dockerfile
environment: &environment environment: &environment
APP_ENV: ${APP_ENV:-local} APP_ENV: ${APP_ENV:-local}
DATABASE_URL: postgresql://${APP_DB_USER:-dtf_app}:${APP_DB_PASSWORD:-local-app-database-only}@db:5432/${POSTGRES_DB:-dtf_local} DATABASE_URL: postgresql://${APP_DB_USER:-dtf_app}:${APP_DB_PASSWORD:-local-app-database-only}@db:5432/${POSTGRES_DB:-dtf_local}
@@ -58,17 +55,14 @@ services:
memory: 3G memory: 3G
pids: 128 pids: 128
db-init: db-init:
build: image: ${API_IMAGE:-gitea.blyzer.com.br/blyzer/dtf-api}:${IMAGE_TAG:-latest}
context: .
dockerfile: local/Dockerfile
command: python -m local.bootstrap command: python -m local.bootstrap
environment: environment:
DATABASE_ADMIN_URL: postgresql://${POSTGRES_USER:-dtf_local}:${POSTGRES_PASSWORD:-local-database-only}@db:5432/${POSTGRES_DB:-dtf_local} DATABASE_ADMIN_URL: postgresql://${POSTGRES_USER:-dtf_local}:${POSTGRES_PASSWORD:-local-database-only}@db:5432/${POSTGRES_DB:-dtf_local}
APP_DB_USER: ${APP_DB_USER:-dtf_app} APP_DB_USER: ${APP_DB_USER:-dtf_app}
APP_DB_PASSWORD: ${APP_DB_PASSWORD:-local-app-database-only} APP_DB_PASSWORD: ${APP_DB_PASSWORD:-local-app-database-only}
networks: [local] networks: [local]
depends_on: depends_on: [db]
db: {condition: service_healthy}
storage-init: storage-init:
image: minio/minio:RELEASE.2025-04-22T22-12-26Z image: minio/minio:RELEASE.2025-04-22T22-12-26Z
entrypoint: [/bin/sh, /init.sh] entrypoint: [/bin/sh, /init.sh]
@@ -83,8 +77,7 @@ services:
- ./local/storage-policy.json:/policy.json:ro - ./local/storage-policy.json:/policy.json:ro
- ./local/storage-lifecycle.json:/lifecycle.json:ro - ./local/storage-lifecycle.json:/lifecycle.json:ro
networks: [local] networks: [local]
depends_on: depends_on: [storage]
storage: {condition: service_healthy}
db: db:
image: postgres:17-alpine image: postgres:17-alpine
environment: environment:
@@ -115,9 +108,7 @@ services:
api: api:
<<: *app <<: *app
command: uvicorn local.app:app --host 0.0.0.0 --port 8000 --no-access-log command: uvicorn local.app:app --host 0.0.0.0 --port 8000 --no-access-log
depends_on: depends_on: [db-init, storage-init]
db-init: {condition: service_completed_successfully}
storage-init: {condition: service_completed_successfully}
healthcheck: healthcheck:
test: [CMD, python, -c, "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] test: [CMD, python, -c, "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
interval: 5s interval: 5s
@@ -126,40 +117,32 @@ services:
worker: worker:
<<: *app <<: *app
command: python -m local.worker command: python -m local.worker
depends_on: depends_on: [api, scanner]
api: {condition: service_healthy}
scanner: {condition: service_healthy}
healthcheck: healthcheck:
test: [CMD, python, -c, "import urllib.request; urllib.request.urlopen('http://localhost:8002/health')"] test: [CMD, python, -c, "import urllib.request; urllib.request.urlopen('http://localhost:8002/health')"]
interval: 5s interval: 5s
timeout: 3s timeout: 3s
retries: 12 retries: 12
site: site:
build: image: ${WEB_IMAGE:-gitea.blyzer.com.br/blyzer/dtf-web}:${IMAGE_TAG:-latest}
context: .
dockerfile: local/Dockerfile.web
environment: environment:
S3_PUBLIC_ENDPOINT: ${S3_PUBLIC_ENDPOINT:-http://localhost:9000} S3_PUBLIC_ENDPOINT: ${S3_PUBLIC_ENDPOINT:-http://localhost:9000}
ports: ["127.0.0.1:${SITE_PORT:-8080}:80", "127.0.0.1:${API_PORT:-8000}:81"] ports: ["127.0.0.1:${SITE_PORT:-8080}:80", "127.0.0.1:${API_PORT:-8000}:81"]
networks: [local, edge] networks: [local, edge]
depends_on: depends_on: [api]
api: {condition: service_healthy}
healthcheck: healthcheck:
test: [CMD, wget, -q, -O, /dev/null, http://127.0.0.1/health] test: [CMD, wget, -q, -O, /dev/null, http://127.0.0.1/health]
interval: 5s interval: 5s
timeout: 3s timeout: 3s
retries: 12 retries: 12
kanban: kanban:
build: image: ${WEB_IMAGE:-gitea.blyzer.com.br/blyzer/dtf-web}:${IMAGE_TAG:-latest}
context: .
dockerfile: local/Dockerfile.web
environment: environment:
WEB_INDEX: kanban.html WEB_INDEX: kanban.html
S3_PUBLIC_ENDPOINT: ${S3_PUBLIC_ENDPOINT:-http://localhost:9000} S3_PUBLIC_ENDPOINT: ${S3_PUBLIC_ENDPOINT:-http://localhost:9000}
ports: ["127.0.0.1:${KANBAN_PORT:-8081}:80"] ports: ["127.0.0.1:${KANBAN_PORT:-8081}:80"]
networks: [local, edge] networks: [local, edge]
depends_on: depends_on: [api]
api: {condition: service_healthy}
healthcheck: healthcheck:
test: [CMD, wget, -q, -O, /dev/null, http://127.0.0.1/health] test: [CMD, wget, -q, -O, /dev/null, http://127.0.0.1/health]
interval: 5s interval: 5s