Skip to content

Instantly share code, notes, and snippets.

@rwillians
Last active May 10, 2017 22:12
Show Gist options
  • Save rwillians/1fe0a123d15771bcddef803957dd9d0b to your computer and use it in GitHub Desktop.
Save rwillians/1fe0a123d15771bcddef803957dd9d0b to your computer and use it in GitHub Desktop.
Sentry using docker-compose
version: '3'
services:
redis:
image: 'redis:alpine'
ports:
- '6379:6379'
networks:
- private
volumes:
- 'redis:/data'
memcached:
image: 'memcached:alpine'
ports:
- '11211:11211'
networks:
- private
volumes:
- 'redis:/data'
postgres:
image: postgres:alpine
ports:
- '5432:5432'
networks:
- private
volumes:
- 'postgres:/var/lib/postgresql/data'
environment:
- POSTGRES_PASSWORD=secret
- POSTGRES_USER=sentry
sentry-cron:
image: sentry
command: run cron
depends_on:
- redis
- memcached
- postgres
networks:
- private
environment:
- SENTRY_SECRET_KEY='place a secure secret here'
- SENTRY_MAILGUN_API_KEY=YOUR_MAILGUN_API_KEY_OPTIONAL
- SENTRY_SERVER_EMAIL='Sentry <user@domain>'
- SENTRY_EMAIL_HOST=YOUR_SMTP_HOST
- SENTRY_EMAIL_PORT=YOUR_SMTP_PORT
- SENTRY_EMAIL_USER=YOUR_SMTP_USER
- SENTRY_EMAIL_PASSWORD=YOUR_SMTP_PASSWORD
- SENTRY_MEMCACHED_HOST=memcached
- SENTRY_POSTGRES_HOST=postgres
- SENTRY_DB_USER=sentry
- SENTRY_DB_PASSWORD=secret
- SENTRY_REDIS_HOST=redis
volumes:
- 'sentry:/var/lib/sentry/files'
sentry-worker:
image: sentry
command: run worker
depends_on:
- redis
- memcached
- postgres
networks:
- private
environment:
- SENTRY_SECRET_KEY='place a secure secret here'
- SENTRY_MAILGUN_API_KEY=YOUR_MAILGUN_API_KEY_OPTIONAL
- SENTRY_SERVER_EMAIL='Sentry <user@domain>'
- SENTRY_EMAIL_HOST=YOUR_SMTP_HOST
- SENTRY_EMAIL_PORT=YOUR_SMTP_PORT
- SENTRY_EMAIL_USER=YOUR_SMTP_USER
- SENTRY_EMAIL_PASSWORD=YOUR_SMTP_PASSWORD
- SENTRY_MEMCACHED_HOST=memcached
- SENTRY_POSTGRES_HOST=postgres
- SENTRY_DB_USER=sentry
- SENTRY_DB_PASSWORD=secret
- SENTRY_REDIS_HOST=redis
volumes:
- 'sentry:/var/lib/sentry/files'
sentry:
image: sentry
depends_on:
- redis
- memcached
- postgres
ports:
- '8080:9000'
networks:
- private
- public
environment:
- SENTRY_SECRET_KEY='place a secure secret here'
- SENTRY_MAILGUN_API_KEY=YOUR_MAILGUN_API_KEY_OPTIONAL
- SENTRY_SERVER_EMAIL='Sentry <user@domain>'
- SENTRY_EMAIL_HOST=YOUR_SMTP_HOST
- SENTRY_EMAIL_PORT=YOUR_SMTP_PORT
- SENTRY_EMAIL_USER=YOUR_SMTP_USER
- SENTRY_EMAIL_PASSWORD=YOUR_SMTP_PASSWORD
- SENTRY_MEMCACHED_HOST=memcached
- SENTRY_POSTGRES_HOST=postgres
- SENTRY_DB_USER=sentry
- SENTRY_DB_PASSWORD=secret
- SENTRY_REDIS_HOST=redis
volumes:
- 'sentry:/var/lib/sentry/files'
networks:
private:
external: false
public:
volumes:
postgres:
redis:
sentry:

Sentry using docker-compose

Sentry is an open-source exception logger which you probably know for its SaaS, though "expection logger" doesn't make justice to what it does.

They also provide a free docker setup available so you can run your own sentry platform in your infrastructure, as you can see in their official Docker Hub repository.

Their documentation is pretty good and you should have no problem getting up and running from there. But I must be honest, I'm too lazy to run all those docker run commands, that's way I've made this docker-compose setup guide.

This gist is supposed to conver only a very basic setup.

Fell free to share any improviments.

How to get it up and running?

First: Create your docker-compose.yml file using mine as template. You might want to change a few environment variables, such as SENTRY_EMAIL* ones.

Second: Run docker-compose up -d --build. This will build all services necessary as demon (they will be running in the background).

Third: Now all your services are running, but you need to run the initial configuration: run docker-compose exec sentry bash ./entrypoint.sh upgrade. This is start an interactive shell. Make sure to create your user when you are prompted to and set it as superuser.

That's it, now browse to your local sentry at http://localhost:8080.

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