How to set up a watch device with docker

I found the official image of the sentry in the docker hub. But the document is incomplete, and I can’t set up the environment step by step.

First you need to configure the database container, but none of them told you how to configure it first. In particular, I do not know how the username and password that the gatekeepers will use will be used.

And I also get the following error when starting the sentinel 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' 
+5
source share
4 answers

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

In version 8, you can easily convert these 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 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 load

 docker-compose up -d 

Debugging

 docker-compose ps docker-compose logs --tail=10 
+4
source

Take a look at the sentry.conf.py file, which is part of the official docker watch image. It gets a bunch of properties from the environment, for example. SENTRY_DB_NAME, SENTRY_DB_USER. Below is a snippet of the file.

 os.getenv('SENTRY_DB_PASSWORD') or os.getenv('MYSQL_ENV_MYSQL_PASSWORD') or os.getenv('MYSQL_ENV_MYSQL_ROOT_PASSWORD') 

Regarding the question of how to separate the database password, it should be set in environment variables. You can do this by doing:

 sudo docker run --name some-sentry --link some-mysql:mysql \ -e SENTRY_DB_USER=XXX \ -e SENTRY_DB_PASSWORD=XXX \ -d sentry 

As for your problem except, it seems to you that there is no configuration file Configuration file does not exist at '/.sentry/sentry.conf.py' ' This file is copied to the inside of the container /home/user/.sentry/sentry.conf.py . I'm not sure why your watchdog is looking for it in /.sentry/sentry.conf.py. It could be an environment variable or a parameter that controls this, or it could just be a bug in the container.

+1
source

This works for me https://github.com/slafs/sentry-docker , and we do not need to configure the database or others. I’ll tell you more about the configuration later.

+1
source

Here, my docker composes yml, with the official image from https://hub.docker.com/_/sentry/ :

https://gist.github.com/ebuildy/270f4ef3abd41e1490c1

Run:

 docker-compose -p sw up -d docker exec -ti sw_sentry_1 sentry upgrade 

Here it is!

+1
source

Source: https://habr.com/ru/post/1210344/


All Articles