One minute
Docker部署sentry服务
以前的项目使用sentry来检测bugs, 现在需要在新服务器也架设sentry, 记录一下架设
编写docker-compose.yml
version: '2'
services:
redis:
image: redis:latest
container_name: sentry-redis
restart: always
postgres:
image: postgres:latest
container_name: sentry-postgres
restart: always
environment:
- POSTGRES_USER=sentry
- POSTGRES_PASSWORD=sentry
- POSTGRES_DBNAME=sentry
- POSTGRES_DBUSER=sentry
- POSTGRES_DBPASS=sentry
volumes:
- ./postgresdb:/var/lib/postgresql/data
sentry:
image: sentry:latest
container_name: sentry
links:
- redis
- postgres
ports:
- 9009:9000
environment:
SENTRY_SECRET_KEY: 's(hb+zd5zgz@f)i!z&^o225g)i&)%_99-hfshpgch2tyj5u=q0'
SENTRY_POSTGRES_HOST: postgres
SENTRY_DB_USER: sentry
SENTRY_DB_PASSWORD: sentry
SENTRY_REDIS_HOST: redis
cron:
image: sentry:latest
container_name: sentry-cron
links:
- redis
- postgres
command: "sentry run cron"
environment:
SENTRY_SECRET_KEY: 's(hb+zd5zgz@f)i!z&^o225g)i&)%_99-hfshpgch2tyj5u=q0'
SENTRY_POSTGRES_HOST: postgres
SENTRY_DB_USER: sentry
SENTRY_DB_PASSWORD: sentry
SENTRY_REDIS_HOST: redis
worker:
image: sentry:latest
container_name: sentry-worker
links:
- redis
- postgres
command: "sentry run worker"
environment:
SENTRY_SECRET_KEY: 's(hb+zd5zgz@f)i!z&^o225g)i&)%_99-hfshpgch2tyj5u=q0'
SENTRY_POSTGRES_HOST: postgres
SENTRY_DB_USER: sentry
SENTRY_DB_PASSWORD: sentry
SENTRY_REDIS_HOST: redis
SENTRY_SECRET_KEY 需要随机修改.
启动
docker-compose up -d
查看 sentry容器 id
docker ps
运行更新
sudo docker exec -it 4ca743bc3243 sentry upgrade
// 4ca743bc3243 为容器id
// 过程中需要输入新用户的邮箱和密码
此时sentry就可以正常的启动了
访问 http://localhost:9009/
开始使用.
Yii2 搭配使用 https://github.com/notamedia/yii2-sentry
composer require notamedia/yii2-sentry