From c003c09ca53e340ce381cfcd6c99ec60fb8591ec Mon Sep 17 00:00:00 2001 From: Joe Bellus Date: Sun, 25 Sep 2022 17:52:40 +0000 Subject: [PATCH] 2.0 Refactor (#1) Reviewed-on: https://git.5sigma.io/conductor/website/pulls/1 --- .drone.yml | 31 ++++ .gitignore | 2 +- .hugo_build.lock | 0 config.toml | 2 +- content/articles/command.md | 51 +++--- content/articles/config.md | 232 +++++++++++++--------------- content/articles/getting-started.md | 60 ++++--- themes/5Sigma/layouts/index.html | 66 ++------ 8 files changed, 197 insertions(+), 247 deletions(-) create mode 100644 .drone.yml create mode 100644 .hugo_build.lock diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..a9f4a3c --- /dev/null +++ b/.drone.yml @@ -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 + + diff --git a/.gitignore b/.gitignore index 96c0ecc..7773828 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -docs/ \ No newline at end of file +dist/ \ No newline at end of file diff --git a/.hugo_build.lock b/.hugo_build.lock new file mode 100644 index 0000000..e69de29 diff --git a/config.toml b/config.toml index 11f30ab..3aa5ada 100644 --- a/config.toml +++ b/config.toml @@ -4,4 +4,4 @@ title = "Conductor: Development Stack Launcher" theme="5Sigma" pygmentsUseClasses=true pygmentsCodeFences=true -publishDir="docs" \ No newline at end of file +publishDir="dist" \ No newline at end of file diff --git a/content/articles/command.md b/content/articles/command.md index f19710a..b48595d 100644 --- a/content/articles/command.md +++ b/content/articles/command.md @@ -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 +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. \ No newline at end of file diff --git a/content/articles/config.md b/content/articles/config.md index 80b7626..f6fc6ee 100644 --- a/content/articles/config.md +++ b/content/articles/config.md @@ -1,163 +1,143 @@ --- 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 - components: - - component1 - - component2 -- name: group2 - components: - - component1 - - component3 + group1: + components: + - component1 + - component2 + 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 - +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 +- **descirption** - A description that is displayed in the task list ## 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 - 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 +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 ``` -* **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 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 +``` + +### 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: ```yaml -name: My Web Application -services: -- name: mysql groups: -- name: full - components: - - frontend - - backend - + dev: + components: + - frontend + - backend + prod: + components: + - frontend + - backend-prod components: -- name: 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 - env: - MIX_ENV: production - color: Purple - tags: - - core - start: - - command: mix - args: - - phx.server - init: - - command: mix - args: - - deps.get - - command: mix - args: - - compile -``` \ No newline at end of file + 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 + + +``` diff --git a/content/articles/getting-started.md b/content/articles/getting-started.md index 1d7635f..e329908 100644 --- a/content/articles/getting-started.md +++ b/content/articles/getting-started.md @@ -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 Config documentation {{< /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: + - frontend + - backend + - support components: -- name: frontend - start: - command: npm - args: - - start -- name: backend - start: - command: npm - args: - - start -- name: support - start: - command: python - args: - - main.py + 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 +``` diff --git a/themes/5Sigma/layouts/index.html b/themes/5Sigma/layouts/index.html index 45c0e88..45d85d4 100644 --- a/themes/5Sigma/layouts/index.html +++ b/themes/5Sigma/layouts/index.html @@ -18,69 +18,23 @@

-
-
-
- - Windows -
-
- - Linux -
-
- - MacOS -
- - - Source Code - -
-
-
+
Binary Download
- Download + href="https://objects.5sigma.io/public/conductor.tar.gz"> + Download +

Conductor currently only support Linux based systems

-
-
- Binary Download -
- - - Donwload - -
-
-
- Hombrew Installation -
-
+
-
-            brew tap 5sigma/tap
-            brew install conductor
-
+
+curl https://objects.5sigma.io/public/conductor.tar.gz | tar -xz 
+./conductor
+
-
- Or -
-
- Binary Download -
- - - - Download - -
@@ -139,4 +93,4 @@ - \ No newline at end of file +