Hello all.
I am using docker to work win sentry and I am getting 400 truing to send any traceback.
I have already spend 2 days digging in google and inside of docker container.
my docker-compose.yml:
version: '3'
services:
# ############################
# -- apps infrastructure -- #
# ############################
auth_app:
restart: always
build: ./
volumes:
- ./:/usr/src/app:ro
environment:
- APP_NAME=auth_app
- PG_DB=auth_db
- PG_HOST=auth_pg
- PG_USER=*****
- DEBUG=1
command: gunicorn --config /usr/src/app/gunicorn_config.py application.app:app
depends_on:
- auth_pg
auth_pg:
restart: always
image: postgres:latest
volumes:
- /data/postgres/auth_postgres:/var/lib/postgresql/data:rw
################################
# -- sentry infrastructure -- #
################################
sentry_redis:
image: redis:3.2-alpine
sentry_pg:
image: postgres:9.5
environment:
- POSTGRES_USER:sentry
- POSTGRES_PASSWORD:sentry
volumes:
- /data/postgres/sentry_pg:/var/lib/postgresql/data:rw
sentry_web_node:
build: ./sentry_node
volumes:
- ./:/usr/src/app:rw
environment:
- SENTRY_CONF=/usr/src/app/sentry_node/
- PG_DB=sentry_db
- PG_HOST=sentry_pg
- PG_USER=sentry
command: sentry run web
depends_on:
- sentry_pg
- sentry_redis
sentry_worker_node:
build: ./sentry_node
volumes:
- ./:/usr/src/app:rw
environment:
- SENTRY_CONF=/usr/src/app/sentry_node/
- PG_DB=sentry_db
- PG_HOST=sentry_pg
- PG_USER=sentry
- C_FORCE_ROOT=true
command: sentry run worker
depends_on:
- sentry_pg
- sentry_redis
sentry_cron_node:
build: ./sentry_node
volumes:
- ./:/usr/src/app:rw
environment:
- SENTRY_CONF=/usr/src/app/sentry_node/
- PG_DB=sentry_db
- PG_HOST=sentry_pg
- PG_USER=sentry
command: sentry run cron
depends_on:
- sentry_pg
- sentry_redis
##################################
# -- balancer infrastructure -- #
##################################
nginx_node:
build: ./nginx_node
ports:
- 80:80
- 433:433
volumes:
- /data/nginx_node/:/var/log/nginx/:rw
command: ["nginx", "-g", "daemon off;"]
depends_on:
- auth_app
- sentry_web_node
links:Hello all.
I am using docker to work win sentry and I am getting 400 truing to send any traceback.
I have already spend 2 days digging in google and inside of docker container.
my docker-compose.yml:
version: '3'
services:
# ############################
# -- apps infrastructure -- #
# ############################
auth_app:
restart: always
build: ./
volumes:
- ./:/usr/src/app:ro
environment:
- APP_NAME=auth_app
- PG_DB=auth_db
- PG_HOST=auth_pg
- PG_USER=*****
- DEBUG=1
command: gunicorn --config /usr/src/app/gunicorn_config.py application.app:app
depends_on:
- auth_pg
auth_pg:
restart: always
image: postgres:latest
volumes:
- /data/postgres/auth_postgres:/var/lib/postgresql/data:rw
################################
# -- sentry infrastructure -- #
################################
sentry_redis:
image: redis:3.2-alpine
sentry_pg:
image: postgres:9.5
environment:
- POSTGRES_USER:sentry
- POSTGRES_PASSWORD:sentry
volumes:
- /data/postgres/sentry_pg:/var/lib/postgresql/data:rw
sentry_web_node:
build: ./sentry_node
volumes:
- ./:/usr/src/app:rw
environment:
- SENTRY_CONF=/usr/src/app/sentry_node/
- PG_DB=sentry_db
- PG_HOST=sentry_pg
- PG_USER=sentry
command: sentry run web
depends_on:
- sentry_pg
- sentry_redis
sentry_worker_node:
build: ./sentry_node
volumes:
- ./:/usr/src/app:rw
environment:
- SENTRY_CONF=/usr/src/app/sentry_node/
- PG_DB=sentry_db
- PG_HOST=sentry_pg
- PG_USER=sentry
- C_FORCE_ROOT=true
command: sentry run worker
depends_on:
- sentry_pg
- sentry_redis
sentry_cron_node:
build: ./sentry_node
volumes:
- ./:/usr/src/app:rw
environment:
- SENTRY_CONF=/usr/src/app/sentry_node/
- PG_DB=sentry_db
- PG_HOST=sentry_pg
- PG_USER=sentry
command: sentry run cron
depends_on:
- sentry_pg
- sentry_redis
##################################
# -- balancer infrastructure -- #
##################################
nginx_node:
build: ./nginx_node
ports:
- 80:80
- 433:433
volumes:
- /data/nginx_node/:/var/log/nginx/:rw
command: ["nginx", "-g", "daemon off;"]
depends_on:
- auth_app
- sentry_web_node
links:
- auth_app
- sentry_web_node
Dockerfile:
FROM ubuntu:16.04
MAINTAINER ***
ADD . /usr/src/app/
# set up usefull staff
RUN apt-get update
RUN apt-get install -y curl coreutils wget net-tools htop iotop mc vim less iputils-ping
# set up necessary staff
RUN apt-get install -y python-setuptools python-dev libxslt1-dev gcc libffi-dev libjpeg-dev libxml2-dev libxslt-dev libyaml-dev libpq-dev python-pip
RUN pip install -r /usr/src/app/requirements.txt (with only sentry)
So
- auth_app
- sentry_web_node
Dockerfile:
FROM ubuntu:16.04
MAINTAINER ***
ADD . /usr/src/app/
# set up usefull staff
RUN apt-get update
RUN apt-get install -y curl coreutils wget net-tools htop iotop mc vim less iputils-ping
# set up necessary staff
RUN apt-get install -y python-setuptools python-dev libxslt1-dev gcc libffi-dev libjpeg-dev libxml2-dev libxslt-dev libyaml-dev libpq-dev python-pip
RUN pip install -r /usr/src/app/requirements.txt (with only sentry)
I have also added domain “sentry” to nginx config which have a set up for dummy domain “cree.ga”.
So, sentry responds, it allows to log in and receive a DSN url
DSN URL is "**http://******d23380436aa2a01d69304c1d7d:****b6435c4a4b9402e23912542523@sentry.cree.ga/3"
I am creating a script:
from raven.base import Client
dsn = current_app.config.get('SENTRY_DSN_URL')
dsn = "http://******d23380436aa2a01d69304c1d7d:******b6435c4a4b9402e23912542523@sentry.cree.ga/3"
client = Client(dsn)
try:
undefined_variable
except Exception as e:
exc = client.captureException()
ident = client.get_ident(exc)
I get exceptions in docker:
sentry_web_node_1 | 172.18.0.7 - - [19/Jun/2017:14:49:22 +0000] "POST /api/3/store/ HTTP/1.1" 400 233 "-" "raven-python/6.1.0"
auth_app_1 | Sentry responded with an error: HTTP Error 400: BAD REQUEST (url: http://sentry_web_node:5000/api/3/store/)
auth_app_1 | Traceback (most recent call last):
auth_app_1 | File "/usr/local/lib/python3.5/site-packages/raven/transport/threaded.py", line 172, in send_sync
auth_app_1 | super(ThreadedHTTPTransport, self).send(url, data, headers)
auth_app_1 | File "/usr/local/lib/python3.5/site-packages/raven/transport/http.py", line 43, in send
auth_app_1 | ca_certs=self.ca_certs,
auth_app_1 | File "/usr/local/lib/python3.5/site-packages/raven/utils/http.py", line 66, in urlopen
auth_app_1 | return opener.open(url, data, timeout)
auth_app_1 | File "/usr/local/lib/python3.5/urllib/request.py", line 472, in open
auth_app_1 | response = meth(req, response)
auth_app_1 | File "/usr/local/lib/python3.5/urllib/request.py", line 582, in http_response
auth_app_1 | 'http', request, response, code, msg, hdrs)
auth_app_1 | File "/usr/local/lib/python3.5/urllib/request.py", line 510, in error
auth_app_1 | return self._call_chain(*args)
auth_app_1 | File "/usr/local/lib/python3.5/urllib/request.py", line 444, in _call_chain
auth_app_1 | result = func(*args)
auth_app_1 | File "/usr/local/lib/python3.5/urllib/request.py", line 590, in http_error_default
auth_app_1 | raise HTTPError(req.full_url, code, msg, hdrs, fp)
auth_app_1 | urllib.error.HTTPError: HTTP Error 400: BAD REQUEST
I wonder, what the hell is going on? Why logs are not informative? I have already added ALLOWED_HOSTS to settings.py
SENTRY_WEB_HOST = '0.0.0.0'
SENTRY_WEB_PORT = 5000
SENTRY_WEB_OPTIONS = {
'workers': 4, # the number of web workers
# 'protocol': 'uwsgi', # Enable uwsgi protocol instead of http
}
ALLOWED_HOSTS = ['sentry_web_node', 'localhost', 'auth_app']
DEBUG = True
cpu@ci7:~/octopus$ docker ps | grep web
7cd25254cce9 octopus_sentry_web_node "sentry run web" 2 hours ago Up 49 minutes 5000/tcp octopus_sentry_web_node_1
cpu@ci7:~/octopus$ docker exec -it 7cd25254cce9 bash
root@7cd25254cce9:/# python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sentry
>>> sentry.__version__
'8.17.0'