Project: Project Syn (Provisioning / Automation & Configuration)
File: README.md

](https://github.com/projectsyn/commodore/actions/workflows/push.yml) ](https://github.com/projectsyn/commodore/actions/workflows/publish-pypi.yml) ](https://github.com/projectsyn/commodore/releases) ](https://pypi.org/project/syn-commodore) ](https://codeclimate.com/github/projectsyn/commodore/maintainability) ](https://codeclimate.com/github/projectsyn/commodore/test_coverage) This repository is part of Project Syn. For documentation on Project Syn and this component, see https://syn.tools. See for changelogs of each release version of Commodore. See for pre-built Docker images of Commodore. Commodore is Commodore provides opinionated tenant-aware management of inventories and templates. Commodore uses Kapitan for the heavy lifting of rendering templates and resolving a hierachical configuration structure. Commodore introduces the concept of a component, which is a bundle of Kapitan templates and associated Kapitan classes which describe how to render the templates. Commodore fetches any components that are required for a given configuration before running Kapitan, and sets up symlinks so Kapitan can find the component classes. Commodore also supports additional processing on the output of Kapitan, such as patching in the desired namespace for a Helm chart which has been rendered using `helm template`. Python 3.8 - 3.11 with `python3-dev` and `python3-venv` updated * Our fork is currently recommended. It parallelizes fetching of dependencies, which speeds up Commodore significantly, and has fixes to make the dependency fetching more deterministic. `libmagic` (install with `brew install libmagic` on macOS) Recommended: create a new virtual environment ```console python3 -m venv venv source venv/bin/activate ``` Install commodore from PyPI ```console pip install syn-commodore ``` <a name="gettingstartedjsonnet"></a>Download jsonnet-bundler from and put the binary in your `$PATH` as `jb`. For Commodore to work, you need to run an instance of somewhere (locally is fine too). Setup a `.env` file to configure Commodore (don't use quotes): ```shell COMMODOREAPIURL=https://lieutenant-api.example.com/ COMMODOREAPITOKEN=<my-token> USER_ID=<your-user-id> COMMODORE_USERNAME=<your name> COMMODORE_USERMAIL=<your email> ``` Run commodore ```console commodore ``` 1.3.0+ Docker Install requirements Install poetry according to the upstream . Create the Commodore environment: ```console poetry install ``` Download jsonnet-bundler from and put the binary in your `$PATH` as `jb`. Finish setup as described Run Commodore ```console poetry run commodore ``` Start hacking on Commodore ```console poetry shell ``` Write a line of test code, make the test fail Write a line of application code, make the test pass Repeat Note: Commodore uses the code formatter, and its formatting is encforced by CI. Run linting and tests Auto format with autopep8 ```console poetry run autopep ``` List all Tox targets ```console poetry run tox -lv ``` Run all linting and tests ```console poetry run tox ``` Run just a specific target ```console poetry run tox -e py38 ``` IMPORTANT: After checking out this project, run `mkdir -p catalog inventory dependencies` in it before running any Docker commands. This will ensure the folders are writable by the current user in the context of the Docker container. A docker-compose setup enables running Commodore in a container. The environment variables are picked up from the local `.env` file. By default your `~/.ssh/` directory is mounted into the container and an `ssh-agent` is started. You can skip starting an agent by setting the `SSHAUTHSOCK` env variable and mounting the socket into the container. Build the Docker image inside of the cloned Commodore repository: ```console docker-compose build ``` Run the built image: ```console docker-compose run commodore catalog compile $CLUSTER_ID ``` Documentation for this component is written using and . It is located in the folder. The is used to organize its content. Run the `make docs-serve` command in the root of the project, and then browse to http://localhost:2020 to see a preview of the current state of the documentation. After writing the documentation, please use the `make docs-vale` command and correct any warnings raised by the tool. This library is licensed under . For information about how to contribute see .