Commit graph

61 commits

Author SHA1 Message Date
Joey Orlando
5967d5af63
remove apns + fix django-push-notifications migrations (#984)
- removes APNS support
- changes the `django-push-notification` library from the `iskhakov`
fork to the [`grafana`
fork](https://github.com/grafana/django-push-notifications). This new
fork basically just patches an issue which affected the database
migrations of this django app (previously the library would not respect
the `USER_MODEL` setting when creating its tables and would instead
reference the `auth_user` table.. which we don't want)
- add `--no-cache` flag to the `make build` command

**NOTE**
A migration should be applied as follows:
```bash
# remove the four push_notifications tables, which have improper foreign key references
python manage.py migrate push_notifications zero

# recreate the tables with the proper foreign key references
python manage.py migrate
```
2022-12-13 13:00:59 +01:00
Vadim Stepanov
1878b7e596
Mobile app FCM support (#923)
* Add ability to configure FCM_API_KEY and FCM_POST_URL

* Delete APNSDevice and GCMDevice instances when unlinking the mobile app backend

* Add a simple FCM relay endpoint

* GCM -> FCM

* comment
2022-12-01 15:17:01 +00:00
Ildar Iskhakov
132cf1da7f
Add celery profiling (#913) 2022-11-29 16:20:41 +08:00
Michael Derynck
3582f9b08f
Improve Jinja Template feedback and error handling (#884)
* Improve feedback so template errors are given to user

* Add security error logging

* Add limits for templates, payloads, results

* Show popup error notification for webhook errors and template errors that don't have a result

* Update tests

* Split exceptions into warnings/errors to give more control when previewing, rendering, saving templates

* Limit title lengths

* Make TypeError a warning

* Adjust title length limit

* Remove length limiting on urlize since it is being done on template render

* Fix tests

* Add KeyError and ValueError to warnings

* No longer enforcing json result when saving webhook in case it is dependent on payload

* Add tests for expected exceptions coming from apply_jinja_template

* Update changelog

* Send raw post if template result is not JSON
2022-11-28 09:46:51 -07:00
Vadim Stepanov
255964ceaf
Mobile app messaging backend (#874)
* move mobile notifications to a separate backend, remove critical notification

* remove outdated mobile app code

* MOBILE_APP_PUSH_NOTIFICATIONS_ENABLED -> FEATURE_MOBILE_APP_INTEGRATION_ENABLED

* create error log if no devices are set up

* move mobile auth related code to the mobile_app Django app

* move mobile auth related code to the mobile_app Django app

* move mobile auth related code to the mobile_app Django app

* fix typing

* add GCMDevice todos

* add user connection capabilities

* add user connect/disconnect to the messaging backend

* move APNS endpoint to mobile_app Django app

* restore critical notifications

* support hackathon app

* tweak migrations so mobile app auth tokens are preserved

* reuse notify_by IDs

* use mobile app template to render push notification

* add GCM/FCM (Android) support

* fix unlink user

* logger.error -> logger.info
2022-11-23 15:56:43 +00:00
Yulya Artyukhina
381520ee13
Get rid of installation token + add a bunch of tests (#624)
* Get rid of installation token (for OSS installations)

This is done by being required to supply the grafana API URL as an
environment variable on the backend. Additionally, optionally an OnCall
API URL environment variable can be passed in to the frontend (this basically
allows completely skipping the need to configure anything).
- deduplicated a lot of the sync logic on the frontend + made
error message more useful and consistent
- Split PluginConfigPage component into several subcomponents
(making it easier to test each individual component)
- Moved RootWithLoader (from plugin/GrafanaPluginRootPage) into its own
subcomponent (making it easier to test)
- Added tests for pre-existing components that were touched:
  - PluginConfigPage component (and its new subcomponents)
  - state/plugin and state/rootBaseStore functions
  - apps.grafana_plugin django app

Helm changes:
- add GRAFANA_API_URL to oncall.env
- some yaml autoformatting changes
- remove reference to python manage.py issue_invite_for_the_frontend --override

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
2022-11-21 16:26:00 +01:00
Joey Orlando
fd4877408a
remove grafana_plugin_management django app (#812)
* remove grafana_plugin_management django app

it seems to be no longer used or referenced. In addition apps.api.serializers.organization.PluginOrganizationSerializer was only
referenced from within grafana_plugin_management and is thereby safe
to remove.
2022-11-09 13:53:59 +01:00
Michael Derynck
fc78dd98da
Merge pull request #707 from grafana/add-region-to-organization
Add region info to organizations
2022-11-08 10:30:53 -07:00
Michael Derynck
f01d754851 Merge dev 2022-11-08 10:14:35 -07:00
Innokentii Konstantinov
9c550af721
Support of oncall-gw (#741)
* Draft support of oncall-gw

* Clean up

* Create oncall connector on org create in gcom

* Naming fixes

* Rework oncall-gateway package. \nMove it from apps.

* Fix typo
2022-11-08 14:43:22 +08:00
Michael Derynck
81702ba52d Merge dev 2022-11-03 12:42:36 -06:00
Michael Derynck
369a23551b Merge branch 'dev' into add-region-to-organization 2022-11-03 12:41:07 -06:00
Vadim Stepanov
e2456315af
Allow no-auth SMTP connection for email notifications (#759)
* DEFAULT_FROM_EMAIL -> EMAIL_FROM

* add EMAIL_FROM live setting

* EMAIL_FROM -> EMAIL_FROM_ADDRESS

* merge dev

* add test for get_from_email

* allow live settings to be null on internal API

* remove redundant tests
2022-11-03 16:18:37 +00:00
Matvey Kukuy
85d94d342e
Readme about how to add Integrations and Zabbix Integration (#653)
* Readme and zabbix

* Typos

* Linking
2022-11-02 22:58:47 +08:00
Michael Derynck
2905423bad Merge dev 2022-11-01 17:56:03 -06:00
Vadim Stepanov
035584f17e
Enable email backend by default (#740)
* enable email backend by default, catch empty EMAIL_HOST

* fix tests

* fix tests

* fix tests
2022-11-01 13:48:36 +00:00
Michael Derynck
9d7c370752 Merge branch 'dev' into add-region-to-organization 2022-10-27 15:41:35 -06:00
Joey Orlando
7974f32239
Revert "Revert "Remove migration-tool Django app and UI page (#708)"" 2022-10-27 15:42:21 +02:00
Joey Orlando
56c6a25dfb Revert "Remove migration-tool Django app and UI page (#708)"
This reverts commit 94934bf3e4.
2022-10-27 12:12:57 +02:00
Joey Orlando
94934bf3e4
Remove migration-tool Django app and UI page (#708)
* remove migration_tool app (#687)
* remove migration-tool page (#699)
2022-10-26 15:47:08 +02:00
Michael Derynck
febe1b2185 Add basic organization moved exception handling and middleware 2022-10-20 15:04:58 -06:00
Michael Derynck
330f103844 Merge branch 'dev' into add-region-to-organization 2022-10-19 11:00:59 -06:00
Vadim Stepanov
e67d3519fe
Restore email notifications (#621)
* remove email verification related code

* remove email verification related code

* remove sendgrid callback

* remove sendgrid related code

* remove sendgrid related code

* rename sendgrid app to email

* remove email from built-in channels

* remove email from built-in channels

* remove email from built-in channels

* add email backend: https://github.com/grafana/oncall/pull/50

* add email templater

* add email templater

* convert md to html

* add email settings to live settings

* use task to send email, handle some exceptions to create logs

* remove ERROR_NOTIFICATION_MAIL_DELIVERY_FAILED usage

* add email limit logic

* fix tests

* add docs

* remove old email templates

* remove old email templates

* add template_fields to messaging backend

* add messaging backends templates to public api

* add comment for deprecated fields

* fix test

* fix tests

* disable email by default

* don't retry on SMTPException and TimeoutError

* add tests

* bring email back to public api docs

* return ERROR_NOTIFICATION_MAIL_LIMIT_EXCEEDED

* make template_fields tuple

* build_subject_and_title -> build_subject_and_message

* add one more comment about template deprecation

* use 8 as backend id

* add comment about gaierror and BadHeaderError

* add comment on importing in notify_user_async

* edit oss docs
2022-10-19 12:32:56 +01:00
Michael Derynck
20a557b7a5 Merge branch 'dev' into mderynck/allow-twilio-api-keys 2022-10-18 11:55:16 -06:00
Michael Derynck
5f5f427c9f Add middleware to catch exception for missing integration, reduce spamminess of logs 2022-10-13 17:18:22 -06:00
Michael Derynck
bc16795fa8 Allow use of API keys as alternative to account auth token for Twilio credentials 2022-10-11 14:47:16 -06:00
Michael Derynck
fa5d4f2674 Add region_slug column to organization 2022-10-11 12:04:33 -06:00
Vadim Stepanov
b84b174e20
Allow multiple database and celery broker types (#582)
* add libs for celery + redis

* move redis & cache config to settings/base.py

* move rmq & celery config to settings/base.py

* BROKER -> BROKER_TYPE

* allow multiple database types

* flake8

* add sqlite db creation to dockerfile

* fix ci

* fix ci

* debug

* remove some defaults

* remove prints

* use local memory as cache on ci

* debug

* add DATABASE_DEFAULTS

* add ci test for sqlite + redis

* add ci test for sqlite + redis

* add ci test for sqlite + redis

* debug

* add redis healthcheck

* fix sqlite

* fix dev settings

* refactor dev settings

* tweak ci settings

* clear cache properly between tests

* move db and broker types to constants

* add librabbitmq deps

* use amqp instead of librabbitmq
2022-10-04 09:25:53 +01:00
Michael Derynck
455321938e
Merge pull request #475 from grafana/add-organization-cleanup-task
Add task to delete organizations if their stack has been deleted in gcom
2022-09-08 10:07:44 -06:00
Michael Derynck
b79aa95d42 Tweaks from code review, add schedule and queue assignment 2022-09-07 07:58:44 -06:00
Matias Bordese
c9ea6e4728 Add web_schedules feature flag 2022-09-02 15:37:33 -03:00
Ildar Iskhakov
4f6968fc4b
Bump celery version, telegram version (#454)
* Bump celery version, telegram version

* Bump kombu version
2022-09-01 11:37:52 +01:00
Innokentii Konstantinov
ba1dfd853f Fix GRAFANA_CLOUD_ONCALL_API_URL 2022-08-31 14:27:12 +05:00
Innokentii Konstantinov
b703130dcb Revert "Fix GRAFANA_CLOUD_ONCALL_API_URL"
This reverts commit fb67003f1e.
2022-08-29 17:36:27 +05:00
Innokentii Konstantinov
fb67003f1e Fix GRAFANA_CLOUD_ONCALL_API_URL 2022-08-29 17:34:27 +05:00
Innokentii Konstantinov
8730a8c7e4 use insight instead of insight_logs 2022-08-24 13:39:05 +05:00
Innokentii Konstantinov
4765c9b07c
Insight logs (#348)
* Entity events insight logs

* Insight logging

* Fix event for updating templates

* Format fixes

* Remove organization_log_type.py

* Simplify signature of chatops_insight_log

* insight logs formatting

* Add possibility to enable all insight logging via DynamicSetting

* Fixes

* Style fixes

* Add migration

* Fix migration
2022-08-24 12:04:44 +05:00
Innokentii Konstantinov
b58f32e396
Set DATA_UPLOAD_MAX_MEMORY_SIZE to 1mb (#393)
* Set DATA_UPLOAD_MAX_MEMORY_SIZE to 1mb

* Remove comment

* More clear DATA_UPLOAD_MAX_MEMORY_SIZE literal

* Add getenv_integer
2022-08-24 11:59:01 +05:00
Michael Derynck
4c37e199e9
Merge pull request #369 from grafana/static-url-env-var
Make STATIC_URL configurable from env
2022-08-15 14:24:57 -06:00
Michael Derynck
0221ce612a Make STATIC_URL configurable from env 2022-08-15 12:08:53 -06:00
Matias Bordese
3b3802870a Add postgresql support for development/testing 2022-08-08 15:33:40 -03:00
Innokentii Konstantinov
819add5f2e
Add DANGEROUS_WEBHOOKS_ENABLED live setting (#286)
* Add DANGEROUS_WEBHOOKS_ENABLED live setting

* Style fix

* Fix DANGEROUS_WEBHOOKS_ENABLED check
2022-08-02 14:20:18 +04:00
Innokentii Konstantinov
972bfd9c68 Fix propagation for the insight logger 2022-07-25 12:59:12 +04:00
Ildar Iskhakov
d08425e17d Add logger for insight logs 2022-07-22 15:09:52 +03:00
Ildar Iskhakov
6bf7d7d075 Fix wrong env var for mobile app settings 2022-07-20 13:56:02 +03:00
Ildar Iskhakov
ee7a58b5cf Add fixes for the mobile app 2022-07-20 10:26:14 +03:00
Matias Bordese
2a5e0dc1f1
Merge pull request #43 from grafana/remove-unused-feature-flag
Remove unused messaging backends feature flag
2022-06-15 14:29:26 -03:00
Matias Bordese
3a69ddcc70 Add missing slack settings to live settings mapping 2022-06-15 11:39:12 -03:00
Michael Derynck
846b898bb9
Merge dev to main (#69)
* 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 <michael.derynck@grafana.com>

* Build actions (#38)

* Drone, github action changes

* Minor version updates

* Update frontend dependencies

* Re-enable unit test

Co-authored-by: Michael Derynck <michael.derynck@grafana.com>

* Revert stylelint version (#52)

* Revert stylelint version

* Build plugin as well as lint

* Build in previous step

Co-authored-by: Michael Derynck <michael.derynck@grafana.com>

* Update screenshot (#53)

Co-authored-by: Michael Derynck <michael.derynck@grafana.com>

* oncall images for docs (#55)

* Update README.md

* Top menu fix

* Fix db encoding

* Add api key docs

* Reverting utf8 fix

* bug fixes

* fix for link for OSS version

* Fixing utf8 and docker compose

* 8080 -> 8000 port for consistency

* makeReq

* Fixing images

* Fixing port

* Fixing port

* Fixing port

* Fixing port

* Fixing port

* Fixing port

* Fixing port

* Fixing port

* Replace symlink with file for CHANGELOG.MD (#68)

Co-authored-by: Michael Derynck <michael.derynck@grafana.com>

Co-authored-by: Matias Bordese <mbordese@gmail.com>
Co-authored-by: Matvey Kukuy <Matvey-Kuk@users.noreply.github.com>
Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
Co-authored-by: Matvey Kukuy <matvey@amixr.io>
Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
Co-authored-by: Alyssa Wada <101596687+alyssawada@users.noreply.github.com>
Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2022-06-14 09:14:45 -06:00
Michael Derynck
66e8cf2cbc
Merge dev to main (#54)
* 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 <michael.derynck@grafana.com>

* Build actions (#38)

* Drone, github action changes

* Minor version updates

* Update frontend dependencies

* Re-enable unit test

Co-authored-by: Michael Derynck <michael.derynck@grafana.com>

* Revert stylelint version (#52)

* Revert stylelint version

* Build plugin as well as lint

* Build in previous step

Co-authored-by: Michael Derynck <michael.derynck@grafana.com>

* Update screenshot (#53)

Co-authored-by: Michael Derynck <michael.derynck@grafana.com>

Co-authored-by: Matias Bordese <mbordese@gmail.com>
Co-authored-by: Matvey Kukuy <Matvey-Kuk@users.noreply.github.com>
Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
Co-authored-by: Matvey Kukuy <matvey@amixr.io>
Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
2022-06-13 16:39:58 -06:00