2.0 Refactor #1

Merged
joe merged 11 commits from ci into master 2022-09-25 17:52:41 +00:00
7 changed files with 146 additions and 247 deletions
Showing only changes of commit 762c5d7151 - Show all commits

6
.drone.yml Normal file
View File

@ -0,0 +1,6 @@
steps:
- name: build
image: plugins/hugo
settings:
hugo_version: 0.104.0
validate: true

0
.hugo_build.lock Normal file
View File

View File

@ -4,4 +4,4 @@ title = "Conductor: Development Stack Launcher"
theme="5Sigma"
pygmentsUseClasses=true
pygmentsCodeFences=true
publishDir="docs"
publishDir="dist"

View File

@ -1,66 +1,55 @@
---
title: "Command Reference"
date: 2020-07-29T22:45:07-04:00
date: 2022-09-10T22:45:07-04:00
description: "Full command usage"
draft: false
weight: 1
version: "0.3.2"
version: "2.0.0"
---
# Comamnd Reference
## Launching a stack
The command can be used to launch any number of configured objects using a space separated list.
The full stack listed in a configuration can be run by running the bare conductor command:
## Listing configured objects
Running the command with no arguments will list all configured groups, components, and tasks that are configured in the configuration file.
```sh
conductor
```
The run subcommand without arguments can also be used:
## Launching a specific item
Launchign a group
```sh
conductor run
conductor groupname
```
## Launching via tags
To run a group of components without launching the entire stack specify tags in the component configuration. One or more tags can be specified to run only components that have at least one of the specified tags.
Launching a specific component
```sh
conductor run --tags web,frontend
conductor componentname
```
## Launching by name
The name of a component can be used as a subcommand to launch that component by itself:
Launching a specific root level task
```sh
conductor my-component
conductor taskname
```
Multiple components can be ran by specifying multiple component subcommands:
Launching a compoennt level task
```sh
conductor server frontend metrics
conductor componentname:taskname
```
## Launching groups
## Launching Multiple Specific Items
Groups of components can be defined in the conductor.yml and launched by name
Multiple objects can be ran with a space separated list. Groups, components, and tasks can be used interchangably.
```sh
conductor my_group
conductor mygroup mytask mycomponent mycomponent:subtask
```
## Setup a stack
Given a configuration file you can clone and initialize an entire stack. This can be useful for bootstrapping a new computer/developer.
From a folder with the conductor.yaml run:
```sh
conductor setup
```
Each component will be cloned into subfolders named after their component name (unless path is set) and their init commands will be run.

View File

