This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
112 changed files
with
5,019 additions
and
2,102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM gitpod/workspace-postgres | ||
|
||
# Install Redis. | ||
RUN sudo apt-get update && \ | ||
sudo apt-get install -y redis-server && \ | ||
sudo rm -rf /var/lib/apt/lists/* | ||
|
||
ENV PYTHONUSERBASE=/workspace/.pip-modules | ||
ENV PATH=$PYTHONUSERBASE/bin:$PATH | ||
ENV PIP_USER=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CHAOSGENIUS_WEBAPP_URL=CHAOSGENIUS_WEBAPP_URL_HERE | ||
|
||
DATABASE_URL_CG_DB=postgresql+psycopg2://gitpod@localhost/postgres | ||
|
||
CELERY_RESULT_BACKEND=redis://localhost:6379/1 | ||
CELERY_BROKER_URL=redis://localhost:6379/1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
image: | ||
file: .gitpod.dockerfile | ||
|
||
# List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/ | ||
tasks: | ||
# modify .bashrc here. | ||
# `PGHOSTADDR` is set to the Postgres server running on Gitpod. pyscopg2 picks up this | ||
# variable and connects to that DB instead of the one we specify through data sources | ||
# for some reason. So we unset this. | ||
# See `DATABASE_URL_CG_DB` in `.gitpod.env` for the credentials to the Postgres server | ||
# running inside Gitpod. | ||
- before: printf 'unset PGHOSTADDR\n' >> $HOME/.bashrc && exit | ||
|
||
# the backend server | ||
- name: API Server | ||
init: | | ||
pip install wheel | ||
pip install -r requirements/dev.txt | ||
# notify that backend requirements have finished installing | ||
gp sync-done backend-reqs | ||
command: | | ||
cp .gitpod.env .env.local | ||
# get the URL for port 5000 exposed through Gitpod and use it as the WEBAPP_URL | ||
# TODO: links to "View KPI", etc. won't work since they are on port 3000 | ||
sed -i "s~CHAOSGENIUS_WEBAPP_URL_HERE~`gp url 5000`~g" ".env.local" | ||
# start postgres server | ||
pg_start | ||
# apply migrations | ||
flask db upgrade | ||
# notify that backend has been setup completely | ||
gp sync-done backend-setup | ||
bash dev_server.sh | ||
- name: Webapp | ||
init: | | ||
cd frontend | ||
npm install | ||
command: | | ||
cd frontend | ||
# BASE_URL is set to port 5000 exposed through gitpod | ||
REACT_APP_BASE_URL=`gp url 5000` npm start | ||
- name: Redis | ||
command: redis-server | ||
|
||
- name: Workers and Scheduler | ||
# TODO: is the await needed here? | ||
init: gp sync-await backend-reqs | ||
command: | | ||
# wait all of backend setup (incl. migrations, env vars) to be completed | ||
gp sync-await backend-setup | ||
bash dev_workers.sh | ||
ports: | ||
# webapp | ||
- port: 3000 | ||
onOpen: open-browser | ||
visibility: "public" | ||
# backend server | ||
- port: 5000 | ||
visibility: "public" | ||
|
||
vscode: | ||
extensions: | ||
- "ms-python.python" | ||
- "samuelcolvin.jinjahtml" | ||
|
||
github: | ||
prebuilds: | ||
# add a check to pull requests (defaults to true) | ||
addCheck: false | ||
# add a "Review in Gitpod" button as a comment to pull requests (defaults to false) | ||
addComment: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Using Gitpod for Chaos Genius | ||
|
||
Gitpod gives you a fully functional VS code environment in a web page<sup id="f1">[1](#fn1)</sup>. All the requirements, system dependencies and services are set up according to the project's specifications. You don't even need to set up Git. This lets you get started with contributing to Chaos Genius with no set up required. | ||
|
||
Use this button to open a Gitpod workspace on Chaos Genius' `develop` branch: | ||
|
||
<a href="https://gitpod.io/#https://github.com/chaos-genius/chaos_genius/tree/develop"><img src="https://gitpod.io/button/open-in-gitpod.svg"/></a> | ||
|
||
- You may need to login with your GitHub account. | ||
- It may take 5-10 mins for set up if the pre-build was not made or did not complete for some reason. | ||
|
||
## Features | ||
|
||
- A new page will open with a URL like `3000-chaosgenius-chaosgenius-<something>.gitpod.io`. This is the Chaos Genius webapp running on Gitpod. It is connected to the backend which runs on Gitpod too. | ||
- Select "Remote Explorer" from the left side bar to see all the open ports. The "Open Browser" button will open the port in a new page (use this on port 3000 to get back the page mentioned in the previous point). | ||
- All services required by Chaos Genius are running in separate terminals (see the right side bar of the terminal window) | ||
- `API Server` is the backend server. You will find the backend logs in this terminal. | ||
- Run `bash dev_server.sh` to restart the server if it had stopped for any reason. | ||
- `Webapp` is the frontend UI. You will find React build logs here. | ||
- Use ```REACT_APP_BASE_URL=`gp url 5000` npm start``` to restart the webapp server if it had stopped. | ||
- `Redis` is the message broker used by Celery workers. You will not find anything useful in these logs. | ||
- Use `redis-server` to restart Redis if it had stopped. | ||
- `Workers and Scheduler` runs the Celery workers and Celery beat scheduler. You will find logs of analytics tasks (anomaly, DeepDrills, etc.), data source metadata pre-fetch, alerts (both individual and alert reports), etc. | ||
- Use `bash dev_workers.sh` to restart them if they had stopped. | ||
- Use the `+` button in the terminal window to open a new shell. The python environment will be pre-activated, which allows you to use the Chaos Genius CLI (see `flask --help` for details). | ||
|
||
### Docker compose support | ||
|
||
If you need to test any functionality that only affects the docker compose deployments, you can use `docker-compose` directly from Gitpod. Both docker and docker-compose are pre-installed. The webapp will need to be accessed from port `8080` (use the Remote Explorer to make it public or to get the link). | ||
|
||
## Known issues | ||
|
||
- The workspace shuts down after 30 mins of inactivity on the default free plan. | ||
- There is also a 50 hours monthly limit. | ||
- Sending emails via SMTP does not work inside Gitpod. See https://github.com/gitpod-io/gitpod/issues/965. | ||
|
||
## Notes | ||
|
||
<b id="fn1">1</b> You can even choose to open Gitpod on your system's VS code. Click on the first button on the left side-bar (the hamburger button) and select `Gitpod: Open in VS Code`. [↩](#f1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.