Kamal accessories or managed services for your database?

Whether to run Postgres, Redis and other dependencies as Kamal accessories or use managed services instead.

Kamal deploys your app containers to your own servers. For databases, caches and search, it offers accessories: long-running containers defined in deploy.yml and managed with kamal accessory commands. The question is whether to run dependencies that way or use a managed service.

What accessories are

An accessory is a container Kamal starts on a chosen host, with its own image, ports, volumes and environment:

accessories:
  db:
    image: postgres:17
    host: 10.0.0.5
    port: "127.0.0.1:5432:5432"
    env:
      secret:
        - POSTGRES_PASSWORD
    directories:
      - data:/var/lib/postgresql/data

Kamal does not redeploy accessories on every app deploy. You boot, reboot and upgrade them explicitly.

What accessories do not do

  • Backups: you need your own scheduled dumps or volume snapshots
  • Failover: one container on one host
  • Upgrades: major Postgres upgrades need manual migration
  • Monitoring: add it yourself

That is not a flaw; Kamal is intentionally a deploy tool. But it means the operational work is yours.

When accessories are a good fit

  • Redis used as a cache, where data loss is harmless
  • Small Postgres databases for internal tools or early products, with tested backups
  • Search engines like Meilisearch where the index can be rebuilt

When managed services win

  • Customer data that must survive hardware failure without manual work
  • Teams without anyone comfortable restoring Postgres at 3 am
  • Compliance needs such as point-in-time recovery and encryption at rest with audit evidence

Managed Postgres costs more per gigabyte but includes backups, failover and upgrades.

A middle path

Run the database on a dedicated server you control, with a backup tool such as pgBackRest or WAL-G shipping to object storage, and test restores monthly. You keep the cost advantage and get real recovery, at the price of a few hours of setup.

Questions to decide

  1. How much data can you lose: none, an hour, a day?
  2. Who restores it, and have they practiced?
  3. What does downtime cost compared to the managed price difference?

Write the answers down. They make the choice obvious.

How Kamal compares with a platform that also provisions databases and backups is covered in Kamal vs Peon.

Disclosure: I help build Peon.


Write a comment