Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup sentry with docker

Tags:

docker

sentry

I have found the official sentry image in dockerhub. But the document is incomplete and I can't setup the environment step by step.

We have to setup the database container first but none of them tell how to setup it at first. Specifically I don't know what are the username and password that sentry will use.

And I also get the following error when I run the sentry container:

sudo docker run --name some-sentry --link some-mysql:mysql -d sentry
e888fcf2976a9ce90f80b28bb4c822c07f7e0235e3980e2a33ea7ddeb0ff18ce

sudo docker logs some-sentry
Traceback (most recent call last):
  File "/usr/local/bin/sentry", line 9, in <module>
    load_entry_point('sentry==6.4.4', 'console_scripts', 'sentry')()
  File "/usr/local/lib/python2.7/site-packages/sentry/utils/runner.py", line 310, in main
    initializer=initialize_app,
  File "/usr/local/lib/python2.7/site-packages/logan/runner.py", line 167, in run_app
    configure_app(config_path=config_path, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/logan/runner.py", line 89, in configure_app
    raise ValueError("Configuration file does not exist at %r" % (config_path,))
ValueError: Configuration file does not exist at '/.sentry/sentry.conf.py'
like image 764
tobe Avatar asked Jan 04 '15 09:01

tobe


1 Answers

UPDATE circa version 21

They don't seem to want to build the official image for us any more as per the deprecation notice on Docker Hub. However, good news, in https://develop.sentry.dev/self-hosted/#getting-started

  • They supply an install script
  • There is an official docker-compose included

Seems Kafka and Zookeeper are now required too. Follow the docs to stay up to date.


This is a moving target. I suggest checking https://hub.docker.com/_/sentry/ for updates as their documentation is pretty good.

Circa version 8 you can easily convert those instructions to use docker-compose

docker-compose.yml

version: "2"
services:
  redis:
    image: redis:3.0.7
    networks:
    - sentry-net

  postgres:
    image: postgres:9.6.1
    environment:
    - POSTGRES_USER:sentry
    - POSTGRES_PASSWORD:sentry
    # volumes:
    # - ./data:/var/lib/postgresql/data:rw
    networks:
    - sentry-net

  sentry:
    image: sentry:${SENTRY_TAG}
    depends_on:
    - redis
    - postgres
    environment:
    - SENTRY_REDIS_HOST=redis
    - SENTRY_SECRET_KEY=${SECRET}
    - SENTRY_POSTGRES_HOST=postgres
    ports:
    - 9000:9000
    networks:
    - sentry-net

  sentry_celery_beat:
    image: sentry:${SENTRY_TAG}
    depends_on:
    - sentry
    environment:
    - SENTRY_REDIS_HOST=redis
    - SENTRY_SECRET_KEY=${SECRET}
    - SENTRY_POSTGRES_HOST=postgres
    command: "sentry run cron"
    networks:
    - sentry-net

  sentry_celery_worker:
    image: sentry:${SENTRY_TAG}
    depends_on:
    - sentry
    environment:
    - SENTRY_REDIS_HOST=redis
    - SENTRY_SECRET_KEY=${SECRET}
    - SENTRY_POSTGRES_HOST=postgres
    command: "sentry run worker"
    networks:
    - sentry-net

networks:
  sentry-net:

.env

SENTRY_TAG=8.10.0

Run docker run --rm sentry:8.10.0 config generate-secret-key and add the secret

.env updated

SENTRY_TAG=8.10.0
SECRET=somelongsecretgeneratedbythetool

First boot:

docker-compose up -d postgres
docker-compose up -d redis
docker-compose run sentry sentry upgrade

Full boot

docker-compose up -d

Debug

docker-compose ps
docker-compose logs --tail=10
like image 103
KCD Avatar answered Oct 07 '22 04:10

KCD