創(chuàng)建目錄及文件
$ 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
部署并初始化用戶(hù)密碼
$ docker-compose up -d # 部署sentry以及相關(guān)依賴(lài)的服務(wù)
$ docker-compose exec sentry sentry upgrade # 創(chuàng)建用戶(hù)和密碼.
查看數(shù)據(jù)庫(kù)中的環(huán)境變量
$ docker inspect sentry_postgres_1 | grep POSTGRES_USER
初始化賬戶(hù)密碼