Skip to content

Instantly share code, notes, and snippets.

@denji
Forked from Cubixmeister/README.md
Last active December 26, 2024 12:27
Show Gist options
  • Save denji/b801f19d95b7d7910982c22bb1478f96 to your computer and use it in GitHub Desktop.
Save denji/b801f19d95b7d7910982c22bb1478f96 to your computer and use it in GitHub Desktop.
Simple Sentry docker-compose.yml
  1. Download docker-compose.yml to dir named sentry
  2. Change SENTRY_SECRET_KEY to random 32 char string
  3. Run docker-compose up -d
  4. Run docker-compose exec sentry sentry upgrade to setup database and create admin user
  5. (Optional) Run docker-compose exec sentry pip install sentry-slack if you want slack plugin, it can be done later
  6. Run docker-compose restart sentry
  7. Sentry is now running on public port 9000

Official Sentry integration/plugin

Sentry integration/plugin

version: '2'
volumes:
pgdb:
services:
redis:
image: redis
postgres:
image: postgres
environment:
POSTGRES_USER: sentry
POSTGRES_PASSWORD: sentry
POSTGRES_DB: sentry
volumes:
- pgdb:/var/lib/postgresql/data
sentry:
image: sentry
links:
- redis
- postgres
ports:
- 9000:9000
environment:
SENTRY_SECRET_KEY: '!!!SECRET!!!'
SENTRY_POSTGRES_HOST: postgres
SENTRY_DB_USER: sentry
SENTRY_DB_PASSWORD: sentry
SENTRY_REDIS_HOST: redis
cron:
image: sentry
links:
- redis
- postgres
command: "sentry run cron"
environment:
SENTRY_SECRET_KEY: '!!!SECRET!!!'
SENTRY_POSTGRES_HOST: postgres
SENTRY_DB_USER: sentry
SENTRY_DB_PASSWORD: sentry
SENTRY_REDIS_HOST: redis
worker:
image: sentry
links:
- redis
- postgres
command: "sentry run worker"
environment:
SENTRY_SECRET_KEY: '!!!SECRET!!!'
SENTRY_POSTGRES_HOST: postgres
SENTRY_DB_USER: sentry
SENTRY_DB_PASSWORD: sentry
SENTRY_REDIS_HOST: redis
server {
server_name sentry.example.com;
listen 80;
location / {
proxy_pass http://sentry:9000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
}
@mosesliao
Copy link

seems to me that the cron and worker services are interfering sentry as they are using the sentry image, hence running on port 9000 too.

I suggest you refer to this link and update your docker-compose.yml accordingly

@wayne-t
Copy link

wayne-t commented Jan 10, 2018

Most of the plugins mentioned in readme have been deprecated and moved to https://github.com/getsentry/sentry-plugins
Latest docker image includes those plugins that've been moved into sentry-plugins:
https://github.com/getsentry/docker-sentry/blob/b7d55c572e0b23c5c537432211823a8677727e1c/8.22/Dockerfile

@yii2-developer
Copy link

yii2-developer commented Jan 24, 2018

POSTGRES_DBNAME: sentry
POSTGRES_DBUSER: sentry
POSTGRES_DBPASS: sentry

Environment variables does not exist in postgres

@denji
Copy link
Author

denji commented Feb 4, 2018

Add "file_env" support, especially for Docker secrets

This adds explicit support for the following:

  • POSTGRES_DB_FILE
  • POSTGRES_INITDB_ARGS_FILE
  • POSTGRES_PASSWORD_FILE
  • POSTGRES_USER_FILE

Environmental variables

For creating superuser

It inherits all of them.
In additions, it also allow them to be read from the corresponding file variables.

@zhil
Copy link

zhil commented Feb 7, 2018

@anboo
Copy link

anboo commented Mar 20, 2018

@zhil +

@ulkoart
Copy link

ulkoart commented Feb 22, 2019

thanks!

@ringyear
Copy link

ringyear commented Jun 3, 2019

thanks

@uhlhosting
Copy link

Does this config allows fully functional mail notifications without mailgun? With self hosted smtp? I got connections timeout with nginx config.

@denji
Copy link
Author

denji commented Jul 16, 2019

@lmgeek
Copy link

lmgeek commented Jan 28, 2020

How to generate SENTRY_SECRET_KEY? I use the docker-compose and nginx.conf but when ingresed in localhost:9000 see the error message please help for install on docker

@grv231
Copy link

grv231 commented Jan 28, 2020

@lmgeek do you have sentry already running in docker (up and running)? If so, try and exec inside the container and use sentry config generate-secret-key to generate a new key. I generally keep it in the config.yml file and create a custom docker image

@lmgeek
Copy link

lmgeek commented Jan 28, 2020

the first step is docker-compose up -d? or how run the sentry container for generate a new secret-key, i need run first sentry/onepremise?

@grv231
Copy link

grv231 commented Jan 28, 2020

@ImGeek I followed the on-prem approach, documented here. The first three steps are good enough to generate the key (preferably different keys for different environments) and then pass that key as env var when you do the deploy to different environments

@throrin19
Copy link

any news about v10 ?

@itJunky
Copy link

itJunky commented Jul 27, 2020

I need to configure mail server for send mentions from sentry. Where i can find config.yml? https://stackoverflow.com/questions/50344403/how-to-config-smtp-settings-in-sentry here is a solution without docker. But how i can do it in this docker way?

@Braintelligence
Copy link

@itJunky How about you look at the official Docker Hub Image readme? https://hub.docker.com/_/sentry

@bokink2099
Copy link

Hello guys, currently I have some issues when I invited new members its success. But when I try to log in using an account the new member can't log in. Did you guys know why?

@yainakrub
Copy link

yainakrub commented Aug 9, 2021

relation "sentry_option" does not exist at character 114

how to edit ?

image

@Qetbn
Copy link

Qetbn commented Nov 15, 2021

thanks! awesome hints

@alexxxxey
Copy link

Thank a lot! I think you can remove sections links:

@mumutu66
Copy link

how to use dedicate kafka...

@viotile
Copy link

viotile commented Dec 7, 2022

For steps 2:
Generate secret key by following command :
docker-compose run --rm sentry config generate-secret-key

@SeLub
Copy link

SeLub commented Feb 14, 2023

How to fix?

ERROR: relation "sentry_option" does not exist at character 114

@ggreeshma07
Copy link

how to fix this error:
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: base name (${BASE_IMAGE}) should not be blank

@thomanhphuc
Copy link

How to fix?

ERROR: relation "sentry_option" does not exist at character 114

docker exec -it sentry-sentry-1 sentry upgrade

@AlaaiDwidar
Copy link

i want to make sentry https , can anyone help

@Abhis9929
Copy link

hey I am getting the error in worker node.

I just deployed the above docker-compose file and changed the secret key and execute upgrade command but getting error in worker node.

Please help me to fix this error as getting from a long time.

worker-node

@des1roer
Copy link

on error

docker-sentry-1     |     return self.cursor.execute(sql, clean_bad_params(params))
docker-sentry-1     | ProgrammingError: ProgrammingError('relation "sentry_projectkey" does not exist\nLINE 1: ...te_limit_window", "sentry_projectkey"."data" FROM "sentry_pr...\n                                                             ^\n',)
docker-sentry-1     | SQL: SELECT "sentry_projectkey"."id", "sentry_projectkey"."project_id", "sentry_projectkey"."label", "sentry_projectkey"."public_key", "sentry_projectkey"."secret_key", "sentry_projectkey"."roles", "sentry_projectkey"."status", "sentry_projectkey"."date_added", "sentry_projectkey"."rate_limit_count", "sentry_projectkey"."rate_limit_window", "sentry_projectkey"."data" FROM "sentry_projectkey" WHERE ("sentry_projectkey"."project_id" = %s  AND "sentry_projectkey"."roles" =  "sentry_projectkey"."roles" | 1) LIMIT 1
docker-sentry-1     | 14:36:02 [ERROR] sentry_sdk.errors: Internal error in sentry_sdk

docker exec sentry bash

into container:

sentry upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment