Skip to main content

Services

Each entry under services in your manifest is one service of your app, keyed by a name you choose. A service's type selects what it is:

typeWhat it runs
containerYour code: a prebuilt image, or an image built from your repository.Container services
postgresA managed database (PostgreSQL), provisioned and operated by AppHaven.Database

A small app is often just the two:

services:
web:
type: container
build:
dockerfile: Dockerfile
ports:
- 3000
env:
DATABASE_URL: ${service.db.url}
depends_on:
- service: db
condition: healthy

db:
type: postgres

Networking

Services in the same deployment share a private internal network and reach each other by service name: a service named api listening on 8080 is reachable from another service as http://api:8080, and a database named db as db:5432. Declared ports are how AppHaven serves your app on its URL; nothing else is reachable from the internet.

Start order (depends_on)

Any service can declare that it should start after another:

depends_on:
- service: db # another service in this manifest
condition: healthy # "started" or "healthy"; default "started"
  • condition: started: wait until the other service's container has started.
  • condition: healthy: wait until it reports healthy. The target must define a healthcheck; managed databases come with one built in.
  • References must point at a service in the same manifest, and the dependency graph must have no cycles.

depends_on controls start ordering only: it doesn't affect networking, and AppHaven also restarts services automatically if they crash, so it isn't your app's only safety net.

Where to go next