---
title: "Docker Compose Stacks"
description: "Deploy a multi-service application from a single compose.yaml in a Git repository."
---
Docker Compose Stacks let you deploy a whole multi-service application from a single `compose.yaml` in a Git repository. Point Miget at a GitHub or public Git repo, and Miget detects each service in the compose file and provisions it - build-backed apps, standalone images, and managed databases/caches - as one coordinated **Stack**.
Miget recognizes your compose file under any of the standard Docker Compose names, so an existing project works without renaming anything:
- `compose.yaml` / `compose.yml` - the current Compose defaults
- `docker-compose.yaml` / `docker-compose.yml` - the legacy defaults
The examples below use `compose.yaml`, but any of these names is detected the same way.
## Why Use a Stack?
- **One repo, many services** - deploy an API, a worker, a database, and a cache together from a single compose file
- **Git-driven** - the stack tracks a branch; every deploy re-reads the compose file and reconciles what changed
- **Managed services detected automatically** - databases and caches declared in compose are provisioned as managed Miget services, not raw containers
- **No orchestration to wire up** - Miget derives resources, environment variables, volumes, and health checks from the compose file
## How It Works
A Stack is placed either on a **Resource** (Miget) or on [Usage Billing](/pricing/usage-billing) - billed by the second, with no resource underneath it - and belongs to a **Project**. Every service and database the stack deploys inherits that same placement and is billed on its own. Each service in the compose file becomes an item in the stack:
- A service with a `build:` section becomes a **buildable app**
- A service with only an `image:` becomes a **standalone app**
- A service with an `image:` plus an `x-miget.managed: ` hint (e.g. `postgres`, `redis`) becomes a **managed service** (database/cache) with credentials injected automatically
Every deploy re-reads the compose file on the tracked branch and reconciles the cluster to match it - new services are added, changed services are updated, and removed services are cleaned up. The stack's overall state and each service's status are computed from the underlying apps and services.
Managed services (databases and caches) are configured for you - you never supply their connection environment variables. Miget injects them automatically.
## Tuning Your Stack for Miget (`compose.miget.yaml`)
A plain `compose.yaml` describes your services, but it says nothing about how much memory each one needs, which one is public, or how large a volume should be. Miget reads those platform details from an optional **`compose.miget.yaml`** placed next to your compose file. Miget automatically layers it on top of the base compose at detect and deploy time - plain `docker compose up` ignores it, so your repo still runs locally unchanged.
The overlay mirrors your service and volume names and carries only an `x-miget` block on each:
```yaml
# compose.miget.yaml - layered onto compose.yaml at deploy time; plain docker compose ignores it
services:
web: # the public HTTP entry - must listen on port 5000
x-miget:
ram: "1024" # memory: plain MB, or a unit like "1Gi"
worker:
x-miget:
ram: "512"
private: true # internal only, not exposed to the internet
db: # provision a managed database instead of a container
x-miget:
managed: postgres
cpu: "500m"
ram: "1Gi"
storage: "5Gi"
extensions: [vector]
cache:
x-miget:
managed: valkey
ram: "256Mi"
volumes:
webdata:
x-miget: { size: "5000", type: RWO } # persistent disk: plain MB, or a unit
```
### `x-miget` reference
On a **service**:
| Key | Meaning |
| --- | --- |
| `ram` | Memory for the service - plain MB (`"1024"`) or a unit (`"1Gi"`, `"256Mi"`). Set one on every service unless you use `size` instead. |
| `cpu` | CPU in millicores (`"500m"`, `"1000m"`). Optional; a default is applied when omitted. Ignored when `size` is set. |
| `size` | A [Usage Billing size code](/pricing/usage-billing#choosing-a-size) (e.g. `"hobby-1c-1g"`) in place of `ram` and `cpu` - sets both from the catalogue in one key. Wins over `ram`/`cpu` when both are present. All services of a stack share one tier, so use `hobby-` or `pro-` codes throughout. |
| `private: true` | Keep the service internal - reachable by the rest of the stack but not exposed to the internet. Mark **every** service except the single public entry. |
| `managed: ` | Provision the service as a **managed Miget add-on** instead of a raw container (such as `postgres` or `valkey`). Miget runs it, backs it up, and injects its connection variables automatically - you never supply them. See [Databases](/databases/postgresql). |
| `storage` | Disk size for a managed service (`"5Gi"`). |
| `extensions` | Postgres extensions to enable on a managed `postgres` (e.g. `[vector]`, `[citext]`, `[hstore]`). |
| `vpc` | Put the service on a [VPC](/networking/private-networks/overview) of the workspace in the stack's region - by name (`vpc: default` joins its `default` subnet), or `{ name: default, subnet: backend }` for another subnet. A redeploy attaches the service when you add the key and detaches it when you remove it. Moving an attached service to another subnet is not applied: remove the key, deploy, then add the new one. A VPC name that does not exist fails that service's creation. |
| `project_variables` | `true` makes the service inherit the project's environment variables (paid plans); removing the key or setting `false` turns that off on the next deploy. A variable the service sets itself wins over the project's with the same key. |
On a stack paying per use, every service runs - and is billed - at a [Usage Billing size](/pricing/usage-billing#choosing-a-size). `ram` and `cpu` round up to the smallest size that holds the RAM, then the CPU: a service asking for 0.5 CPU and 2 Gi runs at `hobby-1c-2g`. A service that no size can hold is refused, and the error lists the sizes.
On a named **volume**:
| Key | Meaning |
| --- | --- |
| `size` | Volume size - MB (`"5000"`) or a unit (`"5Gi"`). |
| `type` | Access mode: `RWO` (per-node block volume - the default) or `RWX` (shared across replicas). |
### Conventions
- **Port 5000 for the public entry.** Miget's ingress only reaches port **5000**, so the one service you expose must listen on 5000. Mark everything else `private: true`.
- **One block per node, not `replicas`.** For clustered software (databases, brokers) each node needs its own identity and volume - add a service block per node rather than scaling with `replicas`.
- **`entrypoint` and `command` work as in Docker.** Compose `entrypoint` replaces the image's ENTRYPOINT and `command` replaces its CMD, on image-only and built services alike. Changing either - or `image` or `healthcheck` - redeploys that service on the next stack deploy.
- **`build` follows the compose file.** A changed `dockerfile` or `context` is used by the stack's next rebuild. A remote Git context (`https://...#ref`) is not followed.
- **Give stateful images a volume.** Analyze warns when a service runs a known stateful image (such as PostgreSQL, MySQL, MongoDB, Kafka, RabbitMQ or Elasticsearch) with no volume: its data would live in temporary storage and be lost on every restart and redeploy.
No `compose.miget.yaml` yet? Add one next to your compose file: give every service an `x-miget.ram`, mark internal services `private: true`, flag managed databases/caches with `managed:`, size your named volumes, and make sure the public service listens on port 5000 - then re-run analyze to confirm the detected resources.
## Ready-made Stacks (deployable.sh)
Miget publishes a catalogue of ready-to-run, already-tuned stacks - WordPress, Ghost, n8n, Kafka, Supabase, and many more - at [deployable.sh](https://deployable.sh) (source: [`deployable-sh/stacks`](https://github.com/deployable-sh/stacks)). Each ships a base `compose.yaml` plus a `compose.miget.yaml` with the overrides above, so it deploys correctly out of the box.
To deploy one, create a stack pointed at the `deployable-sh/stacks` repository and set the compose **path** to the stack's directory (for example `wordpress`). Prefer the catalogue over an arbitrary compose file found on the web - a random `compose.yaml` won't carry Miget's overrides and is likely to fail.
## Creating a Stack
The stack wizard walks through three steps:
1. **Source** - choose a GitHub or public Git repository, the branch to track, and the path to the compose file (use the compose path for monorepos, e.g. `services/api`).
2. **Review** - Miget analyzes the compose file and shows the detected services. Any required environment variables (declared in compose with no value) are surfaced here; the wizard pre-fills them with random values, which you can overwrite.
3. **Details** - name the stack, pick the project, and place it on a Resource or on Usage Billing. On a Resource, Miget pre-selects one with enough RAM for the detected services and blocks creation if the selected Resource is over capacity.
On create, Miget validates capacity, provisions each detected service, and runs the initial build.
## Required Environment Variables
When a compose service declares an environment variable with no value (for example `SECRET_KEY:`), Miget treats it as **required** and asks you to provide it during the Review step. Supplying every required variable is what lets the stack build successfully.
## Deploying and Auto-Deploy
Use the **Deploy** button on the stack page to re-read the compose file and reconcile the stack. There is no separate "re-analyze" action - every deploy refreshes the manifest.
If the stack's Git configuration has auto-deploy enabled and the tracked branch matches, a push to that branch triggers an automatic deploy using the same pipeline.
## Deploy Buttons
Add a one-click **Deploy to Miget** button to any repository with a single link:
```
https://miget.com/deploy?repo=&branch=&path=
```
`miget.com/deploy` auto-detects the right flow from the repo: a **Compose Stack** when a compose file is present, a **container image** when you pass `image`, otherwise a plain **app**. It then forwards you to the matching wizard with the Source step prefilled.
Supported parameters:
- `repo` - the repository (a GitHub `owner/repo` slug or a full HTTPS Git URL)
- `branch` - the branch to track (optional)
- `path` - the compose file's subdirectory for monorepos, e.g. `path=kafka` (optional)
- `image` - a container image to deploy instead of a repo (optional)
- `type` - force `stack`, `app`, or `image` to skip auto-detection (optional)
Drop the button straight into a README with the Markdown badge:
```markdown
[](https://miget.com/deploy?repo=https://github.com/OWNER/REPO)
```
## Managing Stacks via the API
Stacks are fully manageable over the Miget API. Always call the analyze endpoint first to discover services and required variables before creating:
- `POST /api/v1/stacks/analyze` - detect compose services and required env vars from a repo (creates nothing)
- `POST /api/v1/stacks` - create a stack (analyzes server-side, then provisions the apps/services)
- `GET /api/v1/stacks` / `GET /api/v1/stacks/{uuid}` - list stacks / get stack details
- `PUT /api/v1/stacks/{uuid}` - update `label` or `compose_path`
- `POST /api/v1/stacks/{uuid}/deploy` - trigger a redeploy
- `PUT /api/v1/stacks/{uuid}/deployment` - update the Git deployment config (branch, auto-deploy, repository)
- `GET /api/v1/stacks/{uuid}/deployments` - list deployment history
- `DELETE /api/v1/stacks/{uuid}` - delete a stack (cascades to its apps and services)
To deploy from a **private** repository, pass a stored Git credential's UUID as `credential_id`. See [Registry Credentials](/deployments/registry-credentials) for container images and your workspace Git credentials for private repos.
## Next Steps
Connect GitHub for private repos and auto-deploy
Learn how managed databases work on Miget
140+ open-source compose templates that deploy in one click.
The production details most tutorials skip.