@ -1,40 +1,29 @@
---
title: "Configuration File Reference"
date: 2020-07-29T20:42:50-04:00
date: 2022-09-10T20:42:50-04:00
description: "Conductor config file reference"
version: "0.3.2"
version: "2.0.0"
weight: 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.
## Group configuration
```sh
conductor -c /path/to/config/conductor.yaml
```
## Project configuration
The top level of the configuration has various configurational options for the entire stack.
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.
```yml
name: MyProject
services:
- name: mysql
- name: rabbit
groups:
- name: group1
group1:
components:
- component1
- component2
- name: group2
group2:
components:
- component1
- component3
@ -42,122 +31,94 @@ 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
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. All, some, or one of the compoennts can be launched.
Components are indvidual applications that are run as part of the stack. Components can be launched individually or via groups.
### Example component configuration:
```yaml
- name: api
color: Red
components:
api:
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
command: npm start
before: npm-install
tasks:
npm-install:
path: backend/api-gateway
command: npm install
```
* **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 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.
* **default** - If set to false the component will not be ran when the bare `conductor` or `conductor run` is executed.
The key for the component item is the name of the component.
### 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
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:
```yaml
name: My Web Application
services:
- name: mysql
groups:
- name: full
dev:
components:
- frontend
- backend
prod:
components:
- name: frontend
- frontend
- backend-prod
components:
frontend:
env:
FORCE_COLOR: 1
color: Blue
tags:
- core
start:
command: npm
args:
- start
init:
- command: npm
args:
- install
- name: backend
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
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
color: Purple
tags:
- core
start:
- command: mix
args:
- phx.server
init:
- command: mix
args:
- deps.get
- command: mix
args:
- compile
command: mix phx.server
before: backend:setup
tasks:
reset:
env:
MIX_ENV: production
command:
- mix ecto.reset
- mix ecto.migrate
- mix ecto.seed
```

View File

@ -1,24 +1,12 @@
---
title: "Getting Started"
date: 2020-06-28T11:29:09-04:00
date: 2022-09-10T11:29:09-04:00
description: "A quick setup guide to get a server running"
draft: false
version: "0.3.2"
version: "2.0.0"
---
# Installation
Binaries can be downloaded for [Windows](https://github.com/5Sigma/conductor/releases/latest/download/conductor-windows.zip), [Linux](https://github.com/5Sigma/conductor/releases/latest/download/conductor-linux.tar.gz),
or [MacOS](https://github.com/5Sigma/conductor/releases/latest/download/conductor-darwin.zip)
## Homebrew
On MacOS Conductor can be installed via Homebrew
```sh
brew tap 5sigma/tap
brew install conductor
```
# Setting up a project
To setup a project for conductor you need to create a `conductor.yaml` somewhere in your project tree.
@ -41,35 +29,43 @@ in the root `/project/` folder so it is accessible from any of the component pro
For more information see the full <a ui button right floated" href="/articles/config">Config documentation</a>
{{< /infobox >}}
An example of a minimal configuration file could look like this:
An example of a configuration file could look like this:
```yaml
groups:
dev:
components:
- name: frontend
start:
command: npm
args:
- start
- name: backend
start:
command: npm
args:
- start
- name: support
start:
command: python
args:
- main.py
- frontend
- backend
- support
components:
frontend:
env:
API_URL: http://localhost:4000
comamnd: npm start
backend:
env:
DATABSE_URL: mysql://devserver/app-dev
HTTP_PORT: 4000
command: cargo run
support:
command: python main.py
```
Now from the project folder or any folder below it we can launch all 3 components using:
```sh
conductor run
conductor dev
```
Alternatively, we can run a single component by name:
Running a single component:
```sh
conductor backend
```
Running multiple specific components:
```sh
conductor frnotend backend
```

View File

@ -18,68 +18,15 @@
</p>
</div>
</div>
<div class="ui segment basic center aligned">
<div class="ui huge basic inverted buttons" id="download-buttons">
<div class="ui button" data-tab="windows-download">
<i class="ui life windows icon"></i>
Windows
</div>
<div class="ui button" data-tab="linux-download">
<i class="ui linux icon"></i>
Linux
</div>
<div class="ui button" data-tab="macos-download">
<i class="ui apple icon"></i>
MacOS
</div>
<a class="ui button" href="http://github.com/5Sigma/conductor">
<i class="ui icon github"></i>
Source Code
</a>
</div>
</div>
<div class="ui tab basic segment center aligned" data-tab="windows-download">
<div class="ui basic segment center aligned">
<div class="ui inverted huge header" style="font-weight: bold;">
Binary Download
</div>
<a class="ui basic huge inverted button"
href="https://github.com/5Sigma/conductor/releases/latest/download/conductor-windows.zip">
<i class="ui life windows icon"></i> Download
</a>
</div>
<div class="ui tab basic segment center aligned" data-tab="linux-download">
<div class="ui inverted huge header" style="font-weight: bold;">
Binary Download
</div>
<a class="ui basic huge inverted button"
href="https://github.com/5Sigma/conductor/releases/latest/download/conductor-linux.tar.gz">
<i class="ui linux icon"></i>
Donwload
</a>
</div>
<div class="ui tab basic segment center aligned" data-tab="macos-download" style="margin: auto; width: 800px;">
<div class="ui inverted huge header" style="font-weight: bold;">
Hombrew Installation
</div>
<div style="width: 500px; margin: auto; text-align: left;">
<div class="ui inverted segment">
<pre style="font-size: 16px; font-weight: bold;">
brew tap 5sigma/tap
brew install conductor</pre>
</div>
</div>
<div class="ui horizontal divider" style="color: white;">
Or
</div>
<div class="ui inverted huge header" style="font-weight: bold;">
Binary Download
</div>
<div class="ui hidden divider"></div>
<a class="ui basic huge inverted button"
href="https://github.com/5Sigma/conductor/releases/latest/download/conductor-darwin.zip">
<i class="ui apple icon"></i>
Download
<i class="ui life linux icon"></i> Download
</a>
<p style="color: white;margin-top: 15px;font-size: 1.2em">Conductor currently only support Linux based systems</p>
</div>
<div class="ui hidden section divider"></div>
</div>