2.0 Refactor (#1)
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details

Reviewed-on: #1
This commit is contained in:
Joe Bellus 2022-09-25 17:52:40 +00:00
parent 7ccfb421a5
commit c003c09ca5
8 changed files with 197 additions and 247 deletions

31
.drone.yml Normal file
View File

@ -0,0 +1,31 @@
kind: pipeline
steps:
- name: build
image: klakegg/hugo
volumes:
- name: dist
path: dist/
commands:
- hugo
- name: deploy
image: amazon/aws-cli
environment:
AWS_ACCESS_KEY_ID:
from_secret: AWS_ACCESS_KEY
AWS_SECRET_ACCESS_KEY:
from_secret: AWS_SECRET
AWS_DEFAULT_REGION: us-east-1
volumes:
- name: dist
path: dist/
commands:
- aws s3 sync ./dist s3://conductor.5sigma.io --delete;
when:
event:
- promote
target:
- staging
- production

2
.gitignore vendored
View File

@ -1 +1 @@
docs/ dist/

0
.hugo_build.lock Normal file
View File

View File

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

View File

@ -1,66 +1,55 @@
--- ---
title: "Command Reference" title: "Command Reference"
date: 2020-07-29T22:45:07-04:00 date: 2022-09-10T22:45:07-04:00
description: "Full command usage" description: "Full command usage"
draft: false draft: false
weight: 1 weight: 1
version: "0.3.2" version: "2.0.0"
--- ---
# Comamnd Reference # 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 ```sh
conductor conductor
``` ```
The run subcommand without arguments can also be used: ## Launching a specific item
Launchign a group
```sh ```sh
conductor run conductor groupname
``` ```
## Launching via tags Launching a specific component
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.
```sh ```sh
conductor run --tags web,frontend conductor componentname
``` ```
## Launching by name Launching a specific root level task
The name of a component can be used as a subcommand to launch that component by itself:
```sh ```sh
conductor my-component conductor taskname
``` ```
Multiple components can be ran by specifying multiple component subcommands: Launching a compoennt level task
```sh ```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 ```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,163 +1,143 @@
--- ---
title: "Configuration File Reference" 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" description: "Conductor config file reference"
version: "0.3.2" version: "2.0.0"
weight: 1 weight: 1
--- ---
# Configuration file # Configuration file
Conductor will look in the current directory or any parent directory for configuration file named `conductor.yaml`. 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. 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 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.
conductor -c /path/to/config/conductor.yaml Generally, you define all the separate compoennts required to setup a development environment and launch them via a group.
```
## Project configuration
The top level of the configuration has various configurational options for the entire stack.
```yml ```yml
name: MyProject
services:
- name: mysql
- name: rabbit
groups: groups:
- name: group1 group1:
components: components:
- component1 - component1
- component2 - component2
- name: group2 group2:
components: components:
- component1 - component1
- component3 - component3
components: components:
# ... # ...
``` ```
- **name** - An arbitrary name for the project The key for the group item is the name of the group.
- **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
### 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
## Component configuration ## 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: ### Example component configuration:
```yaml ```yaml
- name: api components:
color: Red api:
path: backend/api-gateway path: backend/api-gateway
tags: env:
- api COLORS: 1
- web NPM_ENV: debug
env: command: npm start
COLORS: 1 before: npm-install
NPM_ENV: debug tasks:
start: npm-install:
command: npm path: backend/api-gateway
args: command: npm install
- 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 The key for the component item is the name of the component.
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.
### Command block reference ### Component subfields:
* **command** - the name of the command to run * **path** - The working path relative to the configuration file. By default the path is "."
* **args** - A list of arguments to pass to the command * **env** - A set of environment variables that are set before any commands are run.
* **env** - A list of environment variables to set specific to this command * **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
* **dir** - An optional working directory override if the command should be ran somewhere other than the component path * **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
```
### Task 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
* **descirption** - A description that is displayed in the task list
## Full example config: ## Full example config:
```yaml ```yaml
name: My Web Application
services:
- name: mysql
groups: groups:
- name: full dev:
components: components:
- frontend - frontend
- backend - backend
prod:
components:
- frontend
- backend-prod
components: components:
- name: frontend frontend:
env: env:
FORCE_COLOR: 1 FORCE_COLOR: 1
color: Blue command: npm start
tags: before: setup
- core tasks:
start: setup:
command: npm command: npm install
args: backend:
- start command: mix phx.server
init: before: backend:setup
- command: npm tasks:
args: setup:
- install before:
- name: backend - backend:compile
services: - backend:deps
- mysql compile:
color: Purple command: mix compile
tags: deps:
- core command: mix deps.get
start: backend-prod:
- command: mix env:
args: MIX_ENV: production
- phx.server command: mix phx.server
init: before: backend:setup
- command: mix tasks:
args: reset:
- deps.get env:
- command: mix MIX_ENV: production
args: command:
- compile - mix ecto.reset
- name: production-backend - mix ecto.migrate
default: false - mix ecto.seed
env:
MIX_ENV: production
color: Purple ```
tags:
- core
start:
- command: mix
args:
- phx.server
init:
- command: mix
args:
- deps.get
- command: mix
args:
- compile
```

View File

@ -1,24 +1,12 @@
--- ---
title: "Getting Started" 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" description: "A quick setup guide to get a server running"
draft: false 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 # Setting up a project
To setup a project for conductor you need to create a `conductor.yaml` somewhere in your project tree. 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> For more information see the full <a ui button right floated" href="/articles/config">Config documentation</a>
{{< /infobox >}} {{< /infobox >}}
An example of a minimal configuration file could look like this: An example of a configuration file could look like this:
```yaml ```yaml
groups:
dev:
components:
- frontend
- backend
- support
components: components:
- name: frontend frontend:
start: env:
command: npm API_URL: http://localhost:4000
args: comamnd: npm start
- start backend:
- name: backend env:
start: DATABSE_URL: mysql://devserver/app-dev
command: npm HTTP_PORT: 4000
args: command: cargo run
- start support:
- name: support command: python main.py
start:
command: python
args:
- main.py
``` ```
Now from the project folder or any folder below it we can launch all 3 components using: Now from the project folder or any folder below it we can launch all 3 components using:
```sh ```sh
conductor run conductor dev
``` ```
Alternatively, we can run a single component by name: Running a single component:
```sh ```sh
conductor backend conductor backend
``` ```
Running multiple specific components:
```sh
conductor frnotend backend
```

View File

@ -18,69 +18,23 @@
</p> </p>
</div> </div>
</div> </div>
<div class="ui segment basic center aligned"> <div class="ui basic segment 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 inverted huge header" style="font-weight: bold;"> <div class="ui inverted huge header" style="font-weight: bold;">
Binary Download Binary Download
</div> </div>
<a class="ui basic huge inverted button" <a class="ui basic huge inverted button"
href="https://github.com/5Sigma/conductor/releases/latest/download/conductor-windows.zip"> href="https://objects.5sigma.io/public/conductor.tar.gz">
<i class="ui life windows icon"></i> Download <i class="ui life linux icon"></i> Download
</a> </a>
<p style="color: white;margin-top: 15px;font-size: 1.2em">Conductor currently only support Linux based systems</p>
</div> </div>
<div class="ui tab basic segment center aligned" data-tab="linux-download"> <div style="width: 660px; margin: auto auto; text-align: left;">
<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"> <div class="ui inverted segment">
<pre style="font-size: 16px; font-weight: bold;"> <pre style="font-size: 16px; font-weight: bold;margin: none;">
brew tap 5sigma/tap curl https://objects.5sigma.io/public/conductor.tar.gz | tar -xz
brew install conductor</pre> ./conductor</pre>
</div> </div>
</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
</a>
</div>
<div class="ui hidden section divider"></div> <div class="ui hidden section divider"></div>
</div> </div>
<div class="ui grid two columns"> <div class="ui grid two columns">
@ -139,4 +93,4 @@
</script> </script>
</body> </body>
</html> </html>