chore: remover acoplamento do newwhats e ajustar deploy sem gambiarras
This commit is contained in:
@@ -36,19 +36,20 @@ npm run build
|
||||
|
||||
# 3. Sincronizar arquivos compilados e arquivos de configuração com a VPS 1 (Produção) via Rsync VPN
|
||||
log "🚚 Despachando Backend compilado e dependências para a VPS 1 (Produção)..."
|
||||
rsync -avz --delete --exclude '.env' /home/deploy/stack/clube67/backend/dist/ deploy@10.99.0.1:/home/deploy/stack/newwhats.clube67.com/newwhats.local/backend/dist/
|
||||
rsync -avz --delete /home/deploy/stack/clube67/backend/node_modules/ deploy@10.99.0.1:/home/deploy/stack/newwhats.clube67.com/newwhats.local/backend/node_modules/
|
||||
rsync -avz /home/deploy/stack/clube67/backend/package.json /home/deploy/stack/clube67/backend/package-lock.json deploy@10.99.0.1:/home/deploy/stack/newwhats.clube67.com/newwhats.local/backend/
|
||||
rsync -avz --delete --exclude '.env' /home/deploy/stack/clube67/backend/dist/ deploy@10.99.0.1:/home/deploy/stack/clube67/backend/dist/
|
||||
rsync -avz --delete /home/deploy/stack/clube67/backend/node_modules/ deploy@10.99.0.1:/home/deploy/stack/clube67/backend/node_modules/
|
||||
rsync -avz /home/deploy/stack/clube67/backend/package.json /home/deploy/stack/clube67/backend/package-lock.json deploy@10.99.0.1:/home/deploy/stack/clube67/backend/
|
||||
|
||||
log "🚚 Despachando Frontend estático para a VPS 1 (Produção)..."
|
||||
rsync -avz --delete /home/deploy/stack/clube67/frontend/ deploy@10.99.0.1:/home/deploy/stack/newwhats.clube67.com/newwhats.local/frontend/
|
||||
rsync -avz --delete /home/deploy/stack/clube67/frontend/ deploy@10.99.0.1:/home/deploy/stack/clube67/frontend/
|
||||
|
||||
log "🚚 Despachando Nginx e Docker Compose de produção para a VPS 1..."
|
||||
rsync -avz /home/deploy/stack/clube67/nginx/default.conf deploy@10.99.0.1:/home/deploy/stack/newwhats.clube67.com/nginx/default.conf
|
||||
rsync -avz /home/deploy/stack/clube67/docker-compose.yml deploy@10.99.0.1:/home/deploy/stack/newwhats.clube67.com/docker-compose.yml
|
||||
rsync -avz /home/deploy/stack/clube67/nginx/default.conf deploy@10.99.0.1:/home/deploy/stack/clube67/nginx/default.conf
|
||||
rsync -avz /home/deploy/stack/clube67/docker-compose.yml deploy@10.99.0.1:/home/deploy/stack/clube67/docker-compose.yml
|
||||
|
||||
# 4. Parar containers antigos obsoletos e iniciar os novos na VPS 1
|
||||
log "🔄 Reiniciando containers e aplicando novas definições na VPS 1..."
|
||||
ssh -o BatchMode=yes deploy@10.99.0.1 "cd /home/deploy/stack/newwhats.clube67.com && DOCKER_HOST=unix:///run/user/1000/docker.sock docker compose down && DOCKER_HOST=unix:///run/user/1000/docker.sock docker compose up -d"
|
||||
ssh -o BatchMode=yes deploy@10.99.0.1 "cd /home/deploy/stack/clube67 && DOCKER_HOST=unix:///run/user/1000/docker.sock docker compose down && DOCKER_HOST=unix:///run/user/1000/docker.sock docker compose up -d"
|
||||
|
||||
log "✅ Deploy do Clube67 concluído com absoluto sucesso!"
|
||||
|
||||
|
||||
+14
-25
@@ -6,8 +6,8 @@ services:
|
||||
- "./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro"
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
# Roteador de Produção (clube67.com e newwhats.clube67.com)
|
||||
- "traefik.http.routers.clube67-prod.rule=Host(`clube67.com`) || Host(`www.clube67.com`) || Host(`newwhats.clube67.com`)"
|
||||
# Roteador de Produção do Clube67 (Apenas clube67.com e www.clube67.com)
|
||||
- "traefik.http.routers.clube67-prod.rule=Host(`clube67.com`) || Host(`www.clube67.com`)"
|
||||
- "traefik.http.routers.clube67-prod.entrypoints=websecure"
|
||||
- "traefik.http.routers.clube67-prod.tls.certresolver=le"
|
||||
- "traefik.http.services.clube67-prod.loadbalancer.server.port=80"
|
||||
@@ -16,37 +16,25 @@ services:
|
||||
- soc
|
||||
- web
|
||||
depends_on:
|
||||
- newwhats-backend
|
||||
- clube67-backend
|
||||
|
||||
newwhats-backend:
|
||||
clube67-backend:
|
||||
image: node:20
|
||||
container_name: newwhats-backend-prod
|
||||
container_name: clube67-backend-prod
|
||||
restart: always
|
||||
# rootless docker: container UID 0 já é mapeado para o usuário deploy do host
|
||||
working_dir: /app
|
||||
env_file:
|
||||
- "./newwhats.local/backend/.env"
|
||||
- "./backend/.env"
|
||||
environment:
|
||||
- PORT=8008
|
||||
- PORT=3001
|
||||
- NODE_ENV=production
|
||||
- DATABASE_URL=postgresql://clube67:clube67_db_pass_9903@10.99.0.3:5432/clube67?schema=public
|
||||
- DB_HOST=10.99.0.3
|
||||
- DB_PORT=5432
|
||||
- DB_USER=clube67
|
||||
- DB_PASSWORD=clube67_db_pass_9903
|
||||
- DB_NAME=clube67
|
||||
- REDIS_HOST=10.99.0.3
|
||||
- REDIS_PORT=6379
|
||||
- REDIS_PASSWORD=clube67_dragonfly_pass_9903
|
||||
volumes:
|
||||
- "/home/deploy/newwhats-sessions:/app/sessions"
|
||||
- "/home/deploy/newwhats-media:/app/media"
|
||||
- "./newwhats.local/plugins:/app/plugins"
|
||||
# Montar diretórios e arquivos pré-compilados pelo builder (VPS 4)
|
||||
- "./newwhats.local/backend/dist:/app/dist"
|
||||
- "./newwhats.local/backend/package.json:/app/package.json"
|
||||
- "./newwhats.local/backend/node_modules:/app/node_modules"
|
||||
- "./newwhats.local/frontend:/frontend"
|
||||
# Montar diretórios e arquivos do Clube67 reais
|
||||
- "./backend/uploads:/app/uploads"
|
||||
- "./backend/dist:/app/dist"
|
||||
- "./backend/package.json:/app/package.json"
|
||||
- "./backend/node_modules:/app/node_modules"
|
||||
- "./frontend:/frontend"
|
||||
command: node dist/backend/src/index.js
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
@@ -59,3 +47,4 @@ networks:
|
||||
external: true
|
||||
web:
|
||||
external: true
|
||||
|
||||
|
||||
+6
-6
@@ -1,16 +1,15 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name clube67.com www.clube67.com newwhats.clube67.com;
|
||||
server_name clube67.com www.clube67.com;
|
||||
|
||||
# Limite de upload para mídias do WhatsApp
|
||||
client_max_body_size 100M;
|
||||
client_max_body_size 50M;
|
||||
|
||||
# Resolver DNS interno do Docker para resolução dinâmica
|
||||
resolver 127.0.0.11 valid=30s;
|
||||
|
||||
# Proxy para o Socket.io (Realtime Events)
|
||||
location /socket.io/ {
|
||||
set $backend_upstream http://newwhats-backend:8008;
|
||||
set $backend_upstream http://clube67-backend:3001;
|
||||
proxy_pass $backend_upstream;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
@@ -21,9 +20,9 @@ server {
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# Proxy para tudo (Frontend Estático & API Express)
|
||||
# Proxy para tudo (Landing Page Estática & API Express do Clube67)
|
||||
location / {
|
||||
set $backend_upstream http://newwhats-backend:8008;
|
||||
set $backend_upstream http://clube67-backend:3001;
|
||||
proxy_pass $backend_upstream;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
@@ -35,3 +34,4 @@ server {
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user