# Inventário de Serviços Redbull

> Última atualização: 2026-02-28 — Limpeza de duplicatas + fixes de repo + deploy q1food

---

## Visão Geral

Servidor Redbull (`185.194.141.70`) gerenciado pelo Coolify v4. Proxy reverso: Traefik.

**SSH:** Conexão funciona via IP diretamente (`ssh redbull` → aponta para `185.194.141.70:22`).
> ⚠️ `redbull.rede5.com.br` está atrás do Cloudflare — porta 22 bloqueada. SSH usa IP direto.

---

## Aplicações — Status Completo

### Q1 Agenda (DEV / HML)

| Aplicação | UUID | Domínio | Branch | CI/CD | Status |
|-----------|------|---------|--------|-------|:------:|
| **backend-dev** | `fk00s0cg8kgc0w4csswskgkw` | https://api-dev.q1agenda.com.br | dev | ❌ Sem webhook | ❌ Exited (aguardando envs) |
| **backend-hml** | `lkoc4coo48k0sow4c00gwo8k` | https://api-hml.q1agenda.com.br | hml | ❌ Sem webhook | ❌ Exited (aguardando envs) |
| **frontend-dev** | `jgook0gkss4cco0484co0s4o` | https://dev.q1agenda.com.br | main | ❌ Sem webhook | ✅ Running |
| **frontend-hml** | `lg4k0gk4gsog8ckcs8sw4cwc` | https://hml.q1agenda.com.br | main | ❌ Sem webhook | ✅ Running |

**Repo backend:** `git@github.com:rede5/q1agenda-backend.git` (branch `dev`/`hml`)
**Repo frontend:** `git@github.com:rede5/q1-agenda-frontend.git`
**Fix 2026-02-28:** Repo URL corrigido (`q1-agenda-backend` → `q1agenda-backend`), duplicata sslip deletada, envs Appwrite base adicionados.
**Pendente:** `APPWRITE_PROJECT_ID`, `APPWRITE_API_KEY`, `SECURITY_API_KEY`, `JWT_SECRET` — preencher no Coolify Dashboard antes de deployar.

---

### GoHorse Jobs (LOCAL / DEV)

| Aplicação | UUID | Domínio | Branch | CI/CD | Status |
|-----------|------|---------|--------|-------|:------:|
| **gohorsejobs-backend-local** | `iw4sow8s0kkg4cccsk08gsoo` | https://test2.q1agenda.com.br | dev | ✅ GitHub webhook | ✅ Running |
| **gohorsejobs-frontend-local** | `ao8g40scws0w4cgo8coc8o40` | https://local.gohorsejobs.com | dev | ✅ GitHub webhook | ✅ Running |
| **gohorsejobs-backoffice-local** | `hg48wkw4wggwsswcwc8sooo4` | https://b-local.gohorsejobs.com | dev | ✅ GitHub webhook | ✅ Running |
| **gohorsejobs-seeder-local** | `q4w48gos8cgssso00o8w8gck` | https://s-local.gohorsejobs.com | dev | ✅ GitHub webhook | ✅ Healthy |
**Repo:** `git@github.com:rede5/gohorsejobs.git`
**Fix 2026-02-28:** `gohorsejobs-frontend-dev` (sslip.io, sem domínio, sem envs) deletada — duplicata da `frontend-local`.
**Nota:** `gohorsejobs-backend-local` aponta para `test2.q1agenda.com.br` — revisar domínio.

---

### Rodizios Daqui (DEV)

| Aplicação | UUID | Domínio | Branch | CI/CD | Status |
|-----------|------|---------|--------|-------|:------:|
| **rodiziosdaqui-backend-dev** | `ecso4woo4woo0ks84888k8ck` | http://api.rodiziosdaqui.rede5.com.br | dev | ✅ GitHub webhook | ✅ Running |
| **rodiziosdaqui-frontend-dev** | `l4g4cc884gc04kg8s480gs48` | http://rodiziosdaqui.rede5.com.br | dev | ✅ GitHub webhook | ✅ Running |
| **rodiziosdaqui-backoffice-dev** | `s4kskw08400wcw8g40ossggo` | http://backoffice.rodiziosdaqui.rede5.com.br | dev | ✅ GitHub webhook | ✅ Running |
| **rodiziosdaqui-seeder-dev** | `ko0kkw4kw8g80scksg8sk0wc` | http://seeder.rodiziosdaqui.rede5.com.br | dev | ✅ GitHub webhook | ✅ Healthy |

