Commit graph

22 commits

Author SHA1 Message Date
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
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
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
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
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
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
Joey Orlando
9a7b8acd5a
centralize timezone validation + add serializer validation for on call shifts and schedules (#924)
* Centralize timezone validation into one spot + add serializer validation
for schedules and oncall shifts (both public and internal API)

* add engine-manage make command
2022-12-01 14:13:39 +01:00
Joey Orlando
19e7fc4c00
remove hostess tool + add extra_hosts entry to oncall backend containers 2022-11-23 19:31:26 +01:00
Jack Jackson
c517569108
Create generic Make command to run Django manage.py (#886)
See https://github.com/grafana/oncall/pull/868
2022-11-22 22:15:22 +01: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
c7c3aa823c
local dev setup - fixes for some minor issues (#821)
* use docker compose instead of docker-compose

the former is the newer version, latter is being deprecated

* default to using latest version of grafana, not main

main is "bleeding-edge" grafana, use the more stable "latest" tag

* support requirements-enterprise.txt for both docker/non-docker setups

* backend-bootstrap make command should install enterprise
requirements if the file is there

* only mount the sqlite db file in docker-compose if using sqlite as the DB
2022-11-10 16:04:30 +01:00
Vadim Stepanov
d2243ba09b
Add Makefile command for rebuilding images (#817) 2022-11-09 15:43:12 +00:00
Joey Orlando
925c3f4cc4
add port to run-backend-server make command (#815) 2022-11-09 15:42:03 +01:00
Joey Orlando
1177e44cc7
enterprise dev changes + few other small changes (#802)
* support enterprise development in docker

* fix flaky mysql healthcheck command

I was getting the mysql_to_create_grafana_db and oncall_db_migration prematurely starting up
this commit changes the healthcheck used here to
be the same as what is used in docker-compose-mysql-rabbitmq.yml

* upgrade docker-compose config files to 3.9

3.8 does not actually support the "long form" version of depends_on
see here for more info https://stackoverflow.com/a/54249757
https://docs.docker.com/compose/compose-file/compose-file-v3/#depends_on

* add make init command and update documentation

* cleanup gitignore files
2022-11-09 07:21:33 +01:00
Joey Orlando
78d01df864
One startup command to rule them all (#760)
* Modify `docker-compose-developer` configuration files, and `Makefile`
to support running everything in containers for local development

- Make use of the COMPOSE_PROFILES env var that is supported by
docker-compose to allow swapping-out/turning off certain docker-compose
services.
- add makefile cleanup command. Will remove all docker resources related
to running the project locally
- The "restart grafana container" issue, where users would need
to restart their grafana container when setting up the project for the
first time, is now fixed (make command now runs yarn build:dev before docker-compose startup;
this ensures grafana-plugin/dist is available for grafana container before it starts up)
- The DEVELOPER.md has been updated as well to reflect these new changes. It
has been moved to ./dev/README.md (and references to the old file have
been updated).
- The redis image that is referenced in the docker-compose files
has been pinned to v7.0.5 (latest version as of this commit) to avoid
any surprises w/ future releases.
- remove root .dockerignore in favour of individual .dockerignore files
in ./engine and ./grafana-plugin
2022-11-07 16:34:43 +01:00
Matias Bordese
1d4f036303 Update Makefile to use .env.dev 2022-11-02 16:12:16 -03:00
Matias Bordese
9b65768495 Run migrate before run 2022-10-11 17:06:19 -03:00
Matias Bordese
6cafd07c15 Update running service rules to depend on bootstrap 2022-10-11 16:58:45 -03:00
Matias Bordese
b80cb0fcd6 Allow setting up a different dir for the virtualenv 2022-10-11 16:53:10 -03:00
Matias Bordese
75d230fc4e Add simple Makefile 2022-10-07 16:50:00 -03:00