Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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;
}
}
@skapin

This comment has been minimized.

Copy link

@skapin skapin commented Sep 29, 2017

thanks 🍺

@danieldai

This comment has been minimized.

Copy link

@danieldai danieldai commented Oct 24, 2017

It seem sentry image connect database named postgres by default. I created a database named sentry, and restored old data in it, but sentry image not using it by default.

@denji

This comment has been minimized.

@mosesliao

This comment has been minimized.

Copy link

@mosesliao mosesliao commented Nov 24, 2017

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

This comment has been minimized.

Copy link

@wayne-t 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

This comment has been minimized.

Copy link

@yii2-developer yii2-developer commented Jan 24, 2018

POSTGRES_DBNAME: sentry
POSTGRES_DBUSER: sentry
POSTGRES_DBPASS: sentry

Environment variables does not exist in postgres

@denji

This comment has been minimized.

Copy link
Owner Author

@denji 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

This comment has been minimized.

Copy link

@zhil zhil commented Feb 7, 2018

@anboo

This comment has been minimized.

Copy link

@anboo anboo commented Mar 20, 2018

@zhil +

@ulkoart

This comment has been minimized.

Copy link

@ulkoart ulkoart commented Feb 22, 2019

thanks!

@ringyear

This comment has been minimized.

Copy link

@ringyear ringyear commented Jun 3, 2019

thanks

@uhlhosting

This comment has been minimized.

Copy link

@uhlhosting uhlhosting commented Jul 16, 2019

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

@denji

This comment has been minimized.

Copy link
Owner Author

@denji denji commented Jul 16, 2019

@lmgeek

This comment has been minimized.

Copy link

@lmgeek 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

This comment has been minimized.

Copy link

@grv231 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

This comment has been minimized.

Copy link

@lmgeek 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

This comment has been minimized.

Copy link

@grv231 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

This comment has been minimized.

Copy link

@throrin19 throrin19 commented Mar 18, 2020

any news about v10 ?

@itJunky

This comment has been minimized.

Copy link

@itJunky 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

This comment has been minimized.

Copy link

@Braintelligence Braintelligence commented Aug 23, 2020

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

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