Skip to content

Fase 3.3: Systemd Service

← Anterior: 3.2 Monitoring | Siguiente: 3.4 Docs →


Crear systemd service file

Archivo: */backend/background-jobs-system.md

Rama: feature/background-jobs-systemd

Fase: 3.3: Systemd Service

Estimación: 2 horas

Dependencias: Crear alerting triggers

Deliverables

  • [ ] Crear server/systemd/background-jobs-worker.service
    • [ ] ExecStart: php /var/www/Bautista/server/bin/worker.php
    • [ ] Restart: on-failure
    • [ ] RestartSec: 5
    • [ ] User: www-data
    • [ ] WorkingDirectory: /var/www/Bautista/server
    • [ ] StandardOutput: journal
    • [ ] StandardError: journal
  • [ ] Create .timer para cleanup (daily 2 AM)
  • [ ] Documentación install: sudo systemctl enable background-jobs-worker.service
  • [ ] Tests simulando systemd

Configurar auto-restart

Archivo: */backend/background-jobs-system.md

Rama: feature/background-jobs-systemd

Fase: 3.3: Systemd Service

Estimación: 1 hora

Dependencias: Crear systemd service file

Deliverables

  • [ ] Service file: StartLimitIntervalSec=600, StartLimitBurst=5
  • [ ] Worker graceful shutdown en SIGTERM (5s timeout)
  • [ ] Systemd stops after 5 restarts en 600s
  • [ ] Documentation troubleshooting
  • [ ] Tests simulando crash/restart

Configurar logs journalctl

Archivo: */backend/background-jobs-system.md

Rama: feature/background-jobs-systemd

Fase: 3.3: Systemd Service

Estimación: 2 horas

Dependencias: Configurar auto-restart

Deliverables

  • [ ] Logs automáticamente en journalctl
  • [ ] journalctl -u background-jobs-worker.service -f para live tail
  • [ ] Log retention via journalctl (default 2GB)
  • [ ] Documentation: viewing/filtering logs
  • [ ] Tests reading journalctl entries

← Anterior: 3.2 Monitoring | Siguiente: 3.4 Docs →