Initial commit: Watchtower con schedule, cleanup y notificaciones

This commit is contained in:
2025-11-30 11:49:49 +01:00
parent fc7db813fe
commit 76d24327a1
4 changed files with 80 additions and 1 deletions

6
.env.example Normal file
View File

@@ -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

11
.gitignore vendored Normal file
View File

@@ -0,0 +1,11 @@
# General
.env
.DS_Store
Thumbs.db
# Logs y temporales
logs/
*.log
# Docker
*.tmp

View File

@@ -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

20
docker-compose.yaml Normal file
View File

@@ -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"