2020-07-30 02:01:40 +00:00
---
title: "Configuration File Reference"
date: 2020-07-29T20:42:50-04:00
description: "Conductor config file reference"
2020-08-27 18:22:27 +00:00
version: "0.3.2"
2020-07-30 02:57:21 +00:00
weight: 1
2020-07-30 02:01:40 +00:00
---
# 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.
```sh
conductor -c /path/to/config/conductor.yaml
```
2020-08-27 18:22:27 +00:00
## Project configuration
The top level of the configuration has various configurational options for the entire stack.
```yml
name: MyProject
services:
- name: mysql
- name: rabbit
groups:
- name: group1
components:
- component1
- component2
- name: group2
components:
- component1
- component3
components:
# ...
```
- **name** - An arbitrary name for the project
- **services** - An array of external services that can be launched by components. Currently only docker containers are supported.
- **name** - The name of the docker container to launch
- **groups** - An array of groups can be defined to execute multiple components together
- **name** - An arbitrary name for the group
- **components** - An array of component names that should be launched as a group
2020-07-30 02:01:40 +00:00
## 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:
```yaml
- name: api
color: Red
path: backend/api-gateway
tags:
- api
- web
env:
COLORS: 1
NPM_ENV: debug
start:
2020-07-30 03:09:18 +00:00
command: npm
args:
- start
2020-07-30 02:01:40 +00:00
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.
2020-08-27 18:22:27 +00:00
* **tags** - A list of tags to identify the component. These can be used to execute groups of components using the --tags flag.
2020-07-30 02:01:40 +00:00
* **start** - A command block that is executed when the component is ran
2020-07-30 03:09:18 +00:00
* **init** - A list of command blocks that are ran when the component is initialized
2020-07-30 02:01:40 +00:00
* **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.
2020-08-27 18:22:27 +00:00
* **default** - If set to false the component will not be ran when the bare `conductor` or `conductor run` is executed.
2020-07-30 02:01:40 +00:00
### 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
2020-07-30 02:57:21 +00:00
## Full example config:
```yaml
name: My Web Application
2020-08-27 18:22:27 +00:00
services:
- name: mysql
groups:
- name: full
components:
- frontend
- backend
2020-07-30 02:57:21 +00:00
components:
- name: frontend
2020-08-27 18:22:27 +00:00
env:
FORCE_COLOR: 1
2020-07-30 02:57:21 +00:00
color: Blue
tags:
- core
start:
2020-07-30 03:09:18 +00:00
command: npm
args:
- start
2020-07-30 02:57:21 +00:00
init:
- command: npm
args:
- install
- name: backend
2020-08-27 18:22:27 +00:00
services:
- mysql
color: Purple
tags:
- core
start:
- command: mix
args:
- phx.server
init:
- command: mix
args:
- deps.get
- command: mix
args:
- compile
- name: production-backend
default: false
env:
MIX_ENV: production
2020-07-30 02:57:21 +00:00
color: Purple
tags:
- core
start:
- command: mix
args:
- phx.server
init:
- command: mix
args:
- deps.get
- command: mix
args:
- compile
```