sentry搭建错误日志服务器

错误日志对上线系统非常重要

传统处理logging:
我们一般通过写入logging查看错误,
从而需要登录到服务器查看文件
还需要主动查询
通过发送邮件发送错误。
无法集中管理bug

sentry集成包含了以上这些功能
项目管理 多项目

sentry依赖较多,通过python环境安装容易出错,所以选择采用docker安装

sudo yum remove docker \
\> docker-common \
\> docker-selinux \
\> docker-engine

卸载旧版本docker
安装docker依赖包
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
添加稳定的源
以下文件由python2编写,记得在文件开头注释采用python2.7

sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

安装docker两种方式

1.通过yum包安装
更新yum包
sudo yum makecache fast
安装docker ce
sudo yum install docker-ce
启动docker
sudo systemctl start docker
测试docker
sudo docker run hello-world
安装docker-compose

sudo yum install epel-release
sudo yum install -y python-pip
sudo pip install docker-compose
  1. 下载然后包安装

通过docker安装sentry

sentry依赖组件比较多,包括redis,postgresql等。

1.安装git
sudo yum install git
2.下载docker镜像

3.安装并且运行sentry
https://github.com/getsentry/onpremise

# 创建数据文件文件夹
mkdir -p data/{sentry,postgres}
# 生成secret_key
docker-compose build
docker-compose run --rm web config generate-secret-key
将生成的secret_key加入docker-compose.yml文件

There may need to be modifications to the included `docker-compose.yml` file to accommodate your needs or your environment. These instructions are a guideline for what you should generally do.

1.  `mkdir -p data/{sentry,postgres}` - Make our local database and sentry config directories. This directory is bind-mounted with postgres so you don't lose state!
2.  `docker-compose build` - Build and tag the Docker services
3.  `docker-compose run --rm web config generate-secret-key` - Generate a secret key. Add it to `docker-compose.yml`in `base` as `SENTRY_SECRET_KEY`.
4.  `docker-compose run --rm web upgrade` - Build the database. Use the interactive prompts to create a user account.
5.  `docker-compose up -d` - Lift all services (detached/background mode).
6.  Access your instance at `localhost:9000`!

Note that as long as you have your database bind-mounted, you should be fine stopping and removing the containers without worry.

外部查看并修改docker中的文件。很重要。
https://blog.csdn.net/u011241780/article/details/79459074
docker错误日志
docker logs -f -t --tail 100 onpremise_web_1

docker stop containerId // containerId 是容器的ID

docker ps -a -q // 查看所有容器ID

(docker ps -a -q) // stop停止所有容器
(docker ps -a -q) // remove删除所有容器

失败,原因位置。暂时弃坑

你可能感兴趣的:(sentry搭建错误日志服务器)