ci: add forgejo actions pipeline with traefik labels and https health checks
Some checks are pending
CI/CD → Portainer / Build & Push Docker Images (push) Waiting to run
CI/CD → Portainer / Deploy to Portainer (push) Blocked by required conditions
CI/CD → Portainer / Validate HTTPS & Endpoints (push) Blocked by required conditions

This commit is contained in:
MatheusAlves96 2026-04-21 00:06:22 -03:00
parent e6cb06255b
commit dcd18a07e6
7 changed files with 407 additions and 0 deletions

View file

@ -0,0 +1,63 @@
# CI/CD Pipeline — SaaS Imobiliária
## Fluxo
```
push main → Build images → Push registry → Deploy Portainer → Health checks HTTPS
```
## Configurar no Forgejo (Settings → Secrets & Variables)
### Secrets (valores sensíveis)
| Secret | Descrição |
|--------|-----------|
| `REGISTRY_USER` | Usuário do registry (ex: `gitadmin`) |
| `REGISTRY_PASSWORD` | Senha ou token do registry |
| `PORTAINER_WEBHOOK_URL` | URL do webhook do stack no Portainer |
| `POSTGRES_DB` | Nome do banco de dados |
| `POSTGRES_USER` | Usuário do PostgreSQL |
| `POSTGRES_PASSWORD` | Senha do PostgreSQL |
| `SECRET_KEY` | Flask SECRET_KEY |
| `JWT_SECRET_KEY` | Chave JWT (mín. 32 chars) |
### Variables (valores não-sensíveis)
| Variable | Exemplo |
|----------|---------|
| `REGISTRY` | `git.matheussouza.com.br/gitadmin` |
| `DOMAIN` | `imobiliaria.matheussouza.com.br` |
## Configurar no Portainer
1. Crie um **Stack** com o arquivo `docker-compose.prod.yml`
2. Ative o **webhook** do stack (Stack → Webhooks → Enable)
3. Copie a URL do webhook → cole em `PORTAINER_WEBHOOK_URL`
4. Certifique-se que a rede `traefik-public` existe:
```
docker network create traefik-public
```
## Traefik — pré-requisitos
O Traefik deve estar rodando com:
- Entrypoint `web` (porta 80)
- Entrypoint `websecure` (porta 443)
- CertResolver `letsencrypt` configurado
- Conectado à rede `traefik-public`
Exemplo mínimo de configuração do Traefik:
```yaml
# traefik.yml
entryPoints:
web:
address: ":80"
websecure:
address: ":443"
certificatesResolvers:
letsencrypt:
acme:
email: seu@email.com
storage: /letsencrypt/acme.json
httpChallenge:
entryPoint: web
```