Skip to content

Multi-Container Stacks

Demi can deploy services that depend on each other, like a web app with its own database. All containers are placed on a shared network so they can reach each other by name.

How Networking Works

All managed containers are on a shared Podman network called nurvus. This means containers can reach each other using their container name as the hostname.

For example, if you have a nextcloud container and a nextcloud-db container, nextcloud can connect to the database at nextcloud-db:5432.

Deploying a Stack

Just describe what you want and Demi handles the wiring:

You: deploy nextcloud with its own database

Demi: Here's the plan:

      Container 1: nextcloud-db
      - Image: docker.io/library/postgres:16
      - Volume: /srv/nextcloud-db/data:/var/lib/postgresql/data
      - Env: POSTGRES_USER=nextcloud, POSTGRES_PASSWORD=changeme (change!)

      Container 2: nextcloud
      - Image: docker.io/library/nextcloud:latest
      - Port: 8080 -> 80
      - Volume: /srv/nextcloud/html:/var/www/html
      - Env: POSTGRES_HOST=nextcloud-db, POSTGRES_USER=nextcloud
      - Depends on: nextcloud-db

      Ready to proceed, or want to change anything?

Naming Convention

Supporting containers are named after the service they support:

  • nextcloud-db (not postgres) for Nextcloud's database
  • grafana-db for Grafana's database
  • vaultwarden-db for Vaultwarden's database

This avoids conflicts between stacks and makes it clear which containers belong together.

Dependency Ordering

The depends_on field ensures containers start in the right order. If nextcloud depends on nextcloud-db, NixOS will always start the database before the web app.

Reusing Existing Services

By default, Demi creates dedicated containers for each stack. If you want to reuse an existing service (like a shared postgres), tell her explicitly:

You: deploy nextcloud using my existing postgres on port 5432

Demi will check that the existing container is on the nurvus network and use the correct credentials.