**Repo:** `git@github.com:rede5/rodiziosdaqui.git`
**Projeto mais completo e estável** — todos rodando com CI/CD configurado.

---

### Q1 Food (DEV)

| Aplicação | UUID | Domínio | Branch | CI/CD | Status |
|-----------|------|---------|--------|-------|:------:|
| **q1food-backend-dev** | `eosgwscc4g044c884k0ws4gc` | http://api-dev.q1food.com | dev | ✅ GitHub webhook | ❌ Exited |
| **q1food-frontend-dev** | `g8w440g0w0oowo8skss440wk` | http://dev.q1food.com | dev | ✅ GitHub webhook | ✅ Running |

**Repos:** `rede5/food-backend.git` / `rede5/food-frontend.git`
**Issues:** Backend parado desde 18/02. CI/CD configurado mas deploy falhou.

---

### Sextando (DEV)

| Aplicação | UUID | Domínio | Branch | CI/CD | Status |
|-----------|------|---------|--------|-------|:------:|
| **sextando-backend** | `h8c4sg0sg80c4o8kkcw4ogcg` | https://api-dev.sextando.com.br | dev | ❌ Sem webhook | ❌ Exited |
| **sextando-backoffice** | `nsc0gw0og40g0c88soc0o0wc` | https://backoffice-dev.sextando.com.br | dev | ❌ Sem webhook | ❌ Exited |
| **sextando-frontend** | `vggkcs880o8go0ws84wcggco` | https://dev.sextando.com.br | dev | ❌ Sem webhook | ✅ Running |

**Repo:** `git@github.com:rede5/sextando.git`
**Build:** Frontend usa `nixpacks`, backend/backoffice usam `dockerfile`
**Issues:** Nenhum dos 3 tem webhook CI/CD. Backend e backoffice parados.

---

### ObraMarket (DEV)

| Aplicação | UUID | Domínio | Branch | CI/CD | Status |
|-----------|------|---------|--------|-------|:------:|
| **obramarket-backend-dev** | `ws08owk8ocog0gswg8ogo8c4` | sslip.io (sem domínio próprio) | main | ❌ Sem webhook | ❌ Exited |

