Skip to content

Commit

Permalink
Merge dev to main (#54)
Browse files Browse the repository at this point in the history
* Log (failed) attempt to notify a user with viewer role

* Remove https:// prefix from BASE_URL docker env var

* Fix cloud heartbeat name

* Polishing telegram

* Update docker-compose.yml

* Update plugin README  (#48)

* Update README and screenshot, remove plop for build info since version is now displayed prominently

* Sign build

Co-authored-by: Michael Derynck <[email protected]>

* Build actions (#38)

* Drone, github action changes

* Minor version updates

* Update frontend dependencies

* Re-enable unit test

Co-authored-by: Michael Derynck <[email protected]>

* Revert stylelint version (#52)

* Revert stylelint version

* Build plugin as well as lint

* Build in previous step

Co-authored-by: Michael Derynck <[email protected]>

* Update screenshot (#53)

Co-authored-by: Michael Derynck <[email protected]>

Co-authored-by: Matias Bordese <[email protected]>
Co-authored-by: Matvey Kukuy <[email protected]>
Co-authored-by: Innokentii Konstantinov <[email protected]>
Co-authored-by: Matvey Kukuy <[email protected]>
Co-authored-by: Michael Derynck <[email protected]>
  • Loading branch information
6 people authored Jun 13, 2022
1 parent cc1fc53 commit 66e8cf2
Show file tree
Hide file tree
Showing 36 changed files with 682 additions and 480 deletions.
25 changes: 15 additions & 10 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ steps:
- cd grafana-plugin/
- if [ -z "$DRONE_TAG" ]; then echo "No tag, not modifying version"; else jq '.version="${DRONE_TAG}"' package.json > package.new && mv package.new package.json && jq '.version' package.json; fi
- yarn --network-timeout 500000
- yarn plop "Append build info" "${DRONE_TAG}" "${DRONE_BRANCH}" "${DRONE_COMMIT}"
- yarn build
- ls ./

Expand Down Expand Up @@ -85,18 +84,16 @@ steps:
- pre-commit run black --all-files
- pre-commit run flake8 --all-files

- name: Test Backend
- name: Unit Test Backend
image: python:3.9
environment:
DJANGO_SETTINGS_MODULE: settings.ci-test
SLACK_CLIENT_OAUTH_ID: 1
commands:
- apt-get update && apt-get install -y netcat
- cd engine/
- mkdir sqlite_data
- pip install -r requirements.txt
- pytest --ds=settings.ci-test
- rm -rf sqlite_data
- ./wait_for_test_mysql_start.sh && pytest --ds=settings.ci-test
depends_on:
- rabbit_test

Expand Down Expand Up @@ -125,7 +122,7 @@ steps:
from_secret: gcr_admin
depends_on:
- Lint Backend
- Test Backend
- Unit Test Backend
- Image Tag

- name: Build and Push Engine Docker Image Backend to Dockerhub
Expand All @@ -140,29 +137,37 @@ steps:
from_secret: docker_username
depends_on:
- Lint Backend
- Test Backend
- Unit Test Backend
- Image Tag
when:
ref:
- refs/heads/dev
- refs/tags/v*.*.*

# Services for Test Backend
# Services for Unit Test Backend
services:
- name: rabbit_test
image: rabbitmq:3.7.19
environment:
RABBITMQ_DEFAULT_USER: rabbitmq
RABBITMQ_DEFAULT_PASS: rabbitmq

- name: mysql_test
image: mysql:5.7.25
environment:
MYSQL_DATABASE: oncall_local_dev
MYSQL_ROOT_PASSWORD: local_dev_pwd

trigger:
event:
include:
- tag
- push
- pull_request
ref:
include:
- refs/heads/**
- refs/heads/main
- refs/heads/dev
- refs/tags/v*.*.*

---
Expand Down Expand Up @@ -236,6 +241,6 @@ kind: secret
name: drone_token
---
kind: signature
hmac: 5cdafa5ca416acb1763d1d9ac93bbd932982c874718f40af533914a6711c1a1f
hmac: 7621bb1ccfcbec9f92c385670f2b2790859aba25f31c4936997123906fb102c0

...
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ DJANGO_SETTINGS_MODULE=settings.dev
SECRET_KEY=jkashdkjashdkjh
BASE_URL=http://localhost:8000

FEATURE_TELEGRAM_INTEGRATION_ENABLED=
FEATURE_TELEGRAM_INTEGRATION_ENABLED=True
FEATURE_SLACK_INTEGRATION_ENABLED=True
FEATURE_EXTRA_MESSAGING_BACKENDS_ENABLED=

Expand Down
39 changes: 0 additions & 39 deletions .github/workflows/backend-ci.yml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: ci

on:
push:
branches:
- main
- dev
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
container: python:3.9
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
- name: Build
run: |
pip install $(grep "pre-commit" engine/requirements.txt)
npm install -g yarn
cd grafana-plugin/
yarn --network-timeout 500000
yarn build
- name: Lint All
run: |
pre-commit run --all-files
unit-test-backend:
runs-on: ubuntu-latest
container: python:3.9
env:
DJANGO_SETTINGS_MODULE: settings.ci-test
SLACK_CLIENT_OAUTH_ID: 1
services:
rabbit_test:
image: rabbitmq:3.7.19
env:
RABBITMQ_DEFAULT_USER: rabbitmq
RABBITMQ_DEFAULT_PASS: rabbitmq
mysql_test:
image: mysql:5.7.25
env:
MYSQL_DATABASE: oncall_local_dev
MYSQL_ROOT_PASSWORD: local_dev_pwd

steps:
- uses: actions/checkout@v2
- name: Unit Test Backend
run: |
apt-get update && apt-get install -y netcat
cd engine/
pip install -r requirements.txt
./wait_for_test_mysql_start.sh && pytest --ds=settings.ci-test -x
21 changes: 0 additions & 21 deletions .github/workflows/frontend-ci.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/synk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: snyk

on:
push:
branches: [ main,dev ]
pull_request:
branches: [ main,dev ]

jobs:
security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- uses: actions/setup-node@v3
with:
node-version: 14
- uses: snyk/actions/setup@master
- name: Install Dependencies
run: |
pip install -r engine/requirements.txt
cd grafana-plugin/
yarn --network-timeout 500000
- name: Run Snyk
continue-on-error: true
run: snyk test --all-projects --severity-threshold=high
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Change Log

## 1.0.0 (2022-02-02)
## 0.0.71 (2022-06-06)

- Initial Release
4 changes: 2 additions & 2 deletions docker-compose-developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.2'
services:

mysql:
image: mariadb:10.2
image: mysql:5.7
platform: linux/x86_64
mem_limit: 500m
cpus: 0.5
Expand Down Expand Up @@ -40,7 +40,7 @@ services:
- 5672:5672

mysql-to-create-grafana-db:
image: mariadb:10.2
image: mysql:5.7
platform: linux/x86_64
command: bash -c "mysql -h mysql -uroot -pempty -e 'CREATE DATABASE IF NOT EXISTS grafana CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'"
depends_on:
Expand Down
8 changes: 3 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
command: >
sh -c "uwsgi --ini uwsgi.ini"
environment:
BASE_URL: https://$DOMAIN
BASE_URL: $DOMAIN
SECRET_KEY: $SECRET_KEY
RABBITMQ_USERNAME: "rabbitmq"
RABBITMQ_PASSWORD: $RABBITMQ_PASSWORD
Expand Down Expand Up @@ -39,7 +39,7 @@ services:
build: engine
command: sh -c "./celery_with_exporter.sh"
environment:
BASE_URL: https://$DOMAIN
BASE_URL: $DOMAIN
SECRET_KEY: $SECRET_KEY
RABBITMQ_USERNAME: "rabbitmq"
RABBITMQ_PASSWORD: $RABBITMQ_PASSWORD
Expand Down Expand Up @@ -73,7 +73,7 @@ services:
build: engine
command: python manage.py migrate --noinput
environment:
BASE_URL: https://$DOMAIN
BASE_URL: $DOMAIN
SECRET_KEY: $SECRET_KEY
RABBITMQ_USERNAME: "rabbitmq"
RABBITMQ_PASSWORD: $RABBITMQ_PASSWORD
Expand Down Expand Up @@ -157,8 +157,6 @@ services:
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD:?err}
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: grafana-oncall-app
GF_INSTALL_PLUGINS: grafana-oncall-app
volumes:
- ./grafana-plugin:/var/lib/grafana/plugins/grafana-plugin
depends_on:
mysql_to_create_grafana_db:
condition: service_completed_successfully
Expand Down
23 changes: 23 additions & 0 deletions docs/sources/open-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,26 @@ lt --port 8000 -s pretty-turkey-83 --print-requests

8. All set!

## Telegram Setup

- Telegram integrations requires OnCall to be externally available and provide https endpoint.
- Telegram integration in OnCall is designed for collaborative team work. It requires Telegram Group and a Telegram Channel (private) for alerts.

1. Make sure your OnCall is up and running.

2. Respectfully ask [BotFather](https://t.me/BotFather) for a key, put it in `TELEGRAM_TOKEN` in "OnCall" -> "Env Variables".

3. Set `TELEGRAM_WEBHOOK_HOST` with your external url for OnCall.

4. Go to "OnCall" -> "ChatOps" -> Telegram and enjoy!

## Grafana OSS-Cloud Setup

Grafana OSS could be connected to Grafana Cloud for heartbeat and SMS / Phone Calls. We tried our best in making Grafana OSS <-> Cloud self-explanatory. Check "Cloud" page in your OSS OnCall instance.

Please note that it's possible either to use Grafana Cloud either Twilio for SMS/Phone calls.

## Twilio Setup

1. Make sure Grafana OSS <-> Cloud connector is disabled. Set `GRAFANA_CLOUD_NOTIFICATIONS_ENABLED` as False.
2. Check "OnCall" -> "Env Variables" and set all variables starting with `TWILIO_`
38 changes: 0 additions & 38 deletions engine/Dockerfile.all-in-one

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def _escalation_step_notify_on_call_schedule(self, alert_group, reason) -> None:
escalation_policy_step=self.step,
)
else:
notify_to_users_list = list_users_to_notify_from_ical(on_call_schedule)
notify_to_users_list = list_users_to_notify_from_ical(on_call_schedule, include_viewers=True)
if notify_to_users_list is None:
log_record = AlertGroupLogRecord(
type=AlertGroupLogRecord.TYPE_ESCALATION_FAILED,
Expand Down
Loading

0 comments on commit 66e8cf2

Please sign in to comment.