本地搭建Sentry-docker-compose

 

环境安装html

 

1. 环境要求:python

centos 7
Docker 17.05.0+
Compose 1.19.0+
RAM 2400MB git

 

docker-compose 安装
curl -L https://get.daocloud.io/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
or
yum install python-pip
pip install docker-compose
or
$ curl -L --fail https://github.com/docker/compose/releases/download/1.24.1/run.sh > /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-composegithub

 

1. git拉取当前假定为 /data/sentry,并进入此目录。
git clone https://github.com/getsentry/onpremise.git
而后进入目录仓库目录,默认为 onpremise。
2. 安装前配置
cd onpremise/sentry
cp config.example.yml config.yml
修改 smtp 配置
# mail.backend: 'smtp' # Use dummy if you want to disable email entirely
mail.host: 'smtp.163.com'
mail.port: 25
mail.username: 'xxxx@163.com'
mail.password: 'xxxx'
mail.use-tls: false
#The email address to send on behalf of
mail.from: 'xxxx@163.com'web

 

3. 直接运行 ./install.sh redis

中间过程建立 管理员帐号密码docker

 

最后一步,使用 docker-compose 启动全部容器并提供服务:centos

 

docker-compose up -d
这时候使用 docker-compose ps 命令能够看到相似以下的容器列表:浏览器

 

Name Command State Ports
---------------------------------------------------------------------------------------
onpremise_base_1 /entrypoint.sh run web Up 9000/tcp
onpremise_cron_1 /entrypoint.sh run cron Up 9000/tcp
onpremise_memcached_1 docker-entrypoint.sh memcached Up 11211/tcp
onpremise_postgres_1 docker-entrypoint.sh postgres Up 5432/tcp
onpremise_redis_1 docker-entrypoint.sh redis ... Up 6379/tcp
onpremise_smtp_1 entrypoint.sh tini -- exim ... Up 25/tcp
onpremise_web_1 /entrypoint.sh run web Up 0.0.0.0:9000->9000/tcp
onpremise_worker_1 /entrypoint.sh run worker Up 9000/tcp
并使用浏览器访问 {ip}:9000,使用开始本身填写的管理员帐号就能够登陆后台。curl

 

4. 其余
若是须要改变主机服务端口,只须要修改 docker-compose.yml 文件的 web 容器配置,如改成本机的 8888 端口提供服务:

web:
extends: base
links:
- redis
- postgres
- memcached
- smtp
ports:
- '8888:9000'
能够按照需求将整个服务在 systemd 管理,docker-compose 的其余相关命令以下:

 

docker-compose up # 建立并启动容器,容器没有建立没法启动,同时最好用 -d 参数在后台启动
docker-compose stop # 中止服务
docker-compose start # 启动服务,须要用 up 建立容器并中止以后

 

修改了配置文件应用到docker镜像中:

 

修改config.yal
或者
修改sentry.conf.py,好比添加smtp配置:

 

复制代码
SENTRY_OPTIONS['mail.backend'] = 'smtp'
SENTRY_OPTIONS['mail.host'] = 'smtp.***.com'
SENTRY_OPTIONS['mail.password'] = '*******'
SENTRY_OPTIONS['mail.username'] = 'sentry@**.com'
SENTRY_OPTIONS['mail.port'] = 25
SENTRY_OPTIONS['mail.use-tls'] = False
复制代码
而后

 

docker-compose down(关闭删除容器)
docker-compose build (从新编译镜像)
docker-compose up -d (运行)

 

这样就ok了

 

补充:centos防火墙使用firewalld,直接关闭firewalld docker会启动报错,因此这里配置firewalld规则:
复制代码
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" port protocol="tcp" port="9000" accept"
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="须要访问的ip" accept"
firewall-cmd --permanent --zone=trusted --change-interface=docker0
firewall-cmd --permanent --zone=trusted --add-port=9000/tcp
firewall-cmd --add-port=9000/tcp --permanent

 


Updating Sentry
Updating Sentry using Compose is relatively simple. Just use the following steps to update. Make sure that you have the latest version set in your Dockerfile. Or use the latest version of this repository.

 

Use the following steps after updating this repository or your Dockerfile:

 

docker-compose build --pull # Build the services again after updating, and make sure we're up to date on patch versiondocker-compose run --rm web upgrade # Run new migrationsdocker-compose up -d # Recreate the services

相关文章
相关标签/搜索