Commit graph

63 commits

Author SHA1 Message Date
Dominik Broj
92fa509d22
Brojd/improve e2e tests dx (#3516)
# What this PR does
- introduce e2e tests in Tilt
- support e2e tests commands in Makefile
- stabilize local setup

## Which issue(s) this PR fixes
https://github.com/grafana/oncall/issues/3492

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-12-15 08:58:25 +00:00
Joey Orlando
bdc120b3c6
move some grafana-plugin/README contents (#3525) 2023-12-08 10:30:01 -05:00
Joey Orlando
76a88bc0c1
Revert "upgrade to Python 3.12 (#3456)" and "bump uwsgi version to latest #3466" (#3483)
# What this PR does

This reverts commits 7c4b40a046 and
cdb22285db.

See https://github.com/grafana/oncall-private/pull/2361 for more
details.
2023-12-01 09:56:26 -05:00
Joey Orlando
7c4b40a046
upgrade to Python 3.12 (#3456)
# What this PR does

Upgrade to Python 3.12 + fix several invalid test assertions that lead
to test failures in the latest version of `pytest`:
```
AttributeError: 'called_once_with' is not a valid assertion. Use a spec for the mock if 'called_once_with' is meant to be an attribute.. Did you mean: 'assert_called_once_with'?
```

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-11-30 13:47:41 +00:00
Dominik Broj
2c4b34d3af
generate types, create http client and add exemplary usage (#3384)
# What this PR does

https://github.com/grafana/oncall/issues/3330

- add a script that generates TS type definitions based on OnCall API
OpenAPI schemas
- support adding custom properties on the frontend if needed
- add simple example of usage (for `'/labels/keys/'` endpoint)

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-11-29 05:16:13 +00:00
dependabot[bot]
d8f111f960
Bump aiohttp from 3.8.6 to 3.9.0 in /dev/scripts/generate-fake-data (#3436)
Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.8.6 to
3.9.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/aio-libs/aiohttp/releases">aiohttp's
releases</a>.</em></p>
<blockquote>
<h2>3.9.0</h2>
<h2>Features</h2>
<ul>
<li>
<p>Introduced <code>AppKey</code> for static typing support of
<code>Application</code> storage.
See <a
href="https://docs.aiohttp.org/en/stable/web_advanced.html#application-s-config">https://docs.aiohttp.org/en/stable/web_advanced.html#application-s-config</a></p>
<p>(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/5864">#5864</a>)</p>
</li>
<li>
<p>Added a graceful shutdown period which allows pending tasks to
complete before the application's cleanup is called.
The period can be adjusted with the <code>shutdown_timeout</code>
parameter. -- by :user:<code>Dreamsorcerer</code>.
See <a
href="https://docs.aiohttp.org/en/latest/web_advanced.html#graceful-shutdown">https://docs.aiohttp.org/en/latest/web_advanced.html#graceful-shutdown</a></p>
<p>(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7188">#7188</a>)</p>
</li>
<li>
<p>Added <code>handler_cancellation
&lt;https://docs.aiohttp.org/en/stable/web_advanced.html#web-handler-cancellation&gt;</code>_
parameter to cancel web handler on client disconnection. -- by
:user:<code>mosquito</code>
This (optionally) reintroduces a feature removed in a previous release.
Recommended for those looking for an extra level of protection against
denial-of-service attacks.</p>
<p>(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7056">#7056</a>)</p>
</li>
<li>
<p>Added support for setting response header parameters
<code>max_line_size</code> and <code>max_field_size</code>.</p>
<p>(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/2304">#2304</a>)</p>
</li>
<li>
<p>Added <code>auto_decompress</code> parameter to
<code>ClientSession.request</code> to override
<code>ClientSession._auto_decompress</code>. -- by
:user:<code>Daste745</code></p>
<p>(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/3751">#3751</a>)</p>
</li>
<li>
<p>Changed <code>raise_for_status</code> to allow a coroutine.</p>
<p>(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/3892">#3892</a>)</p>
</li>
<li>
<p>Added client brotli compression support (optional with runtime
check).</p>
<p>(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/5219">#5219</a>)</p>
</li>
<li>
<p>Added <code>client_max_size</code> to
<code>BaseRequest.clone()</code> to allow overriding the request body
size. -- :user:<code>anesabml</code>.</p>
<p>(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/5704">#5704</a>)</p>
</li>
<li>
<p>Added a middleware type alias
<code>aiohttp.typedefs.Middleware</code>.</p>
<p>(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/5898">#5898</a>)</p>
</li>
<li>
<p>Exported <code>HTTPMove</code> which can be used to catch any
redirection request
that has a location -- :user:<code>dreamsorcerer</code>.</p>
<p>(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/6594">#6594</a>)</p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst">aiohttp's
changelog</a>.</em></p>
<blockquote>
<h1>3.9.0 (2023-11-18)</h1>
<h2>Features</h2>
<ul>
<li>
<p>Introduced <code>AppKey</code> for static typing support of
<code>Application</code> storage.
See <a
href="https://docs.aiohttp.org/en/stable/web_advanced.html#application-s-config">https://docs.aiohttp.org/en/stable/web_advanced.html#application-s-config</a></p>
<p><code>[#5864](https://github.com/aio-libs/aiohttp/issues/5864)
&lt;https://github.com/aio-libs/aiohttp/issues/5864&gt;</code>_</p>
</li>
<li>
<p>Added a graceful shutdown period which allows pending tasks to
complete before the application's cleanup is called.
The period can be adjusted with the <code>shutdown_timeout</code>
parameter. -- by :user:<code>Dreamsorcerer</code>.
See <a
href="https://docs.aiohttp.org/en/latest/web_advanced.html#graceful-shutdown">https://docs.aiohttp.org/en/latest/web_advanced.html#graceful-shutdown</a></p>
<p><code>[#7188](https://github.com/aio-libs/aiohttp/issues/7188)
&lt;https://github.com/aio-libs/aiohttp/issues/7188&gt;</code>_</p>
</li>
<li>
<p>Added <code>handler_cancellation
&lt;https://docs.aiohttp.org/en/stable/web_advanced.html#web-handler-cancellation&gt;</code>_
parameter to cancel web handler on client disconnection. -- by
:user:<code>mosquito</code>
This (optionally) reintroduces a feature removed in a previous release.
Recommended for those looking for an extra level of protection against
denial-of-service attacks.</p>
<p><code>[#7056](https://github.com/aio-libs/aiohttp/issues/7056)
&lt;https://github.com/aio-libs/aiohttp/issues/7056&gt;</code>_</p>
</li>
<li>
<p>Added support for setting response header parameters
<code>max_line_size</code> and <code>max_field_size</code>.</p>
<p><code>[#2304](https://github.com/aio-libs/aiohttp/issues/2304)
&lt;https://github.com/aio-libs/aiohttp/issues/2304&gt;</code>_</p>
</li>
<li>
<p>Added <code>auto_decompress</code> parameter to
<code>ClientSession.request</code> to override
<code>ClientSession._auto_decompress</code>. -- by
:user:<code>Daste745</code></p>
<p><code>[#3751](https://github.com/aio-libs/aiohttp/issues/3751)
&lt;https://github.com/aio-libs/aiohttp/issues/3751&gt;</code>_</p>
</li>
<li>
<p>Changed <code>raise_for_status</code> to allow a coroutine.</p>
<p><code>[#3892](https://github.com/aio-libs/aiohttp/issues/3892)
&lt;https://github.com/aio-libs/aiohttp/issues/3892&gt;</code>_</p>
</li>
<li>
<p>Added client brotli compression support (optional with runtime
check).</p>
<p><code>[#5219](https://github.com/aio-libs/aiohttp/issues/5219)
&lt;https://github.com/aio-libs/aiohttp/issues/5219&gt;</code>_</p>
</li>
<li>
<p>Added <code>client_max_size</code> to
<code>BaseRequest.clone()</code> to allow overriding the request body
size. -- :user:<code>anesabml</code>.</p>
<p><code>[#5704](https://github.com/aio-libs/aiohttp/issues/5704)
&lt;https://github.com/aio-libs/aiohttp/issues/5704&gt;</code>_</p>
</li>
<li>
<p>Added a middleware type alias
<code>aiohttp.typedefs.Middleware</code>.</p>
<p><code>[#5898](https://github.com/aio-libs/aiohttp/issues/5898)
&lt;https://github.com/aio-libs/aiohttp/issues/5898&gt;</code>_</p>
</li>
<li>
<p>Exported <code>HTTPMove</code> which can be used to catch any
redirection request
that has a location -- :user:<code>dreamsorcerer</code>.</p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="45b2c2c577"><code>45b2c2c</code></a>
Release v3.9.0 (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7843">#7843</a>)</li>
<li><a
href="5d59d3d6ac"><code>5d59d3d</code></a>
Release v3.9.0rc0 (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7840">#7840</a>)</li>
<li><a
href="c806814a8a"><code>c806814</code></a>
Release v3.9.0rc0 (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7838">#7838</a>)</li>
<li><a
href="e07a1bdaac"><code>e07a1bd</code></a>
Use timestamp instead of datetime to achieve faster cookie expiration…
(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7837">#7837</a>)</li>
<li><a
href="53476dfd4e"><code>53476df</code></a>
Disallow arbitrary sequence types in version (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7835">#7835</a>)
(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7836">#7836</a>)</li>
<li><a
href="9d712f2f9c"><code>9d712f2</code></a>
Bump mypy from 1.6.1 to 1.7.0 (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7833">#7833</a>)</li>
<li><a
href="63a805e1d8"><code>63a805e</code></a>
Bump python-on-whales from 0.66.0 to 0.67.0 (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7832">#7832</a>)</li>
<li><a
href="cb94533dd5"><code>cb94533</code></a>
Ensure writer is always reset on completion (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7815">#7815</a>)
(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7826">#7826</a>)</li>
<li><a
href="c0f9017a9a"><code>c0f9017</code></a>
[PR <a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7821">#7821</a>/366ba40f
backport][3.9] Only check origin if insecure scheme and th...</li>
<li><a
href="9d498ca1e6"><code>9d498ca</code></a>
Bump sphinx from 7.1.1 to 7.2.6 (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7606">#7606</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/aio-libs/aiohttp/compare/v3.8.6...v3.9.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=aiohttp&package-manager=pip&previous-version=3.8.6&new-version=3.9.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/grafana/oncall/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-28 06:56:46 -05:00
dependabot[bot]
bb8b88f720
Bump aiohttp from 3.8.5 to 3.8.6 in /dev/scripts/generate-fake-data (#3354) 2023-11-14 18:38:48 -05:00
Matvey Kukuy
6d7fc16fbd
Tilt Docs polishing (#3090)
minor
2023-09-30 18:17:41 +00:00
Ildar Iskhakov
51014735aa
WIP: Direct paging improvements (#3064)
# What this PR does
* Create Direct Paging integration (with default route) when team is
created with bulk_update
* Create notification policies when user is created with bulk_update
* If user notification policies are empty change it to Email
* Minor markup and wording improvements
* Add grafana queue to helm chart
* Remove disabled commands for redis helm chart
* Improve Dockerfile caching

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-09-28 03:57:49 +00:00
Vadim Stepanov
8729d8f3da
formatting fixes (#3019) 2023-09-13 11:49:18 +01:00
Ildar Iskhakov
2d9b4cf1a3
Update README.md (#3007)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-09-13 11:09:39 +08:00
Bob Cotton
6c8344a82d
Use Tilt for local development (#1396)
# What this PR does

PR adds Tilt for local development

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated

---------

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-09-07 19:38:19 +08:00
Joey Orlando
05dc8839b2
add instructions on how to run helm unit tests
plus add command to Makefile
2023-08-29 11:57:26 +02:00
Alexander Cherepanov
ec028eb9d9
Telegram long polling (#2250)
# What this PR does

Runs Telegram long polling to get updates. 
It's enabled by setting `FEATURE_TELEGRAM_LONG_POLLING_ENABLED=True`.
That will disable webhook and run separate deployment for telegram long
polling.

Telegram long polling is not very HA mode, but it does not need to
expose webhook url to internet and simplifies telegram integration.

## Which issue(s) this PR fixes

closes #561 

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-08-24 09:12:24 +02:00
Joey Orlando
3783aeab64
fix a few flaky e2e tests + allow running project locally via k8s/helm (#2751)
# What this PR does

- updates the GitHub Actions workflow to move the e2e tests into a
"[reusable
workflow](https://docs.github.com/en/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow)"
which are run in two scenarios:
- all tests _except_ those annotated as `@expensive` are run against
`grafana/grafana:latest` on all feature branches
- all tests _including_ `@expensive` tests are run on weekdays @ 07h00
UTC, against a matrix of 6 grafana versions. Results of these builds
will be posted to `#irm-amixr-flux` Slack channel.
- local development will now be:
  ```bash
  make build-dev-images init-k8s start-k8s
  ```
- `build-dev-images` - builds the engine and UI docker images (only need
to run first time)
- `init-k8s` - creates a `kind` cluster and loads the two Docker images
onto the cluster nodes (only need to run first time)
- `start-k8s` - switches `kubectl` context to the created `kind`
cluster, and uses `helm` to deploy everything as defined in
`./dev/helm-local.yml` and `./dev/helm-local.dev.yml` (that latter file
is `.gitignored` and specific to how _you_ want your setup to look like.
Hot reloading works as before. This is the _start_ of #2381. (I've
marked these `make` commands as beta, because they've not yet been
thoroughly tested for local development).
- modifies the `helm` chart to add the concept of `oncall.devMode`,
`ui`, and ability to run oncall w/ sqlite
- `oncall.devMode` will essentially just add `volumes` and
`volumeMounts` to the various engine/migrate containers +
- `ui.enabled` + `ui.env` - create a ui container (which is needed for
hot reloading locally)
- `sqlite` - this was useful for the e2e test environments where Github
runner resources are scarce. Running `mariadb` eats up precious
resources, instead lets just use sqlite here
- fixes an issue that caused sporadic HTTP 502s from the grafana
plugin-proxy, which led to flaky tests. See [this
comment](https://github.com/grafana/oncall/pull/2751/files#diff-09040e8df192699b9c5742110ebbe8d9d5c3938cb156cc1cb99fa1c3fdee4fefR72-R77)
for more context + a link to a relevant Slack conversation. **tldr;**
there is a bug with the Grafana plugin proxy in Grafana >= v10.0.3.
Let's stop using the `latest`/`main` docker tags in our test and pin to
`10.0.2` for now
- ~~re-enables the e2e test which validates a phone number via SMS, and
asserts that we can receive an alert escalation via SMS (new Mailslurp
API Key has been added as a repo secret)~~ update: this is still blocked
by procurement, will be done in a future PR

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-08-22 19:03:29 +02:00
Vadim Stepanov
638c9a3142
Add instruction on removing nullable fields from Django models (#2659)
Adds an instruction on removing nullable fields without downtime.
2023-08-08 12:46:18 +00:00
Joey Orlando
f2b82f6c67
fix make start command when using mysql/postgres as db (#2744)
# What this PR does

Tested `make start` w/ both `mysql` and `postgres` in `COMPOSE_PROFILES`
and things spin up properly.

- Fixes some `yaml` formatting issues introduced
[here](https://github.com/grafana/oncall/pull/2728/files#diff-f5d10b03472abe3719098ae8a8855468e92524ebe790c39a34d2c632f3f0486d)
in #2728 which were causing the `mysql` container to fail to start up
when running `make start`
- Addresses #2492 by specifying `required: false` under `depends_on`,
for containers in `docker-compose-developer.yml` which have container(s)
which may be conditionally spun-up based on `COMPOSE_PROFILES`.
Basically in v2.20.2 they introduced [this
change](https://github.com/docker/compose/releases/tag/v2.20.2#:~:text=Add%20support%20of%20depends_on.required%20attribute%20by)
which was a breaking change for our setup and preventing us from
upgrading to >= 2.19.0.

## Which issue(s) this PR fixes

Closes #2492 

‼️ with this PR you will need to make sure you are running
`docker-compose` >= `v2.20.2`, otherwise 👇 ‼️


![image](https://github.com/grafana/oncall/assets/9406895/312bdeb7-e1c5-4774-b2e9-6facddd641c1)


## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-08-03 11:50:40 -04:00
Joey Orlando
b26706e7e4
configure yamllint pre-commit step (#2728)
# What this PR does

Add [`yamllint`](https://github.com/adrienverge/yamllint) to
`pre-commit` configuration + fix pre-existing errors

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-08-03 02:35:08 -04:00
Joey Orlando
e3e4976c65
remove two unused feature flags (#2734)
# What this PR does

- Removes `FEATURE_WEB_SCHEDULES_ENABLED` and
`FEATURE_WEBHOOKS_2_ENABLED` feature flags as they are no longer needed
- Remove reference to `FEATURE_EXTRA_MESSAGING_BACKENDS_ENABLED` in
`./dev/.env.dev.example`. This also doesn't seem to be used in either
this repo or `oncall-private`

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-08-02 14:07:47 -04:00
Maxim Mordasov
36f9851003
add a couple of tests for users screen (#2612)
# What this PR does

There are the following tests added:

 - admin is allowed to edit other profiles
 - editor is not allowed to edit other profiles

## Which issue(s) this PR fixes

https://github.com/grafana/oncall/issues/1586

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
2023-08-02 15:42:48 +03:00
dependabot[bot]
2477859cb6
Bump aiohttp from 3.8.3 to 3.8.5 in /dev/scripts/generate-fake-data (#2602)
Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.8.3 to
3.8.5.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/aio-libs/aiohttp/releases">aiohttp's
releases</a>.</em></p>
<blockquote>
<h2>3.8.5</h2>
<h2>Security bugfixes</h2>
<ul>
<li>
<p>Upgraded the vendored copy of llhttp_ to v8.1.1 -- by
:user:<code>webknjaz</code>
and :user:<code>Dreamsorcerer</code>.</p>
<p>Thanks to :user:<code>sethmlarson</code> for reporting this and
providing us with
comprehensive reproducer, workarounds and fixing details! For more
information, see
<a
href="https://github.com/aio-libs/aiohttp/security/advisories/GHSA-45c4-8wx5-qw6w">https://github.com/aio-libs/aiohttp/security/advisories/GHSA-45c4-8wx5-qw6w</a>.</p>
<p>.. _llhttp: <a href="https://llhttp.org">https://llhttp.org</a></p>
<p>(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7346">#7346</a>)</p>
</li>
</ul>
<h2>Features</h2>
<ul>
<li>
<p>Added information to C parser exceptions to show which character
caused the error. -- by :user:<code>Dreamsorcerer</code></p>
<p>(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7366">#7366</a>)</p>
</li>
</ul>
<h2>Bugfixes</h2>
<ul>
<li>
<p>Fixed a transport is :data:<code>None</code> error -- by
:user:<code>Dreamsorcerer</code>.</p>
<p>(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/3355">#3355</a>)</p>
</li>
</ul>
<hr />
<h2>3.8.4</h2>
<h2>Bugfixes</h2>
<ul>
<li>Fixed incorrectly overwriting cookies with the same name and domain,
but different path.
(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/6638">#6638</a>)</li>
<li>Fixed <code>ConnectionResetError</code> not being raised after
client disconnection in SSL environments.
(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7180">#7180</a>)</li>
</ul>
<hr />
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/aio-libs/aiohttp/blob/v3.8.5/CHANGES.rst">aiohttp's
changelog</a>.</em></p>
<blockquote>
<h1>3.8.5 (2023-07-19)</h1>
<h2>Security bugfixes</h2>
<ul>
<li>
<p>Upgraded the vendored copy of llhttp_ to v8.1.1 -- by
:user:<code>webknjaz</code>
and :user:<code>Dreamsorcerer</code>.</p>
<p>Thanks to :user:<code>sethmlarson</code> for reporting this and
providing us with
comprehensive reproducer, workarounds and fixing details! For more
information, see
<a
href="https://github.com/aio-libs/aiohttp/security/advisories/GHSA-45c4-8wx5-qw6w">https://github.com/aio-libs/aiohttp/security/advisories/GHSA-45c4-8wx5-qw6w</a>.</p>
<p>.. _llhttp: <a href="https://llhttp.org">https://llhttp.org</a></p>
<p><code>[#7346](https://github.com/aio-libs/aiohttp/issues/7346)
&lt;https://github.com/aio-libs/aiohttp/issues/7346&gt;</code>_</p>
</li>
</ul>
<h2>Features</h2>
<ul>
<li>
<p>Added information to C parser exceptions to show which character
caused the error. -- by :user:<code>Dreamsorcerer</code></p>
<p><code>[#7366](https://github.com/aio-libs/aiohttp/issues/7366)
&lt;https://github.com/aio-libs/aiohttp/issues/7366&gt;</code>_</p>
</li>
</ul>
<h2>Bugfixes</h2>
<ul>
<li>
<p>Fixed a transport is :data:<code>None</code> error -- by
:user:<code>Dreamsorcerer</code>.</p>
<p><code>[#3355](https://github.com/aio-libs/aiohttp/issues/3355)
&lt;https://github.com/aio-libs/aiohttp/issues/3355&gt;</code>_</p>
</li>
</ul>
<hr />
<h1>3.8.4 (2023-02-12)</h1>
<h2>Bugfixes</h2>
<ul>
<li>Fixed incorrectly overwriting cookies with the same name and domain,
but different path.
<code>[#6638](https://github.com/aio-libs/aiohttp/issues/6638)
&lt;https://github.com/aio-libs/aiohttp/issues/6638&gt;</code>_</li>
<li>Fixed <code>ConnectionResetError</code> not being raised after
client disconnection in SSL environments.
<code>[#7180](https://github.com/aio-libs/aiohttp/issues/7180)
&lt;https://github.com/aio-libs/aiohttp/issues/7180&gt;</code>_</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="9c13a52c21"><code>9c13a52</code></a>
Bump aiohttp to v3.8.5 a security release</li>
<li><a
href="7c02129567"><code>7c02129</code></a>
 Bump pypa/cibuildwheel to v2.14.1</li>
<li><a
href="135a45e9d6"><code>135a45e</code></a>
Improve error messages from C parser (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7366">#7366</a>)
(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7380">#7380</a>)</li>
<li><a
href="9337fb3f2a"><code>9337fb3</code></a>
Fix bump llhttp to v8.1.1 (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7367">#7367</a>)
(<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7377">#7377</a>)</li>
<li><a
href="f07e9b44b5"><code>f07e9b4</code></a>
[PR <a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7373">#7373</a>/66e261a5
backport][3.8] Drop azure mention (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7374">#7374</a>)</li>
<li><a
href="01d9b70e54"><code>01d9b70</code></a>
[PR <a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7370">#7370</a>/22c264ce
backport][3.8] fix: Spelling error fixed (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7371">#7371</a>)</li>
<li><a
href="3577b1e371"><code>3577b1e</code></a>
[PR <a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7359">#7359</a>/7911f1e9
backport][3.8]  Set up secretless publishing to PyPI (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7360">#7360</a>)</li>
<li><a
href="8d45f9c995"><code>8d45f9c</code></a>
[PR <a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7333">#7333</a>/3a54d378
backport][3.8] Fix TLS transport is <code>None</code> error (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7357">#7357</a>)</li>
<li><a
href="dd8e24e773"><code>dd8e24e</code></a>
[PR <a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7343">#7343</a>/18057581
backport][3.8] Mention encoding in <code>yarl.URL</code> (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7355">#7355</a>)</li>
<li><a
href="40874103eb"><code>4087410</code></a>
[PR <a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7346">#7346</a>/346fd202
backport][3.8]  Bump vendored llhttp to v8.1.1 (<a
href="https://redirect.github.com/aio-libs/aiohttp/issues/7352">#7352</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/aio-libs/aiohttp/compare/v3.8.3...v3.8.5">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=aiohttp&package-manager=pip&previous-version=3.8.3&new-version=3.8.5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/grafana/oncall/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-21 01:33:48 -04:00
Joey Orlando
933e7256e3
move local developer resources to ./dev folder (#2479)
# What this PR does

As part of #1953, I wanted to be able to easily locally modify my
Grafana instance's access control provisioning configuration. In the
`grafana` container in `docker-compose-developer.yml`, we already have
this:
```yml
volumes:
  - ./provisioning:/etc/grafana/provisioning
```
The `dev` directory has a `.gitignore` setup which is better suited for
what I would like to do. By default, if I add
`./dev/grafana/provisioning/access-control/custom-roles.yml`, it will be
git-ignored. This would've not been the case with the `./provisioning`
directory

*Other stuff*
- create `./dev/grafana` folder. This folder contains resources that are
volume mounted into the `grafana` container in
`docker-compose-developer.yml`.
  - We already had a `./dev/grafana.dev.ini` file, relocated this here.
  - Relocated `./provisioning` to `./dev/grafana/provisioning`. 
- consolidate `./examples/terraform` into `./terraform` directory

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated (N/A)
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required) (N/A)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required) (N/A)
2023-07-10 06:09:22 -04:00
Joey Orlando
f5495ed702
add first multi-role e2e tests (#2417)
# What this PR does

Lays ground work for #1586. Adds three new fixtures, `adminRolePage`,
`editorRolePage`, and `viewerRolePage`. These fixtures can be easily
accessed in a `test` context and allow the test to be run as a user
authenticated with one of these Grafana basic roles.

The bulk of the changes in the PR are to the "global setup" step. There
is a bit of logic + communication with the Grafana instance's API, in
order to create all the necessary authentication credentials.

Lastly, adds the first basic role authorization test, asserting that
Admin/Editors can view the list of OnCall users, whereas Viewers cannot.

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-07-04 09:19:14 +00:00
Joey Orlando
9dde1805aa
add mypy static type checker to backend codebase (#2151)
# What this PR does

- Adds [`mypy` static type checking](https://mypy-lang.org/) to our CI
pipeline. Currently there is still a **ton** of errors being returned by
the tool, as we'll need to fix pre-existing errors. I think we can
slowly chip away at these errors in small PRs, doing them all in one
large PR is likely very risky.
- Also, this PR starts chipping away at one of the main type errors that
we have which is accessing the `datetime` class (from the `datetime`
library) or `timedelta` function on the `django.utils.timezone` module.
Basically we should be instead accessing these two objects from the
native `datetime` module. This makes sense because the [`__all__`
attribute](https://github.com/django/django/blob/main/django/utils/timezone.py#L14-L30)
in `django.utils.timezone` does not re-export `datetime` or `timedelta`.
- splits `engine` dependencies out into `requirements.txt` and
`requirements-dev.txt`

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated (N/A)
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required) (N/A)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required) (N/A)
2023-06-12 12:50:33 -04:00
Joey Orlando
47042decb7
don't enforce line-length rule for markdownlint for code-blocks or tables (#2145)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-09 06:57:19 +00:00
Matias Bordese
eee5065e74
Add initial setup for local dev prometheus exporter (#2039) 2023-06-01 12:31:33 +00:00
Roman Pertl
39770c2266
Feat(Dev): Improve Building of Grafana Plugin in Development Env + update node version (#1890)
# What this PR does

- Improvement to the local development environment for the grafana
plugin
- Run initial yarn build inside the docker container with the same
version that is later used for periodic rebuilds
  - Removes the requirement for having yarn/nodejs installed locally
- Using a named volume for storing the node_modules, so they are only
stored once
  - Remove the yarn install step from the Dockerfile
- Ideally we store the node_modules only once inside the named volumes.
Currently they are stored times
- on the host system outside of dockerin grafana-plugins/node_modules
    - inside the docker image
- inside the anonymous docker volume created at the start of a container
- update `node` to 18.16.0 (14.17.0 has reached end-of-life as of 3
weeks ago)

## Which issue(s) this PR fixes

## Checklist

- [X] ~Unit, integration, and e2e (if applicable) tests updated~ N/A
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
2023-05-17 16:12:51 -04:00
Joey Orlando
bb3521b879
upgrade to python 3.11.3 (#1849)
# What this PR does

Upgrades the backend to Python 3.11.3 (latest stable release) + update
linting step on Drone builds to run **all** the linting steps, not just
the Python ones.

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated (N/A)
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required) (N/A)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-05 15:32:40 +00:00
Joey Orlando
0d4db59137
Add "Notifications Receiver" RBAC role (#1853)
# What this PR does

Closes #1651 

Plus, add developer instructions on how to run `grafana-enterprise` with
RBAC for OnCall, enabled locally.

## Todo

- [x] add API integration test for new `permission` query param filter

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-02 12:19:34 +00:00
Michael Derynck
fdac018948
Update dev directory .gitignore (#1850) 2023-04-28 15:51:58 +00:00
Shantanu Alsi
e806ad32f1
Fix documentation links (#1766)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-04-19 10:12:16 +01:00
Yulya Artyukhina
f61af74411
Add mobile app auth for notification_policies endpoint (#1725)
Add mobile app authentication for `notification_policies` endpoint
2023-04-11 16:36:46 +00:00
Matvey Kukuy
e14cf8f269 Readme updates 2023-04-11 15:43:52 +03:00
Ildar Iskhakov
b2b7237bc4
Update README.md (#1587)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-03-21 23:45:22 +08:00
Ildar Iskhakov
3f9dec6a68
Add "make help" command (#1583)
# What this PR does
Moved part of dev/README.md into `make help` command:
```
make help
start                    start all of the docker containers
init                     build the frontend plugin code then run make start
restart                  restart all docker containers
build                    rebuild images (e.g. when changing requirements.txt)
cleanup                  this will remove all of the images, containers, volumes, and networks
lint                     run both frontend and backend linters
test                     run backend tests
start-celery-beat        start celery beat
purge-queues             purge celery queues
shell                    starts an OnCall engine Django shell
dbshell                  opens a DB shell
engine-manage            run Django's `manage.py` script, inside of a docker container, passing `$CMD` as arguments.
exec-engine              exec into engine container's bash
_backend-debug-enable    enable Django's debug mode and Silk profiling (this is disabled by default for performance reasons)
_backend-debug-disable   disable Django's debug mode and Silk profiling
backend-manage-command   run Django's `manage.py` script, passing `$CMD` as arguments.
```


## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-03-21 08:12:13 +00:00
Joey Orlando
4d655dff60
modify check_escalation_finished_task task (#1266)
# What this PR does

This PR:
- modifies the `check_escalation_finished_task` celery task to:
  - do stricter escalation validation based on the alert group's
escalation snapshot (see the `audit_alert_group_escalation` method in
`engine/apps/alerts/tasks/check_escalation_finished.py` for the
validation logic)
- use a read-only database for querying alert-groups if one is
configured, otherwise use the "default" one
- ping a configurable heartbeat (new env var
`ALERT_GROUP_ESCALATION_AUDITOR_CELERY_TASK_HEARTBEAT_URL` added)
- increase the task frequency from every 10 to every 13 minutes (this
can be configured via an env variable)
  - adds public documentation on how to configure this auditor task
- modifies the local celery startup command to properly take into
consideration all celery related env vars (similar to the ones we use in
`engine/celery_with_exporter.sh`; this made it easier to enable `celery
beat` locally for testing)
- removes the following code:
- removes references to `AlertGroup.estimate_escalation_finish_time` and
marks the model field as deprecated using the [`django-deprecate-fields`
library](https://pypi.org/project/django-deprecate-fields/). This field
was only used for the previous version of this validation task
- `EscalationSnapshotMixin.calculate_eta_for_finish_escalation` was only
used to calculate the value for
`AlertGroup.estimate_escalation_finish_time`
  - `calculate_escalation_finish_time` celery task
  

## Which issue(s) this PR fixes

https://github.com/grafana/oncall-private/issues/1558

## Checklist

- [x] Tests updated
- [x] Documentation added
- [x] `CHANGELOG.md` updated
2023-03-17 10:14:08 +00:00
Vadim Stepanov
302586792f
Update dev/README.md (#1516)
# What this PR does
Fix `cp` command usage in `dev/README.md` + add `npx playwright install`
step to integration tests instruction
2023-03-09 17:09:02 +00:00
Innokentii Konstantinov
7bad073626
Remove OSS_INSTALATION env var (#881)
It's a duplicate of LICENSE env var

**What this PR does**:
Remove OSS_INSTALLATION env var in favour of LICENSE env var. Also, I
refactored features tests a little. From my point of view it makes
little sense to test if all features are disabled or enabled. Better to
test specific use-case (e.g. oss installation).
Also to test that all features are disabled it is needed to set LICENSE
equals cloud license, which makes test confusing.

**Checklist**
- [x] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-03-07 11:07:42 +00:00
Joey Orlando
8f22b2fd74
first UI integration test - phone verification + receive SMS alert flow (#900)
**What this PR does**:
Adds our first UI integration test using
[Playwright](https://playwright.dev/) and runs the test on CI. Right now
the test:
- logs into Grafana
- configures the plugin (if it isn't already)
- creates an OnCall schedule, where the current user will be OnCall
- creates an escalation chain to notify based on the newly created
OnCall schedule
- creates a webhook integration, attached to the created escalation
chain
- sends a demo alert for the new integration
- goes to the alert groups page and validates that the escalation step
to alert the OnCall user actually happened

Currently the Playwright tests are run against the 3 default headless
browsers, chromium, Firefox, and webkit. The CI job that runs these
tests is run as a matrix against 3 tagged versions of `grafana`; `main`,
`latest`, and `9.2.6`.

Secondly, it adds most of the logic for a second test which:
- logs into Grafana
- configures the plugin (if it isn't already)
- goes to the user's settings, verifies their phone number (using a tool
called [MailSlurp](https://www.mailslurp.com/))
- configures the current user's default escalation policy to send alerts
via SMS
- creates an escalation policy and configures it to send alerts to our
current user
- creates an integration and assigns the created escalation policy
- triggers a test alert + verifies that we receive the SMS alert text
(again, using MailSlurp)

**Which issue(s) this PR fixes**:
Closes #873 

**Checklist**
- [x] Tests updated
- [ ] Documentation added (N/A)
- [ ] `CHANGELOG.md` updated (N/A)
2023-03-06 16:28:52 +00:00
Ildar Iskhakov
1b7ada4315
Add database migrations linter (#1020)
# What this PR does

This PR adds
[django-migration-linter](https://github.com/3YOURMIND/django-migration-linter)
to keep database migrations
 backwards compatible

- we can automatically run migrations and they are zero-downtime, e.g.
old code can work with the migrated database
 - we can run and rollback migrations without worrying about data safety
- OnCall is deployed to the multiple environments core team is not able
to control

See [django-migration-linter
checklist](https://github.com/3YOURMIND/django-migration-linter/blob/main/docs/incompatibilities.md)
for the common mistakes and best practices


## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-02-06 16:01:37 +08:00
Vadim Stepanov
08dbab73d2
Remove mobile_app_settings DynamicSetting (#1268)
# What this PR does
Remove checks for `mobile_app_settings` DynamicSetting, so changing
`FEATURE_MOBILE_APP_INTEGRATION_ENABLED` is enough for toggling the
mobile app backend (aka remove per-org feature flag)

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-02-02 13:21:04 +00:00
Vadim Stepanov
9b709e86c9
Fix local dev setup slowness (#1270)
# What this PR does
Fixes an issue when a local dev setup becomes extremely slow.

- Set `DEBUG` and `SILK_PROFILER_ENABLED` to `False` by default + add
utility make commands to toggle it
- Use `uwsgi` instead of Django's built-in `runserver` for local dev
setup
- Limit Celery concurrency to 3 for local dev setup (previously was 20,
used >1GB RAM on my machine)

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-02-02 09:08:48 +00:00
Joey Orlando
98241b9a10
fake-data generation script + fixes for django-silk and django-debug-toolbar (#1128)
# What this PR does

## Main stuff

- add Python script to populate local Grafana/OnCall setup w/ large
amounts of fake data. Right now the data types that can be generated
are:
- teams and Admin users via the Grafana API (must be synced manually by
going into the UI before going onto the next step)
- Calendar Schedules which have three 8h oncall-shifts, via the OnCall
public API
- fixes `django-debug-toolbar` when being run in `docker-compose`
locally

## Other stuff
- documents how to easily modify the Grafana `docker-compose` container
provisioning configuration
- document solutions for two backend setup related issues encountered
when running the engine/celery workers locally, outside of
`docker-compose`, on an Apple silicon Mac
- fixes small bug in `grafana_plugin.helpers.client.APIClient.call_api`
where it would call `response.json()` for all requests, regardless of
whether or not the response actually contained data or not
- in `engine/settings/dev.py`, properly setup `django-silk` and document
the steps to use it locally
- make it possible to log out debug SQL queries by specifying
`DEV_DEBUG_VIEW_SQL_QUERIES` env var, rather than having to uncomment
out a section of `settings/dev.py`

## Which issue(s) this PR fixes

- Some local setup issues when trying to use `django-silk` and
`django-debug-toolbar`
- Makes it much easier to populate your local setup with a lot of fake
data
- Makes it possible to easily modify your local grafana's provisioning
configuration

## Checklist

- [ ] Tests updated (N/A)
- [ ] Documentation added (N/A)
- [ ] `CHANGELOG.md` updated (N/A)
2023-01-20 09:19:41 +01:00
Dieter Plaetinck
6e4d877f93
dev quickstart: no need to configure, safe to ignore warnings (#1131) 2023-01-13 12:19:42 +01:00
Ildar Iskhakov
15256bc4cf Remove local uwsgi instrumentation and local development tempo and agent 2023-01-04 22:25:17 +08:00
Ildar Iskhakov
846497ddc7 Move env vars to docker-compose-dev.yml and clean up 2023-01-04 10:49:42 +08:00
Ildar Iskhakov
2b0e4e1d14 Merge branch 'dev' into iskhakov/add-tracing 2023-01-04 10:46:49 +08:00
Joey Orlando
7ebc9cbbf7
modify push notification settings + use fcm-django library (#998)
- swaps out `django-push-notifications` for
[`fcm-django`](https://github.com/grafana/fcm-django). Again.. this is a
fork of the parent repo for exactly the same reason.. the migrations
point to `auth_user` without letting us use our own user model, this has
been patched in the `grafana` fork. The reason why we are using
`fcm-django` vs `django-push-notifications` is that the latter does not
support the new FCM API, only the "legacy" API. The legacy FCM API does
not support certain push notification settings that we would like to
use.
- modifies the iOS/Android specific push notification settings
- adds a `flower` pod in the `docker-compose-developer.yml`, useful for
debugging tasks locally
- sets the mobile app verification token TTL to 5 minutes when
developing locally. The default of 1 minute makes working with device
emulators really tricky..

This PR also swaps out the base image in `engine/Dockerfile` from
`python:3.9-alpine3.16` to `python:3.9-slim-buster`.

As to why.. in short, with the introduction of the `fcm-django` library
there is now a peer-dependency on
[`grpcio`](https://github.com/grpc/grpc) (which is used by
`firebase_admin`.. which I am using in this PR to interact directly with
Firebase Cloud Messaging (FCM)). `grpcio` does not publish wheels (read:
compiled binaries) for the Alpine distro. It does publish wheels for
Debian and hence `pip install -r requirements.txt` does not need to
build this library from the source distribution.

This is a [known
"issue"](https://github.com/grpc/grpc/issues/22815#issuecomment-1107874367)
and the recommended solution in the community is to.. not use alpine.

These were the numbers, when building the image locally, in terms of
image size and build time:

| | Local image size (uncompressed | Build time (may differ based on
your network speed) |
| ------------------------- | -------------------------------------- |
---------- |
| `python:3.9-alpine3.16`   | 785MB  | 320s |
| `python:3.9-slim-buster` | 1.05GB  | 90s   |

Co-authored-by: Salvatore Giordano <salvatoregiordanoo@gmail.com>
2022-12-20 12:41:34 +01:00
Ildar Iskhakov
fa3413d2a9 Add tracing support 2022-12-19 17:15:06 +08:00
Joey Orlando
ed4be171f6
add make command to configure mobile app feature (#988)
Adds a make command, `enable-mobile-app-feature-flags`, which sets the
backend feature flag in `./dev/.env.dev`, and updates a record in the
`base_dynamicsetting` database table, which are needed to enable the
mobile app backend features.
2022-12-14 09:36:35 +01:00