**Repo:** `git@github.com:rede5/obramarket.git`
**Fix 2026-02-28:** 3 duplicatas deletadas (forgejo, IP interno, URL inválida). Envs base adicionados (SERVER_PORT, DB_PORT, etc.).
**Pendente:** `DB_HOST`, `DB_USER`, `DB_PASSWORD`, `DB_NAME`, `JWT_SECRET`, `PEPPER_SECRET`, `ADMIN_EMAIL`, `ADMIN_PASSWORD`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` — preencher no Coolify + configurar domínio próprio.

---

## Resumo de Status

| Projeto | Rodando | Parado | CI/CD | Apps Total |
|---------|:-------:|:------:|-------|:----------:|
| Q1Agenda | 2 | 2 | ❌ Nenhum | 4 |
| GoHorse Jobs | 4 | 0 | ✅ Todos | 4 |
| Rodizios Daqui | 4 | 0 | ✅ Todos | 4 |
| Q1Food | 1 | 1 🔄 | ✅ Ambos | 2 |
| Sextando | 3 | 0 | ❌ Nenhum | 3 |
| ObraMarket | 0 | 1 | ❌ Nenhum | 1 |
| Q1Total | 1 | 0 | ✅ | 1 |
| Q1Site | 1 | 0 | ✅ | 1 |
| SaveInMed | 2 | 0 | ✅ | 2 |
| **Total** | **18** | **4** | | **22** |

> 🔄 q1food-backend em deploy após refactor Supabase → PostgreSQL (2026-02-28)

---

## Bancos de Dados (Databases)

| Serviço | UUID | DB | Apps Vinculados | Status |
|---------|------|----|-----------------|:------:|
| **gohorsejobs-dev** | `bgws48os8wgwk08o48wg8k80` | PostgreSQL 16 | gohorsejobs-* | ✅ Healthy (10d) |
| **rodiziosdaqui-dev** | `e8ogwk008c8s8sok8wc00ow0` | PostgreSQL 16 | rodiziosdaqui-* | ✅ Healthy (10d) |
| **q1food-dev** | `vskkccs8880cg0ggckccsgww` | PostgreSQL | q1food-* | ✅ Healthy (8d) |
| **vaultwarden-db** | `sg0co4s44cs48o4kc4cgg844` | PostgreSQL | Vaultwarden | ✅ Healthy (8d) |
| **bookstack-db** | `mariadb-ogs4okgoosk48cswoo0s4k84` | MariaDB | BookStack | ✅ Up (3d) |

---

## Serviços (Coolify Services)

| Serviço | Domínio | Status |
|---------|---------|:------:|
| **BookStack** (`ogs4okgoosk48cswoo0s4k84`) | https://docs.rede5.com.br | ✅ Running (3d) |
| **Vaultwarden** (`h8wg0gogw44swosgk8wgc8cs`) | https://vault.rede5.com.br | ✅ Healthy |
| **Forgejo** (`zskgc8sck4w8g8w0o4w44o40`) | pipe.gohorsejobs.com | ⚠️ API=exited, Docker=Up 9d |
| **Supabase** (`hk0ogck8w0co0skc0c8g0ss0`) | - | ❌ Exited |

---

## Infraestrutura Coolify (containers internos)

| Container | Status |
|-----------|:------:|
| coolify | ✅ Up 9d (healthy) |
| coolify-proxy (Traefik) | ✅ Up 9d (healthy) |
| coolify-db | ✅ Up 10d (healthy) |
| coolify-redis | ✅ Up 10d (healthy) |
| coolify-realtime | ✅ Up 10d (healthy) |
| coolify-sentinel | ✅ Up 20h (healthy) |

---

## Conectividade SSH

| Método | Status | Observação |
|--------|:------:|------------|
| `ssh redbull` (via IP `185.194.141.70:22`) | ✅ OK | Funciona |
| `ssh root@redbull.rede5.com.br` (port 22) | ❌ Timeout | Cloudflare bloqueia porta 22 |
| Coolify API (`https://redbull.rede5.com.br`) | ✅ OK | Via Traefik HTTPS |
| Coolify API (`http://185.194.141.70:8000`) | ✅ OK | Acesso direto |

**SSH Config:** `~/.ssh/config` usa `HostName 185.194.141.70` (IP direto).

---

## Webhooks CI/CD

### GoHorse Jobs (`rede5/gohorsejobs` → branch `dev`)

| App | Webhook URL |
|-----|------------|
| Backend | `https://redbull.rede5.com.br/api/v1/webhook/github?uuid=iw4sow8s0kkg4cccsk08gsoo` |
| Frontend | `https://redbull.rede5.com.br/api/v1/webhook/github?uuid=ao8g40scws0w4cgo8coc8o40` |
| Backoffice | `https://redbull.rede5.com.br/api/v1/webhook/github?uuid=hg48wkw4wggwsswcwc8sooo4` |
| Seeder | `https://redbull.rede5.com.br/api/v1/webhook/github?uuid=q4w48gos8cgssso00o8w8gck` |

### Rodizios Daqui (`rede5/rodiziosdaqui` → branch `dev`)

