- Implemented Docker operations including image building, container management, and resource stats. - Added Gitea API client for repository management and webhook handling. - Introduced monitoring service to collect and store container metrics in InfluxDB. - Created a queue system using BullMQ for managing deployment jobs with real-time log streaming. - Developed Telegram notification service for deployment status updates. - Added Traefik label generation for dynamic reverse proxy configuration. - Implemented WebSocket endpoints for log streaming and terminal access to containers. - Created an updater sidecar for self-updating the AutoDeployer container.
64 lines
2.2 KiB
Markdown
64 lines
2.2 KiB
Markdown
# AutoDeployer
|
|
|
|
Piattaforma di deployment self-hosted per gestire i servizi Docker con integrazione Gitea, Traefik, e monitoring in tempo reale.
|
|
|
|
## Feature
|
|
|
|
- 🔗 **Integrazione Gitea** — ogni repo = un servizio, deploy automatico via webhook
|
|
- 🚀 **Auto-Deploy** — webhook push → build → deploy automatico
|
|
- 🐳 **Dockerfile Build** — supporto per path e context personalizzati
|
|
- 🏷️ **Traefik Labels** — gestione visuale con preview dei label
|
|
- 📋 **Log Viewer** — streaming real-time via WebSocket
|
|
- 🔐 **Variabili d'Ambiente** — build-time e runtime, con supporto secret
|
|
- ⚡ **Zero-Downtime Deploy** — health check + switch traffico senza interruzioni
|
|
- 🔔 **Notifiche Telegram** — notifiche deploy su Telegram
|
|
- 📊 **Monitoring** — CPU, RAM, Network in tempo reale con storico su InfluxDB
|
|
- 💻 **Web Terminal** — shell interattiva nei container dal browser
|
|
- 🛡️ **Docker Networks** — gestione reti Docker dall'interfaccia
|
|
|
|
## Setup Rapido
|
|
|
|
```bash
|
|
# 1. Copia .env
|
|
cp .env.example .env
|
|
|
|
# 2. Configura le variabili in .env
|
|
# - JWT_SECRET (genera con: openssl rand -hex 64)
|
|
# - WEBHOOK_SECRET
|
|
# - GITEA_TOKEN
|
|
# - TELEGRAM_BOT_TOKEN e TELEGRAM_CHAT_ID
|
|
# - INFLUXDB_TOKEN
|
|
# - DEPLOY_DOMAIN
|
|
|
|
# 3. Build e avvia
|
|
docker compose up -d --build
|
|
|
|
# 4. Apri https://deploy.tuodominio.com
|
|
# Al primo accesso, crea l'account admin
|
|
```
|
|
|
|
## Architettura
|
|
|
|
- **Backend**: Node.js + Express + SQLite + BullMQ
|
|
- **Frontend**: React + Vite (servito dallo stesso container)
|
|
- **Build Queue**: BullMQ su Redis esistente (DB 2)
|
|
- **Monitoring**: InfluxDB per metriche storiche
|
|
- **Container**: Singolo container con accesso al Docker socket
|
|
|
|
## Reti Docker
|
|
|
|
- `meb-public` — Traefik, Gitea, AutoDeployer
|
|
- `meb-private` — Redis, PostgreSQL, InfluxDB, servizi interni
|
|
|
|
## Webhook
|
|
|
|
Ogni servizio genera un URL webhook univoco. Configura il webhook nel repository Gitea:
|
|
|
|
1. Gitea → Settings → Webhooks → Add Webhook
|
|
2. Target URL: `http://autodeployer:3000/api/webhooks/{webhook-id}`
|
|
3. Secret: il `WEBHOOK_SECRET` del `.env`
|
|
4. Trigger: Push Events
|
|
|
|
> **Nota**: Usa l'URL interno Docker (`http://autodeployer:3000`) per evitare
|
|
> il passaggio da Cloudflare.
|