246 lines
20 KiB
Plaintext
246 lines
20 KiB
Plaintext
╔═══════════════════════════════════════════════════════════════════════════════╗
|
|
║ DIRETRIZES DE DESENVOLVIMENTO - v5.0 ║
|
|
║ ║
|
|
║ ⚠️ ESTE ARQUIVO NÃO DEVE SER EDITADO APÓS QUALQUER COMMIT/PUSH ║
|
|
║ ⚠️ Representa o contrato de desenvolvimento desde a versão 1.27.3 ║
|
|
║ ⚠️ Substitui .DIRETRIZES_DESENVOLVIMENTO_v4 (v4.0) ║
|
|
║ ║
|
|
╚═══════════════════════════════════════════════════════════════════════════════╝
|
|
|
|
DATA DE CRIAÇÃO: 14 de Dezembro de 2025
|
|
VERSÃO INICIAL: 1.27.3
|
|
VERSÃO DAS DIRETRIZES: 5.0
|
|
STATUS: ATIVO E IMUTÁVEL
|
|
AMBIENTE: Linux (Dev Container / Ubuntu)
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
🚨🚨🚨 REGRA CRÍTICA: DEPLOY OBRIGATÓRIO 🚨🚨🚨
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
╔═════════════════════════════════════════════════════════════════════════════╗
|
|
║ ║
|
|
║ ⛔ É ABSOLUTAMENTE PROIBIDO ENVIAR ARQUIVOS MANUALMENTE COM SCP/RSYNC ⛔ ║
|
|
║ ║
|
|
║ ✅ SEMPRE USAR OS SCRIPTS DE DEPLOY: ║
|
|
║ ║
|
|
║ 📁 BACKEND: cd /workspaces/webmoney/backend && ./deploy.sh ║
|
|
║ 📁 FRONTEND: cd /workspaces/webmoney/frontend && ./deploy.sh ║
|
|
║ ║
|
|
║ 🔥 CONSEQUÊNCIAS DE NÃO USAR: ║
|
|
║ - Arquivos em diretórios errados ║
|
|
║ - Cache não limpo → código antigo executa ║
|
|
║ - Permissões incorretas ║
|
|
║ - Migrações não executadas ║
|
|
║ - Sistema quebrado em produção ║
|
|
║ ║
|
|
╚═════════════════════════════════════════════════════════════════════════════╝
|
|
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
DETALHES DOS SCRIPTS DE DEPLOY
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
|
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
│ BACKEND (backend/deploy.sh) │
|
|
├─────────────────────────────────────────────────────────────────────────────┤
|
|
│ O que faz: │
|
|
│ [1/8] Verifica dependências locais │
|
|
│ [2/8] rsync para /var/www/webmoney/backend (exclui logs, .env, etc) │
|
|
│ [3/8] Configura .env de produção │
|
|
│ [4/8] composer install --no-dev │
|
|
│ [5/8] Ajusta permissões (www-data) │
|
|
│ [6/8] php artisan migrate --force │
|
|
│ [7/8] Cache: config:cache, route:cache, view:cache │
|
|
│ [8/8] systemctl reload php8.4-fpm │
|
|
│ │
|
|
│ Destino: /var/www/webmoney/backend │
|
|
└─────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
│ FRONTEND (frontend/deploy.sh) │
|
|
├─────────────────────────────────────────────────────────────────────────────┤
|
|
│ O que faz: │
|
|
│ [1/4] npm run build (gera pasta dist) │
|
|
│ [2/4] Limpa diretório remoto │
|
|
│ [3/4] Copia dist/* para servidor │
|
|
│ [4/4] Verifica se index.html existe │
|
|
│ │
|
|
│ Destino: /var/www/webmoney/frontend/dist ⚠️ (NÃO é /frontend!) │
|
|
└─────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
COMANDOS DE DEPLOY - COPIAR E COLAR
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
|
|
# Deploy do BACKEND (após editar arquivos PHP/Laravel)
|
|
cd /workspaces/webmoney/backend && chmod +x deploy.sh && ./deploy.sh
|
|
|
|
# Deploy do FRONTEND (após editar arquivos React/JS)
|
|
cd /workspaces/webmoney/frontend && chmod +x deploy.sh && ./deploy.sh
|
|
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
⛔ PROIBIÇÕES DE DEPLOY
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
|
|
✗ NUNCA usar: scp arquivo root@213.165.93.60:/var/www/...
|
|
✗ NUNCA usar: rsync individual de arquivos
|
|
✗ NUNCA copiar arquivos manualmente para o servidor
|
|
✗ NUNCA esquecer de limpar cache após deploy manual (se urgente)
|
|
✗ NUNCA assumir que o código subiu - SEMPRE testar
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
REGRAS DE DESENVOLVIMENTO
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
REGRA #1: CONTROLE DE VERSÃO SEMÂNTICO
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
|
|
✓ Formato: MAJOR.MINOR.PATCH (exemplo: 1.27.3)
|
|
✓ Incrementar versão em CADA commit/push
|
|
✓ Manter sincronizado em: VERSION, CHANGELOG.md
|
|
|
|
Regra de Incremento:
|
|
- MAJOR (X.0.0): Mudanças incompatíveis, redesign completo
|
|
- MINOR (0.X.0): Novas funcionalidades
|
|
- PATCH (0.0.X): Correções de bugs, ajustes menores
|
|
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
REGRA #2: VALIDAÇÃO OBRIGATÓRIA EM PRODUÇÃO
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
|
|
✓ TODAS as mudanças devem ser testadas em https://webmoney.cnxifly.com
|
|
✓ Workflow obrigatório:
|
|
1. Editar código
|
|
2. Deploy usando ./deploy.sh da pasta correspondente
|
|
3. Testar no domínio
|
|
4. Commit/push apenas após validação
|
|
5. Só então editar novamente
|
|
|
|
✗ PROIBIDO commit sem teste em produção
|
|
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
REGRA #3: DOCUMENTAÇÃO ESSENCIAL
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
|
|
Arquivos de documentação mantidos (apenas estes):
|
|
|
|
| Arquivo | Propósito | Atualizar quando |
|
|
|---------|-----------|------------------|
|
|
| VERSION | Número da versão | Cada commit |
|
|
| CHANGELOG.md | Histórico de mudanças | Cada commit |
|
|
| README.md | Visão geral do projeto | Mudanças significativas |
|
|
| ESTRUTURA_PROJETO.md | Estrutura técnica | Novos arquivos/endpoints |
|
|
| CREDENCIAIS_SERVIDOR.md | Acessos | Mudança de credenciais |
|
|
| .DIRETRIZES_DESENVOLVIMENTO_v5 | Este arquivo | NUNCA (criar nova versão) |
|
|
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
REGRA #4: CHECKLIST DE COMMIT
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
|
|
Antes de CADA commit:
|
|
☑ VERSION atualizado
|
|
☑ CHANGELOG.md atualizado
|
|
☑ Deploy executado (./deploy.sh)
|
|
☑ Testado em webmoney.cnxifly.com
|
|
☑ Sem erros no console do navegador
|
|
☑ Mensagem de commit descritiva
|
|
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
REGRA #5: PROIBIÇÕES EXPLÍCITAS
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
|
|
✗ NÃO editar arquivos sem commit anterior
|
|
✗ NÃO criar documentação específica de versão
|
|
✗ NÃO duplicar informação em múltiplos arquivos
|
|
✗ NÃO fazer deploy manual (usar ./deploy.sh)
|
|
✗ NÃO commitar sem testar em produção
|
|
✗ NÃO usar scp/rsync direto - USAR SCRIPTS
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
INFRAESTRUTURA
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
SERVIDOR DE PRODUÇÃO
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
|
|
IP: 213.165.93.60
|
|
Porta SSH: 22
|
|
Usuário: root
|
|
Senha: Master9354
|
|
|
|
Acesso Linux (Dev Container):
|
|
sshpass -p 'Master9354' ssh -o StrictHostKeyChecking=no root@213.165.93.60 "comando"
|
|
|
|
Estrutura de Diretórios:
|
|
/var/www/webmoney/
|
|
├── backend/ # Laravel API (Nginx proxy para PHP-FPM)
|
|
└── frontend/
|
|
└── dist/ # React build (Nginx root) ⚠️ IMPORTANTE: /dist!
|
|
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
DOMÍNIOS
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
|
|
| Subdomínio | Função |
|
|
|------------|--------|
|
|
| webmoney.cnxifly.com | Aplicação principal |
|
|
| phpmyadmin.cnxifly.com | Banco de dados |
|
|
| webmail.cnxifly.com | Email |
|
|
| mail.cnxifly.com | PostfixAdmin |
|
|
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
STACK TECNOLÓGICA
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
|
|
| Camada | Tecnologia |
|
|
|--------|------------|
|
|
| Backend | Laravel 12 + PHP 8.4-FPM |
|
|
| Frontend | React 18 + Vite 7 + Bootstrap 5 |
|
|
| Banco | MariaDB 11.4 |
|
|
| Cache | Redis |
|
|
| Servidor | Nginx + SSL (Let's Encrypt) |
|
|
| Auth | Laravel Sanctum (Bearer Tokens) |
|
|
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
BANCO DE DADOS
|
|
───────────────────────────────────────────────────────────────────────────────
|
|
|
|
Host: localhost
|
|
Porta: 3306
|
|
Database: webmoney
|
|
Usuário: webmoney
|
|
Senha: M@ster9354
|
|
|
|
Acesso rápido:
|
|
sshpass -p 'Master9354' ssh root@213.165.93.60 "mysql -u webmoney -p'M@ster9354' webmoney -e 'QUERY'"
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
FLUXO DE TRABALHO OBRIGATÓRIO
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
┌────────────────────────────────────────────────────────────────────────────┐
|
|
│ │
|
|
│ 1. EDITAR CÓDIGO │
|
|
│ └── Fazer mudanças nos arquivos │
|
|
│ │
|
|
│ 2. DEPLOY (OBRIGATÓRIO USAR SCRIPT!) │
|
|
│ ├── Backend: cd backend && ./deploy.sh │
|
|
│ └── Frontend: cd frontend && ./deploy.sh │
|
|
│ │
|
|
│ 3. TESTAR EM PRODUÇÃO │
|
|
│ └── https://webmoney.cnxifly.com │
|
|
│ │
|
|
│ 4. SE ERRO: Voltar ao passo 1 │
|
|
│ │
|
|
│ 5. SE OK: Atualizar VERSION e CHANGELOG │
|
|
│ │
|
|
│ 6. COMMIT E PUSH │
|
|
│ └── git add -A && git commit -m "msg" && git push │
|
|
│ │
|
|
└────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
FIM DO DOCUMENTO
|
|
═══════════════════════════════════════════════════════════════════════════════
|