This document will help you get started with contributing to Chaos Genius.
Contribution does not always mean code. You can contribute to Chaos Genius in the following ways:
- Try Chaos Genius and share your feedback.
- Show us some love - Give us a star!
- Submit an issue if you find a bug or need a feature.
- Share a part of the documentation that you find difficult to follow.
- Improve our documentation.
- Translate our README.
- Send a PR for one of our issues. Please read this section before starting.
Thank you for contributing!
The rest of this document will focus on code contributions to this repository.
This document assumes that you:
- Have basic familiarity with git and the Pull Requests (PR) workflow.
- Have read some of the Chaos Genius documentation.
- Know about the Chaos Genius community. Please reach out to us for any help!
Follow these steps if you want to make a code contribution to Chaos Genius.
-
Find an issue that you want to work on. If an issue does not exist for your problem, please create one.
- Leave a comment on the issue indicating that you want to work on it.
- Wait for one of the maintainers to confirm and provide more details on it (if required).
-
Clone the repository (you will need to create a fork if you're an external contributor).
git clone https://github.com/chaos-genius/chaos_genius.git # for internal contributor
or
git clone https://github.com/<your-github-username>/chaos_genius.git # for external contributors
then
cd chaos_genius
-
Create a new branch from
develop
branch- If you're an internal contributor, the branch must be named appropriately. Use
feature/
orfix/
prefix as needed. An example of a good branch name isfeature/add-prophet-model
.
- If you're an internal contributor, the branch must be named appropriately. Use
-
See Development Workflow for setting up Chaos Genius locally and testing your changes.
-
Commit your changes while following the commit guidelines.
-
Open a Pull Request from your branch.
- The PR must be directed to the
develop
branch (and not themain
branch). - A maintainer will soon add appropriate tags and milestones.
- Once your change is approved and the PR is merged, it will be available in the next release of Chaos Genius.
- The PR must be directed to the
We support 3 different development workflows:
- Gitpod: easiest and fastest way to get started. Has some minor limitations but can be used in most cases.
- Docker Compose: if you have Docker and docker-compose set up locally, this is the fastest way to get started on your local system.
- Local setup: if you prefer running it directly on your system (without layers like Docker), opt for this. It requires running a Postgres and a Redis server yourself and needs some set up.
It can be quite a bit of work to set up Chaos Genius locally for development. Instead, you can use Gitpod which gives you everything you need to run and develop Chaos Genius but in a cloud environment and with the familiar interface of VS Code. See GITPOD.md for details.
We have provided Docker Compose files specifically made for development. They include all the services (Postgres, Redis, etc.) along with auto-reloading backend server, workers and scheduler.
Note: this does not yet support development of the webapp/frontend. Use Gitpod or a local setup instead if you will be making changes to the webapp/frontend/UI.
Run the dev compose using:
docker-compose -f docker-compose.dev.yml up
If you will be testing third party data sources (go for the above if you're not sure), use this instead:
docker-compose -f docker-compose.dev-thirdparty.yml up
Prerequisites:
- Python 3.8 with
venv
- A PostgreSQL server
- A Redis server
Steps to set up a development environment:
- Create a new python virtual environment.
python3 -m venv .venv source .venv/bin/activate
- Install the development requirements.
pip install -r requirements/dev.txt
- Copy
.env.local.template
to.env.local
and set appropriate variables.cp .env.local.template .env.local
- In particular, you will need to change:
DATABASE_URL_CG_DB
- change username, password, DB host and DB name as needed.CHAOSGENIUS_WEBAPP_URL
- this is the URL used in emails. For local dev setups, this can behttp://localhost:5000
.CELERY_RESULT_BACKEND
andCELERY_BROKER_URL
- change the Redis host name as needed.
- In particular, you will need to change:
- Run the following command to start a local API server:
bash dev_server.sh
- Note: this does not start any of the celery schedulers or workers, which are needed if you want to run any analytics.
Prerequisites:
- Node JS
Steps to set up a development environment:
- The webapp is present in the
frontend
directory.cd frontend
- Install dependencies.
npm i
- Create a
.env
file (while inside thefrontend
directory) and add the following to it (this is the URL of the API server):REACT_APP_BASE_URL=http://localhost:5000
- Start a local server.
npm start
- A browser window should open at http://localhost:3000 with the webapp.
We will use Semantic Commit Messages, that are an adoption of Conventional Commits:
feat: add hat wobble
^--^ ^------------^
| |
| +-> Summary in present tense.
|
+-------> Type: chore, docs, feat, fix, refactor, style, or test.
- feat: (new feature for the user, not a new feature for build script)
- fix: (bug fix for the user, not a fix to a build script)
- docs: (changes to the documentation)
- style: (formatting, missing semi colons, etc; no production code change)
- refactor: (refactoring production code, eg. renaming a variable)
- test: (adding missing tests, refactoring tests; no production code change)
- chore: (updating grunt tasks etc; no production code change)
Please look into Semantic Commit’s references for more information.
Commit message should talk about WHAT changed, and WHY. Not HOW – how is the diff, and you don’t need to repeat it.
- Describe your changes in the PR description. It can have minimal information if the commits describe the changes instead.
- Add the
don't merge
label if your PR is in-progress.