Sidecar Patterns for Modest Setups: Logging, Refreshing Certs
Use sidecar containers for log forwarding and certificate renewal on a single VPS without adding cluster complexity or vendor lock-in.
Netbay Cloud Team
Netbay Engineering
On this page
A sidecar is a helper container that shares a network and volumes with a main container to do a supporting job. The pattern is famous from service meshes, but its most useful forms on a single VPS are mundane: shipping logs off-box and keeping certificates renewed. You get separation of concerns without paying for a mesh or a platform.
Neither pattern needs Kubernetes. In Docker Compose or Podman Quadlets, a sidecar shares the main service's network namespace and a couple of volumes, and the two containers come up and down together.
Log Forwarding Sidecar
Write the app's logs to a shared volume as JSON lines, and let a small aggregator sidecar read, buffer, and ship them. Because only the exporter talks to the logging service, the app stays simple and stateless.
version: "3.9"
services:
app:
image: myapp:2.1
volumes:
- logs:/var/log/app
networks: [internal]
logshipper:
image: fluent/fluent-bit:3
command: ["-c", "/fluent-bit/conf/fluent-bit.conf"]
volumes:
- logs:/var/log/app:ro
- ./fluent-bit.conf:/fluent-bit/conf/fluent-bit.conf:ro
networks: [internal]
environment:
- LOKI_URL=http://loki.example.com/loki/api/v1/push
restart: unless-stopped
volumes:
logs:The app writes to /var/log/app; the sidecar tails that same directory, forwards it, and never sees the app's secrets.
Certificate Renewal Sidecar
Renewing an ACME certificate is a classic job best kept out of your app. A certbot sidecar shares the webroot and the certificate directory with the reverse proxy or app, renews on a schedule, and reloads the proxy. Here is the Compose shape:
version: "3.9"
services:
web:
image: caddy:2
restart: unless-stopped
ports: ["80:80", "443:443"]
volumes:
- caddydata:/data
networks: [internal]
certrefresh:
image: certbot/certbot:latest
command: ["renew", "--webroot", "-w", "/var/www", "--deploy-hook", "/bin/true"]
volumes:
- caddydata:/data
- webroot:/var/www
networks: [internal]
volumes:
caddydata:
webroot:With Caddy handling issuance internally you may not need the sidecar at all; this pattern is for nginx-plus-certbot where the renewal and reload happen in a dedicated container.
Sidecars as a Deployment Discipline
The discipline that makes sidecars maintainable on one node:
- Share only the minimal volumes and network surface the helper truly needs.
- Give each sidecar its own restart policy and healthcheck.
- Keep helpers ephemeral and stateless — the cert data and logs persist, the helper is disposable.
- Do not over-split: one good helper beats three half-baked ones.
Podman Quadlet expresses the same idea by putting both containers in one pod directory, so they share a network automatically while systemd manages the lifecycle.
Takeaway
Sidecars are a clean way to add logging and certificate renewal to a small VPS-shaped stack without adopting a service mesh or an orchestrator. Apply them to the Compose stack you already run on a Netbay instance — provision yours at netbayhosts.in and let a tiny sidecar keep certs fresh and logs flowing while your app stays boring and stable.
Keep reading
Follow along on a real VPS
Deploy Linux in under 60 seconds
These guides are written against Ubuntu, Debian, and RHEL-family images — the same ones on NetBay.
Deploy an instance