Skip to content

Compose file specification

To make it easy to get started with levv, we comply with the compose specification to define and deploy services.

levv is compliant with the essential subset of the compose spec necessary to run and deploy services in production. See the section below for a complete list of the supported keywords.

For platform-specific features like container size, levv makes use of labels.

Platform-specific labels

Label Format Description
io.levv.size str Your container size. See Billing for a list of options (default: "nano")
io.levv.public "port/protocol" To expose a port publicly. Supported protocols are http, tcp and udp. Examples: "80/http", "6379/tcp".
io.levv.kind str Specify it to define a container as a Job. Only supported value is job.
io.levv.schedule Group of labels to configure container scheduling.
io.levv.schedule.start_time hh:mm When your application scales up to # replicas
io.levv.schedule.end_time hh:mm When your application scales down to # min_replicas
io.levv.schedule.day_of_month number, range Which days of the month
io.levv.schedule.month number, name, range Which months of the year
io.levv.schedule.day_of_week number, name, range Which days of the week
io.levv.schedule.timezone timezone name Timezone
io.levv.schedule.min_replicas number The number of replicas

Compose specification keywords

Legend
Full support
Partial support
Different behavior

services

Keyword Status Spec
command
configs/short syntax
configs/long syntax No support for uid and gid
deploy.replicas
domainname
entrypoint
env_file
environment
image
restart Only when io.levv.kind is set to job. Only supported value is no.
labels
ports This is not a port-forwarding but a way to make a port accessible to other services within the same project
secrets/short syntax
secrets/long syntax No support for uid and gid
volumes

configs

Compose specification

Keyword Status
file
environment
content
external
name

secrets

Compose specification

Keyword Status
file
environment
external
name

volumes

Keyword Status Spec
driver_opts.size

Full Example

services:
  backend:
    image: myrepo/myimage:latest
    deploy:
      replicas: 2
    labels:
      io.levv.size: "small"
    environment:
      DEPLOYMENT: production
      LOG_LEVEL: debug
    secrets:
      - source: storage_keys
    volumes:
        - files-disk:/usr/local/data
  db:
      image: redis
      deploy:
        replicas: 1
      labels:
        io.levv.size: "medium"
      secrets:
        - source: token
    ports:
        - 6379:6379
  frontend:
    image: nginx
    deploy:
      replicas: 2
    labels:
      io.levv.size: "micro"
      io.levv.public: "80/http"
    ports:
      - "80:80"
    domainname: "example.com"
secrets:
  storage_keys:
    file: /home/user/secret.txt
  token:
    environment: "MY_SECRET_TOKEN"
volumes:
  files-disk:
    driver_opts:
      size: 2G