创建目录及文件
$ mkdir sentry && cd sentry
$ touch docker-compose.yml
编辑 docker-compose.yml
version: '3.1'
services:
redis:
image: redis:alpine
restart: always
#command: /bin/sh -c "redis-server --requirepass $$REDIS_HOST_PASSWORD"
postgres:
image: postgres:latest
restart: always
environment:
"POSTGRES_USER": sentry
"POSTGRES_PASSWORD": ABCabc123
"POSTGRES_DB": sentry
ports:
- "5432:5432"
sentry:
image: sentry
links:
- redis
- postgres
ports:
- 9200:9000
environment:
SENTRY_SECRET_KEY: xxxxxxxxxxxxxxxx
SENTRY_POSTGRES_HOST: postgres
SENTRY_DB_USER: sentry
SENTRY_DB_PASSWORD: ABCabc123
SENTRY_REDIS_HOST: redis
cron:
image: sentry
links:
- redis
- postgres
command: "sentry run cron"
environment:
SENTRY_SECRET_KEY: xxxxxxxxxxxxxxxx
SENTRY_POSTGRES_HOST: postgres
SENTRY_DB_USER: sentry
SENTRY_DB_PASSWORD: ABCabc123
SENTRY_REDIS_HOST: redis
worker:
image: sentry
links:
- redis
- postgres
command: "sentry run worker"
environment:
SENTRY_SECRET_KEY: xxxxxxxxxxxxxxxx
SENTRY_POSTGRES_HOST: postgres
SENTRY_DB_USER: sentry
SENTRY_DB_PASSWORD: ABCabc123
SENTRY_REDIS_HOST: redis
查看 SECRET 并替换
$ docker run --rm sentry config generate-secret-key
4d%5!ciz*w1b5jo&+*cqgcr6(7^)-lic1hr%0&43k156@vfw5x
将 docker-compose.yml 文件中的 xxxxxxxxxxxxxxxx
替换成 4d%5!ciz*w1b5jo&+*cqgcr6(7^)-lic1hr%0&43k156@vfw5x
部署并初始化用户密码
$ docker-compose up -d # 部署sentry以及相关依赖的服务
$ docker-compose exec sentry sentry upgrade # 创建用户和密码.
查看数据库中的环境变量
$ docker inspect sentry_postgres_1 | grep POSTGRES_USER
初始化账户密码
image.png
网友评论