Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry docker compose #148

Merged
merged 2 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<Your copied DSN from step 10>
- SDK_SENTRY_DSN=<Your copied DSN from step 10>
```
12. Repeat step 8 - 11 for each application you want to monitor.
82 changes: 82 additions & 0 deletions docker-compose.sentry.dev.yml
Original file line number Diff line number Diff line change
@@ -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:
Loading