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:
  database:
    type: postgres
services:
  web:
    build: .
    command: bundle exec rails server -b 0.0.0.0 -p 3000
    port: 3000
    resources:
      - database

The convox.yml file also supports environment variable interpolation. This allows you to specify things like different domains or database options depending on which environment you are deploying your application into. For example, if you want to run different instance sizes for your database between staging and production you can setup your convox.yml like:

resources:
  database:
    type: postgres
    options:
      class: ${POSTGRES_INSTANCE_SIZE} 

You can then specify a different value for POSTGRES_INSTANCE_SIZE in your staging and production Racks using convox env set POSTGRES_INSTANCE_SIZE=XXXX and when your application is deployed to that Rack it will use that value to size the database.

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
services:
  web:
    build: .
    command: bin/web
    environment:
      - FOO
      - BAR=baz
    health: /health
    internal: true
    port: 3000
    resources:
      - database
    test: make test
  worker:
    build: ./worker
    command: bin/worker
    environment:
      - FOO
    links:
      - web
    resources:
      - database
  metrics:
    agent: true
    image: awesome/metrics
timers:
  cleanup:
    schedule: "0 3 * * ? *"
    command: bin/cleanup
    service: web