Skip to content

Commit

Permalink
Merge branch 'oncall'
Browse files Browse the repository at this point in the history
  • Loading branch information
mj0nez committed Mar 18, 2023
2 parents 9ddc279 + 36c5468 commit 98d010a
Show file tree
Hide file tree
Showing 10 changed files with 9,361 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DOMAIN=http://localhost:8082
# COMPOSE_PROFILES=with_grafana # Remove this line if you want to use existing grafana
SECRET_KEY=my_random_secret_must_be_more_than_32_characters_long
65 changes: 65 additions & 0 deletions OnCall_integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Integrate OnCall

> This is a working copy from [Doc](https://github.com/grafana/oncall/blob/dev/README.md).
## Getting Started

We prepared multiple environments:

- [production](https://grafana.com/docs/grafana-cloud/oncall/open-source/#production-environment)
- [developer](./dev/README.md)
- hobby (described in the following steps)

1. Download [`docker-compose.yml`](docker-compose.yml):

```bash
curl -fsSL https://raw.githubusercontent.com/grafana/oncall/dev/docker-compose.yml -o docker-compose.yml
```

2. Set variables:

```bash
echo "DOMAIN=http://localhost:8080
COMPOSE_PROFILES=with_grafana # Remove this line if you want to use existing grafana
SECRET_KEY=my_random_secret_must_be_more_than_32_characters_long" > .env
```

an .env with `
```
DOMAIN=http://localhost:8080 # verify the port is correct
SECRET_KEY=my_random_secret_must_be_more_than_32_characters_long # just for demonstration
```

3. Launch services:

```bash
docker-compose pull && docker-compose up -d
```

4. Go to [OnCall Plugin Configuration](http://localhost:3000/plugins/grafana-oncall-app), using log in credentials
as defined above: `admin`/`admin` (or find OnCall plugin in configuration->plugins) and connect OnCall _plugin_
with OnCall _backend_:

```text
OnCall backend URL: http://engine:8080
```

5. Enjoy! Check our [OSS docs](https://grafana.com/docs/grafana-cloud/oncall/open-source/) if you want to set up
Slack, Telegram, Twilio or SMS/calls through Grafana Cloud.

## Update version

To update your Grafana OnCall hobby environment:

```shell
# Update Docker image
docker-compose pull engine
# Re-deploy
docker-compose up -d
```

After updating the engine, you'll also need to click the "Update" button on the [plugin version page](http://localhost:3000/plugins/grafana-oncall-app?page=version-history).
See [Grafana docs](https://grafana.com/docs/grafana/latest/administration/plugin-management/#update-a-plugin) for more
info on updating Grafana plugins.
4 changes: 2 additions & 2 deletions compose-observe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ networks:

services:
grafana:
# image: grafana/grafana-oss:9.4.3
image: grafana-custom:9.4.3
image: grafana/grafana-oss:9.4.3 # open source
# image: grafana-custom:9.4.3 # customized image
container_name: grafana
environment:
- GF_DATABASE_TYPE=postgres
Expand Down
82 changes: 82 additions & 0 deletions compose-oncall.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
version: "3.9"

volumes:
grafana_data:
oncall_data:
redis_data:

networks:
default:
name: monitoring-network

x-environment: &oncall-environment
DATABASE_TYPE: sqlite3
BROKER_TYPE: redis
BASE_URL: $DOMAIN
SECRET_KEY: my_random_secret_must_be_more_than_32_characters_long
REDIS_URI: redis://redis:6379/0
DJANGO_SETTINGS_MODULE: settings.hobby
CELERY_WORKER_QUEUE: "default,critical,long,slack,telegram,webhook,retry,celery"
CELERY_WORKER_CONCURRENCY: "1"
CELERY_WORKER_MAX_TASKS_PER_CHILD: "100"
CELERY_WORKER_SHUTDOWN_INTERVAL: "65m"
CELERY_WORKER_BEAT_ENABLED: "True"
GRAFANA_API_URL: http://grafana:3000

services:
engine:
image: grafana/oncall
restart: unless-stopped
ports:
- "8082:8080"
command: >
sh -c "uwsgi --ini uwsgi.ini"
environment: *oncall-environment
volumes:
- oncall_data:/var/lib/oncall
depends_on:
oncall_db_migration:
condition: service_completed_successfully
redis:
condition: service_healthy

celery:
image: grafana/oncall
restart: unless-stopped
command: sh -c "./celery_with_exporter.sh"
environment: *oncall-environment
volumes:
- oncall_data:/var/lib/oncall
depends_on:
oncall_db_migration:
condition: service_completed_successfully
redis:
condition: service_healthy

oncall_db_migration:
image: grafana/oncall
command: python manage.py migrate --noinput
environment: *oncall-environment
volumes:
- oncall_data:/var/lib/oncall
depends_on:
redis:
condition: service_healthy

redis:
image: redis:7.0.5
restart: unless-stopped
expose:
- 6379
volumes:
- redis_data:/data
deploy:
resources:
limits:
memory: 500m
cpus: "0.5"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
timeout: 5s
interval: 5s
retries: 10
Loading

0 comments on commit 98d010a

Please sign in to comment.