website/content/articles/config.md

144 lines
4.2 KiB
Markdown
Raw Normal View History

2020-07-30 02:01:40 +00:00
---
title: "Configuration File Reference"
date: 2022-09-10T20:42:50-04:00
2020-07-30 02:01:40 +00:00
description: "Conductor config file reference"
version: "2.0.0"
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.
## Group configuration
2020-08-27 18:22:27 +00:00
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.
2020-08-27 18:22:27 +00:00
```yml
groups:
group1:
components:
- component1
- component2
group2:
components:
- component1
- component3
2020-08-27 18:22:27 +00:00
components:
# ...
```
The key for the group item is the name of the group.
2020-08-27 18:22:27 +00:00
### Group subfields:
- **components** - An array of component names that should be launched as a group
- **descirption** - A description that is displayed in the task list
2020-08-27 18:22:27 +00:00
2020-07-30 02:01:40 +00:00
## Component configuration
Components are indvidual applications that are run as part of the stack. Components can be launched individually or via groups.
2020-07-30 02:01:40 +00:00
### Example component configuration:
```yaml
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 subfields:
* **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.
* **descirption** - A description that is displayed in the task list
## 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.
### Example task configuration:
```yaml
tasks:
build:
env:
MODE: production
path: backend/
command: cargo build --release
description: Backend release build
2020-07-30 02:01:40 +00:00
```
### Task subfields:
* **path** - The working path relative to the configuration file. By default the path is "."
2020-07-30 02:01:40 +00:00
* **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
* **descirption** - A description that is displayed in the task list
2020-07-30 02:01:40 +00:00
2020-07-30 02:57:21 +00:00
## Full example config:
```yaml
2020-08-27 18:22:27 +00:00
groups:
dev:
components:
- frontend
- backend
prod:
components:
- frontend
- backend-prod
2020-07-30 02:57:21 +00:00
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
```