| App | Webhook URL |
|-----|------------|
| Backend | `https://redbull.rede5.com.br/api/v1/webhook/github?uuid=ecso4woo4woo0ks84888k8ck` |
| Backoffice | `https://redbull.rede5.com.br/api/v1/webhook/github?uuid=s4kskw08400wcw8g40ossggo` |
| Frontend | `https://redbull.rede5.com.br/api/v1/webhook/github?uuid=l4g4cc884gc04kg8s480gs48` |
| Seeder | `https://redbull.rede5.com.br/api/v1/webhook/github?uuid=ko0kkw4kw8g80scksg8sk0wc` |

### Q1Food (`rede5/food-*` → branch `dev`)

| App | Webhook URL |
|-----|------------|
| Backend | `https://redbull.rede5.com.br/api/v1/webhook/github?uuid=eosgwscc4g044c884k0ws4gc` |
| Frontend | `https://redbull.rede5.com.br/api/v1/webhook/github?uuid=g8w440g0w0oowo8skss440wk` |

> **Secrets dos webhooks:** ver `services_inventory.md` seção anterior ou Coolify Dashboard.

---

## Portas do Sistema

| Porta | Serviço |
|:-----:|---------|
| 22 | SSH (acesso via IP direto) |
| 80 | Traefik HTTP |
| 443 | Traefik HTTPS |
| 8000 | Coolify Dashboard |
| 22222 | Forgejo SSH |
| 3000 | Frontends (Next.js) |
| 3001 | Backoffice |
| 8080 | Backends (Go) |
| 8081 | Seeders |
| 8521 | GoHorse Backend |

---

## Fixes Aplicados

### 2026-02-28

| App | Problema | Fix | Status |
|-----|----------|-----|:------:|
| **q1food-backend** | Migração Supabase → PostgreSQL incompleta (app crashava no startup) | 19 arquivos reescritos via GitHub API (branch `dev`): config, database, 7 models, 6 services, migrations/init.sql + Dockerfile uploads dir + fix postgres:// → ✅ Running | ✅ OK |
| **q1agenda-backend** (dev+hml) | Repo URL errado (`q1-agenda-backend` → `q1agenda-backend`), duplicata sslip.io, sem envs | PATCH Coolify repo URL, branch dev/hml, DELETE duplicata, envs Appwrite base adicionados | ⚠️ Aguarda credenciais |
| **obramarket-backend** | 4 duplicatas com repos inconsistentes (forgejo, IP, inválido, github) | DELETE 3 duplicatas, envs base adicionados | ⚠️ Aguarda credenciais DB |
| **gohorsejobs-frontend-dev** | Duplicata sem domínio/envs (sslip.io) da frontend-local | DELETE do Coolify | ✅ Limpo |

### 2026-02-26

| App | Problema | Fix | Status |
|-----|----------|-----|:------:|
| **q1food-backend** | Submodulo `.gitmodules` auto-referenciando o próprio repo via HTTPS | Deletado `.gitmodules` via GitHub API (commit `432e07d`) | ✅ Build OK |
| **sextando-backend** | `schema.sql` não copiado para container final (multi-stage) | Adicionado `COPY --from=builder /app/internal/database/schema.sql` no Dockerfile (commit `61d6b98`) | ✅ UP |
| **sextando-backend** | `base_directory=/` causava contexto errado (Go files em `/backend/`) | PATCH Coolify: `base_directory=/backend`, `dockerfile=/Dockerfile` | ✅ Fixado |
| **sextando-backoffice** | `base_directory=/` contexto errado (`prisma/` não encontrado) | PATCH Coolify: `base_directory=/backoffice`, `dockerfile=/Containerfile` | ✅ Fixado |
| **sextando-backoffice** | Containerfile usava `npm ci` sem `package-lock.json` (projeto usa pnpm) | Trocado para `npm install` (commit `84ca0d7`) | ✅ Build OK |
| **sextando-backoffice** | `dist/main` não encontrado — `tsconfig.json` sem `rootDir` → saída em `dist/src/main`. Prisma sem `DATABASE_URL` | CMD → `node dist/src/main` + `openssl` no final stage + `DATABASE_URL` configurada | ✅ UP |

