Skip to content

Accessories (Databases, Caches & Dashboards) ​

Learn how to provision and manage stateful companion services like PostgreSQL, Redis, MinIO, and Adminer alongside your application.


What Are Accessories? ​

Unlike application containers (which are replaced on every deploy to enable zero-downtime blue/green switches), accessories are long-lived, persistent containers:

  • Stateful Storage: Data is preserved across deployments using Docker host volumes.
  • Dedicated Lifecycle: Accessories are started once and remain running when you deploy code updates.
  • Optional Traefik Ingress: Accessories can have their own public domains and SSL certificates (great for web-based DB managers like Adminer).

Configuring Accessories in epd.yml ​

yaml
accessories:
  # 1. PostgreSQL Database
  db:
    image: postgres:17-alpine
    host: 203.0.113.10
    env:
      clear:
        POSTGRES_DB: myapp
        POSTGRES_USER: postgres
      secret:
        - POSTGRES_PASSWORD
    volumes:
      - /var/lib/epd/volumes/myapp-postgres:/var/lib/postgresql/data
    ports:
      - "127.0.0.1:5432:5432" # Bound strictly to localhost for safety

  # 2. Redis Cache
  redis:
    image: redis:7-alpine
    host: 203.0.113.10
    volumes:
      - /var/lib/epd/volumes/myapp-redis:/data
    command: redis-server --appendonly yes

  # 3. Database Management UI (Public HTTPS via Traefik)
  db_ui:
    image: adminer:latest
    host: 203.0.113.10
    port: 8080
    domains: [db.myapp.example.com]

Inter-Container Networking ​

In Docker mode, application containers and accessory containers run on the shared epd Docker network.

Your application can reach accessories using their container name directly:

postgres://postgres:${POSTGRES_PASSWORD}@epd-myapp-accessory-db:5432/myapp
redis://epd-myapp-accessory-redis:6379

Managing Accessories via CLI ​

epd includes specialized CLI commands for working with accessories:

Inspect Status ​

bash
epd status

Shows running accessories, image tags, port mappings, and container health.

View Accessory Logs ​

bash
# Follow live logs from the postgres database
epd logs --accessory db -f

Run Commands Inside an Accessory ​

bash
# Open an interactive psql session inside the database container
epd exec --accessory db -i -- psql -U postgres -d myapp

# Run a Redis CLI ping
epd exec --accessory redis -- redis-cli ping

Recreate Accessories ​

If you update an accessory's image tag, environment variable, or volume configuration:

bash
epd deploy --recreate-accessories

Next Steps ​

Released under the MIT License.