❯ The Maintenance Routine Your Self-Hosted Systems Actually Need

by Jonas Reyes — the builder's desk, Side Quest Studios
November 28, 2026

Alright, let’s get this out of the way: if you’re running anything beyond a local hello_world.py script on your laptop, you need a maintenance routine. And no, "I'll get to it when it breaks" is not a routine. That's a recipe for 3 AM panic calls and the kind of existential dread that makes you question why you ever left the comfortable, warm embrace of managed SaaS. We’ve all been there. It’s Thanksgiving 2026, and while everyone else is arguing about whether stores should be open on Thanksgiving, you're staring at a red dashboard, wondering why your carefully crafted AI_widget_v2.0 is returning 500s.

This isn't about shiny new features or the latest AI hype. This is about keeping the lights on. It’s about the boring, essential work that lets you sleep at night. I've kept real fleets alive, watched entire data centers sweat, and debugged enough OSError: [Errno 28] No space left on device messages to last a lifetime. This is what you do.

Backups: If It's Not Backed Up, It Doesn't Exist

Let's start with the absolute non-negotiable. If you don't have backups, you don't have a system; you have a ticking time bomb. Period. And I don’t mean "I copied some files to my external drive last month." I mean automated, verified, offsite backups.

For Linux, rsync is your best friend. For databases, specific dumps are critical. * Filesystems: rsync -avz --delete /source/path/ user@backup.server:/dest/path/ * --delete is crucial for keeping the backup synchronized, removing files that no longer exist on the source. Be careful. * Schedule this with cron. 0 2 * * * rsync -avz --delete /var/www/html/ user@backup.server:/mnt/backups/web/ runs nightly at 2 AM. * PostgreSQL: pg_dump -Fc mydb > mydb.dump * -Fc creates a custom format archive, good for pg_restore. * Ship this dump offsite immediately. scp mydb.dump user@backup.server:/mnt/backups/db/ * MySQL/MariaDB: mysqldump mydb > mydb.sql * Simple, effective. Again, scp it somewhere else. * Configuration Files: /etc directory? Critical. Treat it like a database. rsync it. Version control it with git. Yes, git /etc. It’s not crazy, it’s sane.

And the "verified" part? Don't just assume. Regularly, once a month at minimum, restore a backup to a test environment. If you can't restore it, you don't have a backup. You have a collection of useless bits. No exceptions. This isn’t optional.

Updates and Patching: Don't Be That Guy

"If it ain't broke, don't fix it" is for hobbyists, not people running production systems. Software has bugs. Software has vulnerabilities. AI models are getting smarter, but they still can't patch your kernel for you despite some claims. Neglecting updates is how you end up with ransomware, data breaches, and a very bad week.

  • Operating System:
    • Debian/Ubuntu: sudo apt update && sudo apt upgrade -y
    • CentOS/RHEL: sudo yum update -y or sudo dnf update -y
    • Do this weekly. Seriously.
    • For kernel updates, you’ll need a reboot. Schedule it. Don't just hit reboot and hope. Announce it.
  • Application Dependencies: If you're running Python, you have a requirements.txt.
    • Keep those dependencies updated. pip-compile --upgrade from pip-tools is a lifesaver for managing pinned versions.
    • Run security scans on your dependencies: pip audit or safety check. Integrate this into your CI pipeline. If you don't have a CI pipeline for your self-hosted setup, you're doing it wrong. Start with GitHub Actions or GitLab CI. It's not hard.

Yes, updates can break things. That's why you have backups and test environments. Don't update production directly. Stage it. Test it. Then deploy. This isn't rocket science, it's just discipline.

Log Management: Stop Staring, Start Analyzing

