Skip to content

Instantly share code, notes, and snippets.

@jensens
Last active April 13, 2019 09:43
Show Gist options
  • Star 30 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
  • Save jensens/00f329c292fcb68861ec53abc453c5c7 to your computer and use it in GitHub Desktop.
Save jensens/00f329c292fcb68861ec53abc453c5c7 to your computer and use it in GitHub Desktop.
sentry setup with docker-compose
version: '2'
volumes:
pgdb:
services:
redis:
image: redis
postgres:
image: 'eeacms/postgres:9.5'
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DBNAME: sentry
POSTGRES_DBUSER: sentry
POSTGRES_DBPASS: sentry
volumes:
- pgdb:/var/lib/postgresql/data
sentry:
image: sentry:latest
depends_on:
- redis
- postgres
links:
- redis
- postgres
ports:
- 9000:9000
environment:
SENTRY_SECRET_KEY: verysecret
SENTRY_POSTGRES_HOST: postgres
SENTRY_DB_USER: postgres
SENTRY_DB_PASSWORD: postgres
SENTRY_REDIS_HOST: redis
sentry_celery_beat:
image: sentry:latest
depends_on:
- redis
- postgres
command: "sentry celery beat --pidfile=/tmp/celerybeat-sentry.pid"
environment:
SENTRY_SECRET_KEY: verysecret
SENTRY_POSTGRES_HOST: postgres
SENTRY_DB_USER: postgres
SENTRY_DB_PASSWORD: postgres
SENTRY_REDIS_HOST: redis
sentry_celery_worker:
image: sentry:latest
depends_on:
- redis
- postgres
command: "sentry celery worker"
environment:
SENTRY_SECRET_KEY: verysecret
SENTRY_POSTGRES_HOST: postgres
SENTRY_DB_USER: postgres
SENTRY_DB_PASSWORD: postgres
SENTRY_REDIS_HOST: redis

In order to run this image do: docker-compose up -d to get all up. On first run DB initialization and initial user setup is done like so:

First start a bash in the container: docker-compose exec sentry /bin/bash. Then, inside bash, do sentry upgrade wait until it asks you for an inital user. When finished exit the bash.

When in doubt check with docker-compose ps if all went fine.

@marianobianchi
Copy link

I think you should change some commands:

  1. Instead of "sentry celery beat" you should use "sentry run cron"
  2. Instead of "sentry celery worker" you should use "sentry run worker"

I was having a problem described (and solved) here: getsentry/sentry#1810 (comment)

@luckydonald
Copy link

I suggest checking the hub page of the official sentry docker for updates as their documentation is pretty good.

@Kxrr
Copy link

Kxrr commented Jul 5, 2017

It works fine, thanks.

@frnknglrt
Copy link

Anyone needs sending emails from sentry? If yes, make sure to set the environment variables

  • SENTRY_SERVER_EMAIL,
  • SENTRY_EMAIL_HOST,
  • SENTRY_EMAIL_PORT,
  • SENTRY_EMAIL_USER,
  • SENTRY_EMAIL_PASSWORD

also for the celery worker.

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