← Home

Keeping the Website Running After a VPS Reboot

Reboots happen. Kernel updates, provider maintenance, or manual restarts. If your deployment is healthy only until the next reboot, it is not production-ready. This is the setup that keeps the site coming back automatically.

1. Confirm restart policy in Compose

In compose.yml, keep:

restart: unless-stopped

This is useful, but on its own not always enough for a clean boot workflow.

2. Create a systemd service for compose

Create /etc/systemd/system/website-compose.service:

[Unit]
Description=Website Podman Compose Stack
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/opt/website
ExecStart=/usr/bin/podman-compose -f compose.yml up -d
ExecStop=/usr/bin/podman-compose -f compose.yml down
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target

Enable and start it:

sudo systemctl daemon-reload
sudo systemctl enable website-compose.service
sudo systemctl start website-compose.service
sudo systemctl status website-compose.service --no-pager

3. Make sure Caddy also starts on boot

sudo systemctl enable caddy
sudo systemctl status caddy --no-pager

4. Reboot test

sudo reboot

After reconnecting:

systemctl status website-compose.service --no-pager
podman ps
curl -I http://127.0.0.1:4321
curl -I https://adrian-altner.de

Expected result:

  • website-compose.service is active
  • website container is running
  • local and public health checks return success

5) Troubleshooting after reboot

  • Container not running: journalctl -u website-compose.service -n 100 --no-pager
  • Caddy running but site down: podman logs --tail=200 website
  • TLS/proxy issues: journalctl -u caddy -n 100 --no-pager

The goal is simple: after reboot, no manual recovery steps.

← Home