Logs are your system's heartbeat. They tell you what's working, what's failing, and what's about to catch fire. Just letting them pile up in /var/log is useless. You need to centralize, rotate, and monitor them.

  • Rotation: logrotate is built into Linux for a reason. Configure it for your application logs.
    • Example: /etc/logrotate.d/myapp /var/log/myapp/*.log { daily missingok rotate 7 compress delaycompress notifempty create 0640 www-data adm sharedscripts postrotate systemctl reload myapp.service > /dev/null 2>&1 || true endscript }
    • This rotates daily, keeps 7 compressed logs, and reloads your app so it opens a new log file. Basic. Essential.
  • Centralization: For anything beyond a single server, you need a central log aggregator.
    • ELK Stack (Elasticsearch, Logstash, Kibana): The classic. A bit heavy, but incredibly powerful.
    • Loki + Promtail + Grafana: Simpler, lighter, integrates well with Prometheus. My preference for most small-to-medium setups.
    • promtail config in /etc/promtail/config.yaml to scrape your application logs and ship them to Loki.
  • Monitoring: Don't just collect logs. Set up alerts.
    • If you see 500 errors spike, you need to know now.
    • If you see "out of memory" errors, you need to know.
    • Use Grafana alerts against Loki queries. Or build a simple Python script to parse logs and send alerts to a Slack webhook. grep -c "ERROR" /var/log/myapp/current.log is a good starting point for a cron job.

Don't wait for your users to tell you something's broken. Your logs will tell you first.

Resource Monitoring: Know Your Limits

Disk space, CPU, memory, network I/O. These aren't abstract numbers; they are the fundamental limits of your system. Ignore them at your peril.

  • Prometheus + Node Exporter + Grafana: This is the standard.
    • node_exporter runs on each server, exposing hardware metrics.
    • prometheus scrapes these metrics.
    • grafana visualizes them and handles alerting.
    • Install node_exporter on your Linux box: wget https://github.com/prometheus/node_exporter/releases/download/v1.x.x/node_exporter-1.x.x.linux-amd64.tar.gz then unpack and run as a systemd service.
  • Alerting Thresholds:
    • Disk usage: Alert at 80%, critical at 90%. (df -h is your manual check. Automate it.)
    • CPU utilization: Alert if consistently above 80% for 5 minutes. (top or htop for interactive. sar for historical.)
    • Memory: Alert if free memory drops below 10% or swap usage increases. (free -h)
  • Application-Specific Metrics: Beyond system resources, monitor your application.
    • Request rates, error rates, latency. If your Python application is using Flask or FastAPI, expose an /metrics endpoint using Prometheus client libraries.
    • This is how you distinguish between a server problem and an application bug.

"But I don't have time to set this up!" I hear you. You don't have time not to. The time you save debugging a catastrophic outage is orders of magnitude greater than the time it takes to set up basic monitoring.

Cleanup and Optimization: Trim the Fat

Systems accumulate cruft. Old logs, temporary files, unused packages, orphaned Docker images. This isn't just about aesthetics; it eats up disk space, can impact performance, and makes troubleshooting harder.

  • Temporary Files: Regularly clear /tmp and /var/tmp.
    • sudo find /tmp -type f -atime +7 -delete (delete files older than 7 days)
    • sudo find /var/tmp -type f -atime +30 -delete (longer retention for /var/tmp is often fine)
    • Be careful with automated deletion in /tmp if you have applications that rely on long-lived temp files. Know your applications.
  • Unused Packages:
    • Debian/Ubuntu: sudo apt autoremove --purge -y
    • CentOS/RHEL: sudo yum autoremove -y or sudo dnf autoremove -y
    • Do this after every major update.
  • Docker: If you're using containers, they generate a lot of junk.
    • docker system prune -a (removes all stopped containers, unused networks, dangling images, and build cache)
    • Run this regularly. Schedule it with cron. 0 3 * * * docker system prune -af
  • Database Cleanup: Databases can grow massive with old data, unindexed tables, or bloated transaction logs.
    • PostgreSQL: VACUUM ANALYZE or VACUUM FULL (the latter locks tables, so schedule carefully). Autovacuum helps, but manual runs are sometimes needed.
    • MySQL: OPTIMIZE TABLE (also locks). Regularly review table sizes and indexes.

This is the equivalent of cleaning your garage. It's not glamorous, but it prevents you from tripping over old tires when you actually need to find your wrench.

Security Audits: Trust, But Verify

You’ve patched, you’ve updated. But is your firewall configured correctly? Are there open ports you don't know about? Are your SSH keys secure?

  • Firewall Rules:
    • ufw status (Ubuntu) or firewall-cmd --list-all (CentOS/RHEL)
    • Regularly review your firewall rules. Are all ports necessary? Close anything that isn

References