Application Setup
convox.yml

The convox.yml file is a manifest used to describe your application and all of its infrastructure needs. This file is similar to a Docker Compose file but allows for detailed configuration options for your environments.

For a simple Rails application with a Postgres Database the convox.yml file might look like:

resources:
  postgres:
    type: postgres
services:
  web:
    build: .
    command: bundle exec rails server -b 0.0.0.0 -p 3000
    port: 3000
    resources:
      - postgres

Accessing Resources

You can access defined resources from services with environment variables. In the above example, the postgres resource provides a POSTGRES_URL variable that is accessible from the web service.

The environment variable name is the resource name converted to all-caps, with a _URL suffix.

This would contain the entire connection string you would need, ie:

POSTGRES_URL=postgres://username:password@host.com:5432/databaseName

Complete convox.yml options

For a complete set of options available in convox.yml can click on the various sections in the template below.

environment:
  - DEFAULT=value
resources:
  database:
    type: postgres
    options:
      storage: 200
  queue:
    type: redis
services:
  web:
    build: .
    command: bin/web
    environment:
      - FOO
      - BAR=baz
    health: /health
    internal: true
    port: 3000
    resources:
      - database
    test: make test
    deployment:
      minimum: 50
      maximum: 200
    termination:
      grace: 45
    scale:
      count: 1-10
      cooldown:
        down: 180
        up: 30
      targets:
        cpu: 70
        memory: 90
        requests: 200
    privileged: true
  worker:
    build: ./worker
    command: bin/worker
    environment:
      - FOO
    links:
      - web
    resources:
      - database
      - queue
  metrics:
    agent: true
    image: awesome/metrics
  grpc:
    build: .
    port: grpc:50051
timers:
  cleanup:
    schedule: "0 3 * * ? *"
    command: bin/cleanup
    service: web