From f13e3a907638d427d956af80f26fc62885d0dc06 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Thu, 30 Apr 2026 21:14:14 +0000 Subject: [PATCH] feat: setup inicial docker swarm stack --- docker-stack.yml | 49 +++++++++++++++++++++++++++++++++++ nginx/conf.d/modumfiscal.conf | 25 ++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 docker-stack.yml create mode 100644 nginx/conf.d/modumfiscal.conf diff --git a/docker-stack.yml b/docker-stack.yml new file mode 100644 index 0000000..8edf7ff --- /dev/null +++ b/docker-stack.yml @@ -0,0 +1,49 @@ +version: "3.9" + +services: + nginx: + image: nginx:alpine + ports: + - "80:80" + volumes: + - /opt/infra/nginx/conf.d:/etc/nginx/conf.d:ro + deploy: + replicas: 1 + restart_policy: + condition: on-failure + update_config: + order: start-first + networks: + - app-net + + modumfiscal-front: + image: gabriel18lb/modumfiscal-front:latest + deploy: + replicas: 1 + restart_policy: + condition: on-failure + update_config: + parallelism: 1 + delay: 10s + order: start-first + networks: + - app-net + + modumfiscal-api: + image: gabriel18lb/modumfiscal-api:latest + deploy: + replicas: 2 + restart_policy: + condition: on-failure + delay: 200s + max_attempts: 3 + update_config: + parallelism: 1 + delay: 15s + order: start-first + networks: + - app-net + +networks: + app-net: + external: true diff --git a/nginx/conf.d/modumfiscal.conf b/nginx/conf.d/modumfiscal.conf new file mode 100644 index 0000000..e958a9e --- /dev/null +++ b/nginx/conf.d/modumfiscal.conf @@ -0,0 +1,25 @@ +upstream core_api { + server app_modumfiscal-api.app-net:8090; +} + +server { + listen 80; + listen [::]:80; + server_name modumfiscal.com.br www.modumfiscal.com.br; + + location /api/ { + proxy_pass http://core_api; + proxy_http_version 1.1; + 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 / { + proxy_pass http://app_modumfiscal-front.app-net:80; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } +}