Skip to content

Commit

Permalink
Examples(grafana-oncall): test slack-setup
Browse files Browse the repository at this point in the history
Signed-off-by: Weifeng Wang <[email protected]>
  • Loading branch information
qclaogui committed Apr 7, 2024
1 parent 8d054a4 commit ef276c8
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 5 deletions.
6 changes: 6 additions & 0 deletions examples/grafana-oncall/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://grafana.com/docs/oncall/latest/set-up/open-source/#slack-setup
FEATURE_SLACK_INTEGRATION_ENABLED=true
SLACK_CLIENT_OAUTH_ID=xxxxxx
SLACK_CLIENT_OAUTH_SECRET=xxxxxx
SLACK_INSTALL_RETURN_REDIRECT_HOST=https://codelab-monitoring-oncall.loca.lt
SLACK_SIGNING_SECRET=xxxxxx
1 change: 1 addition & 0 deletions examples/grafana-oncall/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
19 changes: 14 additions & 5 deletions examples/grafana-oncall/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ x-environment: &oncall-environment
SEND_ANONYMOUS_USAGE_STATS: ${SEND_ANONYMOUS_USAGE_STATS:-false}
DATABASE_TYPE: sqlite3
BROKER_TYPE: redis
BASE_URL: http://engine:8080
BASE_URL: ${BASE_URL:-http://engine:8080}
SECRET_KEY: ${SECRET_KEY:-r4KriYc9sL6PJLaGdDRQL3PKqT6bufTx2uhj}
FEATURE_PROMETHEUS_EXPORTER_ENABLED: ${FEATURE_PROMETHEUS_EXPORTER_ENABLED:-true}
REDIS_URI: redis://redis:6379/0
Expand All @@ -29,12 +29,21 @@ x-environment: &oncall-environment
CELERY_WORKER_MAX_TASKS_PER_CHILD: "100"
CELERY_WORKER_SHUTDOWN_INTERVAL: "65m"
CELERY_WORKER_BEAT_ENABLED: "True"
GRAFANA_API_URL: http://grafana:3000
GRAFANA_API_URL: ${GRAFANA_API_URL:-http://grafana:3000}
EMAIL_HOST: inbucket
EMAIL_PORT: 2500
EMAIL_FROM_ADDRESS: [email protected]
EMAIL_USE_TLS: false
# GRAFANA_CLOUD_ONCALL_TOKEN: ${GRAFANA_CLOUD_ONCALL_TOKEN:-}
FEATURE_TELEGRAM_INTEGRATION_ENABLED: ${FEATURE_TELEGRAM_INTEGRATION_ENABLED:-false}
FEATURE_SLACK_INTEGRATION_ENABLED: ${FEATURE_SLACK_INTEGRATION_ENABLED:-false}
SLACK_CLIENT_OAUTH_ID: ${SLACK_CLIENT_OAUTH_ID:-}
SLACK_CLIENT_OAUTH_SECRET: ${SLACK_CLIENT_OAUTH_SECRET:-}
SLACK_INSTALL_RETURN_REDIRECT_HOST: ${SLACK_INSTALL_RETURN_REDIRECT_HOST:-}
SLACK_SIGNING_SECRET: ${SLACK_SIGNING_SECRET:-}
GRAFANA_CLOUD_NOTIFICATIONS_ENABLED: ${GRAFANA_CLOUD_NOTIFICATIONS_ENABLED:-false}
GRAFANA_CLOUD_ONCALL_HEARTBEAT_ENABLED: ${GRAFANA_CLOUD_ONCALL_HEARTBEAT_ENABLED:-false}
GRAFANA_CLOUD_ONCALL_TOKEN: ${GRAFANA_CLOUD_ONCALL_TOKEN:-}


services:
engine:
Expand All @@ -52,8 +61,8 @@ services:
image: &oncallImage grafana/oncall:v1.3.117
restart: always
ports:
- "8080"
# - "8080:8080"
# - "8080"
- "8080:8080"
command: sh -c "uwsgi --ini uwsgi.ini"
environment:
<<: *oncall-environment
Expand Down
86 changes: 86 additions & 0 deletions examples/grafana-oncall/config/slack/app_manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# https://grafana.com/docs/oncall/latest/set-up/open-source/#slack-setup
# # lt --port 8080 -s codelab-monitoring-oncall --print-requests
# # Localtunnel will generate an url, e.g. https://codelab-monitoring-oncall.loca.lt
_metadata:
major_version: 1
minor_version: 1
display_information:
name: QC Owl Bot
background_color: "#400440"
features:
app_home:
home_tab_enabled: false
messages_tab_enabled: true
messages_tab_read_only_enabled: false
bot_user:
display_name: QC Owl Bot
always_online: true
shortcuts:
- name: Add to resolution note
type: message
callback_id: add_resolution_note
description: Add this message to resolution note
slash_commands:
- command: /oncall
url: https://codelab-monitoring-oncall.loca.lt/slack/interactive_api_endpoint/
description: Direct page a team or user(s)
should_escape: false
oauth_config:
redirect_urls:
- https://codelab-monitoring-oncall.loca.lt/api/internal/v1/complete/slack-install-free/
- https://codelab-monitoring-oncall.loca.lt/api/internal/v1/complete/slack-login/
scopes:
user:
- channels:read
- chat:write
- identify
- users.profile:read
bot:
- app_mentions:read
- channels:history
- channels:read
- chat:write
- chat:write.customize
- chat:write.public
- commands
- files:write
- groups:history
- groups:read
- im:history
- im:read
- im:write
- mpim:history
- mpim:read
- mpim:write
- reactions:write
- team:read
- usergroups:read
- usergroups:write
- users.profile:read
- users:read
- users:read.email
- users:write
settings:
event_subscriptions:
request_url: https://codelab-monitoring-oncall.loca.lt/slack/event_api_endpoint/
bot_events:
- app_home_opened
- app_mention
- channel_archive
- channel_created
- channel_deleted
- channel_rename
- channel_unarchive
- member_joined_channel
- message.channels
- message.im
- subteam_created
- subteam_members_changed
- subteam_updated
- user_profile_changed
interactivity:
is_enabled: true
request_url: https://codelab-monitoring-oncall.loca.lt/slack/interactive_api_endpoint/
org_deploy_enabled: false
socket_mode_enabled: false
token_rotation_enabled: false

0 comments on commit ef276c8

Please sign in to comment.