fangmd / blogsource

6 stars 0 forks source link

Sentry #55

Open fangmd opened 2 years ago

fangmd commented 2 years ago

docker 部署: https://github.com/getsentry/self-hosted

文档:https://develop.sentry.dev/self-hosted/

fangmd commented 2 years ago

安装

docker-compose down && docker-compose build && docker-compose up -d

https

config.yml

system.url-prefix: 'https://sentry.mountainseas.cn'
`sentry.conf.py`

###########
# SSL/TLS #
###########

# If you're using a reverse SSL proxy, you should enable the X-Forwarded-Proto
# header and enable the settings below

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SOCIAL_AUTH_REDIRECT_IS_HTTPS = True

nginx 配置

sentry部署完成后,需要自己启动一个 nginx 去做代理, 实现域名的设置和 https

server {
    # 配置监听端口
    listen       443 ssl http2 default_server;
    listen       [::]:443 ssl http2 default_server;

    # 域名
    server_name  sentry.xxxx.cn;

    # nginx 默认根目录
    root         /usr/share/nginx/html;

    # 加载其他配置文件,这里是 nginx 默认配置,可以不需要
    # include /etc/nginx/default.d/*.conf;

    # 这一段是公有的ssl,需要将证书改成自己申请的证书
    ssl_certificate ssl/xxxx.cn.pem;
    ssl_certificate_key ssl/xxxx.cn.key;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;

    client_max_body_size 200M;
    client_body_buffer_size 1024k;

    # 这一段是最重要的,将域名代理到本机 http://localhost:9000 服务上,对应的就是 docker 内的 sentry 服务
    location / {
        proxy_set_header  X-Real-IP  $remote_addr;
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header  Host $host;
        proxy_connect_timeout 180;
        proxy_read_timeout 180;
        proxy_send_timeout 180;
        proxy_pass http://localhost:9000;
    }

    gzip  on;
    gzip_http_version 1.1;
    gzip_vary on;
    gzip_comp_level 9;
    gzip_proxied any;
    gzip_types text/plain  text/css application/json  application/x-javascript text/xml application/xml application/xml+rss text/javascript application/x-shockwave-flash image/png image/x-icon image/gif image/jpeg;
    gzip_buffers 16 8k;

    error_page 404 /404.html;
        location = /404.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }
}

邮箱配置

腾讯企业邮箱

# mail.backend: 'smtp'  # Use dummy if you want to disable email entirely
mail.host: 'smtp.exmail.qq.com'
mail.port: 587
mail.username: 'xxx@openseas.com.cn'
mail.password: 'xxx'
mail.use-tls: true
# mail.use-ssl: false
mail.from: 'xxx@openseas.com.cn'

image

fangmd commented 2 years ago

cli

sentry-cli --url https://sentry.mountainseas.cn login