diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..db16204 --- /dev/null +++ b/.env.example @@ -0,0 +1,6 @@ +TZ=Europe/Madrid +WATCHTOWER_CLEANUP=true +WATCHTOWER_INCLUDE_STOPPED=false +WATCHTOWER_SCHEDULE=0 0 3 * * * +# WATCHTOWER_NOTIFICATIONS=shoutrrr +# WATCHTOWER_NOTIFICATION_URL=telegram://TOKEN@CHATID diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5d91ca2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +# General +.env +.DS_Store +Thumbs.db + +# Logs y temporales +logs/ +*.log + +# Docker +*.tmp diff --git a/README.md b/README.md index 5033a76..1f7434e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,44 @@ -# watchtower +# Watchtower — Actualización automática de contenedores +## Qué es +[Watchtower](https://containrrr.dev/watchtower/) monitoriza imágenes y actualiza contenedores automáticamente cuando hay nuevas versiones. + +## Características +- Actualiza servicios etiquetados +- Limpieza de imágenes antiguas (`WATCHTOWER_CLEANUP=true`) +- Programación vía cron (`WATCHTOWER_SCHEDULE`) +- Notificaciones (Shoutrrr: Telegram, Slack, Email, etc.) + +## Despliegue +```bash +git clone https://git.ictiberia.com/groales/watchtower +cd watchtower +docker compose up -d +``` + +## Etiquetado de servicios +Para que un servicio se auto-actualice, añade: +```yaml +labels: + - "com.centurylinklabs.watchtower.enable=true" +``` + +## Variables de entorno +Edita `.env` o el `docker-compose.yaml`: +- `WATCHTOWER_SCHEDULE`: cron (UTC) p.ej. `0 0 3 * * *` (diario 03:00) +- `WATCHTOWER_CLEANUP`: `true` para borrar imágenes antiguas +- `WATCHTOWER_NOTIFICATIONS` y `WATCHTOWER_NOTIFICATION_URL`: ver Shoutrrr + +## Buenas prácticas +- Etiqueta solo servicios que quieras actualizar +- Usa horarios de baja actividad +- Revisa logs en actualizaciones críticas +- Mantén backups si actualizas servicios de estado + +## Troubleshooting +```bash +docker logs watchtower --tail=200 +``` + +--- +Última actualización: Nov 2025 diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..43c24bd --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,20 @@ +services: + watchtower: + image: containrrr/watchtower:latest + container_name: watchtower + restart: always + environment: + - TZ=Europe/Madrid + - WATCHTOWER_CLEANUP=true + - WATCHTOWER_INCLUDE_STOPPED=false + - WATCHTOWER_SCHEDULE=0 0 3 * * * + # Notificaciones (ejemplos): + # - WATCHTOWER_NOTIFICATIONS=shoutrrr + # - WATCHTOWER_NOTIFICATION_URL=telegram://token@chatid + volumes: + - /var/run/docker.sock:/var/run/docker.sock + command: --label-enable + +# Etiqueta tus servicios para que watchtower los actualice: +# labels: +# - "com.centurylinklabs.watchtower.enable=true"