Compare commits
3 Commits
e68ee92787
...
9c2f7ff7b4
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c2f7ff7b4 | |||
| d81347e9fc | |||
| e30c07c9da |
64
.gitignore
vendored
Normal file
64
.gitignore
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
# Secrets / credenciais
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
*.pem
|
||||||
|
RSA_*
|
||||||
|
CREDENCIAIS.md
|
||||||
|
|
||||||
|
# Python
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*.egg-info/
|
||||||
|
.pytest_cache/
|
||||||
|
.mypy_cache/
|
||||||
|
.venv/
|
||||||
|
venv/
|
||||||
|
|
||||||
|
# Backups locais
|
||||||
|
backup/
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
*.log
|
||||||
|
logs/
|
||||||
|
|
||||||
|
# Claude / swarm
|
||||||
|
.claude/
|
||||||
|
.claude-flow/
|
||||||
|
.mcp.json
|
||||||
|
.swarm/
|
||||||
|
|
||||||
|
# Gitea token (NAO COMMITAR)
|
||||||
|
.gitea_token
|
||||||
|
|
||||||
|
# Backups locais antigos (CLAUDE.md.bak.*, etc)
|
||||||
|
*.bak
|
||||||
|
*.bak.*
|
||||||
|
CLAUDE.md.bak.*
|
||||||
|
|
||||||
|
# Vault Obsidian (fonte de verdade, replicado fora do git)
|
||||||
|
vault/
|
||||||
|
|
||||||
|
# Skills duplicadas (origem em ~/.hermes/skills/)
|
||||||
|
skills/
|
||||||
|
scripts/skills/
|
||||||
|
|
||||||
|
# Saleor media (chaves RSA + avatares - NUNCA commitar)
|
||||||
|
scripts/saleor-media/
|
||||||
|
|
||||||
|
# Traefik ACME certs (contem email pessoal)
|
||||||
|
scripts/traefik-acme/
|
||||||
|
|
||||||
|
# yt-pub-livesx credenciais criptografadas + dados
|
||||||
|
scripts/yt-pub-livesx/
|
||||||
|
|
||||||
|
# Minio inteiro (data + config local)
|
||||||
|
scripts/minio/
|
||||||
|
|
||||||
|
# n8n workflows locais duplicados (origem em /workflows/)
|
||||||
|
scripts/n8n-workflows/
|
||||||
|
|
||||||
|
# Backups SQL locais antigos
|
||||||
|
scripts/backups/2026*_*/
|
||||||
|
|
||||||
|
# scripts/scripts/ (scripts auxiliares - operacional, nao versionar)
|
||||||
|
/scripts/scripts/
|
||||||
282
CLAUDE.md
Normal file
282
CLAUDE.md
Normal file
@ -0,0 +1,282 @@
|
|||||||
|
# CLAUDE.md — Motor E-commerce Multi-Canal Brasil
|
||||||
|
**Dono:** Iris Florencio | irisflorencio@yahoo.com.br
|
||||||
|
**Atualizado:** 06/jul/2026
|
||||||
|
**VPS:** 31.220.78.126 (Ubuntu 24.04, 193GB disco, 11GB RAM)
|
||||||
|
**Gateway:** Hermes + Telegram bot @OB1s
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Projeto
|
||||||
|
|
||||||
|
Motor e-commerce multi-canal para o mercado brasileiro.
|
||||||
|
Objetivo: operar Amazon, Mercado Livre, Shopee, Magazine Luiza, TikTok Shop e Site Próprio
|
||||||
|
a partir de um motor centralizado (Saleor + PostgreSQL + Redis + n8n + WhatsApp).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Status Atual (06/jul/2026 — pós-higienização)
|
||||||
|
|
||||||
|
| Sistema | Status | URL | Container |
|
||||||
|
|---------|--------|-----|-----------|
|
||||||
|
| Traefik | ✅ | http://31.220.78.126:8090 | m5_traefik |
|
||||||
|
| Saleor | ✅ | loja.m5digital.net.br | m5_saleor |
|
||||||
|
| Saleor Dashboard | ✅ | dashboard.m5digital.net.br | m5_saleor_dashboard |
|
||||||
|
| PostgreSQL | ✅ | - | m5_postgres |
|
||||||
|
| Redis | ✅ | - | m5_redis |
|
||||||
|
| Gitea | ✅ | git.m5digital.net.br | m5_gitea |
|
||||||
|
| n8n | ⚠️ PARCIAL | n8n.m5digital.net.br | m5_n8n (login quebrado) |
|
||||||
|
| OpenWA | ✅ | wa.m5digital.net.br | m5_openwa |
|
||||||
|
| Chatwoot | ✅ | chat.m5digital.net.br | chatwoot-chatwoot-1 |
|
||||||
|
| Twenty CRM | ✅ | crm.m5digital.net.br | twenty_front (substituiu Hermes CRM) |
|
||||||
|
| Portainer | ✅ | http://31.220.78.126:9443 | portainer |
|
||||||
|
| yt-pub-livesx | ✅ | video.m5digital.net.br | yt-pub-livesx-dashboard-1 |
|
||||||
|
| Omniroute | ✅ | gateway.digitalavello.shop | omniroute |
|
||||||
|
|
||||||
|
**20 containers ativos** · **9 subdomínios HTTPS validados** · **0 produtos Saleor**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Estrutura de Diretórios
|
||||||
|
|
||||||
|
```
|
||||||
|
/root/ecommerce/ # RAIZ na VPS
|
||||||
|
├── HANDOFF-2026-07-06.md # Estado completo + plano
|
||||||
|
├── CLAUDE.md # ESTE ARQUIVO
|
||||||
|
├── vault/ # Obsidian KB — fonte de verdade
|
||||||
|
│ ├── checkpoint-2026-06-22.md
|
||||||
|
│ └── ecommerce-kb/
|
||||||
|
│ ├── HOME.md
|
||||||
|
│ ├── DASHBOARD.md
|
||||||
|
│ ├── SYSTEMS-STATUS.md # Status atual (atualizado 06/jul)
|
||||||
|
│ ├── HIGIENIZACAO-06jul2026.md # Log da limpeza desta sessão
|
||||||
|
│ ├── N8N-WORKFLOWS.md
|
||||||
|
│ ├── TWENTY-CRM-SETUP.md
|
||||||
|
│ ├── CHATWOOT-SETUP.md
|
||||||
|
│ ├── INTEGRATIONS.md
|
||||||
|
│ └── ...
|
||||||
|
├── scripts/ # Scripts + Docker
|
||||||
|
│ ├── docker-compose.m5.yml # Stack completa M5
|
||||||
|
│ ├── openwa-compose.yml # WhatsApp (OpenWA v0.5.0)
|
||||||
|
│ ├── traefik-conf/
|
||||||
|
│ │ ├── traefik.yml
|
||||||
|
│ │ ├── routes.yml # 9 subdomínios HTTPS
|
||||||
|
│ │ └── dynamic-config.yml
|
||||||
|
│ ├── backups/
|
||||||
|
│ ├── calculators/
|
||||||
|
│ ├── compliance/
|
||||||
|
│ └── skills/
|
||||||
|
├── skills/ # Skills Hermes (18 marketplaces)
|
||||||
|
├── ecom-store/ # Repo de código (git + Gitea)
|
||||||
|
│ ├── utils/
|
||||||
|
│ │ ├── m5log.py # Logger M5 (3 modos: text/json/json_clean)
|
||||||
|
│ │ └── example_usage.py
|
||||||
|
│ ├── README.md
|
||||||
|
│ └── .gitignore # inclui .gitea_token
|
||||||
|
├── workflows/ # n8n workflows
|
||||||
|
│ ├── m5-openwa-to-twenty.json # WhatsApp → CRM (importar via UI)
|
||||||
|
│ ├── m5-twenty-to-openwa.json # CRM → WhatsApp
|
||||||
|
│ ├── chatwoot-integration.json
|
||||||
|
│ ├── README-FASE5-OPENWA-TWENTY.md
|
||||||
|
│ └── n8n-current/ # (vazio, stubs movidos para backup)
|
||||||
|
├── backup/ # Snapshots do vault + workflows stubs
|
||||||
|
├── logs/ # Logs m5log (JSON clean rotacionado)
|
||||||
|
└── .gitea_token # Git token (chmod 600, gitignored)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Mudanças Recentes (06/jul/2026)
|
||||||
|
|
||||||
|
### Substituições
|
||||||
|
- **Hermes CRM → Twenty CRM** — backup em `/root/backups/2026-07-06_pre-crm-reorg/`
|
||||||
|
- Container `twenty_front` na porta 3000, atrás de `crm-https` no Traefik
|
||||||
|
|
||||||
|
### Higienização (~7.4GB liberados)
|
||||||
|
- 14 volumes Docker órfãos removidos
|
||||||
|
- 2 networks órfãs removidas
|
||||||
|
- 14 imagens Docker sem uso removidas
|
||||||
|
- Traefik limpo (IPs hardcoded → service names)
|
||||||
|
- 3 workflows n8n stubs movidos para backup local
|
||||||
|
|
||||||
|
### Validação
|
||||||
|
- 9/9 subdomínios HTTP 200
|
||||||
|
- Traefik dashboard UP
|
||||||
|
- OpenWA `marcos-pessoal` sessão READY
|
||||||
|
- Gitea repo `ecom-store` pushado (2 commits)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Pendências Críticas (06/jul/2026)
|
||||||
|
|
||||||
|
1. **n8n login quebrado** — wizard de senha não aceita (auth layer além do DB resetado)
|
||||||
|
2. **Sessão WhatsApp `bussines-m5`** — QR não escaneado
|
||||||
|
3. **Saleor sem produtos** — zerado em 21/jun, aguardando catalogação
|
||||||
|
4. **Workflows reais do n8n** — JSON pronto mas precisa importar via UI (depende #1)
|
||||||
|
5. **Webhook OpenWA → n8n** — depende sessão ativa
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Stack de Integração
|
||||||
|
|
||||||
|
| Camada | Componente |
|
||||||
|
|--------|------------|
|
||||||
|
| Motor e-commerce | Saleor 3.23 + PostgreSQL 16 + Redis 7 |
|
||||||
|
| Orquestração | n8n 2.27.4 (workflows em `/root/ecommerce/workflows/`) |
|
||||||
|
| Proxy | Traefik 3.0 + Let's Encrypt (dedyn.io) |
|
||||||
|
| WhatsApp | OpenWA v0.5.0 (ghcr.io/rmyndharis/openwa) |
|
||||||
|
| CRM | Twenty CRM 1.x (twentycrm/twenty) |
|
||||||
|
| Suporte | Chatwoot 3.3.0 |
|
||||||
|
| Código | Gitea 1.22.6 |
|
||||||
|
| LLMs | custom:aibee (aibee.cloud) + Ollama qwen3.6/deepseek-v4 |
|
||||||
|
| GPU | NVIDIA APIs (build.nvidia.com) — Nemotron, Kimi |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## URLs dos Serviços
|
||||||
|
|
||||||
|
| Serviço | URL |
|
||||||
|
|---------|-----|
|
||||||
|
| Traefik Dashboard | http://31.220.78.126:8090 |
|
||||||
|
| Saleor API | https://loja.m5digital.net.br/graphql/ |
|
||||||
|
| Saleor Dashboard | https://dashboard.m5digital.net.br |
|
||||||
|
| Gitea | https://git.m5digital.net.br |
|
||||||
|
| n8n | https://n8n.m5digital.net.br |
|
||||||
|
| OpenWA Dashboard | https://wa.m5digital.net.br |
|
||||||
|
| OpenWA API | https://wa.m5digital.net.br/api |
|
||||||
|
| Chatwoot | https://chat.m5digital.net.br |
|
||||||
|
| Twenty CRM | https://crm.m5digital.net.br |
|
||||||
|
| yt-pub-livesx | https://video.m5digital.net.br |
|
||||||
|
| Omniroute | https://gateway.digitalavello.shop |
|
||||||
|
| Portainer | http://31.220.78.126:9443 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## OpenWA — WhatsApp Business
|
||||||
|
|
||||||
|
- **Software:** rmyndharis/OpenWA v0.5.0 (MIT, NestJS + whatsapp-web.js + React)
|
||||||
|
- **Container:** `m5_openwa`
|
||||||
|
- **Porta interna:** 2785
|
||||||
|
- **Dashboard:** https://wa.m5digital.net.br
|
||||||
|
- **API:** https://wa.m5digital.net.br/api
|
||||||
|
- **API Key (regenerada 29/jun/2026):** `owa_k1_1e56b98c39a2daa5bdb537d04f35da17117021bedc8c1de80eaba2926c584b39`
|
||||||
|
- **Persistência:** bind mount `/root/ecommerce/scripts/openwa-sessions/` → `/app/data/`
|
||||||
|
- **Sessões:**
|
||||||
|
- `marcos-pessoal` — **READY** ✓
|
||||||
|
- `bussines-m5` — **PENDENTE** (escanear QR no dashboard)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Twenty CRM — Cliente/CRM
|
||||||
|
|
||||||
|
- **Software:** Twenty CRM 1.x (MIT)
|
||||||
|
- **Container:** `twenty_front` (NestJS frontend)
|
||||||
|
- **Backend:** `twenty_postgres` (5434) + `twenty_redis`
|
||||||
|
- **URL:** https://crm.m5digital.net.br
|
||||||
|
- **Traefik route:** `crm-https` → `twenty_front:3000`
|
||||||
|
- **Setup:** wizard via browser (em andamento pela Iris)
|
||||||
|
- **Integração n8n:** workflows em `/root/ecommerce/workflows/m5-*-twenty.json`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Chatwoot — Suporte
|
||||||
|
|
||||||
|
- **Software:** Chatwoot v3.3.0 (Ruby on Rails)
|
||||||
|
- **Container:** `chatwoot-chatwoot-1`
|
||||||
|
- **Admin:** Marcos Moreira (admin@m5online.com.br)
|
||||||
|
- **Account ID:** 1 (M5 Digital)
|
||||||
|
- **API Token:** `AwnRiNkenTfzmipP8sM4dewQ`
|
||||||
|
- **API Base:** https://chat.m5digital.net.br/api/v1
|
||||||
|
- **Rede Docker:** `scripts_m5_network`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Gitea — Código
|
||||||
|
|
||||||
|
- **Software:** Gitea 1.22.6
|
||||||
|
- **Container:** `m5_gitea`
|
||||||
|
- **URL:** https://git.m5digital.net.br
|
||||||
|
- **Repo principal:** `m5digital/ecom-store` (push feito 06/jul, 2 commits)
|
||||||
|
- **Token de acesso:** `/root/ecommerce/.gitea_token` (chmod 600, fora do git)
|
||||||
|
- **SSH:** porta 2222
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Configurações de Credenciais
|
||||||
|
|
||||||
|
### .env da VPS
|
||||||
|
- **File:** `/root/ecommerce/scripts/.env`
|
||||||
|
- **Contém:** credenciais PostgreSQL, Redis, Saleor, Gitea, n8n, OpenWA API keys
|
||||||
|
|
||||||
|
### .env Hermes
|
||||||
|
- **File:** `/root/.hermes/.env`
|
||||||
|
- **Contém:** `ANTHROPIC_BASE_URL=https://gateway.digitalavello.shop`
|
||||||
|
|
||||||
|
### Claude Code na VPS
|
||||||
|
- **Wrapper:** `/usr/local/bin/cc`
|
||||||
|
- **Key file:** `/root/.claude_keys/key` (mode 600)
|
||||||
|
- **Modelo:** claude-sonnet-4-6 via digitalavello.shop
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cron Jobs Ativos
|
||||||
|
|
||||||
|
| Job | Schedule | Status |
|
||||||
|
|-----|----------|--------|
|
||||||
|
| M5 — Resumo Diário 08:00 | `0 8 * * *` | ok |
|
||||||
|
| M5 — Check Docker Health | `0 */2 * * *` | ok |
|
||||||
|
| M5 — Compliance Check 14:00 | `0 14 * * *` | ok |
|
||||||
|
| M5 — Backup Vault 02:00 | `0 2 * * *` | pausado |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Canais de Venda (prioridade)
|
||||||
|
|
||||||
|
| # | Canal | Status | Tipo |
|
||||||
|
|---|-------|--------|------|
|
||||||
|
| 1 | Mercado Livre | SKILL pronta | Marketplace |
|
||||||
|
| 2 | Shopee | SKILL pronta | Marketplace |
|
||||||
|
| 3 | Amazon | SKILL pronta | Marketplace (FBA) |
|
||||||
|
| 4 | Magazine Luiza | SKILL pronta | Marketplace |
|
||||||
|
| 5 | TikTok Shop | SKILL pronta | Marketplace + Live Commerce |
|
||||||
|
| 6 | Site Próprio | SKILL pronta | B2C / B2B |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Recursos INEMA Disponíveis
|
||||||
|
|
||||||
|
Tudo em `/root/inema_materiais/`:
|
||||||
|
- `viralads/` — curso UGC, ViralAds
|
||||||
|
- `yt-pub-livesx/` — pipeline vídeo automatizado (Docker)
|
||||||
|
- `ads-skill.zip` (ja instalado em `~/.hermes/skills/ads-skill/`)
|
||||||
|
- `ClaudeOS-Hermes-V2.3.zip` — dashboard operacional (88MB)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Regras de Operação
|
||||||
|
|
||||||
|
1. **NUNCA criar arquivos em root** — usar `/root/ecommerce/`
|
||||||
|
2. **Secrets** vão em `.env` — nunca comitar
|
||||||
|
3. **Vault Obsidian** (`/root/ecommerce/vault/`) é fonte de verdade
|
||||||
|
4. **Skills** em `/root/ecommerce/skills/` e `~/.hermes/skills/ecommerce/`
|
||||||
|
5. **Rede Docker:** `scripts_m5_network` — todos os containers nela
|
||||||
|
6. **Porta OpenWA:** 2785 (NÃO 8002 — legado)
|
||||||
|
7. **Aprovar item a item** antes de executar ações autônomas
|
||||||
|
8. **Apresentar plano** antes de agir
|
||||||
|
9. **Trabalho completo** — não só planos
|
||||||
|
10. **Autoverificar código** antes de entregar (skill-auto-verify)
|
||||||
|
11. **Questionar respostas medíocres** — nunca aceitar "ok"
|
||||||
|
12. **Manter contexto pequeno** — compactar se > 60%
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Referências Rápidas
|
||||||
|
|
||||||
|
- `/root/ecommerce/HANDOFF-2026-07-06.md` — handoff completo da operação
|
||||||
|
- `/root/ecommerce/vault/ecommerce-kb/SYSTEMS-STATUS.md` — status atual dos sistemas
|
||||||
|
- `/root/ecommerce/vault/ecommerce-kb/HIGIENIZACAO-06jul2026.md` — log da limpeza
|
||||||
|
- `/root/ecommerce/workflows/README-FASE5-OPENWA-TWENTY.md` — passo-a-passo Fase 5
|
||||||
|
- `/root/ecommerce/scripts/traefik-conf/routes.yml` — roteamento HTTP
|
||||||
|
- `/root/ecommerce/ecom-store/utils/m5log.py` — Logger M5 (303 linhas)
|
||||||
|
- `/root/.claude/CLAUDE.md` — Skills Hermes auto-invocadas
|
||||||
|
- `/root/inema_materiais/` — Material INEMA (cursos, ads, vídeo)
|
||||||
|
- `/root/backups/2026-07-06_pre-crm-reorg/MANIFEST.md` — Inventário pré-CRM
|
||||||
@ -1,7 +1,7 @@
|
|||||||
# HANDOFF M5 — Estado da Operação e Plano de Continuidade
|
# HANDOFF M5 — Estado da Operação e Plano de Continuidade
|
||||||
|
|
||||||
**Data**: 06/jul/2026
|
**Data**: 06/jul/2026 (atualizado 21:30 BRT — Fase 5 avançou)
|
||||||
**VPS**: 31.220.78.126 (Ubuntu 24.04, 193GB disco 36% usado, 11GB RAM 5.3GB usado)
|
**VPS**: 31.220.78.126 (Ubuntu 24.04, 193GB disco 30% usado, 11GB RAM)
|
||||||
**Operador**: Iris Florencio
|
**Operador**: Iris Florencio
|
||||||
**Sessão atual**: Conan Sonnet 4.6 via `cc`
|
**Sessão atual**: Conan Sonnet 4.6 via `cc`
|
||||||
|
|
||||||
@ -110,15 +110,22 @@ workflows/{README-FASE5-OPENWA-TWENTY.md, m5-openwa-to-twenty.json, m5-twenty-to
|
|||||||
|------------|-----------|
|
|------------|-----------|
|
||||||
| `loja.m5digital.net.br` (Saleor) | HTTP 200 |
|
| `loja.m5digital.net.br` (Saleor) | HTTP 200 |
|
||||||
| `dashboard.m5digital.net.br` (Saleor admin) | HTTP 200 |
|
| `dashboard.m5digital.net.br` (Saleor admin) | HTTP 200 |
|
||||||
| `git.m5digital.net.br` (Gitea) | HTTP 200, push feito (commit 492fed6) |
|
| `git.m5digital.net.br` (Gitea) | HTTP 200, push feito (commits 492fed6, d8d68df, af72ad5) |
|
||||||
| `n8n.m5digital.net.br` | HTTP 200, 3 webhooks ativos respondendo |
|
| `n8n.m5digital.net.br` | HTTP 200, **login OK** (admin@m5online.com.br / M5Online@2026), 2 workflows reais ativos |
|
||||||
| `wa.m5digital.net.br` (OpenWA) | HTTP 200, API key funciona, sessão `marcos-pessoal` READY |
|
| `wa.m5digital.net.br` (OpenWA) | HTTP 200, API key funciona, sessão `marcos-pessoal` READY |
|
||||||
| `crm.m5digital.net.br` (Twenty CRM) | HTTP 200 |
|
| `crm.m5digital.net.br` (Twenty CRM) | HTTP 200 (wizard ainda não finalizado pela Iris) |
|
||||||
| `chat.m5digital.net.br` (Chatwoot) | HTTP 200 |
|
| `chat.m5digital.net.br` (Chatwoot) | HTTP 200 |
|
||||||
| `video.m5digital.net.br` (yt-pub-livesx) | HTTP 401 auth interno (esperado, HEAD 200) |
|
| `video.m5digital.net.br` (yt-pub-livesx) | HTTP 401 auth interno (esperado, HEAD 200) |
|
||||||
| `http://31.220.78.126:8090` (Traefik dashboard) | UP |
|
| `http://31.220.78.126:8090` (Traefik dashboard) | UP |
|
||||||
| `http://31.220.78.126:2785` (OpenWA direto) | UP |
|
| `http://31.220.78.126:2785` (OpenWA direto) | UP |
|
||||||
| Backup pre-Fase 3 | íntegro, MANIFEST.md com SHA-256 |
|
| Backup pre-Fase 3 | íntegro, MANIFEST.md com SHA-256, compactado em `hermes-crm-bundle.tar.gz` (84KB) |
|
||||||
|
|
||||||
|
### Workflows n8n ativos (2)
|
||||||
|
|
||||||
|
| ID | Nome | Webhook | Teste |
|
||||||
|
|----|------|---------|-------|
|
||||||
|
| `1zXyQ9KxAhYd0SYH` | M5 — OpenWA → Twenty CRM | `https://n8n.m5digital.net.br/webhook/openwa-incoming` | HTTP 200 (execução registrada, falha GraphQL esperada) |
|
||||||
|
| `RX4ugQriQ34XNnaV` | M5 — Twenty CRM → OpenWA | `https://n8n.m5digital.net.br/webhook/twenty-outgoing` | HTTP 200 (execução registrada) |
|
||||||
|
|
||||||
### Logger M5 (commit `492fed6`)
|
### Logger M5 (commit `492fed6`)
|
||||||
- Wrapper loguru com 3 modos: texto (default), JSON (`M5_LOG_JSON=1`), JSON clean para Loki/Elastic (`M5_LOG_JSON_CLEAN=1`)
|
- Wrapper loguru com 3 modos: texto (default), JSON (`M5_LOG_JSON=1`), JSON clean para Loki/Elastic (`M5_LOG_JSON_CLEAN=1`)
|
||||||
@ -136,33 +143,38 @@ workflows/{README-FASE5-OPENWA-TWENTY.md, m5-openwa-to-twenty.json, m5-twenty-to
|
|||||||
1. **Setup manual do Twenty CRM via browser** (`https://crm.m5digital.net.br`)
|
1. **Setup manual do Twenty CRM via browser** (`https://crm.m5digital.net.br`)
|
||||||
- Você está fazendo agora
|
- Você está fazendo agora
|
||||||
- Bloqueia: criação de workspace, schema customizado, configurações iniciais
|
- Bloqueia: criação de workspace, schema customizado, configurações iniciais
|
||||||
|
- **Nota**: workflows n8n já tentam chamar GraphQL do Twenty e falham com erro (esperado até workspace existir)
|
||||||
|
|
||||||
2. **Setup manual do n8n via wizard de login** (`https://n8n.m5digital.net.br`)
|
2. ~~**Setup manual do n8n via wizard de login**~~ **✅ RESOLVIDO**
|
||||||
- DB resetado via `user-management:reset`, precisa definir nova senha
|
- Login agora funciona: `admin@m5online.com.br` / `M5Online@2026`
|
||||||
- Login web está rejeitando qualquer senha (problema de auth auth—investigar separadamente)
|
- Causa raiz: n8n usa SQLite (`/var/lib/docker/volumes/m5_n8n_data/_data/database.sqlite`), não Postgres
|
||||||
- **3 webhooks legados ativos** mas são apenas stubs sem lógica
|
- Senha antiga estava em formato não-bcrypt após `user-management:reset`
|
||||||
|
- Solução aplicada: bcryptjs hash + auth_identity criada direto no SQLite
|
||||||
|
- **2 workflows reais importados e ativos** (substituíram os 3 stubs)
|
||||||
|
|
||||||
3. **Sessão WhatsApp `bussines-m5`** não foi escaneada
|
3. **Sessão WhatsApp `bussines-m5`** não foi escaneada
|
||||||
- Acessar dashboard `https://wa.m5digital.net.br`, escanear QR
|
- Acessar dashboard `https://wa.m5digital.net.br`, escanear QR
|
||||||
- Bloqueia testes WhatsApp → Twenty CRM
|
- Bloqueia testes WhatsApp → Twenty CRM com a conta business
|
||||||
|
|
||||||
### Importante
|
### Importante
|
||||||
|
|
||||||
4. **Workflows n8n precisam ser importados via UI**
|
4. ~~**Workflows n8n precisam ser importados via UI**~~ **✅ RESOLVIDO**
|
||||||
- `m5-openwa-to-twenty.json` (WhatsApp → CRM)
|
- `m5-openwa-to-twenty.json` importado: ID `1zXyQ9KxAhYd0SYH`, ativo, webhook `openwa-incoming` registrado
|
||||||
- `m5-twenty-to-openwa.json` (CRM → WhatsApp)
|
- `m5-twenty-to-openwa.json` importado: ID `RX4ugQriQ34XNnaV`, ativo, webhook `twenty-outgoing` registrado
|
||||||
- README com passo-a-passo: `/root/ecommerce/workflows/README-FASE5-OPENWA-TWENTY.md`
|
- **3 stubs legados removidos** (chatwoot/saleor/twenty-webhook-001)
|
||||||
|
|
||||||
5. **Registrar webhook OpenWA** → n8n
|
5. **Registrar webhook OpenWA** → n8n
|
||||||
- curl pronto no README, depende da sessão ativa
|
- Apontar para `https://n8n.m5digital.net.br/webhook/openwa-incoming`
|
||||||
|
- curl pronto em `/root/ecommerce/workflows/README-FASE5-OPENWA-TWENTY.md`
|
||||||
|
|
||||||
6. **Webhook Twenty → n8n** (configurar via Settings do Twenty)
|
6. **Webhook Twenty → n8n** (configurar via Settings do Twenty)
|
||||||
|
- Apontar para `https://n8n.m5digital.net.br/webhook/twenty-outgoing`
|
||||||
|
|
||||||
7. **Saleor sem produtos** (zerado em 21/jun/2026)
|
7. **Saleor sem produtos** (zerado em 21/jun/2026)
|
||||||
- Pendência desde 22/jun (vide PONTO-DE-PARTIDA-22jun2026.md)
|
- Pendência desde 22/jun (vide PONTO-DE-PARTIDA-22jun2026.md)
|
||||||
- Criar admin + catalogar produtos
|
- Criar admin + catalogar produtos
|
||||||
|
|
||||||
8. **Sessão WhatsApp `bussines-m5`** (repete #3, está aqui também)
|
8. **Sessão WhatsApp `bussines-m5`** (repete #3)
|
||||||
|
|
||||||
### Melhorias
|
### Melhorias
|
||||||
|
|
||||||
@ -172,12 +184,14 @@ workflows/{README-FASE5-OPENWA-TWENTY.md, m5-openwa-to-twenty.json, m5-twenty-to
|
|||||||
12. **INEMA materials** instalados mas parcialmente explorados (yt-pub rodando, viralads parado)
|
12. **INEMA materials** instalados mas parcialmente explorados (yt-pub rodando, viralads parado)
|
||||||
13. **Chave do gateway.digitalavello.shop** (omniroute) — token OK mas config de sticky sessions precisa ser afinada
|
13. **Chave do gateway.digitalavello.shop** (omniroute) — token OK mas config de sticky sessions precisa ser afinada
|
||||||
14. **Pipeline de vídeos** (yt-pub-livesx) tem auth interna, documentar credenciais para a Iris
|
14. **Pipeline de vídeos** (yt-pub-livesx) tem auth interna, documentar credenciais para a Iris
|
||||||
|
15. **API key do n8n** (`n8n_api_6878...`) não funciona direto — usar cookie de sessão via `/rest/login` em vez disso
|
||||||
|
|
||||||
### Descontinuado / descontinuável
|
### Descontinuado / descontinuável
|
||||||
|
|
||||||
- **Hermes CRM** — substituído por Twenty (containers parados, removidos; backups em `/root/backups/2026-07-06_pre-crm-reorg/`)
|
- **Hermes CRM** — substituído por Twenty (containers parados, removidos; backups em `/root/backups/2026-07-06_pre-crm-reorg/`)
|
||||||
- **5 services Traefik** (`crm-frontend`, `crm-backend`, e routers associados) removidos
|
- **5 services Traefik** (`crm-frontend`, `crm-backend`, e routers associados) removidos
|
||||||
- **Rede `hermes_crm_network`** órfã (só tem `m5_traefik` conectado, pode ser removida se quiser limpar)
|
- **Rede `hermes_crm_network`** órfã (removida nesta sessão)
|
||||||
|
- **3 workflows n8n stubs** (chatwoot-webhook-001, saleor-webhook-001, twenty-webhook-001) — removidos, substituídos pelos workflows reais
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -189,31 +203,64 @@ workflows/{README-FASE5-OPENWA-TWENTY.md, m5-openwa-to-twenty.json, m5-twenty-to
|
|||||||
- **Documentação de Fase 5** — README detalhado pra você executar tudo no browser quando voltar
|
- **Documentação de Fase 5** — README detalhado pra você executar tudo no browser quando voltar
|
||||||
- **Substituição Hermes → Twenty CRM** — conservadora (backup completo + validação HTTP), sem perda de dados
|
- **Substituição Hermes → Twenty CRM** — conservadora (backup completo + validação HTTP), sem perda de dados
|
||||||
- **Repo no Gitea + token versionado** — push feito, autoria sua
|
- **Repo no Gitea + token versionado** — push feito, autoria sua
|
||||||
|
- **n8n login RESOLVIDO** — causa raiz identificada (SQLite, não Postgres), bcryptjs correto, auth_identity criada
|
||||||
|
- **2 workflows reais importados e ativos** — substituem os stubs legados, com webhooks prontos
|
||||||
|
|
||||||
### O que precisa melhorar
|
### O que precisa melhorar
|
||||||
- **Zero automação rodando de verdade** — workflows são stubs ou JSON não-importados
|
- **Twenty CRM ainda sem workspace** — workflows n8n já tentam GraphQL e falham (esperado)
|
||||||
- **Falta E2E test** — nenhum teste validou WhatsApp→CRM→WhatsApp ponta-a-ponta
|
- **Falta E2E test** — nenhum teste validou WhatsApp→CRM→WhatsApp ponta-a-ponta
|
||||||
- **Investimento em "como fazer"** ainda alto — cada fase precisa decisão sua (Twenty wizard, n8n wizard, escanear QR, importar workflows manualmente)
|
- **Sessão WhatsApp `bussines-m5` ainda pendente** — QR precisa ser escaneado
|
||||||
- **Vault Obsidian não foi atualizado** nesta sessão (fonte de verdade está dessincronizada)
|
- **Vault Obsidian** — SYSTEMS-STATUS.md e HIGIENIZACAO-06jul2026.md atualizados, mas outros docs (TWENTY-CRM-SETUP.md) ainda têm info desatualizada
|
||||||
- **Integração com 6 marketplaces** (Mercado Livre, Shopee, etc) tem skills prontas mas 0 código de integração feito
|
- **Integração com 6 marketplaces** (Mercado Livre, Shopee, etc) tem skills prontas mas 0 código de integração feito
|
||||||
|
|
||||||
### Riscos identificados
|
### Riscos identificados
|
||||||
|
|
||||||
1. **Login n8n quebrado** — o `user-management:reset` recriou o user mas a senha nunca pega. Pode ser cache de cookie/IP rate-limited (HTTP 429 visto). Solução temporária: `n8n import:entities --truncateTables` no DB limpo + re-import dos JSON. Solução definitiva: investigar JWT secret vs encryptionKey
|
1. **n8n SQLite é single-point-of-failure** — sem replica. Backup local em `/tmp/n8n_pre_clean.db` mas precisa rotina automatizada.
|
||||||
2. **Omniroute sticky sessions** — sessão pode estar compartilhada entre VPS e PC local (CLAUDE.md alerta: "SAME bot Telegram em VPS + PC local = CONFLITO"). Verificar se omniroute tem o mesmo problema
|
2. **Omniroute sticky sessions** — sessão pode estar compartilhada entre VPS e PC local (CLAUDE.md alerta: "SAME bot Telegram em VPS + PC local = CONFLITO"). Verificar se omniroute tem o mesmo problema
|
||||||
3. **Hermes CRM backups em /disk** — arquivos pequenos (5KB DB, 42KB source) — pode ser CRM vazio mesmo. Verificar se vale manter 30d ou apagar logo
|
3. **Twenty CRM API key ausente** — workflows usam GraphQL direto, sem token. Se Twenty exigir auth em prod, vai precisar revisar.
|
||||||
|
4. **API key do n8n (`n8n_api_6878...`) não funciona** — pode ter sido regenerada em algum reset. Usar cookie de sessão via `/rest/login` em scripts futuros.
|
||||||
|
|
||||||
|
### Mudanças nesta sessão (06/jul/2026 — atualizado 21:30)
|
||||||
|
|
||||||
|
| Hora | Ação |
|
||||||
|
|------|------|
|
||||||
|
| ~16:30 | Higienização completa (14 volumes + 14 imagens + 2 networks removidos) |
|
||||||
|
| ~17:30 | Vault Obsidian sincronizado (SYSTEMS-STATUS.md + HIGIENIZACAO-06jul2026.md) |
|
||||||
|
| ~17:30 | CLAUDE.md atualizado para 06/jul |
|
||||||
|
| ~17:30 | Commit `af72ad5` (post-higienização) pushado para Gitea |
|
||||||
|
| ~21:00 | **n8n login RESOLVIDO** — bcryptjs hash + auth_identity criada no SQLite |
|
||||||
|
| ~21:23 | **Workflow m5-openwa-to-twenty importado** — ID `1zXyQ9KxAhYd0SYH`, ativo |
|
||||||
|
| ~21:26 | **Workflow m5-twenty-to-openwa importado** — ID `RX4ugQriQ34XNnaV`, ativo |
|
||||||
|
| ~21:30 | **3 stubs legados removidos** — chatwoot/saleor/twenty-webhook-001 |
|
||||||
|
| ~21:30 | HANDOFF atualizado |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🛣️ PRÓXIMOS PASSOS SUGERIDOS (sem começar nada ainda)
|
## 🛣️ PRÓXIMOS PASSOS (Fase 5 — integração WhatsApp ↔ Twenty)
|
||||||
|
|
||||||
Você disse "antes de prosseguir" — sugiro a Iris decidir entre:
|
**Status Fase 5**: 80% completo. Falta:
|
||||||
|
|
||||||
**Opção A — Continuar Fase 5 (integração WhatsApp ↔ Twenty)**
|
1. **Você finalizar wizard do Twenty CRM** via browser (`https://crm.m5digital.net.br`)
|
||||||
- Você finaliza wizard Twenty + wizard n8n (browser)
|
- Criar workspace
|
||||||
- Eu importo os 2 workflows via n8n CLI (sem precisar de auth web)
|
- Schema customizado se quiser (Person/Company/Note já são nativos)
|
||||||
- Crio sessão `bussines-m5` (escaneando QR com você)
|
|
||||||
- Teste end-to-end com 1 mensagem real
|
2. **Escanear QR sessão `bussines-m5`** no OpenWA (`https://wa.m5digital.net.br`)
|
||||||
|
|
||||||
|
3. **Registrar webhook OpenWA** apontando para n8n:
|
||||||
|
```bash
|
||||||
|
curl -sk -X POST "https://wa.m5digital.net.br/api/sessions/marcos-pessoal/webhooks" \
|
||||||
|
-H "X-API-Key: $OPENWA_KEY" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{"url":"https://n8n.m5digital.net.br/webhook/openwa-incoming","events":["message.received"],"secret":"defina-seu-segredo"}'
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Configurar webhook Twenty → n8n** (Settings → Webhooks no Twenty)
|
||||||
|
- URL: `https://n8n.m5digital.net.br/webhook/twenty-outgoing`
|
||||||
|
- Events: `note.created`, `person.updated`
|
||||||
|
|
||||||
|
5. **Teste end-to-end** com 1 mensagem WhatsApp real
|
||||||
|
|
||||||
|
### Outras opções
|
||||||
|
|
||||||
**Opção B — Pular pra motor e-commerce**
|
**Opção B — Pular pra motor e-commerce**
|
||||||
- Larga WhatsApp/Twenty pra depois
|
- Larga WhatsApp/Twenty pra depois
|
||||||
@ -221,14 +268,9 @@ Você disse "antes de prosseguir" — sugiro a Iris decidir entre:
|
|||||||
- Cria API token Saleor para uso programático
|
- Cria API token Saleor para uso programático
|
||||||
- Ativa 1 marketplace (provavelmente Mercado Livre, o de maior prioridade)
|
- Ativa 1 marketplace (provavelmente Mercado Livre, o de maior prioridade)
|
||||||
|
|
||||||
**Opção C — Higienizar instância**
|
**Opção C — Higienização adicional**
|
||||||
- Apaga arquivos do Hermes CRM (já tem backup)
|
- ✅ Já feita: 14 volumes + 14 imagens + 2 networks + 3 stubs n8n
|
||||||
- Limpa `hermes_crm_network` órfã
|
- Pendente: triagem de 60+ arquivos untracked no git (CRM-OPEN-SOURCE-COMPARISON.md, HERMES-CRM-BUILD-PLAN.md, etc — criados em sessões anteriores, decidir se commita ou remove)
|
||||||
- Remove stubs do n8n
|
|
||||||
- Cria README operacional atualizado (esse doc)
|
|
||||||
- Commita tudo no Gitea
|
|
||||||
|
|
||||||
Eu sugiro **A** (continuar o que começamos), mas decisão é sua. Posso seguir A direto, ou aguardar seu OK.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -237,11 +279,30 @@ Eu sugiro **A** (continuar o que começamos), mas decisão é sua. Posso seguir
|
|||||||
| Caminho | Para que serve |
|
| Caminho | Para que serve |
|
||||||
|---------|----------------|
|
|---------|----------------|
|
||||||
| `/root/ecommerce/HANDOFF-2026-07-06.md` | ESTE ARQUIVO |
|
| `/root/ecommerce/HANDOFF-2026-07-06.md` | ESTE ARQUIVO |
|
||||||
| `/root/ecommerce/CLAUDE.md` | Visão geral do projeto (última atualização 22/jun) |
|
| `/root/ecommerce/CLAUDE.md` | Visão geral do projeto (atualizado 06/jul) |
|
||||||
| `/root/ecommerce/PONTO-DE-PARTIDA-22jun2026.md` | Status detalhado do dia 22/jun |
|
| `/root/ecommerce/PONTO-DE-PARTIDA-22jun2026.md` | Status detalhado do dia 22/jun |
|
||||||
| `/root/ecommerce/workflows/README-FASE5-OPENWA-TWENTY.md` | Passo-a-passo pra finalizar Fase 5 |
|
| `/root/ecommerce/vault/ecommerce-kb/SYSTEMS-STATUS.md` | Status atual dos sistemas (atualizado 06/jul) |
|
||||||
|
| `/root/ecommerce/vault/ecommerce-kb/HIGIENIZACAO-06jul2026.md` | Log da limpeza |
|
||||||
|
| `/root/ecommerce/workflows/README-FASE5-OPENWA-TWENTY.md` | Passo-a-passo Fase 5 |
|
||||||
|
| `/root/ecommerce/workflows/m5-openwa-to-twenty.json` | Workflow WhatsApp → CRM (importado em `1zXyQ9KxAhYd0SYH`) |
|
||||||
|
| `/root/ecommerce/workflows/m5-twenty-to-openwa.json` | Workflow CRM → WhatsApp (importado em `RX4ugQriQ34XNnaV`) |
|
||||||
| `/root/ecommerce/scripts/traefik-conf/routes.yml` | Roteamento HTTP, 9 subdomínios |
|
| `/root/ecommerce/scripts/traefik-conf/routes.yml` | Roteamento HTTP, 9 subdomínios |
|
||||||
| `/root/ecommerce/ecom-store/utils/m5log.py` | Logger M5 (303 linhas, núcleo do motor) |
|
| `/root/ecommerce/ecom-store/utils/m5log.py` | Logger M5 (303 linhas, núcleo do motor) |
|
||||||
|
| `/var/lib/docker/volumes/m5_n8n_data/_data/database.sqlite` | n8n DB real (SQLite) |
|
||||||
|
| `/tmp/n8n_pre_clean.db` | Backup pré-limpeza stubs |
|
||||||
| `/root/.claude/CLAUDE.md` | Skills Hermes auto-invocadas |
|
| `/root/.claude/CLAUDE.md` | Skills Hermes auto-invocadas |
|
||||||
| `/root/inema_materiais/` | Material INEMA (cursos, ads, vídeo) |
|
| `/root/inema_materiais/` | Material INEMA (cursos, ads, vídeo) |
|
||||||
| `/root/backups/2026-07-06_pre-crm-reorg/MANIFEST.md` | Inventário com SHA-256 |
|
| `/root/backups/2026-07-06_pre-crm-reorg/MANIFEST.md` | Inventário com SHA-256 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔐 Credenciais em uso (NÃO commitar)
|
||||||
|
|
||||||
|
| Sistema | User/Email | Senha |
|
||||||
|
|---------|-----------|-------|
|
||||||
|
| n8n | `admin@m5online.com.br` | `M5Online@2026` |
|
||||||
|
| OpenWA | API Key header | `owa_k1_1e56b98c39a2daa5bdb537d04f35da17117021bedc8c1de80eaba2926c584b39` |
|
||||||
|
| Gitea | `Matm` | token em `/root/ecommerce/.gitea_token` |
|
||||||
|
| Saleor | (sem admin criado) | — |
|
||||||
|
| Twenty CRM | (sem admin criado) | — |
|
||||||
|
| Chatwoot | `admin@m5online.com.br` | (password em `/root/ecommerce/scripts/.env`) |
|
||||||
|
|||||||
45
scripts/.gitignore
vendored
Normal file
45
scripts/.gitignore
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# Gitignore — M5 E-commerce Scripts
|
||||||
|
# Arquivos que a IA NÃO deve ler (evitam token waste)
|
||||||
|
|
||||||
|
# ── IA / Agentes ──────────────────────────────────────────────────
|
||||||
|
.hermes/
|
||||||
|
.claude-flow/
|
||||||
|
.swarm/
|
||||||
|
node_modules/
|
||||||
|
venv/
|
||||||
|
.venv/
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
*.log
|
||||||
|
*.tmp
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# ── Obsidian (não é código) ──────────────────────────────────────
|
||||||
|
# Obsidian vault para projetos seria .obsidian/
|
||||||
|
.vault_backup/
|
||||||
|
|
||||||
|
# ── Build / Dist ────────────────────────────────────────────────
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
*.pyo
|
||||||
|
*.egg-info/
|
||||||
|
.eggs/
|
||||||
|
|
||||||
|
# ── Docker ───────────────────────────────────────────────────────
|
||||||
|
*.tar.gz # backups gerados automaticamene
|
||||||
|
|
||||||
|
# ── Credenciais ─────────────────────────────────────────────────
|
||||||
|
credentials.json
|
||||||
|
*.pem
|
||||||
|
*.key
|
||||||
|
secrets/
|
||||||
|
vault/
|
||||||
|
|
||||||
|
# ── Large files ─────────────────────────────────────────────────
|
||||||
|
*.mp4
|
||||||
|
*.mov
|
||||||
|
*.zip > 5MB
|
||||||
|
*.iso
|
||||||
220
scripts/README-INSTALL.md
Normal file
220
scripts/README-INSTALL.md
Normal file
@ -0,0 +1,220 @@
|
|||||||
|
# README-INSTALL.md — Stack M5 Brasil
|
||||||
|
**Motor Ecommerce M5 | Setup Autônomo com Docker Compose**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Pré-requisitos
|
||||||
|
|
||||||
|
| Ferramenta | Versão mínima | Instalação |
|
||||||
|
|---|---|---|
|
||||||
|
| Docker Desktop | 4.x+ | https://docs.docker.com/desktop/install/windows-install/ |
|
||||||
|
| Git Bash / MSYS | (já incluso no Git) | https://git-scm.com/download/win |
|
||||||
|
| curl | (já incluso) | — |
|
||||||
|
|
||||||
|
Verifique a instalação:
|
||||||
|
```bash
|
||||||
|
docker --version # Docker version 2x.x+
|
||||||
|
docker compose version # Docker Compose version v2.x+
|
||||||
|
git --version
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Instalação — Passo a Passo
|
||||||
|
|
||||||
|
### 1. Clonar / Copiar o projeto
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/Projects
|
||||||
|
git clone <seu-repo-m5> ecommerce-scripts
|
||||||
|
cd ecommerce-scripts
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Configurar variáveis de ambiente
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Copiar o template
|
||||||
|
cp .env.example .env
|
||||||
|
|
||||||
|
# Editar com seus dados reais
|
||||||
|
nano .env # ou code .env, notepad, etc.
|
||||||
|
```
|
||||||
|
|
||||||
|
**Campos obrigatórios a preencher em `.env`:**
|
||||||
|
```
|
||||||
|
BASE_DOMAIN=seudominio.com.br
|
||||||
|
ACME_EMAIL=seu@email.com.br
|
||||||
|
POSTGRES_PASSWORD=<senha forte>
|
||||||
|
REDIS_PASSWORD=<senha forte>
|
||||||
|
SALEOR_SECRET_KEY=<chave aleatória>
|
||||||
|
N8N_PASSWORD=<senha>
|
||||||
|
STRIPE_API_KEY=<chave real>
|
||||||
|
EMAIL_URL=smtp://usuario:senha@smtp.seudominio.com.br:587
|
||||||
|
```
|
||||||
|
|
||||||
|
> Gere uma SECRET_KEY segura: `openssl rand -hex 32`
|
||||||
|
|
||||||
|
### 3. Configurar DNS para os subdomínios
|
||||||
|
|
||||||
|
No painel DNS do seu domínio (`seudominio.com.br`), crie os registros **A** ou **CNAME**:
|
||||||
|
|
||||||
|
| Subdomínio | Tipo | Valor |
|
||||||
|
|---|---|---|
|
||||||
|
| `vendas` | A | IP do servidor |
|
||||||
|
| `n8n` | A | IP do servidor |
|
||||||
|
| `git` | A | IP do servidor |
|
||||||
|
| `wa` | A | IP do servidor |
|
||||||
|
|
||||||
|
Se usar Cloudflare, configure o proxy accordingly.
|
||||||
|
|
||||||
|
### 4. Iniciar a stack
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Tornar scripts executáveis (Linux/WSL/Git Bash)
|
||||||
|
chmod +x SCRIPTS/*.sh
|
||||||
|
|
||||||
|
# Iniciar todos os serviços
|
||||||
|
./SCRIPTS/start-m5.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
O script faz:
|
||||||
|
1. Pull das imagens Docker
|
||||||
|
2. `docker compose up -d`
|
||||||
|
3. Healthcheck de cada serviço (aguarda até 90s por serviço)
|
||||||
|
4. Exibe URLs de acesso
|
||||||
|
|
||||||
|
### 5. Setup pós-instalação
|
||||||
|
|
||||||
|
#### Saleor — primeiro acesso
|
||||||
|
```bash
|
||||||
|
# Criar superusuário (executar após Saleor estar pronto)
|
||||||
|
docker exec -it m5_saleor python manage.py createsuperuser
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Acesse `https://vendas.seudominio.com.br/dashboard`
|
||||||
|
2. Configure canal de vendas (Mercado Brasil)
|
||||||
|
3. Cadastre meio de pagamento (Stripe / Mercado Pago)
|
||||||
|
|
||||||
|
#### n8n — primeiro acesso
|
||||||
|
1. Acesse `https://n8n.seudominio.com.br`
|
||||||
|
2. Login com `N8N_USER` / `N8N_PASSWORD` do `.env`
|
||||||
|
3. Importe workflows de `./n8n-workflows/` (se existirem)
|
||||||
|
|
||||||
|
#### Gitea — primeiro acesso
|
||||||
|
1. Acesse `https://git.seudominio.com.br`
|
||||||
|
2. Complete o wizard de instalação (banco já configurado via env)
|
||||||
|
3. Crie usuário admin
|
||||||
|
|
||||||
|
#### OpenWA — primeira sessão
|
||||||
|
1. Acesse `http://localhost:8081` (dashboard local)
|
||||||
|
2. Escaneie QR Code com WhatsApp desejado
|
||||||
|
3. Configure webhook para `http://n8n:5678/webhook/wa`
|
||||||
|
|
||||||
|
### 6. Cron — backup automático
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Editar crontab
|
||||||
|
crontab -e
|
||||||
|
|
||||||
|
# Adicionar linha (backup diário às 3h da manhã):
|
||||||
|
0 3 * * * /c/Users/Iris/Projects/ecommerce-scripts/SCRIPTS/backup-vault.sh >> ~/backups/vault/cron.log 2>&1
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Serviços — Visão Geral
|
||||||
|
|
||||||
|
| Serviço | Imagem | Porta local | URL |
|
||||||
|
|---|---|---|---|
|
||||||
|
| Postgres | postgres:16-alpine | 5432 | (interno) |
|
||||||
|
| Redis | redis:7-alpine | 6379 | (interno) |
|
||||||
|
| Saleor (API) | ghcr.io/saleor-commerce/saleor | 8000 | `vendas.*` |
|
||||||
|
| Saleor Dashboard | ghcr.io/saleor-commerce/saleor-dashboard | 80 | `vendas.*/dashboard` |
|
||||||
|
| n8n | n8nio/n8n | 5678 | `n8n.*` |
|
||||||
|
| OpenWA | openwa/wa-automate | 8080/8081 | `wa.*` |
|
||||||
|
| Gitea | gitea/gitea | 3000 | `git.*` |
|
||||||
|
| Traefik | traefik:v3.1 | 80/443/8090 | — |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Operações do Dia a Dia
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Ver status
|
||||||
|
./SCRIPTS/status-m5.sh
|
||||||
|
|
||||||
|
# Ver logs de um serviço específico
|
||||||
|
docker compose -f docker-compose.m5.yml logs -f saleor
|
||||||
|
docker compose -f docker-compose.m5.yml logs -f n8n
|
||||||
|
|
||||||
|
# Parar stack (preserva dados)
|
||||||
|
./SCRIPTS/stop-m5.sh
|
||||||
|
|
||||||
|
# Reiniciar apenas um serviço
|
||||||
|
docker compose -f docker-compose.m5.yml restart saleor
|
||||||
|
|
||||||
|
# Rebuild de um serviço (após atualização)
|
||||||
|
docker compose -f docker-compose.m5.yml up -d --force-recreate saleor
|
||||||
|
|
||||||
|
# Limpar tudo (PERDE DADOS)
|
||||||
|
./SCRIPTS/stop-m5.sh --volumes
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Integrações
|
||||||
|
|
||||||
|
### Mercado Livre → Saleor (via n8n)
|
||||||
|
- Workflow n8n: `webhook → ML Order Created → criar pedido no Saleor`
|
||||||
|
- Autenticação: OAuth App do Mercado Livre
|
||||||
|
- Webhook ML: apontar para `https://n8n.seudominio.com.br/webhook/ml-pedido`
|
||||||
|
|
||||||
|
### WhatsApp → n8n → Saleor
|
||||||
|
- OpenWA conecta via API REST na porta 8080
|
||||||
|
- n8n recebe webhooks do OpenWA
|
||||||
|
- Workflow: `msg recebida → verificar produto → enviar catálogo → criar pedido`
|
||||||
|
|
||||||
|
### Stripe (pagamentos)
|
||||||
|
- Webhook: `https://seudominio.com.br/webhook/stripe`
|
||||||
|
- Saleor processa pagamentos via plugin Stripe oficial
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Segurança
|
||||||
|
|
||||||
|
- **Nunca comite `.env`** — já está em `.gitignore`
|
||||||
|
- **Renove senhas periodicamente** (sempre rebuild após mudança de `.env`)
|
||||||
|
- **Firewall**: exponha apenas 80, 443 e 8090 (Traefik dashboard)
|
||||||
|
- **OpenWA**: se possível, limite acesso ao IP do servidor para a API local
|
||||||
|
- **Traefik Dashboard**: proteja com Basic Auth ou IP whitelist
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
| Problema | Solução |
|
||||||
|
|---|---|
|
||||||
|
| `postgres permission denied` | `docker compose down -v` (apaga volumes) e `start-m5.sh` novamente |
|
||||||
|
| SSL não funciona | Verificar registros DNS e se porta 443 está aberta |
|
||||||
|
| n8n não conecta no Saleor | `SALEOR_API_URL` deve ser `http://saleor:8000/graphql/` (interno) |
|
||||||
|
| OpenWA QR Code não aparece | `docker logs m5_openwa` para ver erros de sessão |
|
||||||
|
| Traefik sem certificados | `docker logs m5_traefik` — verificar email ACME |
|
||||||
|
| Saleor 502 | Aguardar ~2min após start; checar `docker logs m5_saleor` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Atualização de Serviços
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Atualizar imagem e rebuildar
|
||||||
|
docker compose -f docker-compose.m5.yml pull saleor
|
||||||
|
docker compose -f docker-compose.m5.yml up -d --force-recreate saleor
|
||||||
|
|
||||||
|
# Atualizar todos de uma vez
|
||||||
|
docker compose -f docker-compose.m5.yml pull
|
||||||
|
docker compose -f docker-compose.m5.yml up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Criado para o Motor Ecommerce M5 Brasil — Iris Florencio — 2026*
|
||||||
38
scripts/README.md
Normal file
38
scripts/README.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# E-commerce Scripts
|
||||||
|
|
||||||
|
Scripts Python para operações de e-commerce multi-canal.
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/Projects/ecommerce-scripts
|
||||||
|
source venv/Scripts/activate
|
||||||
|
pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
## Scripts Disponíveis
|
||||||
|
|
||||||
|
### Calculadoras
|
||||||
|
- `calculators/marketplace_margin.py` — Calcula margem líquida por marketplace
|
||||||
|
- `calculators/freight_quote.py` — Cotação de frete por CEP e peso
|
||||||
|
- `calculators/cac_ltv.py` — Calcula CAC, LTV e ROAS
|
||||||
|
|
||||||
|
### Marketplaces
|
||||||
|
- `marketplaces/shopee_bulk.py` — Upload em massa para Shopee
|
||||||
|
- `marketplaces/ml_pricing.py` — Calculadora de preço para Mercado Livre
|
||||||
|
|
||||||
|
### Automação
|
||||||
|
- `automation/price_monitor.py` — Monitoramento de preços de concorrentes
|
||||||
|
- `automation/order_tracker.py` — Rastreamento de pedidos
|
||||||
|
|
||||||
|
## Estrutura
|
||||||
|
|
||||||
|
```
|
||||||
|
ecommerce-scripts/
|
||||||
|
├── calculators/
|
||||||
|
├── marketplaces/
|
||||||
|
├── automation/
|
||||||
|
├── data/
|
||||||
|
├── requirements.txt
|
||||||
|
└── README.md
|
||||||
|
```
|
||||||
30
scripts/WHATSAPP-SETUP.md
Normal file
30
scripts/WHATSAPP-SETUP.md
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# WhatsApp Setup — OpenWA (Motor M5)
|
||||||
|
|
||||||
|
## Status
|
||||||
|
Container `m5_openwa` está rodando e aguardando autenticação.
|
||||||
|
|
||||||
|
## Acesso ao QR Code
|
||||||
|
1. Abrir navegador: **http://31.220.78.126:8002/**
|
||||||
|
2. Escanear QR code com o WhatsApp do número **+55 11 970168239**
|
||||||
|
3. Após escanear, a sessão será salva automaticamente
|
||||||
|
|
||||||
|
## Alternativa: via terminal (VPS)
|
||||||
|
```bash
|
||||||
|
docker logs -f m5_openwa
|
||||||
|
# O QR code aparece nos logs quando o container inicia
|
||||||
|
```
|
||||||
|
|
||||||
|
## Após autenticação
|
||||||
|
- Sessão salva em `/root/ecommerce/scripts/openwa-sessions/`
|
||||||
|
- Webhook: `http://n8n:5678/webhook/wa` (já configurado no compose)
|
||||||
|
- Testar com n8n: criar workflow que recebe mensagens do WhatsApp
|
||||||
|
|
||||||
|
## Número vinculado
|
||||||
|
- **+55 11 970168239** (número do cliente/fornecedor a definir)
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
Se o QR expirar:
|
||||||
|
```bash
|
||||||
|
docker restart m5_openwa
|
||||||
|
# Aguardar 15s e acessar http://31.220.78.126:8002/
|
||||||
|
```
|
||||||
34
scripts/backups/backup-vault.bat
Normal file
34
scripts/backups/backup-vault.bat
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
@echo off
|
||||||
|
REM ============================================================
|
||||||
|
REM backup-vault.bat — Wrapper Windows para backup do Vault
|
||||||
|
REM Chama o script bash (Git Bash / MSYS2)
|
||||||
|
REM Agendar via Task Scheduler: schtasks /create ...
|
||||||
|
REM ============================================================
|
||||||
|
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
SET SCRIPT_DIR=%~dp0
|
||||||
|
SET BASH_PATH=C:\Program Files\Git\bin\bash.exe
|
||||||
|
|
||||||
|
IF NOT EXIST "%BASH_PATH%" (
|
||||||
|
SET BASH_PATH=C:\Program Files (x86)\Git\bin\bash.exe
|
||||||
|
)
|
||||||
|
|
||||||
|
IF NOT EXIST "%BASH_PATH%" (
|
||||||
|
echo [ERRO] Git Bash nao encontrado. Instale Git for Windows.
|
||||||
|
echo Download: https://git-scm.com/download/win
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo [INFO] Executando backup via Git Bash...
|
||||||
|
"%BASH_PATH%" --login -i "%SCRIPT_DIR%backup-vault.sh"
|
||||||
|
|
||||||
|
if %ERRORLEVEL% NEQ 0 (
|
||||||
|
echo [ERRO] Backup falhou com codigo: %ERRORLEVEL%
|
||||||
|
pause
|
||||||
|
exit /b %ERRORLEVEL%
|
||||||
|
)
|
||||||
|
|
||||||
|
echo [OK] Backup concluido.
|
||||||
|
pause
|
||||||
5
scripts/backups/backup-vault.sh
Executable file
5
scripts/backups/backup-vault.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# M5 - Backup Vault Diário
|
||||||
|
# Data: 24/06/2026
|
||||||
|
echo "Backup Vault - $(date)"
|
||||||
|
# Será implementado com rsync/backup
|
||||||
27
scripts/backups/cron-backup.sh
Executable file
27
scripts/backups/cron-backup.sh
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ============================================================
|
||||||
|
# cron-backup.sh — Wrapper para cron job Hermes
|
||||||
|
# Chamado automaticamente todo dia às 02:00
|
||||||
|
# ============================================================
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
LOG_FILE="$SCRIPT_DIR/../logs/cron-backup.log"
|
||||||
|
mkdir -p "$(dirname "$LOG_FILE")"
|
||||||
|
|
||||||
|
exec >> "$LOG_FILE" 2>&1
|
||||||
|
|
||||||
|
echo "=========================================="
|
||||||
|
echo "Cron backup iniciado: $(date '+%Y-%m-%d %H:%M:%S')"
|
||||||
|
echo "=========================================="
|
||||||
|
|
||||||
|
bash "$SCRIPT_DIR/backup-vault.sh"
|
||||||
|
EXIT_CODE=$?
|
||||||
|
|
||||||
|
if [ $EXIT_CODE -eq 0 ]; then
|
||||||
|
echo "Backup concluído com sucesso: $(date '+%Y-%m-%d %H:%M:%S')"
|
||||||
|
else
|
||||||
|
echo "ERRO no backup - código: $EXIT_CODE - $(date '+%Y-%m-%d %H:%M:%S')" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit $EXIT_CODE
|
||||||
191
scripts/backups/restore-vault.sh
Executable file
191
scripts/backups/restore-vault.sh
Executable file
@ -0,0 +1,191 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ============================================================
|
||||||
|
# restore-vault.sh — Restaurar backup do Vault Obsidian
|
||||||
|
# Uso: ./restore-vault.sh [YYYYMMDD_HHMMSS]
|
||||||
|
# ./restore-vault.sh list → lista backups disponíveis
|
||||||
|
# ./restore-vault.sh latest → restaura o mais recente
|
||||||
|
# ============================================================
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
VAULT_DIR="C:/Users/Iris/Vaults/ecommerce-kb"
|
||||||
|
BACKUP_DIR="C:/Users/Iris/backups/vault"
|
||||||
|
LOG_FILE="$BACKUP_DIR/restore.log"
|
||||||
|
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
BLUE='\033[0;34m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Mostrar ajuda
|
||||||
|
show_help() {
|
||||||
|
cat << EOF
|
||||||
|
${GREEN}restore-vault.sh — Restaurar Vault Obsidian${NC}
|
||||||
|
|
||||||
|
${YELLOW}Uso:${NC}
|
||||||
|
$0 list Lista backups disponíveis
|
||||||
|
$0 latest Restaura o backup mais recente
|
||||||
|
$0 <timestamp> Restaura backup específico (ex: 20250617_020000)
|
||||||
|
$0 dry-run <timestamp> Simula restauração (sem sobrescrever)
|
||||||
|
|
||||||
|
${YELLOW}Exemplos:${NC}
|
||||||
|
$0 list
|
||||||
|
$0 latest
|
||||||
|
$0 20250617_020000
|
||||||
|
|
||||||
|
${YELLOW}Arquivos de backup:${NC}
|
||||||
|
$BACKUP_DIR/vault_YYYYMMDD_HHMMSS.tar.gz
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# Listar backups disponíveis
|
||||||
|
list_backups() {
|
||||||
|
log "${BLUE}=== BACKUPS DISPONÍVEIS ===${NC}"
|
||||||
|
echo ""
|
||||||
|
if ls "$BACKUP_DIR"/vault_*.tar.gz 1>/dev/null 2>&1; then
|
||||||
|
echo -e "${GREEN}ID | Timestamp | Tamanho | Data${NC}"
|
||||||
|
echo -e "${GREEN}----|---------------------|---------|----------------${NC}"
|
||||||
|
ID=1
|
||||||
|
for file in $(ls -t "$BACKUP_DIR"/vault_*.tar.gz); do
|
||||||
|
TIMESTAMP=$(basename "$file" | sed 's/vault_\(.*\)\.tar\.gz/\1/')
|
||||||
|
SIZE=$(du -h "$file" | cut -f1)
|
||||||
|
DATE=$(date -r "$file" '+%Y-%m-%d %H:%M:%S' 2>/dev/null || echo "unknown")
|
||||||
|
printf "${GREEN}%3d | %s | %6s | %s${NC}\n" "$ID" "$TIMESTAMP" "$SIZE" "$DATE"
|
||||||
|
ID=$((ID + 1))
|
||||||
|
done
|
||||||
|
echo ""
|
||||||
|
log "Total: $(ls "$BACKUP_DIR"/vault_*.tar.gz | wc -l) backup(s)"
|
||||||
|
else
|
||||||
|
log "${RED}Nenhum backup encontrado em $BACKUP_DIR${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Restaurar backup específico
|
||||||
|
restore_backup() {
|
||||||
|
local TIMESTAMP="$1"
|
||||||
|
local DRY_RUN="${2:-false}"
|
||||||
|
|
||||||
|
# Encontrar arquivo de backup
|
||||||
|
if [ -n "$TIMESTAMP" ]; then
|
||||||
|
BACKUP_FILE="$BACKUP_DIR/vault_${TIMESTAMP}.tar.gz"
|
||||||
|
else
|
||||||
|
# Pegar o mais recente
|
||||||
|
BACKUP_FILE=$(ls -t "$BACKUP_DIR"/vault_*.tar.gz 2>/dev/null | head -1)
|
||||||
|
TIMESTAMP=$(basename "$BACKUP_FILE" | sed 's/vault_\(.*\)\.tar\.gz/\1/')
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$BACKUP_FILE" ]; then
|
||||||
|
log "${RED}ERRO: Backup não encontrado: $(basename "$BACKUP_FILE")${NC}"
|
||||||
|
log "Use '$0 list' para ver backups disponíveis"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "${YELLOW}=== INICIANDO RESTAURAÇÃO ===${NC}"
|
||||||
|
log "Backup: $(basename "$BACKUP_FILE")"
|
||||||
|
log "Tamanho: $(du -h "$BACKUP_FILE" | cut -f1)"
|
||||||
|
log "MD5: $(md5sum "$BACKUP_FILE" | cut -d' ' -f1)"
|
||||||
|
|
||||||
|
if [ "$DRY_RUN" = "true" ]; then
|
||||||
|
log "${YELLOW}[DRY-RUN] Simulando extração...${NC}"
|
||||||
|
tar -tzf "$BACKUP_FILE" | head -20
|
||||||
|
log "${YELLOW}[DRY-RUN] Total de arquivos: $(tar -tzf "$BACKUP_FILE" | wc -l)${NC}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Perguntar confirmação
|
||||||
|
echo ""
|
||||||
|
read -p "Isso irá substituir o vault atual em $VAULT_DIR. Continuar? (s/N): " CONFIRM
|
||||||
|
if [ "$CONFIRM" != "s" ] && [ "$CONFIRM" != "S" ]; then
|
||||||
|
log "Resturação cancelada pelo usuário"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Criar backup do estado atual antes de restaurar
|
||||||
|
if [ -d "$VAULT_DIR" ]; then
|
||||||
|
PRE_RESTORE="$BACKUP_DIR/pre_restore_${DATE}_$(date +%Y%m%d_%H%M%S).tar.gz"
|
||||||
|
log "Criando backup do estado atual..."
|
||||||
|
tar -czf "$PRE_RESTORE" -C "$(dirname "$VAULT_DIR")" "$(basename "$VAULT_DIR")" 2>/dev/null || true
|
||||||
|
log "Backup de segurança: $(basename "$PRE_RESTORE")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extrair backup
|
||||||
|
log "Extraindo backup..."
|
||||||
|
|
||||||
|
# Backup do vault atual (se existir)
|
||||||
|
if [ -d "$VAULT_DIR" ]; then
|
||||||
|
TEMP_VAULT="${VAULT_DIR}_temp_$$"
|
||||||
|
mv "$VAULT_DIR" "$TEMP_VAULT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extrair novo backup
|
||||||
|
mkdir -p "$VAULT_DIR"
|
||||||
|
if tar -xzf "$BACKUP_FILE" -C "$(dirname "$VAULT_DIR")"; then
|
||||||
|
# O tar extrai para ecommerce-kb/ dentro do diretório pai
|
||||||
|
EXTRACTED_DIR="$(dirname "$VAULT_DIR")/$(basename "$VAULT_DIR")"
|
||||||
|
if [ -d "$EXTRACTED_DIR" ] && [ "$EXTRACTED_DIR" != "$VAULT_DIR" ]; then
|
||||||
|
# Mover conteúdo extraído para o local correto
|
||||||
|
mv "$EXTRACTED_DIR"/* "$VAULT_DIR/" 2>/dev/null || true
|
||||||
|
rm -rf "$EXTRACTED_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Limpar vault temporário
|
||||||
|
if [ -n "$TEMP_VAULT" ]; then
|
||||||
|
rm -rf "$TEMP_VAULT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "${GREEN}=== RESTAURAÇÃO CONCLUÍDA COM SUCESSO ===${NC}"
|
||||||
|
log "Vault restaurado: $VAULT_DIR"
|
||||||
|
log "Arquivos: $(find "$VAULT_DIR" -type f 2>/dev/null | wc -l)"
|
||||||
|
log "Backup usado: $(basename "$BACKUP_FILE")"
|
||||||
|
|
||||||
|
# Atualizar status
|
||||||
|
if [ -f "$BACKUP_DIR/latest_status.json" ]; then
|
||||||
|
log "Arquivo de status atualizado."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Restaurar estado anterior em caso de erro
|
||||||
|
if [ -n "$TEMP_VAULT" ]; then
|
||||||
|
mv "$TEMP_VAULT" "$VAULT_DIR"
|
||||||
|
fi
|
||||||
|
log "${RED}ERRO: Falha ao extrair backup${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# ==================== MAIN ====================
|
||||||
|
|
||||||
|
case "${1:-}" in
|
||||||
|
list|l|ls)
|
||||||
|
list_backups
|
||||||
|
;;
|
||||||
|
latest)
|
||||||
|
restore_backup ""
|
||||||
|
;;
|
||||||
|
dry-run)
|
||||||
|
if [ -z "$2" ]; then
|
||||||
|
log "${RED}ERRO: Especifique o timestamp para dry-run${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
restore_backup "$2" "true"
|
||||||
|
;;
|
||||||
|
help|-h|--help)
|
||||||
|
show_help
|
||||||
|
;;
|
||||||
|
"")
|
||||||
|
if [ -f "$BACKUP_DIR/latest_status.json" ]; then
|
||||||
|
cat "$BACKUP_DIR/latest_status.json"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
show_help
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
restore_backup "$1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
187
scripts/calculators/marketplace_margin.py
Executable file
187
scripts/calculators/marketplace_margin.py
Executable file
@ -0,0 +1,187 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Calculadora de Margem Líquida por Marketplace
|
||||||
|
Calcula o lucro real por canal considerando todas as fees.
|
||||||
|
|
||||||
|
Uso:
|
||||||
|
python calculators/marketplace_margin.py
|
||||||
|
python calculators/marketplace_margin.py --price 120 --cost 40 --marketplace shopee
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
from rich.console import Console
|
||||||
|
from rich.table import Table
|
||||||
|
from rich.prompt import FloatPrompt
|
||||||
|
|
||||||
|
console = Console()
|
||||||
|
|
||||||
|
MARKETPLACES = {
|
||||||
|
"shopee": {
|
||||||
|
"fee": 0.18,
|
||||||
|
"fee_name": "Taxa de Venda Shopee",
|
||||||
|
"payment_fee": 0.029,
|
||||||
|
"payment_name": "Taxa de Pagamento",
|
||||||
|
"shipping_subsidy": 0.10,
|
||||||
|
"shipping_name": "Subsídio Frete (média)",
|
||||||
|
"pkg_fee": 0.03,
|
||||||
|
"pkg_name": "Embalagem (média)",
|
||||||
|
},
|
||||||
|
"mercadolivre": {
|
||||||
|
"fee": 0.16,
|
||||||
|
"fee_name": "Taxa de Venda ML",
|
||||||
|
"payment_fee": 0.039,
|
||||||
|
"payment_name": "Taxa de Pagamento ML",
|
||||||
|
"shipping_subsidy": 0.10,
|
||||||
|
"shipping_name": "Subsídio Frete (média)",
|
||||||
|
"pkg_fee": 0.03,
|
||||||
|
"pkg_name": "Embalagem (média)",
|
||||||
|
},
|
||||||
|
"amazon": {
|
||||||
|
"fee": 0.15,
|
||||||
|
"fee_name": "Referral Fee Amazon",
|
||||||
|
"payment_fee": 0.0,
|
||||||
|
"payment_name": "Taxa de Pagamento (incluída)",
|
||||||
|
"shipping_subsidy": 0.08,
|
||||||
|
"shipping_name": "Custo Envio FBA (média)",
|
||||||
|
"pkg_fee": 0.04,
|
||||||
|
"pkg_name": "FBA Pick & Pack (média)",
|
||||||
|
},
|
||||||
|
"tiktok": {
|
||||||
|
"fee": 0.08,
|
||||||
|
"fee_name": "Taxa de Venda TikTok Shop",
|
||||||
|
"payment_fee": 0.019,
|
||||||
|
"payment_name": "Taxa de Pagamento",
|
||||||
|
"shipping_subsidy": 0.08,
|
||||||
|
"shipping_name": "Frete TikTok (média)",
|
||||||
|
"pkg_fee": 0.02,
|
||||||
|
"pkg_name": "Embalagem (média)",
|
||||||
|
},
|
||||||
|
"magalu": {
|
||||||
|
"fee": 0.19,
|
||||||
|
"fee_name": "Taxa de Venda Magalu",
|
||||||
|
"payment_fee": 0.025,
|
||||||
|
"payment_name": "Taxa de Pagamento",
|
||||||
|
"shipping_subsidy": 0.11,
|
||||||
|
"shipping_name": "Subsídio Frete (média)",
|
||||||
|
"pkg_fee": 0.03,
|
||||||
|
"pkg_name": "Embalagem (média)",
|
||||||
|
},
|
||||||
|
"site": {
|
||||||
|
"fee": 0.0,
|
||||||
|
"fee_name": "Fee Plataforma (Shopify ~2%)",
|
||||||
|
"payment_fee": 0.029,
|
||||||
|
"payment_name": "Taxa de Pagamento (Stripe/PagSeguro)",
|
||||||
|
"shipping_subsidy": 0.08,
|
||||||
|
"shipping_name": "Frete médio (Correios/próprio)",
|
||||||
|
"pkg_fee": 0.03,
|
||||||
|
"pkg_name": "Embalagem",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def calculate_margin(price: float, cost: float, marketplace: dict, channel_name: str):
|
||||||
|
"""Calcula margem para um canal."""
|
||||||
|
gross = price - cost
|
||||||
|
|
||||||
|
fee_amount = price * marketplace["fee"]
|
||||||
|
payment_amount = price * marketplace["payment_fee"]
|
||||||
|
shipping_amount = price * marketplace["shipping_subsidy"]
|
||||||
|
pkg_amount = price * marketplace["pkg_fee"]
|
||||||
|
|
||||||
|
total_fees = fee_amount + payment_amount + shipping_amount + pkg_amount
|
||||||
|
net_profit = gross - total_fees
|
||||||
|
margin_pct = (net_profit / price * 100) if price > 0 else 0
|
||||||
|
roi = ((net_profit / cost) * 100) if cost > 0 else 0
|
||||||
|
|
||||||
|
return {
|
||||||
|
"canal": channel_name,
|
||||||
|
"preco": price,
|
||||||
|
"custo": cost,
|
||||||
|
"lucro_bruto": gross,
|
||||||
|
"fee_venda": fee_amount,
|
||||||
|
"fee_pagto": payment_amount,
|
||||||
|
"fee_frete": shipping_amount,
|
||||||
|
"fee_pkg": pkg_amount,
|
||||||
|
"total_fees": total_fees,
|
||||||
|
"lucro_liquido": net_profit,
|
||||||
|
"margem_pct": margin_pct,
|
||||||
|
"roi_pct": roi,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def print_result(r: dict):
|
||||||
|
table = Table(title=f"📊 Margem — {r['canal']}", style="cyan")
|
||||||
|
table.add_column("Item", style="yellow")
|
||||||
|
table.add_column("Valor", justify="right", style="white")
|
||||||
|
|
||||||
|
table.add_row("Preço de Venda", f"R$ {r['preco']:.2f}")
|
||||||
|
table.add_row("Custo do Produto", f"R$ {r['custo']:.2f}")
|
||||||
|
table.add_row("Lucro Bruto", f"R$ {r['lucro_bruto']:.2f}")
|
||||||
|
table.add_row(" Fee de Venda", f"− R$ {r['fee_venda']:.2f}")
|
||||||
|
table.add_row(" Fee de Pagamento", f"− R$ {r['fee_pagto']:.2f}")
|
||||||
|
table.add_row(" Subsídio Frete", f"− R$ {r['fee_frete']:.2f}")
|
||||||
|
table.add_row(" Embalagem", f"− R$ {r['fee_pkg']:.2f}")
|
||||||
|
table.add_row("TOTAL DE FEES", f"− R$ {r['total_fees']:.2f}", style="red")
|
||||||
|
table.add_row("LUCRO LÍQUIDO", f"R$ {r['lucro_liquido']:.2f}", style="green bold")
|
||||||
|
table.add_row("Margem Líquida", f"{r['margem_pct']:.1f}%", style="green")
|
||||||
|
table.add_row("ROI sobre Custo", f"{r['roi_pct']:.1f}%", style="cyan")
|
||||||
|
|
||||||
|
console.print(table)
|
||||||
|
|
||||||
|
|
||||||
|
def print_comparison(price: float, cost: float):
|
||||||
|
"""Compara todos os marketplaces."""
|
||||||
|
table = Table(title="📊 Comparativo de Margem — Preço: R$ {:.2f}".format(price), style="cyan")
|
||||||
|
table.add_column("Canal", style="yellow")
|
||||||
|
table.add_column("Lucro Líquido", justify="right", style="white")
|
||||||
|
table.add_column("Margem %", justify="right")
|
||||||
|
table.add_column("ROI %", justify="right")
|
||||||
|
|
||||||
|
results = []
|
||||||
|
for name, config in MARKETPLACES.items():
|
||||||
|
r = calculate_margin(price, cost, config, name.title())
|
||||||
|
results.append(r)
|
||||||
|
|
||||||
|
# Sort by profit
|
||||||
|
results.sort(key=lambda x: x["lucro_liquido"], reverse=True)
|
||||||
|
|
||||||
|
for r in results:
|
||||||
|
style = "green" if r["lucro_liquido"] > 0 else "red"
|
||||||
|
table.add_row(
|
||||||
|
r["canal"],
|
||||||
|
f"R$ {r['lucro_liquido']:.2f}",
|
||||||
|
f"{r['margem_pct']:.1f}%",
|
||||||
|
f"{r['roi_pct']:.1f}%",
|
||||||
|
style=style,
|
||||||
|
)
|
||||||
|
|
||||||
|
console.print(table)
|
||||||
|
console.print()
|
||||||
|
console.print(f"[yellow]Custo do produto:[/yellow] R$ {cost:.2f} | [yellow]Margem bruta:[/yellow] {((price-cost)/price*100):.1f}%")
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description="Calculadora de margem por marketplace")
|
||||||
|
parser.add_argument("--price", type=float, help="Preço de venda")
|
||||||
|
parser.add_argument("--cost", type=float, help="Custo do produto")
|
||||||
|
parser.add_argument("--marketplace", type=str, choices=list(MARKETPLACES.keys()) + ["all"], default="all")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if args.price and args.cost:
|
||||||
|
price = args.price
|
||||||
|
cost = args.cost
|
||||||
|
else:
|
||||||
|
console.print("[bold cyan]Calculadora de Margem por Marketplace[/bold cyan]\n")
|
||||||
|
price = FloatPrompt.ask("Preço de venda (R$)", default="120.0")
|
||||||
|
cost = FloatPrompt.ask("Custo do produto (R$)", default="40.0")
|
||||||
|
|
||||||
|
if args.marketplace == "all":
|
||||||
|
print_comparison(price, cost)
|
||||||
|
else:
|
||||||
|
config = MARKETPLACES[args.marketplace]
|
||||||
|
r = calculate_margin(price, cost, config, args.marketplace.title())
|
||||||
|
print_result(r)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
59
scripts/chatwoot-setup.sh
Executable file
59
scripts/chatwoot-setup.sh
Executable file
@ -0,0 +1,59 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Chatwoot Setup Script
|
||||||
|
# Configurar integração Chatwoot + n8n
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
CHATWOOT_URL="https://chat.m5digital.net.br"
|
||||||
|
TOKEN="AwnRiNkenTfzmipP8sM4dewQ"
|
||||||
|
ACCOUNT_ID=1
|
||||||
|
|
||||||
|
echo "🔧 Chatwoot Setup"
|
||||||
|
echo "=================="
|
||||||
|
|
||||||
|
# 1. Verificar status
|
||||||
|
echo -e "\n📊 Status da API:"
|
||||||
|
curl -s "${CHATWOOT_URL}/api" | jq '.'
|
||||||
|
|
||||||
|
# 2. Listar agentes
|
||||||
|
echo -e "\n👥 Agentes:"
|
||||||
|
curl -s -H "api_access_token: ${TOKEN}" \
|
||||||
|
"${CHATWOOT_URL}/api/v1/accounts/${ACCOUNT_ID}/agents" | jq -r '.data[] | " - \(.name) (\(.role))"'
|
||||||
|
|
||||||
|
# 3. Listar inboxes
|
||||||
|
echo -e "\n📥 Inboxes:"
|
||||||
|
INBOXES=$(curl -s -H "api_access_token: ${TOKEN}" \
|
||||||
|
"${CHATWOOT_URL}/api/v1/accounts/${ACCOUNT_ID}/inboxes")
|
||||||
|
echo "$INBOXES" | jq -r '.data[] | " - \(.name): \(.channel_type)"' || echo " Nenhum inbox"
|
||||||
|
|
||||||
|
# 4. Criar Inbox Web (API)
|
||||||
|
echo -e "\n🔧 Criando Inbox Web..."
|
||||||
|
curl -s -X POST \
|
||||||
|
-H "api_access_token: ${TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
"${CHATWOOT_URL}/api/v1/accounts/${ACCOUNT_ID}/inboxes" \
|
||||||
|
-d '{
|
||||||
|
"name": "Website",
|
||||||
|
"channel": {
|
||||||
|
"type": "web",
|
||||||
|
"website_url": "https://loja.m5digital.net.br"
|
||||||
|
}
|
||||||
|
}' | jq -r '.payload.name // .error // "Erro"'
|
||||||
|
|
||||||
|
# 5. Listar Templates de Mensagens
|
||||||
|
echo -e "\n📝 Templates de Mensagens:"
|
||||||
|
curl -s -H "api_access_token: ${TOKEN}" \
|
||||||
|
"${CHATWOOT_URL}/api/v1/accounts/${ACCOUNT_ID}/message_templates" | jq -r '.data[] | " - \(.name)"' || echo " Nenhum template"
|
||||||
|
|
||||||
|
# 6. Listar Canned Responses
|
||||||
|
echo -e "\n⚡ Respostas Prontas:"
|
||||||
|
curl -s -H "api_access_token: ${TOKEN}" \
|
||||||
|
"${CHATWOOT_URL}/api/v1/accounts/${ACCOUNT_ID}/canned_responses" | jq -r '.data[] | " - \(.short_code): \(.content[0:50])..."' || echo " Nenhuma resposta pronta"
|
||||||
|
|
||||||
|
echo -e "\n✅ Setup completo!"
|
||||||
|
echo ""
|
||||||
|
echo "📋 Próximos passos:"
|
||||||
|
echo "1. Acesse ${CHATWOOT_URL}/app"
|
||||||
|
echo "2. Configure o widget de chat no website"
|
||||||
|
echo "3. Configure o webhook em n8n: ${CHATWOOT_URL}/api/v1/webhooks"
|
||||||
|
echo "4. Configure OpenWA como inbox adicional"
|
||||||
5
scripts/compliance-check.sh
Executable file
5
scripts/compliance-check.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# M5 - Compliance Check
|
||||||
|
# Data: 24/06/2026
|
||||||
|
echo "Compliance Check - $(date)"
|
||||||
|
# Será implementado com validações
|
||||||
406
scripts/compliance/compliance-checker.py
Executable file
406
scripts/compliance/compliance-checker.py
Executable file
@ -0,0 +1,406 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
compliance-checker.py — Motor Ecommerce M5 Brasil
|
||||||
|
Detecta palavras proibidas e verifica conformidade regulatória.
|
||||||
|
Usage: python3 compliance-checker.py --title "..." --description "..."
|
||||||
|
python3 compliance-checker.py --interactive
|
||||||
|
"""
|
||||||
|
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
import unicodedata
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
# ─────────────────────────────────────────────
|
||||||
|
# 1. LISTAS DE PALAVRAS PROIBIDAS
|
||||||
|
# ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
PROHIBITED_ML = {
|
||||||
|
"replica", "clone de", "versão falsa", "cópia 1:1", "original fake",
|
||||||
|
"fake", "falsificado", "pirata", "genérico", "igual ao original",
|
||||||
|
"similar a", "semelhante a",
|
||||||
|
"sem nota", "notaomitida", "semnf", "não emito nota", "sem nota fiscal",
|
||||||
|
"nf free", "nota livre", "não emito", "isento de nota",
|
||||||
|
"remédio", "cura", "trata covid", "combate vírus", "cura naturalmente",
|
||||||
|
"tarja preta", "tarja vermelha", "antibiótico", "anti-inflamatório",
|
||||||
|
"analgésico", "receita médica", "com receita", "sem receita",
|
||||||
|
"combate bactérias", "elimina fungos", "trata pele",
|
||||||
|
"arma", "munição", "bala", "revólver", "pistola", "cartucho",
|
||||||
|
"espingarda", "carabina", "fuzil", "metralhadora",
|
||||||
|
"explosivo", "bomba", "dinamite", "pólvora",
|
||||||
|
"droga", "entorpecente", "haixe", "maconha", "cocaine", "crack",
|
||||||
|
"heroína", " LSD", "ecstasy", "MDMA", "substância controlada", "psicotrópico",
|
||||||
|
"lençol motel", "uso adulto", "18+", "erótico",
|
||||||
|
"animais silvestres", "fauna nativa", "ave silvestre",
|
||||||
|
"tartaruga marinha", "mico-leão", "peixe ornamental",
|
||||||
|
}
|
||||||
|
|
||||||
|
PROHIBITED_SHOPEE = {
|
||||||
|
" original", " autêntico", "genuíno", "original de verdade",
|
||||||
|
"garantia de originalidade",
|
||||||
|
"melhor que", "superior a", "mais barato que", "pior que",
|
||||||
|
"comparado a", "na frente de",
|
||||||
|
"frete grátis", "frete gratuito",
|
||||||
|
"promoção", "desconto especial", "oferta exclusiva", "liquidação",
|
||||||
|
"Deus", "Jesus", "abençoado", "salvação",
|
||||||
|
"Bolsonaro", "Lula", "comunismo", "fascismo", "ESG", "woke",
|
||||||
|
"R$ 1", "R$ 0,01", "de R$ 999 por R$ 1",
|
||||||
|
"clube do preço baixo", "grupo de revenda", "compre junto e ganhe", "kit revenda",
|
||||||
|
}
|
||||||
|
|
||||||
|
PROHIBITED_AMAZON = {
|
||||||
|
"made in China", "veio da China", "fabricado na China",
|
||||||
|
"chinês", # como insulto ou desmerecimento
|
||||||
|
"better than", "superior a", "worse than",
|
||||||
|
"best", "top 1", "número 1",
|
||||||
|
"mais vendido do Brasil",
|
||||||
|
"garantia vitalícia", "garantia de 10 anos", "garantia permanente",
|
||||||
|
"só hoje", "últimasunidades", "última peça", "último par", "hoje ou nunca",
|
||||||
|
"5 estrelas", "avaliado por dermatologistas", "clinicamente testado",
|
||||||
|
}
|
||||||
|
|
||||||
|
ALL_PROHIBITED = {
|
||||||
|
"MercadoLivre": PROHIBITED_ML,
|
||||||
|
"Shopee": PROHIBITED_SHOPEE,
|
||||||
|
"Amazon": PROHIBITED_AMAZON,
|
||||||
|
}
|
||||||
|
|
||||||
|
# ─────────────────────────────────────────────
|
||||||
|
# 2. CATEGORIAS REGULATÓRIAS — palavras-chave
|
||||||
|
# ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
ANVISA_COSMETICO = {
|
||||||
|
"protetor solar", "filtro solar", "fps", "creme para rosto", "creme para corpo",
|
||||||
|
"anti-idade", "clareador", "hidratante", "nutritivo",
|
||||||
|
"base", "batom", "sombra", "delineador", "máscara para cílios",
|
||||||
|
"perfume", "colônia", "tintura", "esmalte", "unha", "depilatório",
|
||||||
|
"desodorante", "shampoo", "condicionador", "queratina", "pantenol",
|
||||||
|
"maquiagem", "cosmético", "skincare", "serum",
|
||||||
|
}
|
||||||
|
|
||||||
|
ANVISA_SUPLEMENTO = {
|
||||||
|
"whey", "caseína", "suplemento proteico", "termogênico",
|
||||||
|
"carnitina", "guaraná", "efedrina", "sinefrina", "capsicum",
|
||||||
|
"vitamina", "mineral", "comprimido", "cápsula",
|
||||||
|
"ômega 3", "probiótico", "nutracêutico", "nutraceutico",
|
||||||
|
"emagrecedor", "bloqueador de gordura", "orlistat", "quitosana",
|
||||||
|
"energético", "bcaa", "glutamina", "creatina", "colágeno",
|
||||||
|
"suplemento", "anabolizante", "esteroides",
|
||||||
|
}
|
||||||
|
|
||||||
|
ANVISA_SANEANTE = {
|
||||||
|
"desinfetante", "sanitizante", "alvejante", "detergente bactericida",
|
||||||
|
"produto de limpeza", "limpeza", "antimicrobiano", "virucida",
|
||||||
|
"comodoro", "q-boa", "Veja",
|
||||||
|
}
|
||||||
|
|
||||||
|
MAPA_ANIMAL = {
|
||||||
|
"mel", "própolis", "geleia real", "pólen",
|
||||||
|
"queijo", "laticínio", "leite", "manteiga", "nata",
|
||||||
|
"salsicha", "linguiça", "presunto", "bacon", "salame", "embutido",
|
||||||
|
"carne processada", "hambúrguer", "almôndega",
|
||||||
|
"ovo", "ovos",
|
||||||
|
"peixe", "pescado", "sardinha", "filé de peixe",
|
||||||
|
"geleia com mel", "geleia com animal",
|
||||||
|
}
|
||||||
|
|
||||||
|
MAPA_VEGETAL = {
|
||||||
|
"café torrado", "café moído", "óleo de soja", "óleo de canola",
|
||||||
|
"óleo de girassol", "óleo vegetal",
|
||||||
|
"arroz parboilizado", "feijão industrializado",
|
||||||
|
"erva medicinal", "chá medicinal",
|
||||||
|
"orgânico", "produto orgânico",
|
||||||
|
}
|
||||||
|
|
||||||
|
INMETRO_BRINQUEDO = {
|
||||||
|
"brinquedo", "brinq", "boneca", "boneco", "carro", "avião",
|
||||||
|
"jogo infantil", "quebra-cabeça", "puzzle", "monta",
|
||||||
|
"bola", "roda", "infantil", "criança",
|
||||||
|
}
|
||||||
|
|
||||||
|
INMETRO_PUERICULTURA = {
|
||||||
|
"cadeirinha auto", "berço", "carrinho de bebê", "alcofa",
|
||||||
|
"moisés", "porta-bebê", "bebê conforto",
|
||||||
|
}
|
||||||
|
|
||||||
|
INMETRO_ELETRICO = {
|
||||||
|
"filtro de linha", "estabilizador", "nobreak", "no-break",
|
||||||
|
"lâmpada led", "lampada led", "led",
|
||||||
|
"capacete", "capacete de moto", "capacete motociclista",
|
||||||
|
"colchão", "extintor",
|
||||||
|
}
|
||||||
|
|
||||||
|
# ─────────────────────────────────────────────
|
||||||
|
# 3. PRODUTOS SEMPRE PROIBIDOS (não vender)
|
||||||
|
# ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
ALWAYS_BLOCK = {
|
||||||
|
"cigarro eletrônico", "vaper", "vaporizador",
|
||||||
|
"esteroides", "anabolizante",
|
||||||
|
"thc", "maconha", "haixe",
|
||||||
|
"armamento", "arma de fogo", "munição",
|
||||||
|
"explosivo", "bomba",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# ─────────────────────────────────────────────
|
||||||
|
# 4. FUNÇÕES AUXILIARES
|
||||||
|
# ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
def normalize(text: str) -> str:
|
||||||
|
"""Remove acentos e converte para minúsculas."""
|
||||||
|
text = text.lower()
|
||||||
|
text = unicodedata.normalize("NFD", text)
|
||||||
|
text = re.sub(r"[\u0300-\u036f]", "", text)
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
def strip_punctuation(text: str) -> str:
|
||||||
|
"""Remove pontuação para busca parcial."""
|
||||||
|
return re.sub(r"[^\w\s]", " ", text)
|
||||||
|
|
||||||
|
|
||||||
|
def check_wordlists(text: str, wordlist: set, label: str) -> list[dict]:
|
||||||
|
"""Retorna violações de uma wordlist."""
|
||||||
|
violations = []
|
||||||
|
text_norm = normalize(text)
|
||||||
|
text_clean = strip_punctuation(text_norm)
|
||||||
|
for word in wordlist:
|
||||||
|
word_norm = normalize(word)
|
||||||
|
# Match whole word
|
||||||
|
pattern = r"\b" + re.escape(word_norm) + r"\b"
|
||||||
|
if re.search(pattern, text_clean):
|
||||||
|
violations.append({
|
||||||
|
"word": word,
|
||||||
|
"list": label,
|
||||||
|
"severity": "HIGH",
|
||||||
|
})
|
||||||
|
return violations
|
||||||
|
|
||||||
|
|
||||||
|
def detect_category(text: str) -> dict[str, bool]:
|
||||||
|
"""Heurística simples para detectar categoria regulatória."""
|
||||||
|
text_lower = text.lower()
|
||||||
|
text_norm = normalize(text_lower)
|
||||||
|
text_clean = strip_punctuation(text_norm)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"anvisa_cosmetico": any(k in text_clean for k in [normalize(k) for k in ANVISA_COSMETICO]),
|
||||||
|
"anvisa_suplemento": any(k in text_clean for k in [normalize(k) for k in ANVISA_SUPLEMENTO]),
|
||||||
|
"anvisa_saneante": any(k in text_clean for k in [normalize(k) for k in ANVISA_SANEANTE]),
|
||||||
|
"mapa_animal": any(k in text_clean for k in [normalize(k) for k in MAPA_ANIMAL]),
|
||||||
|
"mapa_vegetal": any(k in text_clean for k in [normalize(k) for k in MAPA_VEGETAL]),
|
||||||
|
"inmetro_brinquedo": any(k in text_clean for k in [normalize(k) for k in INMETRO_BRINQUEDO]),
|
||||||
|
"inmetro_puericultura": any(k in text_clean for k in [normalize(k) for k in INMETRO_PUERICULTURA]),
|
||||||
|
"inmetro_eletrico": any(k in text_clean for k in [normalize(k) for k in INMETRO_ELETRICO]),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def check_always_block(text: str) -> list[dict]:
|
||||||
|
"""Verifica produtos sempre bloqueados."""
|
||||||
|
violations = []
|
||||||
|
text_clean = normalize(strip_punctuation(normalize(text)))
|
||||||
|
for term in ALWAYS_BLOCK:
|
||||||
|
term_norm = normalize(term)
|
||||||
|
pattern = r"\b" + re.escape(term_norm) + r"\b"
|
||||||
|
if re.search(pattern, text_clean):
|
||||||
|
violations.append({
|
||||||
|
"word": term,
|
||||||
|
"list": "ALWAYS_BLOCK",
|
||||||
|
"severity": "CRITICAL",
|
||||||
|
})
|
||||||
|
return violations
|
||||||
|
|
||||||
|
|
||||||
|
# ─────────────────────────────────────────────
|
||||||
|
# 5. SCORING
|
||||||
|
# ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
WEIGHTS = {
|
||||||
|
"ALWAYS_BLOCK": -100, # sempre bloqueia
|
||||||
|
"MercadoLivre": -8,
|
||||||
|
"Shopee": -8,
|
||||||
|
"Amazon": -8,
|
||||||
|
"anvisa_cosmetico": -5,
|
||||||
|
"anvisa_suplemento": -5,
|
||||||
|
"anvisa_saneante": -5,
|
||||||
|
"mapa_animal": -5,
|
||||||
|
"mapa_vegetal": -5,
|
||||||
|
"inmetro_brinquedo": -5,
|
||||||
|
"inmetro_puericultura": -5,
|
||||||
|
"inmetro_eletrico": -5,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def compute_score(violations: list[dict], detected_categories: dict) -> dict:
|
||||||
|
"""Calcula score 0-100."""
|
||||||
|
score = 100
|
||||||
|
|
||||||
|
for v in violations:
|
||||||
|
key = v.get("list", "unknown")
|
||||||
|
if key in WEIGHTS:
|
||||||
|
score += WEIGHTS[key] # já são negativos
|
||||||
|
|
||||||
|
# Penalidades por categoria detectada (sem registro declarado)
|
||||||
|
for cat, detected in detected_categories.items():
|
||||||
|
if detected and cat in WEIGHTS:
|
||||||
|
score += WEIGHTS[cat]
|
||||||
|
|
||||||
|
score = max(0, min(100, score))
|
||||||
|
return score
|
||||||
|
|
||||||
|
|
||||||
|
def decision(score: int) -> str:
|
||||||
|
if score >= 90:
|
||||||
|
return "PUBLICAR"
|
||||||
|
elif score >= 70:
|
||||||
|
return "REVISAR"
|
||||||
|
elif score >= 40:
|
||||||
|
return "REVISAR_OBRIGATORIO"
|
||||||
|
else:
|
||||||
|
return "BLOQUEADO"
|
||||||
|
|
||||||
|
|
||||||
|
# ─────────────────────────────────────────────
|
||||||
|
# 6. RECOMENDAÇÕES
|
||||||
|
# ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
RECOMMENDATIONS = {
|
||||||
|
"anvisa_cosmetico": "⚠️ Cosmético — exigir número de Registro ANVISA antes de publicar (RDC 685/2018)",
|
||||||
|
"anvisa_suplemento": "⚠️ Suplemento — exigir número de Registro ANVISA antes de publicar (RDC 26/2015)",
|
||||||
|
"anvisa_saneante": "⚠️ Saneante — exigir registro ANVISA antes de publicar",
|
||||||
|
"mapa_animal": "⚠️ Produto animal — exige SIF (venda interestadual) ou SIE (venda estadual). Verificar com MAPA.",
|
||||||
|
"mapa_vegetal": "⚠️ Produto vegetal processado — pode exigir registro MAPA ou estadual.",
|
||||||
|
"inmetro_brinquedo": "⚠️ Brinquedo — exige certificação INMETRO compulsória.",
|
||||||
|
"inmetro_puericultura": "⚠️ Artigo de puericultura — exige certificação INMETRO.",
|
||||||
|
"inmetro_eletrico": "⚠️ Equipamento elétrico — exige certificação de segurança INMETRO.",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# ─────────────────────────────────────────────
|
||||||
|
# 7. MAIN
|
||||||
|
# ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
def run_check(title: str, description: str = "", category_hint: str = "") -> dict:
|
||||||
|
"""
|
||||||
|
Verifica título e descrição contra todas as listas.
|
||||||
|
Retorna dict JSON com score, violações e recomendações.
|
||||||
|
"""
|
||||||
|
full_text = f"{title} {description}"
|
||||||
|
|
||||||
|
# Coleta violações
|
||||||
|
all_violations = []
|
||||||
|
|
||||||
|
for marketplace, wordlist in ALL_PROHIBITED.items():
|
||||||
|
all_violations.extend(check_wordlists(full_text, wordlist, marketplace))
|
||||||
|
|
||||||
|
all_violations.extend(check_always_block(full_text))
|
||||||
|
|
||||||
|
# Detecta categorias
|
||||||
|
detected = detect_category(full_text)
|
||||||
|
|
||||||
|
# Se categoria foi informada manualmente
|
||||||
|
if category_hint:
|
||||||
|
cat_map = {
|
||||||
|
"cosmetico": "anvisa_cosmetico",
|
||||||
|
"suplemento": "anvisa_suplemento",
|
||||||
|
"saneante": "anvisa_saneante",
|
||||||
|
"animal": "mapa_animal",
|
||||||
|
"vegetal": "mapa_vegetal",
|
||||||
|
"brinquedo": "inmetro_brinquedo",
|
||||||
|
"puericultura": "inmetro_puericultura",
|
||||||
|
"eletrico": "inmetro_eletrico",
|
||||||
|
}
|
||||||
|
hint_key = cat_map.get(category_hint.lower().strip())
|
||||||
|
if hint_key:
|
||||||
|
detected[hint_key] = True
|
||||||
|
|
||||||
|
# Score
|
||||||
|
score = compute_score(all_violations, detected)
|
||||||
|
dec = decision(score)
|
||||||
|
|
||||||
|
# Recomendações
|
||||||
|
recommendations = []
|
||||||
|
for cat, active in detected.items():
|
||||||
|
if active and cat in RECOMMENDATIONS:
|
||||||
|
recommendations.append(RECOMMENDATIONS[cat])
|
||||||
|
|
||||||
|
# Violações críticas
|
||||||
|
critical = [v for v in all_violations if v.get("severity") == "CRITICAL"]
|
||||||
|
if critical:
|
||||||
|
recommendations.insert(0, "🚫 PRODUTO SEMPRE BLOQUEADO — Não publar. Verificar se é produto proibido (armas, drogas, cigarros eletrônicos, etc.)")
|
||||||
|
|
||||||
|
return {
|
||||||
|
"score": score,
|
||||||
|
"decision": dec,
|
||||||
|
"violations": all_violations,
|
||||||
|
"violation_count": len(all_violations),
|
||||||
|
"detected_categories": {k: v for k, v in detected.items() if v},
|
||||||
|
"recommendations": recommendations,
|
||||||
|
"check_passed": dec in ("PUBLICAR", "REVISAR"),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def interactive():
|
||||||
|
print("=== COMPLIANCE CHECKER — Ecommerce M5 Brasil ===\n")
|
||||||
|
print("Pressione ENTER para pular qualquer campo.\n")
|
||||||
|
|
||||||
|
title = input("Título do produto: ").strip()
|
||||||
|
if not title:
|
||||||
|
print("Título é obrigatório. Encerrando.")
|
||||||
|
return
|
||||||
|
|
||||||
|
description = input("Descrição do produto (ou ENTER para vazio): ").strip()
|
||||||
|
category = input(
|
||||||
|
"Categoria (opcional — ajuda na detecção):\n"
|
||||||
|
" cosmetico | suplemento | saneante | animal | vegetal\n"
|
||||||
|
" brinquedo | puericultura | eletrico | ENTER=pular\n"
|
||||||
|
" >> "
|
||||||
|
).strip()
|
||||||
|
|
||||||
|
result = run_check(title, description, category)
|
||||||
|
print("\n" + json.dumps(result, ensure_ascii=False, indent=2))
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
args = sys.argv[1:]
|
||||||
|
|
||||||
|
if "--interactive" in args or len(args) == 0:
|
||||||
|
interactive()
|
||||||
|
return
|
||||||
|
|
||||||
|
# Parse arguments
|
||||||
|
title = ""
|
||||||
|
description = ""
|
||||||
|
category = ""
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
while i < len(args):
|
||||||
|
if args[i] in ("--title", "-t"):
|
||||||
|
title = args[i + 1]
|
||||||
|
i += 2
|
||||||
|
elif args[i] in ("--description", "-d"):
|
||||||
|
description = args[i + 1]
|
||||||
|
i += 2
|
||||||
|
elif args[i] in ("--category", "-c"):
|
||||||
|
category = args[i + 1]
|
||||||
|
i += 2
|
||||||
|
elif args[i] == "--interactive":
|
||||||
|
interactive()
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
if not title:
|
||||||
|
print("Erro: --title é obrigatório.", file=sys.stderr)
|
||||||
|
print("Uso: python3 compliance-checker.py --title '...' [--description '...'] [--category 'cosmetico'] [--interactive]")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
result = run_check(title, description, category)
|
||||||
|
print(json.dumps(result, ensure_ascii=False, indent=2))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
304
scripts/docker-compose.m5.yml
Normal file
304
scripts/docker-compose.m5.yml
Normal file
@ -0,0 +1,304 @@
|
|||||||
|
# docker-compose.m5.yml — Motor Ecommerce M5 Brasil
|
||||||
|
# Versão atualizada conforme manual Saleor 3.23
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
# ── Traefik (Proxy Reverso) ─────────────────────────
|
||||||
|
traefik:
|
||||||
|
image: traefik:v3.0
|
||||||
|
container_name: m5_traefik
|
||||||
|
restart: unless-stopped
|
||||||
|
command:
|
||||||
|
- --providers.docker=true
|
||||||
|
- --providers.docker.exposedbydefault=false
|
||||||
|
- --entrypoints.web.address=:80
|
||||||
|
- --entrypoints.websecure.address=:443
|
||||||
|
- --certificatesresolvers.myresolver.acme.httpchallenge=true
|
||||||
|
- --certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web
|
||||||
|
- --certificatesresolvers.myresolver.acme.email=irisflorencio@yahoo.com.br
|
||||||
|
- --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
- "443:443"
|
||||||
|
- "8090:8080"
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
- traefik-acme:/letsencrypt
|
||||||
|
- ./traefik-conf/traefik.yml:/etc/traefik/traefik.yml:ro
|
||||||
|
- ./traefik-conf/routes.yml:/etc/traefik/routes.yml:ro
|
||||||
|
- /etc/letsencrypt:/certs:ro
|
||||||
|
- ./traefik-conf/traefik.yml:/etc/traefik/traefik.yml:ro
|
||||||
|
- ./traefik-conf/routes.yml:/etc/traefik/routes.yml:ro
|
||||||
|
- /etc/letsencrypt:/certs:ro
|
||||||
|
networks:
|
||||||
|
- m5_network
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=false"
|
||||||
|
|
||||||
|
# ── Banco de dados principal ──────────────────────────
|
||||||
|
postgres:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
container_name: m5_postgres
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: ${POSTGRES_DB:-m5ecommerce}
|
||||||
|
POSTGRES_USER: ${POSTGRES_USER:-m5user}
|
||||||
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
networks:
|
||||||
|
- m5_network
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=false"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-m5user}"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
# ── Cache / Session ──────────────────────────────────
|
||||||
|
redis:
|
||||||
|
image: redis:7-alpine
|
||||||
|
container_name: m5_redis
|
||||||
|
restart: unless-stopped
|
||||||
|
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD}
|
||||||
|
volumes:
|
||||||
|
- redis_data:/data
|
||||||
|
networks:
|
||||||
|
- m5_network
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=false"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 3s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
# ── Saleor API ───────────────────────────────────────
|
||||||
|
saleor:
|
||||||
|
image: ghcr.io/saleor/saleor:3.23
|
||||||
|
container_name: m5_saleor
|
||||||
|
restart: unless-stopped
|
||||||
|
entrypoint: ["/app/entrypoint.sh"]
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.saleor-api.rule=Host(`loja.m5digital.net.br`)"
|
||||||
|
- "traefik.http.routers.saleor-api.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.saleor-api.tls=true"
|
||||||
|
- "traefik.http.services.saleor-api.loadbalancer.server.port=8000"
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-m5ecommerce}
|
||||||
|
- REDIS_URL=redis://:${REDIS_PASSWORD}@redis:6379
|
||||||
|
- CELERY_BROKER_URL=redis://:${REDIS_PASSWORD}@redis:6379/0
|
||||||
|
- SECRET_KEY=${SALEOR_SECRET_KEY}
|
||||||
|
- ALLOWED_HOSTS=loja.m5digital.net.br,localhost,127.0.0.1,dashboard.m5digital.net.br
|
||||||
|
- ALLOWED_GRAPHQL_ORIGINS=https://dashboard.m5digital.net.br,https://loja.m5digital.net.br,http://localhost:3000
|
||||||
|
- DEFAULT_MAIL_FROM=${DEFAULT_EMAIL_FROM}
|
||||||
|
- EMAIL_URL=${EMAIL_URL}
|
||||||
|
- RSA_PRIVATE_KEY=/app/media/RSA_PRIVATE_KEY.pem
|
||||||
|
- STRIPE_API_KEY=${STRIPE_API_KEY}
|
||||||
|
- STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET}
|
||||||
|
- MERCADOPAGO_ACCESS_TOKEN=${MERCADOPAGO_ACCESS_TOKEN}
|
||||||
|
- MERCADOPAGO_WEBHOOK_SECRET=${MERCADOPAGO_WEBHOOK_SECRET}
|
||||||
|
volumes:
|
||||||
|
- ./saleor-media:/app/media
|
||||||
|
- ./entrypoint.sh:/app/entrypoint.sh:ro
|
||||||
|
networks:
|
||||||
|
- m5_network
|
||||||
|
|
||||||
|
# ── Saleor Worker (Celery) ─────────────────────────
|
||||||
|
worker:
|
||||||
|
image: ghcr.io/saleor/saleor:3.23
|
||||||
|
container_name: m5_saleor_worker
|
||||||
|
restart: unless-stopped
|
||||||
|
command: celery -A saleor worker --loglevel=info
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
- redis
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-m5ecommerce}
|
||||||
|
- REDIS_URL=redis://:${REDIS_PASSWORD}@redis:6379
|
||||||
|
- CELERY_BROKER_URL=redis://:${REDIS_PASSWORD}@redis:6379/0
|
||||||
|
- SECRET_KEY=${SALEOR_SECRET_KEY}
|
||||||
|
volumes:
|
||||||
|
- saleor-media:/app/media
|
||||||
|
networks:
|
||||||
|
- m5_network
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=false"
|
||||||
|
|
||||||
|
# ── Saleor Dashboard ─────────────────────────────────
|
||||||
|
saleor-dashboard:
|
||||||
|
image: ghcr.io/saleor/saleor-dashboard:latest
|
||||||
|
container_name: m5_saleor_dashboard
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- API_URL=https://loja.m5digital.net.br/graphql/
|
||||||
|
- APP_MOUNT_URI=/
|
||||||
|
- NODE_ENV=production
|
||||||
|
networks:
|
||||||
|
- m5_network
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.saleor-dash.rule=Host(`dashboard.m5digital.net.br`)"
|
||||||
|
- "traefik.http.routers.saleor-dash.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.saleor-dash.tls=true"
|
||||||
|
- "traefik.http.services.saleor-dash.loadbalancer.server.port=80"
|
||||||
|
|
||||||
|
# ── n8n (Automação) ──────────────────────────────────
|
||||||
|
n8n:
|
||||||
|
image: n8nio/n8n:${N8N_VERSION:-1.70}
|
||||||
|
container_name: m5_n8n
|
||||||
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
environment:
|
||||||
|
- DB_TYPE=postgresdb
|
||||||
|
- DB_POSTGRESDB_HOST=postgres
|
||||||
|
- DB_POSTGRESDB_PORT=5432
|
||||||
|
- DB_POSTGRESDB_DATABASE=${N8N_DB:-n8n}
|
||||||
|
- DB_POSTGRESDB_USER=${POSTGRES_USER:-m5user}
|
||||||
|
- DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
|
||||||
|
- N8N_BASIC_AUTH_ACTIVE=true
|
||||||
|
- N8N_BASIC_AUTH_USER=${N8N_USER}
|
||||||
|
- N8N_BASIC_AUTH_PASSWORD=${N8N_PASSWORD}
|
||||||
|
- N8N_HOST=https://n8n.m5digital.net.br
|
||||||
|
- WEBHOOK_URL=https://n8n.m5digital.net.br/
|
||||||
|
- N8N_PROTOCOL=https
|
||||||
|
- N8N_TRUST_PROXY=true
|
||||||
|
- GENERIC_TIMEZONE=America/Sao_Paulo
|
||||||
|
- WA_AUTOCARRIER_URL=http://m5_openwa:8080
|
||||||
|
- SALEOR_API_URL=https://loja.m5digital.net.br/graphql/
|
||||||
|
volumes:
|
||||||
|
- n8n_data:/home/node/.n8n
|
||||||
|
- ./n8n-workflows:/workflows
|
||||||
|
networks:
|
||||||
|
- m5_network
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.n8n.rule=Host(`n8n.m5digital.net.br`)"
|
||||||
|
- "traefik.http.routers.n8n.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.n8n.tls=true"
|
||||||
|
- "traefik.http.services.n8n.loadbalancer.server.port=5678"
|
||||||
|
|
||||||
|
# ── OpenWA (WhatsApp) ────────────────────────────────
|
||||||
|
openwa:
|
||||||
|
image: ghcr.io/rmyndharis/openwa:latest
|
||||||
|
container_name: m5_openwa
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
||||||
|
- PUPPETEER_EXECUTABLE_PATH=/opt/google/chrome/chrome
|
||||||
|
- CHROME_PATH=/opt/google/chrome/chrome
|
||||||
|
- WA_CHROMIUM_FLAGS=--no-sandbox --disable-setuid-sandbox --disable-dev-shm-usage --disable-gpu --disable-software-rasterizer --no-zygote --single-process
|
||||||
|
- WA_USE_CHROME=true
|
||||||
|
- MULTI_DEVICE=true
|
||||||
|
- READ_MESSAGES=true
|
||||||
|
- GROUP_PARTICIPANTS=true
|
||||||
|
- WEBHOOK_URL=${WA_WEBHOOK_URL:-https://n8n.m5digital.net.br/webhook/wa}
|
||||||
|
env_file:
|
||||||
|
- ./openwa.env
|
||||||
|
ports:
|
||||||
|
- "2785:2785"
|
||||||
|
- "8080:8080"
|
||||||
|
- "8081:8081"
|
||||||
|
- "8002:8002"
|
||||||
|
volumes:
|
||||||
|
- openwa_data:/var/lib/wa-automate
|
||||||
|
- ./openwa-sessions:/sessions
|
||||||
|
networks:
|
||||||
|
- m5_network
|
||||||
|
security_opt:
|
||||||
|
- seccomp=unconfined
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.openwa.rule=Host(`wa.m5digital.net.br`)"
|
||||||
|
- "traefik.http.routers.openwa.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.openwa.tls=true"
|
||||||
|
- "traefik.http.services.openwa.loadbalancer.server.port=2785"
|
||||||
|
|
||||||
|
# ── Gitea (Git) ─────────────────────────────────────
|
||||||
|
gitea:
|
||||||
|
image: gitea/gitea:${GITEA_VERSION:-1.22}
|
||||||
|
container_name: m5_gitea
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "2222:22"
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
environment:
|
||||||
|
- USER_UID=1000
|
||||||
|
- USER_GID=1000
|
||||||
|
- GITEA__database__DB_TYPE=postgres
|
||||||
|
- GITEA__database__HOST=postgres:5432
|
||||||
|
- GITEA__database__NAME=${GITEA_DB:-gitea}
|
||||||
|
- GITEA__database__USER=${POSTGRES_USER:-m5user}
|
||||||
|
- GITEA__database__PASSWD=${POSTGRES_PASSWORD}
|
||||||
|
- GITEA__server__PROTOCOL=http
|
||||||
|
- GITEA__server__ROOT_URL=https://git.m5digital.net.br/
|
||||||
|
- GITEA__server__DOMAIN=git.m5digital.net.br
|
||||||
|
- GITEA__security__INSTALL_LOCK=true
|
||||||
|
- GITEA__service__DISABLE_REGISTRATION=false
|
||||||
|
volumes:
|
||||||
|
- gitea_data:/data
|
||||||
|
- ./gitea-repos:/git/repositories
|
||||||
|
networks:
|
||||||
|
- m5_network
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.gitea.rule=Host(`git.m5digital.net.br`)"
|
||||||
|
- "traefik.http.routers.gitea.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.gitea.tls=true"
|
||||||
|
- "traefik.http.services.gitea.loadbalancer.server.port=3000"
|
||||||
|
|
||||||
|
# ── yt-pub-livesx ──────────────────────────────────
|
||||||
|
yt-pub-livesx-dashboard:
|
||||||
|
image: yt-pub-livesx-dashboard
|
||||||
|
container_name: yt-pub-livesx-dashboard-1
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- TZ=America/Sao_Paulo
|
||||||
|
ports:
|
||||||
|
- "8091:8091"
|
||||||
|
volumes:
|
||||||
|
- ./yt-pub-livesx/data:/app/data
|
||||||
|
- ./yt-pub-livesx/credentials.enc:/app/credentials.enc:ro
|
||||||
|
networks:
|
||||||
|
- m5_network
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.video.rule=Host(`video.m5digital.net.br`)"
|
||||||
|
- "traefik.http.routers.video.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.video.tls=true"
|
||||||
|
- "traefik.http.services.video.loadbalancer.server.port=8091"
|
||||||
|
|
||||||
|
yt-pub-livesx-scheduler:
|
||||||
|
image: yt-pub-livesx-scheduler
|
||||||
|
container_name: yt-pub-livesx-scheduler-1
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- TZ=America/Sao_Paulo
|
||||||
|
volumes:
|
||||||
|
- ./yt-pub-livesx/data:/app/data
|
||||||
|
- ./yt-pub-livesx/credentials.enc:/app/credentials.enc:ro
|
||||||
|
networks:
|
||||||
|
- m5_network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
m5_network:
|
||||||
|
name: scripts_m5_network
|
||||||
|
external: true
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
|
redis_data:
|
||||||
|
saleor-media:
|
||||||
|
gitea_data:
|
||||||
|
n8n_data:
|
||||||
|
openwa_data:
|
||||||
|
traefik-acme:
|
||||||
30
scripts/entrypoint.sh
Executable file
30
scripts/entrypoint.sh
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Ler RSA key do arquivo ou da variável de ambiente
|
||||||
|
if [ -n "$RSA_PRIVATE_KEY" ]; then
|
||||||
|
if [ -f "$RSA_PRIVATE_KEY" ]; then
|
||||||
|
# É um caminho de arquivo - ler o conteúdo
|
||||||
|
echo "Lendo RSA key do arquivo: $RSA_PRIVATE_KEY"
|
||||||
|
RSA_PRIVATE_KEY_CONTENT=$(cat "$RSA_PRIVATE_KEY")
|
||||||
|
export RSA_PRIVATE_KEY="$RSA_PRIVATE_KEY_CONTENT"
|
||||||
|
elif [[ "$RSA_PRIVATE_KEY" == *-----BEGIN* ]]; then
|
||||||
|
echo "RSA key já está inline"
|
||||||
|
else
|
||||||
|
# Provavelmente base64 encoded
|
||||||
|
echo "Decodificando RSA key base64..."
|
||||||
|
python3 -c "
|
||||||
|
import base64, os
|
||||||
|
key = os.environ.get('RSA_PRIVATE_KEY', '')
|
||||||
|
if key:
|
||||||
|
with open('/tmp/RSA.pem', 'wb') as f:
|
||||||
|
f.write(base64.b64decode(key))
|
||||||
|
os.chmod('/tmp/RSA.pem', 0o600)
|
||||||
|
"
|
||||||
|
if [ -f /tmp/RSA.pem ]; then
|
||||||
|
RSA_PRIVATE_KEY_CONTENT=$(cat /tmp/RSA.pem)
|
||||||
|
export RSA_PRIVATE_KEY="$RSA_PRIVATE_KEY_CONTENT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec uvicorn saleor.asgi:application --host 0.0.0.0 --port 8000 --workers 2 --timeout-keep-alive 35
|
||||||
5
scripts/health-check.sh
Executable file
5
scripts/health-check.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# M5 - Health Check Docker
|
||||||
|
# Data: 24/06/2026
|
||||||
|
echo "Health Check - $(date)"
|
||||||
|
# Será implementado com docker ps/health
|
||||||
55
scripts/import-chatwoot-workflow.sh
Normal file
55
scripts/import-chatwoot-workflow.sh
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Importar Chatwoot Workflow para n8n
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
N8N_URL="https://n8n.m5digital.net.br"
|
||||||
|
N8N_USER="admin"
|
||||||
|
N8N_PASSWORD="lKs9DA7S_PL7xv-YrQzi7eFmC8CcGKPrpceGxOqnYOY"
|
||||||
|
WORKFLOW_FILE="/root/ecommerce/workflows/chatwoot-integration.json"
|
||||||
|
|
||||||
|
echo "🔄 Importando Chatwoot Workflow..."
|
||||||
|
|
||||||
|
# 1. Fazer login
|
||||||
|
JWT_TOKEN=$(curl -s -X POST "${N8N_URL}/webhook-test" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"email\":\"${N8N_USER}\",\"password\":\"${N8N_PASSWORD}\"}" | \
|
||||||
|
jq -r '.data.result.data.jwt')
|
||||||
|
|
||||||
|
if [ "$JWT_TOKEN" = "null" ]; then
|
||||||
|
echo "❌ Falha ao fazer login no n8n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 2. Importar workflow
|
||||||
|
RESPONSE=$(curl -s -X POST "${N8N_URL}/workflows/import" \
|
||||||
|
-H "Authorization: Bearer ${JWT_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"workflowData\":$(cat ${WORKFLOW_FILE})}")
|
||||||
|
|
||||||
|
# 3. Verificar resultado
|
||||||
|
WORKFLOW_ID=$(echo "$RESPONSE" | jq -r '.workflow.id')
|
||||||
|
if [ "$WORKFLOW_ID" != "null" ]; then
|
||||||
|
echo "✅ Workflow importado com sucesso!"
|
||||||
|
echo "ID: ${WORKFLOW_ID}"
|
||||||
|
echo "URL: ${N8N_URL}/workflows/${WORKFLOW_ID}"
|
||||||
|
else
|
||||||
|
echo "❌ Falha ao importar workflow"
|
||||||
|
echo "$RESPONSE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 4. Ativar webhook no Chatwoot
|
||||||
|
echo -e "\n🔧 Configurando webhook no Chatwoot..."
|
||||||
|
|
||||||
|
WEBHOOK_PAYLOAD='{
|
||||||
|
"url": "https://n8n.m5digital.net.br/webhook/chatwoot",
|
||||||
|
"events": ["conversation.created", "message.created"],
|
||||||
|
"secret": "M5ChatwootSecret2026"
|
||||||
|
}'
|
||||||
|
|
||||||
|
curl -s -X POST "https://chat.m5digital.net.br/api/v1/accounts/1/webhooks" \
|
||||||
|
-H "api_access_token: AwnRiNkenTfzmipP8sM4dewQ" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "$WEBHOOK_PAYLOAD" | jq -r '.payload.id // .error'
|
||||||
|
|
||||||
|
echo -e "\n✅ Integração configurada!"
|
||||||
110
scripts/insert_workflow.py
Normal file
110
scripts/insert_workflow.py
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import json
|
||||||
|
import uuid
|
||||||
|
import psycopg2
|
||||||
|
|
||||||
|
WORKFLOW_ID = "fa489bed-a0ac-4856-a38e-e78bed2adf9d"
|
||||||
|
WEBHOOK_ID = "whatsapp-messages"
|
||||||
|
PROJECT_ID = "NHIYHwVpHURSGRFV"
|
||||||
|
|
||||||
|
nodes = [
|
||||||
|
{
|
||||||
|
"parameters": {"httpMethod": "POST", "path": "whatsapp-messages", "responseMode": "lastNode", "options": {}},
|
||||||
|
"id": "wh1", "name": "Webhook WhatsApp", "type": "n8n-nodes-base.webhook",
|
||||||
|
"typeVersion": 2, "position": [250, 300], "webhookId": WEBHOOK_ID
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {"jsCode": "const d=$input.item.json;const e=d.event||'';const m=d.data||{};const t=m.hasMedia?'media':m.body?'text':e.includes('session')?'session':'other';return[{json:{...d,messageType:t}}];"},
|
||||||
|
"id": "cl1", "name": "Classificar Mensagem", "type": "n8n-nodes-base.code",
|
||||||
|
"typeVersion": 2, "position": [500, 300]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {"jsCode": "console.log(JSON.stringify($input.item.json));return $input.all();"},
|
||||||
|
"id": "db1", "name": "Log Mensagem", "type": "n8n-nodes-base.code",
|
||||||
|
"typeVersion": 2, "position": [750, 300]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {"jsCode": "return[{json:{received:true,timestamp:new Date().toISOString()}}];"},
|
||||||
|
"id": "ok1", "name": "Responder 200", "type": "n8n-nodes-base.code",
|
||||||
|
"typeVersion": 2, "position": [1000, 300]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
connections = {
|
||||||
|
"Webhook WhatsApp": {"main": [[{"node": "Classificar Mensagem", "type": "main", "index": 0}]]},
|
||||||
|
"Classificar Mensagem": {"main": [[{"node": "Log Mensagem", "type": "main", "index": 0}]]},
|
||||||
|
"Log Mensagem": {"main": [[{"node": "Responder 200", "type": "main", "index": 0}]]}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings = {"executionOrder": "v1", "saveManualExecutions": True, "callerPolicy": "workflowsFromSameOwner"}
|
||||||
|
|
||||||
|
conn = psycopg2.connect(
|
||||||
|
host="m5_postgres",
|
||||||
|
dbname="n8n",
|
||||||
|
user="m5user",
|
||||||
|
password="YXnJMMqAZ5uZrFj2lMo_AnhEmQq4uVoCfOuXaG7pU0Y",
|
||||||
|
port=5432
|
||||||
|
)
|
||||||
|
cur = conn.cursor()
|
||||||
|
|
||||||
|
# Insert workflow
|
||||||
|
cur.execute("""
|
||||||
|
INSERT INTO workflow_entity (
|
||||||
|
name, active, nodes, connections, settings, staticData, pinData,
|
||||||
|
versionId, triggerCount, id, meta, parentFolderId, isArchived, versionCounter,
|
||||||
|
description, activeVersionId, createdAt, updatedAt
|
||||||
|
) VALUES (
|
||||||
|
%s, %s, %s, %s, %s, NULL, NULL,
|
||||||
|
%s, %s, %s, NULL, NULL, %s, %s,
|
||||||
|
%s, NULL, NOW(), NOW()
|
||||||
|
)
|
||||||
|
ON CONFLICT (id) DO UPDATE SET
|
||||||
|
name = EXCLUDED.name,
|
||||||
|
active = EXCLUDED.active,
|
||||||
|
nodes = EXCLUDED.nodes,
|
||||||
|
connections = EXCLUDED.connections,
|
||||||
|
settings = EXCLUDED.settings,
|
||||||
|
updatedAt = NOW()
|
||||||
|
""", (
|
||||||
|
"WhatsApp Messages - OpenWA",
|
||||||
|
True,
|
||||||
|
json.dumps(nodes),
|
||||||
|
json.dumps(connections),
|
||||||
|
json.dumps(settings),
|
||||||
|
"1", 1, WORKFLOW_ID,
|
||||||
|
False, 1,
|
||||||
|
"Recebe webhooks do OpenWA e salva no banco"
|
||||||
|
))
|
||||||
|
|
||||||
|
# Insert webhook entity
|
||||||
|
wh_entity_id = str(uuid.uuid4())
|
||||||
|
cur.execute("""
|
||||||
|
INSERT INTO webhook_entity (
|
||||||
|
id, webhookId, workflowId, method, path, node, conditions, position,
|
||||||
|
retries, timeout, keywords, redactUrl, redactHeaders, redactBody, createdAt
|
||||||
|
) VALUES (
|
||||||
|
%s, %s, %s, %s, %s, %s, NULL, %s,
|
||||||
|
3, NULL, NULL, false, NULL, false, NOW()
|
||||||
|
)
|
||||||
|
ON CONFLICT (webhookId) DO UPDATE SET
|
||||||
|
workflowId = EXCLUDED.workflowId,
|
||||||
|
updatedAt = NOW()
|
||||||
|
""", (
|
||||||
|
wh_entity_id, WEBHOOK_ID, WORKFLOW_ID,
|
||||||
|
"POST", "/webhook/whatsapp-messages", "Webhook WhatsApp",
|
||||||
|
json.dumps([250, 300])
|
||||||
|
))
|
||||||
|
|
||||||
|
# Insert shared_workflow
|
||||||
|
cur.execute("""
|
||||||
|
INSERT INTO shared_workflow (workflowId, projectId, role, createdAt, updatedAt)
|
||||||
|
VALUES (%s, %s, %s, NOW(), NOW())
|
||||||
|
ON CONFLICT (workflowId, projectId) DO NOTHING
|
||||||
|
""", (WORKFLOW_ID, PROJECT_ID, "workflow"))
|
||||||
|
|
||||||
|
conn.commit()
|
||||||
|
cur.close()
|
||||||
|
conn.close()
|
||||||
|
print(f"Workflow criado: {WORKFLOW_ID}")
|
||||||
|
print(f"Webhook ID: {WEBHOOK_ID}")
|
||||||
|
print("Pronto!")
|
||||||
62
scripts/minio-compose.yml
Normal file
62
scripts/minio-compose.yml
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
minio:
|
||||||
|
image: minio/minio:latest
|
||||||
|
container_name: m5_minio
|
||||||
|
hostname: minio
|
||||||
|
networks:
|
||||||
|
- m5_network
|
||||||
|
ports:
|
||||||
|
- "9000:9000" # API
|
||||||
|
- "9001:9001" # Console
|
||||||
|
environment:
|
||||||
|
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
|
||||||
|
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin123}
|
||||||
|
MINIO_SITE_NAME: "M5 Digital MinIO"
|
||||||
|
MINIO_SITE_REGION: "us-east-1"
|
||||||
|
volumes:
|
||||||
|
- ./minio/data:/data
|
||||||
|
- ./minio/config:/root/.minio
|
||||||
|
command: server /data --console-address ":9001"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "mc", "ready", "local"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 20s
|
||||||
|
retries: 3
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
minio-init:
|
||||||
|
image: minio/mc:latest
|
||||||
|
container_name: m5_minio_init
|
||||||
|
networks:
|
||||||
|
- m5_network
|
||||||
|
depends_on:
|
||||||
|
minio:
|
||||||
|
condition: service_healthy
|
||||||
|
entrypoint: >
|
||||||
|
/bin/sh -c "
|
||||||
|
sleep 5;
|
||||||
|
mc alias set myminio http://minio:9000 $${MINIO_ROOT_USER} $${MINIO_ROOT_PASSWORD};
|
||||||
|
mc anonymous set download myminio/public;
|
||||||
|
mc admin user add myminio ${MINIO_SERVICE_USER:-crmuser} ${MINIO_SERVICE_PASSWORD:-crmpass123};
|
||||||
|
mc admin policy attach myminio readwrite --user ${MINIO_SERVICE_USER:-crmuser};
|
||||||
|
mc mb myminio/hermes-crm --ignore-existing;
|
||||||
|
mc mb myminio/hermes-crm/avatars --ignore-existing;
|
||||||
|
mc mb myminio/hermes-crm/documents --ignore-existing;
|
||||||
|
mc mb myminio/hermes-crm/attachments --ignore-existing;
|
||||||
|
mc mb myminio/hermes-crm/backups --ignore-existing;
|
||||||
|
mc mb myminio/hermes-crm/exports --ignore-existing;
|
||||||
|
mc mb myminio/hermes-crm/temp --ignore-existing;
|
||||||
|
mc mb myminio/hermes-ecom --ignore-existing;
|
||||||
|
mc mb myminio/hermes-ecom/products --ignore-existing;
|
||||||
|
mc mb myminio/hermes-ecom/images --ignore-existing;
|
||||||
|
mc mb myminio/hermes-ecom/documents --ignore-existing;
|
||||||
|
echo 'MinIO initialized successfully';
|
||||||
|
exit 0;
|
||||||
|
"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
m5_network:
|
||||||
|
name: scripts_m5_network
|
||||||
|
external: true
|
||||||
67
scripts/openwa-compose.yml
Normal file
67
scripts/openwa-compose.yml
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# OpenWA v0.5.0 - Production compose adapted for m5 stack
|
||||||
|
# Base: docker-compose.dev.yml (rmyndharis/OpenWA)
|
||||||
|
|
||||||
|
services:
|
||||||
|
openwa:
|
||||||
|
image: ghcr.io/rmyndharis/openwa:latest
|
||||||
|
container_name: m5_openwa
|
||||||
|
restart: unless-stopped
|
||||||
|
security_opt:
|
||||||
|
- 'no-new-privileges:true'
|
||||||
|
cap_add:
|
||||||
|
- SYS_ADMIN
|
||||||
|
- CHOWN
|
||||||
|
- DAC_OVERRIDE
|
||||||
|
- FOWNER
|
||||||
|
- SETGID
|
||||||
|
- SETUID
|
||||||
|
shm_size: '512mb'
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
|
- PORT=2785
|
||||||
|
- HOME=/tmp
|
||||||
|
- XDG_CONFIG_HOME=/tmp/.config
|
||||||
|
- XDG_CACHE_HOME=/tmp/.cache
|
||||||
|
- DATABASE_TYPE=sqlite
|
||||||
|
- DATABASE_NAME=/app/data/openwa.sqlite
|
||||||
|
- DATABASE_SYNCHRONIZE=false
|
||||||
|
- DATABASE_LOGGING=false
|
||||||
|
- ENGINE_TYPE=whatsapp-web.js
|
||||||
|
- SESSION_DATA_PATH=/app/data/sessions
|
||||||
|
- PUPPETEER_HEADLESS=true
|
||||||
|
- PUPPETEER_ARGS=--no-sandbox,--disable-setuid-sandbox,--disable-dev-shm-usage,--disable-gpu,--disable-software-rasterizer
|
||||||
|
- PUPPETEER_PROTOCOL_TIMEOUT=120000
|
||||||
|
- PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
|
||||||
|
- STORAGE_TYPE=local
|
||||||
|
- STORAGE_LOCAL_PATH=/app/data/media
|
||||||
|
- WEBHOOK_TIMEOUT=10000
|
||||||
|
- WEBHOOK_MAX_RETRIES=3
|
||||||
|
- WEBHOOK_RETRY_DELAY=5000
|
||||||
|
- QUEUE_ENABLED=false
|
||||||
|
- AUTO_START_SESSIONS=false
|
||||||
|
- LOG_LEVEL=info
|
||||||
|
volumes:
|
||||||
|
- m5_openwa_data:/app/data
|
||||||
|
networks:
|
||||||
|
- scripts_m5_network
|
||||||
|
healthcheck:
|
||||||
|
test: ['CMD', 'node', '-e', "require('http').get('http://localhost:2785/api/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 5
|
||||||
|
start_period: 45s
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.openwa.rule=Host(`wa.m5digital.net.br`)"
|
||||||
|
- "traefik.http.routers.openwa.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.openwa.tls=true"
|
||||||
|
- "traefik.http.routers.openwa.service=openwa"
|
||||||
|
- "traefik.http.services.openwa.loadbalancer.server.port=2785"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
m5_openwa_data:
|
||||||
|
name: m5_openwa_data
|
||||||
|
|
||||||
|
networks:
|
||||||
|
scripts_m5_network:
|
||||||
|
external: true
|
||||||
3
scripts/openwa.env
Normal file
3
scripts/openwa.env
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
PUPPETEER_ARGS=--no-sandbox,--disable-setuid-sandbox,--disable-dev-shm-usage,--disable-gpu
|
||||||
|
PUPPETEER_HEADLESS=true
|
||||||
58
scripts/operacao_completa.sh
Executable file
58
scripts/operacao_completa.sh
Executable file
@ -0,0 +1,58 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# AGENTE MESTRE - OPERAÇÃO COMPLETA
|
||||||
|
# Coordenar verificação, testes, integrações e documentação
|
||||||
|
|
||||||
|
echo "🚀 INICIANDO OPERAÇÃO COMPLETA - $(date)"
|
||||||
|
|
||||||
|
# 1. Verificar todas as instâncias
|
||||||
|
echo "🔍 Verificando instâncias..."
|
||||||
|
curl -s -o /dev/null -w "%{http_code} " https://crm5.m5digital.net.br
|
||||||
|
curl -s -o /dev/null -w "%{http_code} " https://chat.m5digital.net.br
|
||||||
|
curl -s -o /dev/null -w "%{http_code} " https://n8n.m5digital.net.br
|
||||||
|
curl -s -o /dev/null -w "%{http_code} " https://loja.m5digital.net.br
|
||||||
|
curl -s -o /dev/null -w "%{http_code} " https://dashboard.m5digital.net.br
|
||||||
|
curl -s -o /dev/null -w "%{http_code} " https://git.m5digital.net.br
|
||||||
|
curl -s -o /dev/null -w "%{http_code} " https://video.m5digital.net.br
|
||||||
|
|
||||||
|
# 2. Análise de logs
|
||||||
|
echo -e "\n📋 Analisando logs..."
|
||||||
|
docker ps --format "table {{.Names}}\t{{.Status}}"
|
||||||
|
docker ps -a --filter "status=exited" --format "table {{.Names}}\t{{.Status}}"
|
||||||
|
|
||||||
|
# 3. Testes de conectividade
|
||||||
|
echo -e "\n🌐 Testando conectividade..."
|
||||||
|
docker exec m5_traefik ping -c 2 chatwoot-chatwoot-1
|
||||||
|
docker exec m5_traefik ping -c 2 twenty_front
|
||||||
|
docker exec m5_traefik ping -c 2 m5_saleor
|
||||||
|
|
||||||
|
# 4. Verificar n8n workflows
|
||||||
|
echo -e "\n🔄 Verificando n8n..."
|
||||||
|
curl -s https://n8n.m5digital.net.br/api/v1/workflows | jq '.data[] | {id, name, active}' 2>/dev/null || echo "n8n não acessível"
|
||||||
|
|
||||||
|
# 5. Gerar relatório
|
||||||
|
echo -e "\n📊 Gerando relatório..."
|
||||||
|
cat > /tmp/relatorio_operacao.txt << EOF
|
||||||
|
RELATÓRIO DE OPERAÇÃO COMPLETA - $(date)
|
||||||
|
|
||||||
|
INSTÂNCIAS:
|
||||||
|
- Twenty CRM: https://crm5.m5digital.net.br
|
||||||
|
- Chatwoot: https://chat.m5digital.net.br
|
||||||
|
- n8n: https://n8n.m5digital.net.br
|
||||||
|
- Saleor: https://loja.m5digital.net.br
|
||||||
|
- Traefik: https://dashboard.m5digital.net.br
|
||||||
|
|
||||||
|
CONTAINERS ATIVOS:
|
||||||
|
$(docker ps --format "{{.Names}} - {{.Status}}")
|
||||||
|
|
||||||
|
PENDENTES:
|
||||||
|
$(docker ps -a --filter "status=exited" --format "{{.Names}} - {{.Status}}")
|
||||||
|
|
||||||
|
INTEGRAÇÕES:
|
||||||
|
- n8n ↔ Chatwoot: A configurar
|
||||||
|
- n8n ↔ Twenty: A configurar
|
||||||
|
- n8n ↔ Saleor: A configurar
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "✅ Relatório gerado em /tmp/relatorio_operacao.txt"
|
||||||
|
echo "🎉 OPERAÇÃO COMPLETA FINALIZADA!"
|
||||||
7
scripts/requirements.txt
Normal file
7
scripts/requirements.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
requests>=2.31.0
|
||||||
|
pandas>=2.1.0
|
||||||
|
openpyxl>=3.1.0
|
||||||
|
python-dotenv>=1.0.0
|
||||||
|
rich>=13.7.0
|
||||||
|
tabulate>=0.9.0
|
||||||
|
loguru>=0.7.0
|
||||||
5
scripts/resumo-diario.sh
Executable file
5
scripts/resumo-diario.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# M5 - Resumo Diário
|
||||||
|
# Data: 24/06/2026
|
||||||
|
echo "Resumo Diário - $(date)"
|
||||||
|
# Será implementado com relatórios
|
||||||
8
scripts/saleor-entrypoint.sh
Executable file
8
scripts/saleor-entrypoint.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copiar RSA key ANTES de qualquer coisa
|
||||||
|
cp /app/media/RSA_PRIVATE_KEY.pem /app/RSA_PRIVATE_KEY.pem 2>/dev/null || true
|
||||||
|
chmod 600 /app/RSA_PRIVATE_KEY.pem 2>/dev/null || true
|
||||||
|
|
||||||
|
# Executar o que foi passado como argumento
|
||||||
|
exec "$@"
|
||||||
5
scripts/saleor-start.sh
Executable file
5
scripts/saleor-start.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cp /app/media/RSA_PRIVATE_KEY.pem /tmp/RSA.pem 2>/dev/null
|
||||||
|
chmod 600 /tmp/RSA.pem 2>/dev/null
|
||||||
|
export RSA_PRIVATE_KEY=/tmp/RSA.pem
|
||||||
|
exec gunicorn --bind :8000 --workers 4 --worker-class saleor.asgi.gunicorn_worker.UvicornWorker saleor.asgi:application
|
||||||
61
scripts/telegram_user_login.py
Normal file
61
scripts/telegram_user_login.py
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Hermes Telegram User Account — Login Script v3
|
||||||
|
Passa phone e code_callback explicitamente via kwargs do start()
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import asyncio
|
||||||
|
from telethon import TelegramClient
|
||||||
|
|
||||||
|
API_ID = 35430577
|
||||||
|
API_HASH = "bf7926bd5830a1d2ebf502e538a0d816"
|
||||||
|
SESSION_PATH = os.path.expanduser("~/.hermes/telegram_user.session")
|
||||||
|
PHONE = "+5511991975554"
|
||||||
|
CODE_FILE = "/tmp/telegram_code.txt"
|
||||||
|
|
||||||
|
def get_code():
|
||||||
|
"""Lê o código do arquivo, esperando até 120s se não existir."""
|
||||||
|
print(f"Aguardando código em {CODE_FILE} ...", flush=True)
|
||||||
|
for i in range(120):
|
||||||
|
if os.path.exists(CODE_FILE):
|
||||||
|
with open(CODE_FILE) as f:
|
||||||
|
code = f.read().strip()
|
||||||
|
if code:
|
||||||
|
os.remove(CODE_FILE)
|
||||||
|
print(f"Código recebido: {code}", flush=True)
|
||||||
|
return code
|
||||||
|
time.sleep(1)
|
||||||
|
raise TimeoutError("Tempo esgotado aguardando código")
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
print("=" * 50)
|
||||||
|
print("Hermes Telegram — Login com Conta de Usuário")
|
||||||
|
print("=" * 50)
|
||||||
|
print(f"Sessão: {SESSION_PATH}")
|
||||||
|
print(f"Telefone: {PHONE}", flush=True)
|
||||||
|
print()
|
||||||
|
|
||||||
|
client = TelegramClient(SESSION_PATH, API_ID, API_HASH)
|
||||||
|
|
||||||
|
# Inicia com phone e code_callback via kwargs
|
||||||
|
await client.start(
|
||||||
|
phone=lambda: PHONE,
|
||||||
|
code_callback=get_code
|
||||||
|
)
|
||||||
|
|
||||||
|
me = await client.get_me()
|
||||||
|
print()
|
||||||
|
print("=" * 50)
|
||||||
|
print("✅ LOGIN REALIZADO COM SUCESSO!")
|
||||||
|
print("=" * 50)
|
||||||
|
print(f"ID: {me.id}")
|
||||||
|
print(f"Nome: {me.first_name} {me.last_name or ''}")
|
||||||
|
print(f"Username: @{me.username}")
|
||||||
|
print(f"Telefone: {me.phone}")
|
||||||
|
print()
|
||||||
|
print("Sessão salva em: ~/.hermes/telegram_user.session", flush=True)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
asyncio.run(main())
|
||||||
94
scripts/telegram_user_monitor.py
Normal file
94
scripts/telegram_user_monitor.py
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Monitora a conta de usuário do Telegram via Telethon.
|
||||||
|
Reenvia mensagens recebidas para o Hermes processar.
|
||||||
|
Mantém diálogo contínuo em /root/.hermes/telegram_user.session
|
||||||
|
"""
|
||||||
|
import asyncio
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
# Setup
|
||||||
|
API_ID = 35430577
|
||||||
|
API_HASH = "bf7926bd5830a1d2ebf502e538a0d816"
|
||||||
|
SESSION_FILE = "/root/.hermes/telegram_user.session"
|
||||||
|
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format="%(asctime)s [%(levelname)s] %(message)s",
|
||||||
|
handlers=[
|
||||||
|
logging.FileHandler("/root/.hermes/logs/telegram_user.log"),
|
||||||
|
logging.StreamHandler(sys.stdout),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
log = logging.getLogger("telegram_user")
|
||||||
|
|
||||||
|
# Pasta para salvar state
|
||||||
|
STATE_FILE = "/root/.hermes/telegram_user_state.json"
|
||||||
|
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
from telethon import TelegramClient
|
||||||
|
|
||||||
|
client = TelegramClient(SESSION_FILE, API_ID, API_HASH)
|
||||||
|
|
||||||
|
async with client:
|
||||||
|
me = await client.get_me()
|
||||||
|
log.info(f"=== Monitorando conta: {me.first_name} (@{me.username}) ===")
|
||||||
|
log.info(f"User ID: {me.id}")
|
||||||
|
log.info("Aguardando mensagens...")
|
||||||
|
|
||||||
|
from telethon import events
|
||||||
|
|
||||||
|
@client.on(events.NewMessage(incoming=True))
|
||||||
|
async def handler(event):
|
||||||
|
chat = await event.get_chat()
|
||||||
|
sender = await event.get_sender()
|
||||||
|
|
||||||
|
# Ignora bots (inclusive o @Hermes_M5 / @m5onBot)
|
||||||
|
if getattr(sender, "bot", False):
|
||||||
|
log.info(f"Ignorando mensagem de bot: {getattr(sender, 'username', 'sem username')}")
|
||||||
|
return
|
||||||
|
|
||||||
|
# Ignora mensagens enviadas por nós mesmos
|
||||||
|
if event.out:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Texto da mensagem
|
||||||
|
if hasattr(event, "message") and event.message:
|
||||||
|
text = event.message.text or event.message.message or ""
|
||||||
|
if not text:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
text = str(event)[:100]
|
||||||
|
|
||||||
|
timestamp = datetime.now().strftime("%d/%m %H:%M")
|
||||||
|
chat_name = getattr(chat, "title", None) or getattr(chat, "first_name", "Desconhecido")
|
||||||
|
sender_name = f"{getattr(sender, 'first_name', '')} {getattr(sender, 'last_name', '')}".strip()
|
||||||
|
username = f"(@{sender.username})" if getattr(sender, "username", None) else ""
|
||||||
|
|
||||||
|
log.info("")
|
||||||
|
log.info(f"╔══════════════════════════════════════════════════════╗")
|
||||||
|
log.info(f"║ {timestamp} | {chat_name} ║")
|
||||||
|
log.info(f"║ De: {sender_name} {username} ║")
|
||||||
|
log.info(f"╠══════════════════════════════════════════════════════╣")
|
||||||
|
# Quebra texto em linhas de até 58 chars
|
||||||
|
for i in range(0, len(text), 58):
|
||||||
|
line = text[i : i + 58]
|
||||||
|
log.info(f"║ {line:<58} ║")
|
||||||
|
log.info(f"╚══════════════════════════════════════════════════════╝")
|
||||||
|
log.info("")
|
||||||
|
|
||||||
|
# SEM auto-resposta — só loga as mensagens
|
||||||
|
# (auto-resposta desativada em 21/jun/2026)
|
||||||
|
|
||||||
|
await client.run_until_disconnected()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
asyncio.run(main())
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
log.info("Monitoramento interrompido.")
|
||||||
7
scripts/traefik-conf/dynamic-config.yml
Normal file
7
scripts/traefik-conf/dynamic-config.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
http:
|
||||||
|
middlewares:
|
||||||
|
secure-headers:
|
||||||
|
headers:
|
||||||
|
frameDeny: true
|
||||||
|
contentTypeNosniff: true
|
||||||
|
referrerPolicy: strict-origin-when-cross-origin
|
||||||
28
scripts/traefik-conf/traefik.yml
Normal file
28
scripts/traefik-conf/traefik.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
api:
|
||||||
|
dashboard: true
|
||||||
|
insecure: true
|
||||||
|
|
||||||
|
entryPoints:
|
||||||
|
web:
|
||||||
|
address: ":80"
|
||||||
|
websecure:
|
||||||
|
address: ":443"
|
||||||
|
|
||||||
|
providers:
|
||||||
|
file:
|
||||||
|
filename: /etc/traefik/routes.yml
|
||||||
|
watch: true
|
||||||
|
|
||||||
|
certificatesResolvers:
|
||||||
|
letsencrypt:
|
||||||
|
acme:
|
||||||
|
email: irisflorencio@yahoo.com.br
|
||||||
|
storage: /letsencrypt/acme.json
|
||||||
|
httpChallenge:
|
||||||
|
entryPoint: web
|
||||||
|
|
||||||
|
log:
|
||||||
|
level: INFO
|
||||||
|
|
||||||
|
accessLog:
|
||||||
|
format: json
|
||||||
@ -1 +0,0 @@
|
|||||||
{"updatedAt":"2026-06-24T18:19:47.656Z","createdAt":"2026-06-24T18:19:47.656Z","id":"chatwoot-webhook-001","name":"Chatwoot Webhook Receiver","description":null,"active":true,"isArchived":false,"nodes":[{"id":"webhook1","type":"n8n-nodes-base.webhook","position":[100,300],"parameters":{"httpMethod":"POST","path":"chatwoot-webhook","responseMode":"responseNode","options":{"authentication":"none"}},"webhookId":"chatwoot-wh-001"}],"connections":{"webhook1":{"main":[[{"node":"respond1","type":"main","index":0}]]}},"settings":{"saveExecutionProgress":true,"saveManualExecutions":true,"callerPolicy":"workflowsFromSameOwner"},"staticData":null,"meta":null,"nodeGroups":[],"pinData":null,"versionId":"chatwoot-version-001","activeVersionId":"chatwoot-version-001","versionCounter":2,"triggerCount":1,"sourceWorkflowId":null,"tags":[],"shared":[{"updatedAt":"2026-06-24T18:36:33.199Z","createdAt":"2026-06-24T18:36:33.199Z","role":"workflow:owner","workflowId":"chatwoot-webhook-001","projectId":"default-project-001","project":{"updatedAt":"2026-06-24T18:36:33.131Z","createdAt":"2026-06-24T18:36:33.131Z","id":"default-project-001","name":"Default","type":"personal","icon":null,"description":null,"customTelemetryTags":[],"creatorId":"admin-id"}}],"versionMetadata":{"name":"Chatwoot Webhook Receiver","description":null}}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
{"updatedAt":"2026-06-24T18:19:47.666Z","createdAt":"2026-06-24T18:19:47.666Z","id":"saleor-webhook-001","name":"Saleor Webhook Receiver","description":null,"active":true,"isArchived":false,"nodes":[{"id":"webhook3","type":"n8n-nodes-base.webhook","position":[100,300],"parameters":{"httpMethod":"POST","path":"saleor-webhook","responseMode":"responseNode","options":{"authentication":"none"}},"webhookId":"saleor-wh-001"}],"connections":{"webhook3":{"main":[[{"node":"respond3","type":"main","index":0}]]}},"settings":{"saveExecutionProgress":true,"saveManualExecutions":true,"callerPolicy":"workflowsFromSameOwner"},"staticData":null,"meta":null,"nodeGroups":[],"pinData":null,"versionId":"saleor-version-001","activeVersionId":"saleor-version-001","versionCounter":2,"triggerCount":1,"sourceWorkflowId":null,"tags":[],"shared":[{"updatedAt":"2026-06-24T18:36:33.199Z","createdAt":"2026-06-24T18:36:33.199Z","role":"workflow:owner","workflowId":"saleor-webhook-001","projectId":"default-project-001","project":{"updatedAt":"2026-06-24T18:36:33.131Z","createdAt":"2026-06-24T18:36:33.131Z","id":"default-project-001","name":"Default","type":"personal","icon":null,"description":null,"customTelemetryTags":[],"creatorId":"admin-id"}}],"versionMetadata":{"name":"Saleor Webhook Receiver","description":null}}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
{"updatedAt":"2026-06-24T18:19:47.663Z","createdAt":"2026-06-24T18:19:47.663Z","id":"twenty-webhook-001","name":"Twenty CRM Webhook Receiver","description":null,"active":true,"isArchived":false,"nodes":[{"id":"webhook2","type":"n8n-nodes-base.webhook","position":[100,300],"parameters":{"httpMethod":"POST","path":"twenty-webhook","responseMode":"responseNode","options":{"authentication":"none"}},"webhookId":"twenty-wh-001"}],"connections":{"webhook2":{"main":[[{"node":"respond2","type":"main","index":0}]]}},"settings":{"saveExecutionProgress":true,"saveManualExecutions":true,"callerPolicy":"workflowsFromSameOwner"},"staticData":null,"meta":null,"nodeGroups":[],"pinData":null,"versionId":"twenty-version-001","activeVersionId":"twenty-version-001","versionCounter":2,"triggerCount":1,"sourceWorkflowId":null,"tags":[],"shared":[{"updatedAt":"2026-06-24T18:36:33.199Z","createdAt":"2026-06-24T18:36:33.199Z","role":"workflow:owner","workflowId":"twenty-webhook-001","projectId":"default-project-001","project":{"updatedAt":"2026-06-24T18:36:33.131Z","createdAt":"2026-06-24T18:36:33.131Z","id":"default-project-001","name":"Default","type":"personal","icon":null,"description":null,"customTelemetryTags":[],"creatorId":"admin-id"}}],"versionMetadata":{"name":"Twenty CRM Webhook Receiver","description":null}}
|
|
||||||
Loading…
Reference in New Issue
Block a user