website/content/articles/config.md

3.1 KiB

title date description version weight
Configuration File Reference 2020-07-29T20:42:50-04:00 Conductor config file reference 0.2.1 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.

Manually specifying the configuration file

If the configuration file is located outside the current directory structure you can specify it with the -c flag.

conductor -c /path/to/config/conductor.yaml

Component configuration

Components are indvidual applications that are run as part of the stack. All, some, or one of the compoennts can be launched.

Example component configuration:

- name: api
  color: Red
  path: backend/api-gateway
  tags: 
  - api
  - web
  env:
    COLORS: 1
    NPM_ENV: debug
  start:
    command: npm
    args:
    - start
  init:
    - command: npm
      args:
      - install
  repo:
    https://github.com/me/my-project.git
  • name - The name for the component. This name is used in the log output and can also be specified as a sub-command to run the component itself.
  • path - The working path relative to the configuration file. If not specified the path is assuemd to be a subfolder with the component name.
  • env - A set of environment variables that are set before any commands are run.
  • color - The component will use this color in the log output. Valid color values are: Yellow, Blue, Green, Red, and Purple.
  • tags - A comma seperated list of tags to identify the component. These can be used to execute groups of components using the --tags flag.
  • start - A command block that is executed when the component is ran
  • init - A list of command blocks that are ran when the component is initialized
  • repo - The repository url for the component. When running init all components are cloned into subfolders if they have repositories specified and their init commands are ran.
  • retry - Specifies whether the command should be rerun if it exits. This is true by default. Setting this to false will cause the command to be executed. This does not apply to init commands.
  • delay - A delay in seconds to wait before executing this command. This is useful if it needs to wait for another component to spin up.

Command block reference

  • command - the name of the command to run
  • args - A list of arguments to pass to the command
  • env - A list of environment variables to set specific to this command
  • dir - An optional working directory override if the command should be ran somewhere other than the component path

Full example config:

name: My Web Application
components:
- name: frontend
  color: Blue
  tags: 
  - core
  start:
   command: npm
   args:
   - start
  init: 
  - command: npm
    args:
    - install
- name: backend
  color: Purple
  tags:
  - core
  start:
  - command: mix
    args:
    -  phx.server
  init:
  - command: mix
    args:
    - deps.get
  - command: mix
    args:
    - compile