52 lines
1.6 KiB
Markdown
52 lines
1.6 KiB
Markdown
|
|
# Phoenix Deploy API
|
||
|
|
|
||
|
|
Gitea webhook receiver and deploy endpoint stub for Gitea → Phoenix deployment integration.
|
||
|
|
|
||
|
|
## Endpoints
|
||
|
|
|
||
|
|
| Method | Path | Description |
|
||
|
|
|--------|------|-------------|
|
||
|
|
| POST | /webhook/gitea | Receives Gitea push/tag/PR webhooks |
|
||
|
|
| POST | /api/deploy | Deploy request (repo, branch, target) |
|
||
|
|
| GET | /health | Health check |
|
||
|
|
|
||
|
|
## Environment
|
||
|
|
|
||
|
|
Copy `.env.example` to `.env` and set `GITEA_TOKEN` (and optionally `PHOENIX_DEPLOY_SECRET`).
|
||
|
|
|
||
|
|
| Variable | Default | Description |
|
||
|
|
|----------|---------|-------------|
|
||
|
|
| PORT | 4001 | Listen port |
|
||
|
|
| GITEA_URL | https://gitea.d-bis.org | Gitea instance URL |
|
||
|
|
| GITEA_TOKEN | | Token for commit status API |
|
||
|
|
| PHOENIX_DEPLOY_SECRET | | Optional secret for webhook/deploy auth |
|
||
|
|
|
||
|
|
## Gitea Webhook Configuration
|
||
|
|
|
||
|
|
In Gitea: Repository → Settings → Webhooks → Add Webhook
|
||
|
|
|
||
|
|
- **URL:** `https://phoenix-api-host/api/webhook/gitea` (or your Phoenix API URL)
|
||
|
|
- **Content type:** application/json
|
||
|
|
- **Events:** Push events, Tag creation (and optionally Pull requests)
|
||
|
|
- **Secret:** Optional, set PHOENIX_DEPLOY_SECRET to match
|
||
|
|
|
||
|
|
## Deploy API (Trigger from Gitea Actions)
|
||
|
|
|
||
|
|
```bash
|
||
|
|
curl -X POST "https://phoenix-api-host/api/deploy" \
|
||
|
|
-H "Authorization: Bearer $PHOENIX_DEPLOY_TOKEN" \
|
||
|
|
-H "Content-Type: application/json" \
|
||
|
|
-d '{"repo":"d-bis/proxmox","branch":"main","sha":"abc123","target":"default"}'
|
||
|
|
```
|
||
|
|
|
||
|
|
## Integration with Sankofa Phoenix
|
||
|
|
|
||
|
|
This service is a standalone stub. Full deployment logic should be implemented in the Sankofa Phoenix API (VMID 8600). Migrate the webhook handler and deploy logic into the Phoenix API when ready.
|
||
|
|
|
||
|
|
## Run
|
||
|
|
|
||
|
|
```bash
|
||
|
|
npm install
|
||
|
|
GITEA_TOKEN=xxx npm start
|
||
|
|
```
|