Updating a lot...

This commit is contained in:
Matvey Kukuy 2022-06-09 15:49:14 +03:00
parent b1fe53ca68
commit bd92393657
4 changed files with 28 additions and 88 deletions

View file

@ -11,57 +11,45 @@ Developer-friendly, incident response management with brilliant Slack integratio
![Grafana OnCall Screenshot](screenshot.png)
## Getting Started
OnCall consists of two parts:
1. OnCall backend
2. "Grafana OnCall" plugin you need to install in your Grafana
### How to run OnCall backend
1. An all-in-one image of OnCall is available on docker hub to run it:
### Launch "hobby" environment
Download docker-compose.yaml:
```bash
docker run -it --name oncall-backend -p 8000:8000 grafana/oncall-all-in-one
curl https://github.com/... -o docker-compose.yaml
```
2. When the image starts up you will see a message like this:
Set environment:
```bash
👋 This script will issue an invite token to securely connect the frontend.
Maintainers will be happy to help in the slack channel #grafana-oncall: https://slack.grafana.com/
Your invite token: <TOKEN>, use it in the Grafana OnCall plugin.
export DOMAIN=http://localhost
export SECRET_KEY=my_random_secret_must_be_more_than_32_characters_long
export RABBITMQ_PASSWORD=rabbitmq_secret_pw
export MYSQL_PASSWORD=mysql_secret_pw
export COMPOSE_PROFILES=with_grafana
export GRAFANA_USER=admin
export GRAFANA_PASSWORD=admin
```
3. If you started your container detached with -d check the log:
Launch stack:
```bash
docker logs oncall-backend
docker-compose -f docker-compose.yml up --build -d
```
### How to install "Grafana OnCall" Plugin and connect with a backend
1. Open Grafana in your browser and login as an Admin
2. Navigate to Configuration &rarr; Plugins
3. Type Grafana OnCall into the "Search Grafana plugins" field
4. Select the Grafana OnCall plugin and press the "Install" button
5. On the Grafana OnCall Plugin page Enable the plugin and go to the Configuration tab you should see a status field with the message
```
OnCall has not been setup, configure & initialize below.
```
6. Fill in configuration fields using the token you got from the backend earlier, then press "Install Configuration"
```
OnCall API URL: (The URL & port used to access OnCall)
http://host.docker.internal:8000
OnCall Invitation Token (Single use token to connect Grafana instance):
Invitation token from docker startup
Grafana URL (URL OnCall will use to talk to this Grafana instance):
http://localhost:3000 (or http://host.docker.internal:3000 if your grafana is running in Docker locally)
Get the instructions and the token:
```bash
docker-compose -f docker-compose.yml run engine python manage.py issue_invite_for_the_frontend --override
```
## Getting Help
^ follow instructions and enjoy!
## Join our comminuty
- `#grafana-oncall` channel at https://slack.grafana.com/
- Grafana Labs community forum for OnCall: https://community.grafana.com
- File an [issue](https://github.com/grafana/oncall/issues) for bugs, issues and feature suggestions.
## Production Setup
Looking for the production instructions? We're going to release them soon. Please join our Slack channel to be the first to know about them.
For production setup check [PRODUCTION.md](PRODUCTION.md).
## Further Reading
- *Documentation* - [Grafana OnCall](https://grafana.com/docs/grafana-cloud/oncall/)

View file

@ -1,28 +0,0 @@
Download docker-compose.yaml
```bash
curl https://github.com/... -o docker-compose.yaml
```
Start docker-compose stack
```bash
DOMAIN=localhost \
SECRET_KEY=my_random_secret_must_be_more_than_32_characters_long \
RABBITMQ_PASSWORD=rabbitmq_secret_pw \
MYSQL_PASSWORD=mysql_secret_pw \
COMPOSE_PROFILES=with_grafana \
GRAFANA_USER=admin \
GRAFANA_PASSWORD=grafana_secret_pw \
docker-compose -f docker-compose.yml up --build -d
```
Get the instructions and credentials
```bash
DOMAIN=localhost \
SECRET_KEY=my_random_secret_must_be_more_than_32_characters_long \
RABBITMQ_PASSWORD=rabbitmq_secret_pw \
MYSQL_PASSWORD=mysql_secret_pw \
COMPOSE_PROFILES=with_grafana \
GRAFANA_USER=admin \
GRAFANA_PASSWORD=grafana_secret_pw \
docker-compose -f docker-compose.yml run engine python manage.py issue_invite_for_the_frontend --override
```

View file

@ -3,6 +3,8 @@ services:
# TODO: change to the public image once it's public
# image: ...
build: ../../engine
ports:
- 8080:8080
command: >
sh -c "uwsgi --ini uwsgi.ini"
environment:
@ -49,7 +51,7 @@ services:
MYSQL_PORT: 3306
REDIS_URI: redis://redis:6379/0
DJANGO_SETTINGS_MODULE: settings.hobby
CELERY_WORKER_QUEUE: "default,critical,long,slack,telegram,webhook"
CELERY_WORKER_QUEUE: "celery"
CELERY_WORKER_CONCURRENCY: "1"
CELERY_WORKER_MAX_TASKS_PER_CHILD: "100"
CELERY_WORKER_SHUTDOWN_INTERVAL: "65m"
@ -138,6 +140,8 @@ services:
grafana:
image: "grafana/grafana:8.3.2"
mem_limit: 500m
ports:
- 3000:3000
cpus: 0.5
environment:
GF_DATABASE_TYPE: mysql
@ -148,8 +152,6 @@ services:
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD:?err}
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: grafana-oncall-app
GF_INSTALL_PLUGINS: grafana-oncall-app
GF_SERVER_ROOT_URL: http://$DOMAIN/grafana/
GF_SERVER_SERVE_FROM_SUB_PATH: "true"
volumes:
- ../../grafana-plugin:/var/lib/grafana/plugins/grafana-plugin
depends_on:
@ -160,28 +162,6 @@ services:
profiles:
- with_grafana
caddy:
image: caddy
volumes:
- caddy_data:/data
- caddy_config:/config
ports:
- 80:80
- 443:443
command:
- sh
- '-c'
- |
cat <<EOF > /etc/caddy/Caddyfile
{\$$CADDY_DOMAIN} {
reverse_proxy /grafana/* grafana:3000
reverse_proxy /* engine:8080
}
EOF
caddy run --config=/etc/caddy/Caddyfile
environment:
CADDY_DOMAIN: $DOMAIN
volumes:
dbdata:
rabbitmqdata: