Cloud VPS from $1.98/mo · pay with Bitcoin, Ethereum, Monero, USDT or Solana · paid in crypto
Cloud and hosting

Keep a business app online: uptime on a single VPS

Uptime for a business app on one VPS: downtime budgets from 99.9% to 99.99%, automatic restarts, disk and certificate checks, safe updates and a warm standby.

CloudSat teamNovember 18, 20267 min read
Abstract illustration of one server tower circled by a steady pulse line, with a dimmer standby tower waiting behind it
On this pageWhat an uptime target allows

A second server sounds like the cure for downtime. On a single VPS, though, most of what takes a business app offline happens inside the machine: a process that crashed and stayed down, a disk that filled with logs, a certificate that expired on a Sunday, an update that rebooted the server at noon. Those failures cost attention, not money, to prevent. Close them first, then decide whether a warm standby is worth paying for.

What an uptime target allows

Uptime targets are downtime budgets. Over a 30-day month (43,200 minutes) and a 365-day year, they allow:

Target Downtime per 30-day month Downtime per year
99.9% 43.2 minutes 8 h 45.6 min
99.95% 21.6 minutes 4 h 22.8 min
99.99% 4.3 minutes 52.6 minutes

A kernel update with a reboot and a careful check afterwards fits comfortably in a 99.9% month. A failed upgrade that ends in a restore from backup can use up a quarter's budget. Four minutes a month, the 99.99% budget, leaves no room for either, so that target needs at least two servers and automatic failover.

Availability also multiplies. CloudSat's 99.95% SLA covers the network and the host of each server; your software, its configuration, its updates and its load are yours. If the platform and your application each manage 99.95% independently, the app as users see it lands near 99.9%. The only figure that matters is the one you measure from outside.

Make crashes restart themselves

Services under systemd

Run the app as a systemd service with a restart policy, a start limit and a memory cap:

# /etc/systemd/system/invoices.service
[Unit]
Description=Invoices web app
After=network-online.target postgresql.service
Wants=network-online.target
StartLimitIntervalSec=300
StartLimitBurst=5

[Service]
User=invoices
WorkingDirectory=/srv/invoices
ExecStart=/srv/invoices/bin/invoices-server --listen 127.0.0.1:8000
Restart=on-failure
RestartSec=5
MemoryMax=1G

[Install]
WantedBy=multi-user.target

Enable it with sudo systemctl enable --now invoices. Restart=on-failure brings the process back after a crash, a kill signal or a timeout. The start limit stops a crash loop after five attempts in five minutes, so the unit ends up failed where monitoring can see it instead of flapping forever. MemoryMax confines a memory leak to its own service: the kernel kills and systemd restarts the leaking process, instead of the whole server sliding into swap or the out-of-memory killer picking your database.

Containers under Docker

In Compose, set a restart policy and a health check:

