Maintenance — Keeping Pytigon Healthy
A Pytigon application, like any living system, needs regular care. This section covers the routine maintenance tasks that keep your application running smoothly.
Daily
- Check the error log — Look for new errors that might indicate emerging problems
- Verify backups ran — Check backup logs, verify backup file sizes are non-zero
- Monitor disk space — Database and file storage grow over time
Weekly
- Review slow queries — Django Debug Toolbar or PostgreSQL's
pg_stat_statements
- Check for dependency updates —
ptig pip list --outdated
- Test restore a backup — Verify your backup actually works
Monthly
- Archive old logs — Rotate and compress log files older than 30 days
- Review user accounts — Disable accounts of users who have left
- Check SSL certificate expiry — Certificates expire; set calendar reminders
- Performance baseline — Measure response times, compare to previous months
Upgrading Pytigon
Minor Updates (Bug Fixes)
ptig pip install --upgrade pytigon
python manage.py migrate
Major Updates (New Features, Breaking Changes)
- Read the release notes thoroughly
- Test the upgrade in a staging environment
- Backup the database and project files
- Run migrations
- Verify all views load correctly
- Run your test suite
Database Maintenance
SQLite
sqlite3 [PRJ].db "VACUUM;"
sqlite3 [PRJ].db "ANALYZE;"
PostgreSQL
VACUUM ANALYZE;
REINDEX DATABASE pytigon_db;
Task Queue Maintenance
- Monitor failed tasks — The task queue view shows failed and retried tasks
- Clear old task records — Task history can grow large; configure retention in settings
- Restart workers after deployment — Workers must reload to pick up code changes
Health Check
Pytigon provides a health check endpoint at /health/ that returns system status:
{
"status": "ok",
"database": "connected",
"tasks": "running",
"storage": "available",
"version": "2.5.0"
}
Configure monitoring tools (Nagios, Prometheus, UptimeRobot) to hit this endpoint regularly.