我找到了official sentry image在 dockerhub 中。但是文档不完整,无法一步步搭建环境。
我们必须先设置数据库容器,但他们都没有告诉一开始如何设置它。具体我不知道 Sentry 会使用什么用户名和密码。
当我运行 Sentry 容器时,我也收到以下错误:
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'
最佳答案
更新大约 21 版
根据 Docker Hub 上的弃用通知,他们似乎不想再为我们构建官方镜像。然而,好消息,在 https://develop.sentry.dev/self-hosted/#getting-started
- 他们提供安装脚本
- 有官方docker-compose包括
似乎现在也需要 Kafka 和 Zookeeper。关注文档以保持最新状态。
这是一个移动的目标。我建议检查 https://hub.docker.com/_/sentry/更新,因为他们的文档非常好。
大约 8 版,您可以轻松地将这些指令转换为使用 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
运行 docker run --rm sentry:8.10.0 config generate-secret-key
并添加 key
.env 更新
SENTRY_TAG=8.10.0
SECRET=somelongsecretgeneratedbythetool
首次开机:
docker-compose up -d postgres
docker-compose up -d redis
docker-compose run sentry sentry upgrade
完全启动
docker-compose up -d
调试
docker-compose ps
docker-compose logs --tail=10
关于docker - 如何使用 docker 设置 Sentry ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27764032/