website/content/articles/config.md

3.4 KiB

title date description version weight
Configuration File Reference 2022-09-10T20:42:50-04:00 Conductor config file reference 2.0.0 1

Configuration file

Conductor will look in the current directory or any parent directory for configuration file named conductor.yaml. In general you can place this configuration directory in or above any place you might want to run the stack.

Group configuration

Groups can be defined to launch multiple components at a time. This is the primary use case for Conductor and is where development flows are defined. Generally, you define all the separate compoennts required to setup a development environment and launch them via a group.

groups:
  group1:
    components: 
    - component1
    - component2
  group2:
    components: 
    - component1
    - component3
components:
  # ...

The key for the group item is the name of the group.

Group subfields:

  • components - An array of component names that should be launched as a group

Component configuration

Components are indvidual applications that are run as part of the stack. Components can be launched individually or via groups.

Example component configuration:

components:
  api:
    path: backend/api-gateway
    env:
      COLORS: 1
      NPM_ENV: debug
    command: npm start
    before: npm-install
    tasks:
      npm-install:
        path: backend/api-gateway 
        command: npm install 

The key for the component item is the name of the component.

component itself.

  • path - The working path relative to the configuration file. By default the path is "."
  • env - A set of environment variables that are set before any commands are run.
  • command - The command that should be executed when the component is launched. This command can be a shell command. Multiple commands can be specified as an array or a single command can be specified as a string
  • keep_alive - Specifies whether the command should be rerun if it exits. This is true by default.
  • retry_delay - A delay in seconds to wait before launching the command after it exits.
  • tasks - A list of task definitions that are scoped within this compoennt. Tasks can be specified under a component for organizational reasons. These components become namespaced and can be executed directly by using its qualified name: component:task. See the task definitions for information about these blocks.

Task configuration

Tasks are similiar to components, except they are meant as single run utility commands. These can be used to setup the environment, or as pure utility functions like build pipelines and data configuration.

The key for the task item is the name of the task.

Full example config:

groups:
  dev:
    components:
    - frontend
    - backend
  prod:
    components:
    - frontend
    - backend-prod
components:
  frontend:
    env:
      FORCE_COLOR: 1
    command: npm start
    before: setup
    tasks:
      setup:
        command: npm install
  backend:
    command: mix phx.server
    before: backend:setup
    tasks:
      setup:
        before:
          - backend:compile
          - backend:deps
      compile:
        command: mix compile
      deps:
        command: mix deps.get
  backend-prod:
    env:
      MIX_ENV: production
    command: mix phx.server
    before: backend:setup
tasks:
  reset:
    env:
      MIX_ENV: production
    command:
    - mix ecto.reset
    - mix ecto.migrate
    - mix ecto.seed