## Issues Pendentes (Ação Manual Necessária)

| # | Problema | Severidade | Ação |
|---|----------|:----------:|------|
| 1 | **q1agenda-backend** (dev+hml): faltam credenciais Appwrite | 🔴 Alta | Coolify → App → Envs: `APPWRITE_PROJECT_ID`, `APPWRITE_API_KEY`, `SECURITY_API_KEY`, `JWT_SECRET` → Deploy |
| 2 | **obramarket-backend**: faltam credenciais DB + S3 + JWT | 🔴 Alta | Coolify → App → Envs: `DB_HOST/USER/PASSWORD/NAME`, `JWT_SECRET`, `PEPPER_SECRET`, `AWS_ACCESS_KEY_ID/SECRET` → Deploy |
| 3 | **obramarket-backend**: sem domínio próprio (sslip.io) | 🟡 Média | Coolify UI → App → Domains → adicionar `api-dev.obramarket.com.br` |
| 4 | **Sextando: nenhum app tem webhook CI/CD** | 🟡 Média | Configurar webhook GitHub para todos (ver URLs abaixo) |
| 5 | **SSH hostname bloqueado** — porta 22 inacessível via `redbull.rede5.com.br` | 🟢 Baixa | Cloudflare bloqueia porta 22 — SSH config usa IP `185.194.141.70` |
| 6 | **gohorsejobs-backend-local** usa domínio `test2.q1agenda.com.br` | 🟢 Baixa | Revisar domínio para `api-local.gohorsejobs.com` |

### q1agenda-backend — Envs pendentes
```bash
APPWRITE_PROJECT_ID=<id_do_projeto_appwrite>
APPWRITE_API_KEY=<api_key_server>
SECURITY_API_KEY=<chave_interna>
JWT_SECRET=<segredo_jwt>
```

### obramarket-backend — Envs pendentes
```bash
DB_HOST=<host_postgres>
DB_USER=<usuario>
DB_PASSWORD=<senha>
DB_NAME=obramarket_dev
JWT_SECRET=<segredo>
PEPPER_SECRET=<pepper>
ADMIN_EMAIL=admin@obramarket.com.br
ADMIN_PASSWORD=<senha_inicial>
AWS_ACCESS_KEY_ID=<key>
AWS_SECRET_ACCESS_KEY=<secret>
```

### Sextando — Webhooks CI/CD a configurar no GitHub
```
# Repositório: github.com/rede5/sextando → Settings → Webhooks
Backend URL:    https://redbull.rede5.com.br/api/v1/webhook/github?uuid=h8c4sg0sg80c4o8kkcw4ogcg
Backoffice URL: https://redbull.rede5.com.br/api/v1/webhook/github?uuid=nsc0gw0og40g0c88soc0o0wc
Frontend URL:   https://redbull.rede5.com.br/api/v1/webhook/github?uuid=vggkcs880o8go0ws84wcggco
```

---

## Comandos Rápidos

```bash
# SSH (usar IP direto)
ssh redbull

# Ver todos os containers
ssh redbull "docker ps --format 'table {{.Names}}\t{{.Status}}'"

# Ver logs de um app
ssh redbull "docker logs <container_name> --tail 50"

# Coolify API
TOKEN=$(cat ~/.ssh/coolify-redbull-token)
URL="https://redbull.rede5.com.br/api/v1"

# Listar apps com status
curl -s -H "Authorization: Bearer $TOKEN" "$URL/applications" | \
  node -e "const c=[]; process.stdin.on('data',d=>c.push(d)); process.stdin.on('end',()=>{ JSON.parse(c.join('')).forEach(a=>console.log(a.status+' | '+a.name+' | '+a.fqdn)); })"

# Deploy por UUID
curl -s -H "Authorization: Bearer $TOKEN" "$URL/deploy?uuid=<UUID>"

# Reiniciar app
curl -s -H "Authorization: Bearer $TOKEN" "$URL/applications/<UUID>/restart"
```
