Codevate / local-sentry

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Local Sentry

Bootstrap a local Sentry server to test project integrations and make sure your errors are getting logged correctly. This is not intended for production, instead you should use the official on-premise setup.

Getting started

Start by copying the example environment variables file:

cp .env.example .env

Generate a key and assign SENTRY_SECRET_KEY in .env to it:

docker-compose run --rm web config generate-secret-key

Build the database and use the interactive prompts to create a super-user account:

docker-compose run --rm web upgrade

Lift all services in the background:

docker-compose up -d

Once the containers are running, go to http://localhost:9090 and set this as the root URL with no trailing slash. Fill in the other fields and finish the setup.

If there are any issues you can check the logs via:

docker-compose logs -f

Networking with Docker

If your project is using Docker, you'll have to network it with the Sentry web container:

docker network connect --alias sentry your_network sentry_web_1

Then adjust any generated DSNs so that localhost:9090 is replaced with sentry:9000, e.g.

http://xxxx:xxxx@sentry:9000/x

Networking with Vagrant

If your project is using Vagrant, you'll have to find the network gateway address:

netstat -rn | grep "^0.0.0.0 " | cut -d " " -f10

Then adjust any generated DSNs so that localhost is replaced with the IP, e.g.

http://xxxx:xxxx@10.0.2.2:9090/x

Configuring Sentry

Because the sentry:onbuild image is used, you can edit the files in /docker/sentry to customise your instance & install plugins. However, this does require a rebuild:

docker-compose up -d --build web cron worker

Note: The sentry_web_1 container will have to be reconnected to any other Docker networks.

Troubleshooting

If you exit the upgrade while the migrations are running, the internal Sentry project won't be created and you won't be prompted to create a user. This process can also stall due to Docker not having enough RAM available. Running upgrade on its own won't fix this, you'll have to destroy everything and try again:

 docker-compose down -v
 docker-compose run --rm web upgrade

About


Languages

Language:Python 100.0%