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
This commit is contained in:
parent
fc78dd98da
commit
1177e44cc7
9 changed files with 34 additions and 66 deletions
37
.gitignore
vendored
37
.gitignore
vendored
|
|
@ -1,43 +1,8 @@
|
|||
# Backend
|
||||
*/db.sqlite3
|
||||
engine/*.db
|
||||
*.pyc
|
||||
venv
|
||||
.python-version
|
||||
|
||||
.vscode
|
||||
dump.rdb
|
||||
.idea
|
||||
jupiter_playbooks/*
|
||||
engine/reports/*.csv
|
||||
engine/jupiter_playbooks/*
|
||||
|
||||
# Frontend dependencies
|
||||
node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.swp
|
||||
.env
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
scripts/gcom.token
|
||||
scripts/gcom_grafana.token
|
||||
scripts/gcom_raintank.token
|
||||
|
||||
engine/extensions/
|
||||
|
||||
grafana-plugin/frontend_enterprise
|
||||
|
||||
uwsgi-local.ini
|
||||
celerybeat-schedule
|
||||
|
|
|
|||
5
Makefile
5
Makefile
|
|
@ -61,6 +61,9 @@ ifeq ($(DB),$(SQLITE_PROFILE))
|
|||
fi
|
||||
endif
|
||||
|
||||
$(call run_docker_compose_command,up --remove-orphans -d)
|
||||
|
||||
init:
|
||||
# if the oncall UI is to be run in docker we should do an initial build of the frontend code
|
||||
# this makes sure that it will be available when the grafana container starts up without the need to
|
||||
# restart the grafana container initially
|
||||
|
|
@ -68,8 +71,6 @@ ifeq ($(findstring $(UI_PROFILE),$(COMPOSE_PROFILES)),$(UI_PROFILE))
|
|||
cd grafana-plugin && yarn install && yarn build:dev
|
||||
endif
|
||||
|
||||
$(call run_docker_compose_command,up --remove-orphans -d)
|
||||
|
||||
stop:
|
||||
$(call run_docker_compose_command,down)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ Related: [How to develop integrations](/engine/config_integrations/README.md)
|
|||
By default everything runs inside Docker. These options can be modified via the [`COMPOSE_PROFILES`](#compose_profiles) environment variable.
|
||||
|
||||
1. Firstly, ensure that you have `docker` [installed](https://docs.docker.com/get-docker/) and running on your machine. **NOTE**: the `docker-compose-developer.yml` file uses some syntax/features that are only supported by Docker Compose v2. For insturctions on how to enable this (if you haven't already done so), see [here](https://www.docker.com/blog/announcing-compose-v2-general-availability/).
|
||||
2. Run `make start`. By default this will run everything in Docker, using SQLite as the database and Redis as the message broker/cache. See [Running in Docker](#running-in-docker) below for more details on how to swap out/disable which components are run in Docker.
|
||||
2. Run `make init start`. By default this will run everything in Docker, using SQLite as the database and Redis as the message broker/cache. See [Running in Docker](#running-in-docker) below for more details on how to swap out/disable which components are run in Docker.
|
||||
3. Open Grafana in a browser [here](http://localhost:3000/plugins/grafana-oncall-app) (login: `oncall`, password: `oncall`).
|
||||
4. You should now see the OnCall plugin configuration page. Fill out the configuration options as follows:
|
||||
|
||||
|
|
@ -33,6 +33,8 @@ By default everything runs inside Docker. These options can be modified via the
|
|||
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.
|
||||
6. (Optional) Install `pre-commit` hooks by running `make install-precommit-hook`
|
||||
|
||||
**Note**: on subsequent startups you can simply run `make start`, this is a bit faster because it skips the frontend build step.
|
||||
|
||||
### `COMPOSE_PROFILES`
|
||||
|
||||
This configuration option represents a comma-separated list of [`docker-compose` profiles](https://docs.docker.com/compose/profiles/). It allows you to swap-out, or disable, certain components in Docker.
|
||||
|
|
@ -85,6 +87,8 @@ By default everything runs inside Docker. If you would like to run the backend s
|
|||
See [`COMPOSE_PROFILES`](#compose_profiles) for more information on what this option is and how to configure it.
|
||||
|
||||
```bash
|
||||
make init # build the frontend plugin code then run make start
|
||||
make start # start all of the docker containers
|
||||
make stop # stop all of the docker containers
|
||||
make restart # restart all docker containers
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
version: "3.8"
|
||||
version: "3.9"
|
||||
|
||||
x-labels: &oncall-labels
|
||||
- "com.grafana.oncall.env=dev"
|
||||
|
||||
x-oncall-build: &oncall-build-args
|
||||
context: ./engine
|
||||
target: dev
|
||||
target: ${ONCALL_IMAGE_TARGET:-dev}
|
||||
labels: *oncall-labels
|
||||
|
||||
x-oncall-volumes: &oncall-volumes
|
||||
- ./engine:/etc/app
|
||||
# https://stackoverflow.com/a/60456034
|
||||
- ${ENTERPRISE_ENGINE:-/dev/null}:/etc/app/extensions/engine_enterprise
|
||||
- ./engine/oncall.db:/var/lib/oncall/oncall.db
|
||||
|
||||
x-env-files: &oncall-env-files
|
||||
|
|
@ -30,6 +32,8 @@ services:
|
|||
volumes:
|
||||
- ./grafana-plugin:/etc/app
|
||||
- /etc/app/node_modules
|
||||
# https://stackoverflow.com/a/60456034
|
||||
- ${ENTERPRISE_FRONTEND:-/dev/null}:/etc/app/frontend_enterprise
|
||||
profiles:
|
||||
- oncall_ui
|
||||
|
||||
|
|
@ -170,7 +174,7 @@ services:
|
|||
memory: 500m
|
||||
cpus: "0.5"
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||
test: "mysql -uroot -pempty oncall_local_dev -e 'select 1'"
|
||||
timeout: 20s
|
||||
retries: 10
|
||||
volumes:
|
||||
|
|
@ -252,6 +256,11 @@ services:
|
|||
volumes:
|
||||
- grafanadata_dev:/var/lib/grafana
|
||||
- ./grafana-plugin:/var/lib/grafana/plugins/grafana-plugin
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
profiles:
|
||||
- grafana
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
version: "3.8"
|
||||
version: "3.9"
|
||||
|
||||
x-environment: &oncall-environment
|
||||
BASE_URL: $DOMAIN
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
version: "3.8"
|
||||
version: "3.9"
|
||||
|
||||
x-environment: &oncall-environment
|
||||
DATABASE_TYPE: sqlite3
|
||||
|
|
|
|||
5
engine/.gitignore
vendored
Normal file
5
engine/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
requirements-enterprise.txt
|
||||
extensions/
|
||||
uwsgi-local.ini
|
||||
celerybeat-schedule
|
||||
*.db
|
||||
|
|
@ -16,10 +16,11 @@ RUN DJANGO_SETTINGS_MODULE=settings.prod_without_db DATABASE_TYPE=sqlite3 DATABA
|
|||
RUN chown -R 1000:2000 /var/lib/oncall
|
||||
|
||||
FROM base AS dev
|
||||
|
||||
# these are needed for the django dbshell command
|
||||
RUN apk add sqlite mysql-client postgresql-client
|
||||
|
||||
FROM dev AS dev-enterprise
|
||||
RUN pip install -r requirements-enterprise.txt
|
||||
|
||||
FROM base AS prod
|
||||
|
||||
# This is required for prometheus_client to sync between uwsgi workers
|
||||
|
|
|
|||
23
grafana-plugin/.gitignore
vendored
23
grafana-plugin/.gitignore
vendored
|
|
@ -1,33 +1,16 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
.eslintcache
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/dist
|
||||
/ci
|
||||
|
||||
# misc
|
||||
.idea
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
grafana-plugin.yml
|
||||
|
||||
# cache
|
||||
.eslintcache
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# This file is generated
|
||||
grafana-plugin.yml
|
||||
grafana-plugin.yml
|
||||
frontend_enterprise
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue