環境安裝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