services:
  app:
    image: ghcr.io/example/invoices:1.8.2
    restart: unless-stopped
    ports:
      - "127.0.0.1:8000:8000"
    healthcheck:
      test: ["CMD", "curl", "-fsS", "http://localhost:8000/health"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 30s

The two do different jobs. A restart policy acts when the process exits, and only once the container had been running for at least 10 seconds, which prevents tight restart loops. A health check marks a container unhealthy when it stops answering, but Docker Engine does not restart it for that alone. Make a stuck app exit so the policy can act, and have monitoring alert on the unhealthy state. The test needs a client that exists in the image, here curl. Pin image tags rather than latest, so a routine docker compose up never upgrades the app by surprise.

Keep the disk from filling

A full disk stops databases from writing and apps from logging, often both at once. Cap the logs that grow without limit:

# /etc/systemd/journald.conf.d/size.conf
[Journal]
SystemMaxUse=500M
{
  "log-driver": "json-file",
  "log-opts": { "max-size": "20m", "max-file": "5" }
}

The second file is /etc/docker/daemon.json. Restart systemd-journald and Docker afterwards; the Docker limits apply to containers created from then on. Database binary logs and old backups left on the same disk are the other usual suspects. Then alert before the disk is full, not when it is:

#!/bin/sh
# /usr/local/bin/disk-alert: report filesystems above 85% to a webhook
df -P -x tmpfs -x devtmpfs | awk 'NR > 1 && $5 + 0 > 85 { print $6 " at " $5 }' |
while read -r line; do
  curl -fsS -d "$(hostname): $line" https://hooks.example.com/alerts
done

Make it executable with chmod +x, then run it from root's crontab every ten minutes: */10 * * * * /usr/local/bin/disk-alert.

Do not let certificates expire

Certbot renews from a systemd timer; confirm it exists with systemctl list-timers and test the whole path with sudo certbot renew --dry-run. Caddy renews by itself, but only while DNS points at the server and ports 80 or 443 stay reachable, so a firewall change can break renewal quietly. Check the live certificate from outside the server:

echo | openssl s_client -connect app.example.com:443 -servername app.example.com 2>/dev/null \
  | openssl x509 -noout -checkend 1209600 && echo "valid for 14+ days" || echo "renew now"

Most uptime monitors can run the same check and alert well before the expiry date.

Updates without surprise reboots

On Ubuntu, unattended-upgrades installs security updates every day. Kernel and library updates still need a reboot to take effect, so choose when that happens. Put your settings in a file of their own, such as /etc/apt/apt.conf.d/52unattended-upgrades-local, which package upgrades will not overwrite:

Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-WithUsers "true";
Unattended-Upgrade::Automatic-Reboot-Time "04:30";

The server then reboots at 04:30 server time, and only when an update asked for it. Publish that hour to your users as a standing maintenance window. Then reboot once on purpose and confirm the app comes back without anyone typing a command; services that need a manual start are found this way, not during an outage. For major upgrades of the operating system or the app, take a backup first and do it by hand.

Watch from outside

A server cannot report its own power loss, so monitoring has to run somewhere else. Uptime Kuma or Gatus on a small server in another region can check the real URL over HTTPS every minute, alert after two or three failed checks in a row, and warn about certificates. Point the main check at a health endpoint that touches the database but stays cheap: a page that answers while the database is down tells you nothing. Send alerts to a channel someone reads at night.

Both tools also publish a status page. Host it away from the app's server, so customers can see it while the app is down, and post incidents there before the support inbox fills up.

When one server is not enough: a warm standby

When the budget is too small for a restore from backup, keep a second server ready:

  • Same software, current data. Install the app identically, ideally from the same scripts. Replicate the database (streaming replication in PostgreSQL, for example) and sync uploaded files on a schedule that matches how much data you can afford to lose.
  • A fast way to move traffic. Within one region, a CloudSat floating IP can be detached from the failed server and attached to the standby in the console, once you have added the address inside the operating system of both, as the floating IP guide shows. Across regions, switch DNS records that you keep at a low TTL.
  • A person who decides. For a small team, a documented manual switch is safer than automatic failover, which can promote the standby while the primary still writes.
  • A rehearsal. Switch over on purpose every few months, during the maintenance window, and time it.

FAQ

Is the host's SLA enough for my app?

It covers the platform, not the application on it. Your users see the product of both availabilities, minus every crash, full disk and failed deploy of your own. Track your own uptime from an outside monitor.

How often should monitoring check?

Once a minute suits most business apps. Alert after two or three consecutive failures, so a single dropped packet does not page anyone, and keep at least one check that exercises the database.

Should security updates install automatically on production?

For most small teams, yes, with a fixed reboot window. An unpatched server is a larger risk than a planned reboot at a quiet hour. Keep major upgrades manual, with a backup taken first.

Do I need Kubernetes for high availability?

No. Two servers, database replication and a floating IP or DNS switch cover most small business apps. Kubernetes adds an operational load of its own that only pays off with many services and the people to run it.

Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.