diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 62dc57bb5..e0254ca16 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -63,3 +63,30 @@ Open Formulieren can be accessed from `host.docker.internal:9000/openforms/` Open Formulieren is also exposed on `host.docker.internal:9003/` TODO + +## docker-compose.sentry.dev +Contains a Sentry instance for monitoring applications in the environment. Particularly useful for troubleshooting OpenZaak, OpenForms, etc. + +The Sentry GUI can be accessed at `host.docker.internal:9500` or `localhost:9500`. + +#### Configuration +Running Sentry for the first time requires some configuration. + +TODO: Automate configuration + +1. Makes sure the `docker-compose.sentry.dev.yml` is included in your ` docker-compose up` and is running. +2. Open a CMD or Powershell in this repository folder and run `docker-compose -f ./docker-compose.sentry.dev.yml exec sentry sentry upgrade`. +3. After approx. a minute you will get asked if you want to create a user account. Choose `y` and hit enter. +4. We use the following defaults: email=`admin@wearefrank.nl`, password: `admin`. +5. Once finished, run the command: `docker-compose -f ./docker-compose.sentry.dev.yml restart sentry` to restart the sentry container. +6. Open a browser and navigate to `host.docker.internal:9500` or `localhost:9500`. You should see the Sentry login page. Login we the email and password from step 4. +7. Make sure the root url is `http://host.docker.internal:9500` and choose `Please keep my usage information anonymous` under Usage Statistics. +8. In the top-right corner hit the `add...` button and choose `project`. +9. Select the appropriate platform. For OpenZaak, ZaakBrug-Staging and OpenForms this will be `Django`. Change the project name appropriately and hit the `Create Project` button. +10. On the next page look for the word `dsn` and copy the value. +11. In the appropriate docker-compose file, add the following to the environment variables of the `open-zaak`, `zaakbrug-staging` and/or `open-forms` service: +``` +- SENTRY_DSN= +- SDK_SENTRY_DSN= +``` +12. Repeat step 8 - 11 for each application you want to monitor. diff --git a/docker-compose.sentry.dev.yml b/docker-compose.sentry.dev.yml new file mode 100644 index 000000000..2c5cfcf12 --- /dev/null +++ b/docker-compose.sentry.dev.yml @@ -0,0 +1,82 @@ +version: '3.8' + +services: + sentry-redis: + image: redis:${REDIS_VERSION:-6} + command: ["redis-server", "--appendonly", "yes"] + networks: + - sentry-backend + volumes: + - sentry-redis-data:/data + + sentry-postgres: + image: postgres:${POSTGRES_VERSION:-14} + environment: + POSTGRES_USER: sentry + POSTGRES_PASSWORD: sentry + POSTGRES_DB: sentry + POSTGRES_HOST_AUTH_METHOD: trust + networks: + - sentry-backend + volumes: + - sentry-postgres-data:/var/lib/postgresql/data + + # sentry-pgadmin: + # image: dpage/pgadmin4:${PGADMIN_VERSION:-latest} + # user: root + # depends_on: + # - sentry-postgres + # ports: + # - 5050:80 + # environment: + # PGADMIN_DEFAULT_EMAIL: admin@wearefrank.nl + # PGADMIN_DEFAULT_PASSWORD: admin + # # volumes: + # # - sentry-postgres-data:/var/lib/pgadmin + # networks: + # - sentry-backend + + sentry: + image: sentry:${SENTRY_VERSION:-latest} + depends_on: + - sentry-redis + - sentry-postgres + ports: + - 9500:9000 + environment: &sentry-env + SENTRY_SECRET_KEY: ${SECRET_KEY:-t$9llt$7fu65$nt$rmm4y^(xt)!%imecnia87ta(p4t^vf(w(+} + SENTRY_POSTGRES_HOST: sentry-postgres + SENTRY_DB_USER: sentry + SENTRY_DB_PASSWORD: sentry + SENTRY_REDIS_HOST: sentry-redis + networks: + - sentry-backend + - zaakbrug-stack + + sentry-cron: + image: sentry:${SENTRY_VERSION:-latest} + depends_on: + - sentry-redis + - sentry-postgres + command: "sentry run cron" + environment: *sentry-env + networks: + - sentry-backend + + sentry-worker: + image: sentry:${SENTRY_VERSION:-latest} + depends_on: + - sentry-redis + - sentry-postgres + command: "sentry run worker" + environment: *sentry-env + networks: + - sentry-backend + +volumes: + sentry-redis-data: + sentry-postgres-data: + +networks: + zaakbrug-stack: + sentry-backend: \ No newline at end of file