glitchtip
sentry
的青春版平替,兼容 sentry-sdk
。
功能特点:
- 搭建容易 ✅
- 异常追踪 ✅
- Uptime接口性能与监控 ✅
- 邮件通知 ✅
- WebHook ✅
Docker部署
官方最小化示例
# Uncomment version if using an older version of docker compose
# version: "3.8"
x-environment:
&default-environment
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
SECRET_KEY: change_me_to_something_random # 随意, 推荐用命令 openssl rand -hex 32 生成
PORT: 8000
EMAIL_URL: consolemail:// # Example smtp://email:password@smtp_url:port https://glitchtip.com/documentation/install#configuration 可以忽略,不验证邮箱
GLITCHTIP_DOMAIN: https://app.glitchtip.com # Change this to your domain
DEFAULT_FROM_EMAIL: email@glitchtip.com # Change this to your email
CELERY_WORKER_AUTOSCALE: "1,3" # Scale between 1 and 3 to prevent excessive memory usage. Change it or remove to set it to the number of cpu cores.
CELERY_WORKER_MAX_TASKS_PER_CHILD: "10000"
ENABLE_USER_REGISTRATION: false # 是否允许用户注册,建议自己注册完关闭
x-depends_on:
&default-depends_on
- postgres
- redis
services:
postgres:
image: postgres:16
environment:
POSTGRES_HOST_AUTH_METHOD: "trust" # Consider removing this and setting a password
restart: unless-stopped
volumes:
- pg-data:/var/lib/postgresql/data
redis:
image: redis
restart: unless-stopped
web:
image: glitchtip/glitchtip
depends_on: *default-depends_on
ports:
- "8000:8000"
environment: *default-environment
restart: unless-stopped
volumes:
- uploads:/code/uploads
worker:
image: glitchtip/glitchtip
command: ./bin/run-celery-with-beat.sh
depends_on: *default-depends_on
environment: *default-environment
restart: unless-stopped
volumes:
- uploads:/code/uploads
migrate:
image: glitchtip/glitchtip
depends_on: *default-depends_on
command: "./manage.py migrate"
environment: *default-environment
volumes:
pg-data:
uploads:
📋 注意事项
- 访问端口 8000;
- 自己注册完,关闭注册功能
ENABLE_USER_REGISTRATION
再次运行;
- 自己注册完,关闭注册功能
- 参考:Sentry的平替!GlitchTip部署过程及使用感受
使用
以 javascript
项目为例
- 安装依赖 (直接使用 sentry-sdk)
npm install @sentry/browser
- 使用
Sentry.init({
dsn: "http://b45cca5cf9e34b5bba1070e3fcd951fb@127.0.0.1:8000/1",
tracesSampleRate: 0.01,
});