搭建容器化 Sentry 报错追踪平台

分类:Linux 评论: 0

Sentry 是一个错误追踪平台,基于 PythonDjango 开发。可基于大部分语言进行收集报错,可对接语言如:C# 、PHP 、Java 、JavaScript 、Python 、Go 、Ruby 、Objective-C 等进行追踪和收集。

部署

本文基于其官方文档进行部署,官方提供两种部署方式:DockerPython

本文使用容器方案进行部署,理由如官方文档所述:

Note: This method of installation is deprecated in favor of Docker.

依赖

因篇幅所限,关于 Docker 部署方式省略。

检查依赖版本

# docker-compose version
docker-compose version 1.24.1, build 4667896b
docker-py version: 3.7.3
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.1.0j  20 Nov 2018
# docker version
Client: Docker Engine - Community
 Version:           19.03.2
 API version:       1.40
 Go version:        go1.12.8
 Git commit:        6a30dfc
 Built:             Thu Aug 29 05:29:29 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.2
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.8
  Git commit:       6a30dfc
  Built:            Thu Aug 29 05:28:05 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

构建容器

先克隆仓库getsentry/onpremise,这是构建 Sentry 容器的基础。

# git clone https://github.com/getsentry/onpremise.git

在此仓库中,有已经预配置完毕的配置文件 sentry.conf.pyconfig.yml,用户可根据需求对其进行定制,其配置文件内容可参考其官方文档

仓库中的 requirements.txt 是预配置的插件列表,若对插件有定制化需求,可参考其官方文档进行修改。

配置文件及插件配置准备完毕后实际上可以通过一个更加简单的方式进行部署,无需按照其官方文档进行操作。

直接执行仓库中的脚本进行一键部署

# ./install.sh

小贴士:此脚本会自动检查环境,然后基于上述步骤定制的配置文件进行构建镜像,导入数据库等初始化操作。部署需要至少 3072 Mb 内存,若有需求可修改脚本 #8 ,但是不建议修改其数值。

脚本完整执行过程如下(可忽略):

# ./install.sh 
Checking minimum requirements...

Creating volumes for persistent storage...
Created sentry-data.
Created sentry-postgres.

.env already exists, skipped creation.

$SENTRY_IMAGE not set, using latest stable: sentry:9.1.2

Building and tagging Docker images...

smtp uses an image, skipping
memcached uses an image, skipping
redis uses an image, skipping
postgres uses an image, skipping
Building web
Step 1/2 : ARG SENTRY_IMAGE
Step 2/2 : FROM ${SENTRY_IMAGE}-onbuild
9.1.2-onbuild: Pulling from library/sentry
9fc222b64b0a: Pull complete
c92a3a299636: Pull complete
1dc8ac6cace6: Pull complete
b2a31ad97568: Pull complete
26906acb3440: Pull complete
864afed5581b: Pull complete
64fcae6d7ce2: Pull complete
01d06b7b2055: Pull complete
76b6c541f435: Pull complete
7e40ba71f745: Pull complete
7141e823de56: Pull complete
19d5bf57b3d6: Pull complete
68f686156827: Pull complete
8fb05b1a0090: Pull complete
ab297d27a10f: Pull complete
Digest: sha256:4cffb6bd913657dd42d2b89deb9618b019651f9abdf29c55cab60fa8ee588d74
Status: Downloaded newer image for sentry:9.1.2-onbuild
# Executing 4 build triggers
 ---> Running in 6494e186ff98
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Removing intermediate container 6494e186ff98
 ---> Running in da32fc0e51cd
Removing intermediate container da32fc0e51cd
 ---> Running in 7a5c8691b2a7
Removing intermediate container 7a5c8691b2a7
 ---> e79faf5d7eb3

Successfully built e79faf5d7eb3
Successfully tagged onpremise_web:latest
Building cron
Step 1/2 : ARG SENTRY_IMAGE
Step 2/2 : FROM ${SENTRY_IMAGE}-onbuild
# Executing 4 build triggers
 ---> Using cache
 ---> Using cache
 ---> Using cache
 ---> Using cache
 ---> e79faf5d7eb3

Successfully built e79faf5d7eb3
Successfully tagged onpremise_cron:latest
Building worker
Step 1/2 : ARG SENTRY_IMAGE
Step 2/2 : FROM ${SENTRY_IMAGE}-onbuild
# Executing 4 build triggers
 ---> Using cache
 ---> Using cache
 ---> Using cache
 ---> Using cache
 ---> e79faf5d7eb3

Successfully built e79faf5d7eb3
Successfully tagged onpremise_worker:latest

Docker images built.

Generating secret key...
Secret key written to .env

Setting up database...
Starting onpremise_postgres_1  ... done
Starting onpremise_memcached_1 ... done
Starting onpremise_smtp_1      ... done
02:54:28 [WARNING] sentry.utils.geo: settings.GEOIP_PATH_MMDB not configured.
02:54:32 [INFO] sentry.plugins.github: apps-not-configured
Syncing...
Creating tables ...
Creating table django_admin_log
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table south_migrationhistory
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
Migrating...
Running migrations for sentry:
 - Migrating forwards to 0472_auto__add_field_sentryapp_author.
 > sentry:0001_initial
 > sentry:0002_auto__del_field_groupedmessage_url__chg_field_groupedmessage_view__chg
 > sentry:0003_auto__add_field_message_group__del_field_groupedmessage_server_name
 > sentry:0004_auto__add_filtervalue__add_unique_filtervalue_key_value
 > sentry:0005_auto
 > sentry:0006_auto
 > sentry:0007_auto__add_field_message_site
 > sentry:0008_auto__chg_field_message_view__add_field_groupedmessage_data__chg_field
 > sentry:0009_auto__add_field_message_message_id
 > sentry:0010_auto__add_messageindex__add_unique_messageindex_column_value_object_id
 > sentry:0011_auto__add_field_groupedmessage_score
 > sentry:0012_auto
 > sentry:0013_auto__add_messagecountbyminute__add_unique_messagecountbyminute_group_
 > sentry:0014_auto
 > sentry:0014_auto__add_project__add_projectmember__add_unique_projectmember_project
 > sentry:0015_auto__add_field_message_project__add_field_messagecountbyminute_projec
 > sentry:0016_auto__add_field_projectmember_is_superuser
 > sentry:0017_auto__add_field_projectmember_api_key
 > sentry:0018_auto__chg_field_project_owner
 > sentry:0019_auto__del_field_projectmember_api_key__add_field_projectmember_public_
 > sentry:0020_auto__add_projectdomain__add_unique_projectdomain_project_domain
 > sentry:0021_auto__del_message__del_groupedmessage__del_unique_groupedmessage_proje
 > sentry:0022_auto__del_field_group_class_name__del_field_group_traceback__del_field
 > sentry:0023_auto__add_field_event_time_spent
 > sentry:0024_auto__add_field_group_time_spent_total__add_field_group_time_spent_cou
 > sentry:0025_auto__add_field_messagecountbyminute_time_spent_total__add_field_messa
 > sentry:0026_auto__add_field_project_status
 > sentry:0027_auto__chg_field_event_server_name
 > sentry:0028_auto__add_projectoptions__add_unique_projectoptions_project_key_value
 > sentry:0029_auto__del_field_projectmember_is_superuser__del_field_projectmember_pe
 > sentry:0030_auto__add_view__chg_field_event_group
 > sentry:0031_auto__add_field_view_verbose_name__add_field_view_verbose_name_plural_
 > sentry:0032_auto__add_eventmeta
 > sentry:0033_auto__add_option__add_unique_option_key_value
 > sentry:0034_auto__add_groupbookmark__add_unique_groupbookmark_project_user_group
 > sentry:0034_auto__add_unique_option_key__del_unique_option_value_key__del_unique_g
 > sentry:0036_auto__chg_field_option_value__chg_field_projectoption_value
 > sentry:0037_auto__add_unique_option_key__del_unique_option_value_key__del_unique_g
 > sentry:0038_auto__add_searchtoken__add_unique_searchtoken_document_field_token__ad
 > sentry:0039_auto__add_field_searchdocument_status
 > sentry:0040_auto__del_unique_event_event_id__add_unique_event_project_event_id
 > sentry:0041_auto__add_field_messagefiltervalue_last_seen__add_field_messagefilterv
 > sentry:0042_auto__add_projectcountbyminute__add_unique_projectcountbyminute_projec
 > sentry:0043_auto__chg_field_option_value__chg_field_projectoption_value
 > sentry:0044_auto__add_field_projectmember_is_active
 > sentry:0045_auto__add_pendingprojectmember__add_unique_pendingprojectmember_projec
 > sentry:0046_auto__add_teammember__add_unique_teammember_team_user__add_team__add_p
 > sentry:0047_migrate_project_slugs
 > sentry:0048_migrate_project_keys
 > sentry:0049_create_default_project_keys
 > sentry:0050_remove_project_keys_from_members
 > sentry:0051_auto__del_pendingprojectmember__del_unique_pendingprojectmember_projec
 > sentry:0052_migrate_project_members
 > sentry:0053_auto__del_projectmember__del_unique_projectmember_project_user
 > sentry:0054_fix_project_keys
 > sentry:0055_auto__del_projectdomain__del_unique_projectdomain_project_domain
 > sentry:0056_auto__add_field_group_resolved_at
 > sentry:0057_auto__add_field_group_active_at
 > sentry:0058_auto__add_useroption__add_unique_useroption_user_project_key
 > sentry:0059_auto__add_filterkey__add_unique_filterkey_project_key
 > sentry:0060_fill_filter_key
 > sentry:0061_auto__add_field_group_group_id__add_field_group_is_public
 > sentry:0062_correct_del_index_sentry_groupedmessage_logger__view__checksum
 > sentry:0063_auto
 > sentry:0064_index_checksum
 > sentry:0065_create_default_project_key
 > sentry:0066_auto__del_view
 > sentry:0067_auto__add_field_group_platform__add_field_event_platform
 > sentry:0068_auto__add_field_projectkey_user_added__add_field_projectkey_date_added
 > sentry:0069_auto__add_lostpasswordhash
 > sentry:0070_projectoption_key_length
 > sentry:0071_auto__add_field_group_users_seen
 > sentry:0072_auto__add_affecteduserbygroup__add_unique_affecteduserbygroup_project_
 > sentry:0073_auto__add_field_project_platform
 > sentry:0074_correct_filtervalue_index
 > sentry:0075_add_groupbookmark_index
 > sentry:0076_add_groupmeta_index
 > sentry:0077_auto__add_trackeduser__add_unique_trackeduser_project_ident
 > sentry:0078_auto__add_field_affecteduserbygroup_tuser
 > sentry:0079_auto__del_unique_affecteduserbygroup_project_ident_group__add_unique_a
 > sentry:0080_auto__chg_field_affecteduserbygroup_ident
 > sentry:0081_fill_trackeduser
 > sentry:0082_auto__add_activity__add_field_group_num_comments__add_field_event_num_
 > sentry:0083_migrate_dupe_groups
 > sentry:0084_auto__del_unique_group_project_checksum_logger_culprit__add_unique_gro
 > sentry:0085_auto__del_unique_project_slug__add_unique_project_slug_team
 > sentry:0086_auto__add_field_team_date_added
 > sentry:0087_auto__del_messagefiltervalue__del_unique_messagefiltervalue_project_ke
 > sentry:0088_auto__del_messagecountbyminute__del_unique_messagecountbyminute_projec
 > sentry:0089_auto__add_accessgroup__add_unique_accessgroup_team_name
 > sentry:0090_auto__add_grouptagkey__add_unique_grouptagkey_project_group_key__add_f
 > sentry:0091_auto__add_alert
 > sentry:0092_auto__add_alertrelatedgroup__add_unique_alertrelatedgroup_group_alert
 > sentry:0093_auto__add_field_alert_status
 > sentry:0094_auto__add_eventmapping__add_unique_eventmapping_project_event_id
 > sentry:0095_rebase
 > sentry:0096_auto__add_field_tagvalue_data
 > sentry:0097_auto__del_affecteduserbygroup__del_unique_affecteduserbygroup_project_
 > sentry:0098_auto__add_user__chg_field_team_owner__chg_field_activity_user__chg_fie
 > sentry:0099_auto__del_field_teammember_is_active
 > sentry:0100_auto__add_field_tagkey_label
 > sentry:0101_ensure_teams
 > sentry:0102_ensure_slugs
 > sentry:0103_ensure_non_empty_slugs
 > sentry:0104_auto__add_groupseen__add_unique_groupseen_group_user
 > sentry:0105_auto__chg_field_projectcountbyminute_time_spent_total__chg_field_group
 > sentry:0106_auto__del_searchtoken__del_unique_searchtoken_document_field_token__de
 > sentry:0107_expand_user
 > sentry:0108_fix_user
 > sentry:0109_index_filtervalue_times_seen
 > sentry:0110_index_filtervalue_last_seen
 > sentry:0111_index_filtervalue_first_seen
 > sentry:0112_auto__chg_field_option_value__chg_field_useroption_value__chg_field_pr
 > sentry:0113_auto__add_field_team_status
 > sentry:0114_auto__add_field_projectkey_roles
 > sentry:0115_auto__del_projectcountbyminute__del_unique_projectcountbyminute_projec
 > sentry:0116_auto__del_field_event_server_name__del_field_event_culprit__del_field_
 > sentry:0117_auto__add_rule
 > sentry:0118_create_default_rules
 > sentry:0119_auto__add_field_projectkey_label
 > sentry:0120_auto__add_grouprulestatus
 > sentry:0121_auto__add_unique_grouprulestatus_rule_group
 > sentry:0122_add_event_group_id_datetime_index
 > sentry:0123_auto__add_groupassignee__add_index_event_group_datetime
 > sentry:0124_auto__add_grouphash__add_unique_grouphash_project_hash
 > sentry:0125_auto__add_field_user_is_managed
 > sentry:0126_auto__add_field_option_last_updated
 > sentry:0127_auto__add_release__add_unique_release_project_version
 > sentry:0128_auto__add_broadcast
 > sentry:0129_auto__chg_field_release_id__chg_field_pendingteammember_id__chg_field_
 > sentry:0130_auto__del_field_project_owner
 > sentry:0131_auto__add_organizationmember__add_unique_organizationmember_organizati
 > sentry:0132_add_default_orgs
 > sentry:0133_add_org_members
 > sentry:0134_auto__chg_field_team_organization
 > sentry:0135_auto__chg_field_project_team
 > sentry:0136_auto__add_field_organizationmember_email__chg_field_organizationmember
 > sentry:0137_auto__add_field_organizationmember_has_global_access
 > sentry:0138_migrate_team_members
 > sentry:0139_auto__add_auditlogentry
 > sentry:0140_auto__add_field_organization_slug
 > sentry:0141_fill_org_slugs
 > sentry:0142_auto__add_field_project_organization__add_unique_project_organization_
 > sentry:0143_fill_project_orgs
 > sentry:0144_auto__chg_field_project_organization
 > sentry:0145_auto__chg_field_organization_slug
 > sentry:0146_auto__add_field_auditlogentry_ip_address
 > sentry:0147_auto__del_unique_team_slug__add_unique_team_organization_slug
 > sentry:0148_auto__add_helppage
 > sentry:0149_auto__chg_field_groupseen_project__chg_field_groupseen_user__chg_field
 > sentry:0150_fix_broken_rules
 > sentry:0151_auto__add_file
 > sentry:0152_auto__add_field_file_checksum__chg_field_file_name__add_unique_file_na
 > sentry:0153_auto__add_field_grouprulestatus_last_active
 > sentry:0154_auto__add_field_tagkey_status
 > sentry:0155_auto__add_field_projectkey_status
 > sentry:0156_auto__add_apikey
 > sentry:0157_auto__add_authidentity__add_unique_authidentity_auth_provider_ident__a
 > sentry:0158_auto__add_unique_authidentity_auth_provider_user
 > sentry:0159_auto__add_field_authidentity_last_verified__add_field_organizationmemb
 > sentry:0160_auto__add_field_authprovider_default_global_access
 > sentry:0161_auto__chg_field_authprovider_config
 > sentry:0162_auto__chg_field_authidentity_data
 > sentry:0163_auto__add_field_authidentity_last_synced
 > sentry:0164_auto__add_releasefile__add_unique_releasefile_release_ident__add_field
 > sentry:0165_auto__del_unique_file_name_checksum
 > sentry:0166_auto__chg_field_user_id__add_field_apikey_allowed_origins
 > sentry:0167_auto__add_field_authprovider_flags
 > sentry:0168_unfill_projectkey_user
 > sentry:0169_auto__del_field_projectkey_user
 > sentry:0170_auto__add_organizationmemberteam__add_unique_organizationmemberteam_te
 > sentry:0171_auto__chg_field_team_owner
 > sentry:0172_auto__del_field_team_owner
 > sentry:0173_auto__del_teammember__del_unique_teammember_team_user
 > sentry:0174_auto__del_field_projectkey_user_added
 > sentry:0175_auto__del_pendingteammember__del_unique_pendingteammember_team_email
 > sentry:0176_auto__add_field_organizationmember_counter__add_unique_organizationmem
 > sentry:0177_fill_member_counters
 > sentry:0178_auto__del_unique_organizationmember_organization_counter
 > sentry:0179_auto__add_field_release_date_released
 > sentry:0180_auto__add_field_release_environment__add_field_release_ref__add_field_
 > sentry:0181_auto__del_field_release_environment__del_unique_release_project_versio
 > sentry:0182_auto__add_field_auditlogentry_actor_label__add_field_auditlogentry_act
 > sentry:0183_auto__del_index_grouphash_hash
 > sentry:0184_auto__del_field_group_checksum__del_unique_group_project_checksum__del
 > sentry:0185_auto__add_savedsearch__add_unique_savedsearch_project_name
 > sentry:0186_auto__add_field_group_first_release
 > sentry:0187_auto__add_index_group_project_first_release
 > sentry:0188_auto__add_userreport
 > sentry:0189_auto__add_index_userreport_project_event_id
 > sentry:0190_auto__add_field_release_new_groups
 > sentry:0191_auto__del_alert__del_alertrelatedgroup__del_unique_alertrelatedgroup_g
 > sentry:0192_add_model_groupemailthread
 > sentry:0193_auto__del_unique_groupemailthread_msgid__add_unique_groupemailthread_e
 > sentry:0194_auto__del_field_project_platform
 > sentry:0195_auto__chg_field_organization_owner
 > sentry:0196_auto__del_field_organization_owner
 > sentry:0197_auto__del_accessgroup__del_unique_accessgroup_team_name
 > sentry:0198_auto__add_field_release_primary_owner
 > sentry:0199_auto__add_field_project_first_event
 > sentry:0200_backfill_first_event
 > sentry:0201_auto__add_eventuser__add_unique_eventuser_project_ident__add_index_eve
 > sentry:0202_auto__add_field_eventuser_hash__add_unique_eventuser_project_hash
 > sentry:0203_auto__chg_field_eventuser_username__chg_field_eventuser_ident
 > sentry:0204_backfill_team_membership
 > sentry:0205_auto__add_field_organizationmember_role
 > sentry:0206_backfill_member_role
 > sentry:0207_auto__add_field_organization_default_role
 > sentry:0208_backfill_default_role
 > sentry:0209_auto__add_broadcastseen__add_unique_broadcastseen_broadcast_user
 > sentry:0210_auto__del_field_broadcast_badge
 > sentry:0211_auto__add_field_broadcast_title
 > sentry:0212_auto__add_fileblob__add_field_file_blob
 > sentry:0212_auto__add_organizationoption__add_unique_organizationoption_organizati
 > sentry:0213_migrate_file_blobs
Saved 0.00GB (on 0.00GB) with removal of 0 duplicate files
 > sentry:0214_auto__add_field_broadcast_upstream_id
 > sentry:0215_auto__add_field_broadcast_date_expires
 > sentry:0216_auto__add_groupsnooze
 > sentry:0217_auto__add_groupresolution
 > sentry:0218_auto__add_field_groupresolution_status
 > sentry:0219_auto__add_field_groupbookmark_date_added
 > sentry:0220_auto__del_field_fileblob_storage_options__del_field_fileblob_storage__
 > sentry:0221_auto__chg_field_user_first_name
 > sentry:0222_auto__del_field_user_last_name__del_field_user_first_name__add_field_u
 > sentry:0223_delete_old_sentry_docs_options
 > sentry:0224_auto__add_index_userreport_project_date_added
 > sentry:0225_auto__add_fileblobindex__add_unique_fileblobindex_file_blob_offset
 > sentry:0226_backfill_file_size
 > sentry:0227_auto__del_field_activity_event
 > sentry:0228_auto__del_field_event_num_comments
 > sentry:0229_drop_event_constraints
 > sentry:0230_auto__del_field_eventmapping_group__del_field_eventmapping_project__ad
 > sentry:0231_auto__add_field_savedsearch_is_default
 > sentry:0232_default_savedsearch
 > sentry:0233_add_new_savedsearch
 > sentry:0234_auto__add_savedsearchuserdefault__add_unique_savedsearchuserdefault_pr
 > sentry:0235_auto__add_projectbookmark__add_unique_projectbookmark_project_id_user_
 > sentry:0236_auto__add_organizationonboardingtask__add_unique_organizationonboardin
 > sentry:0237_auto__add_eventtag__add_unique_eventtag_event_id_key_id_value_id
 > sentry:0238_fill_org_onboarding_tasks
 > sentry:0239_auto__add_projectdsymfile__add_unique_projectdsymfile_project_uuid__ad
 > sentry:0240_fill_onboarding_option
 > sentry:0241_auto__add_counter__add_unique_counter_project_ident__add_field_group_s
 > sentry:0242_auto__add_field_project_forced_color
 > sentry:0243_remove_inactive_members
 > sentry:0244_auto__add_groupredirect
 > sentry:0245_auto__del_field_project_callsign__del_unique_project_organization_call
 > sentry:0246_auto__add_dsymsymbol__add_unique_dsymsymbol_object_address__add_dsymsd
 > sentry:0247_migrate_file_blobs
 > sentry:0248_auto__add_projectplatform__add_unique_projectplatform_project_id_platf
 > sentry:0249_auto__add_index_eventtag_project_id_key_id_value_id
 > sentry:0250_auto__add_unique_userreport_project_event_id
 > sentry:0251_auto__add_useravatar
 > sentry:0252_default_users_to_gravatar
 > sentry:0253_auto__add_field_eventtag_group_id
 > sentry:0254_auto__add_index_eventtag_group_id_key_id_value_id
 > sentry:0255_auto__add_apitoken
 > sentry:0256_auto__add_authenticator
 > sentry:0257_repair_activity
 > sentry:0258_auto__add_field_user_is_password_expired__add_field_user_last_password
 > sentry:0259_auto__add_useremail__add_unique_useremail_user_email
 > sentry:0260_populate_email_addresses
 > sentry:0261_auto__add_groupsubscription__add_unique_groupsubscription_group_user
 > sentry:0262_fix_tag_indexes
 > sentry:0263_remove_default_regression_rule
 > sentry:0264_drop_grouptagvalue_project_index
 > sentry:0265_auto__add_field_rule_status
 > sentry:0266_auto__add_grouprelease__add_unique_grouprelease_group_id_release_id_en
 > sentry:0267_auto__add_environment__add_unique_environment_project_id_name__add_rel
 > sentry:0268_fill_environment
 > sentry:0269_auto__del_helppage
 > sentry:0270_auto__add_field_organizationmember_token
 > sentry:0271_auto__del_field_organizationmember_counter
 > sentry:0272_auto__add_unique_authenticator_user_type
 > sentry:0273_auto__add_repository__add_unique_repository_organization_id_name__add_
 > sentry:0274_auto__add_index_commit_repository_id_date_added
 > sentry:0275_auto__del_index_grouptagvalue_project_key_value__add_index_grouptagval
 > sentry:0276_auto__add_field_user_session_nonce
 > sentry:0277_auto__add_commitfilechange__add_unique_commitfilechange_commit_filenam
 > sentry:0278_auto__add_releaseproject__add_unique_releaseproject_project_release__a
 > sentry:0279_populate_release_orgs_and_projects
 > sentry:0280_auto__add_field_releasecommit_organization_id
 > sentry:0281_populate_release_commit_organization_id
 > sentry:0282_auto__add_field_releasefile_organization__add_field_releaseenvironment
 > sentry:0283_populate_release_environment_and_release_file_organization
 > sentry:0284_auto__del_field_release_project__add_field_release_project_id__chg_fie
 > sentry:0285_auto__chg_field_release_project_id__chg_field_releasefile_project_id
 > sentry:0286_drop_project_fk_release_release_file
 > sentry:0287_auto__add_field_releaseproject_new_groups
 > sentry:0288_set_release_project_new_groups_to_zero
 > sentry:0289_auto__add_organizationavatar
 > sentry:0290_populate_release_project_new_groups
 > sentry:0291_merge_legacy_releases
 > sentry:0292_auto__add_unique_release_organization_version
 > sentry:0293_auto__del_unique_release_project_id_version
 > sentry:0294_auto__add_groupcommitresolution__add_unique_groupcommitresolution_grou
 > sentry:0295_auto__add_environmentproject__add_unique_environmentproject_project_en
 > sentry:0296_populate_environment_organization_and_projects
 > sentry:0297_auto__add_field_project_flags
 > sentry:0298_backfill_project_has_releases
 > sentry:0299_auto__chg_field_environment_organization_id
 > sentry:0300_auto__add_processingissue__add_unique_processingissue_project_checksum
 > sentry:0301_auto__chg_field_environment_project_id__chg_field_releaseenvironment_p
 > sentry:0302_merge_environments
 > sentry:0303_fix_release_new_group_counts
 > sentry:0304_auto__add_deploy
 > sentry:0305_auto__chg_field_authidentity_data__chg_field_useroption_value__chg_fie
 > sentry:0306_auto__add_apigrant__add_apiauthorization__add_unique_apiauthorization_
 > sentry:0307_auto__add_field_apigrant_scope_list__add_field_apitoken_scope_list__ad
 > sentry:0308_auto__add_versiondsymfile__add_unique_versiondsymfile_dsym_file_versio
 > sentry:0308_backfill_scopes_list
 > sentry:0309_fix_application_state
 > sentry:0310_auto__add_field_savedsearch_owner
 > sentry:0311_auto__add_releaseheadcommit__add_unique_releaseheadcommit_repository_i
 > sentry:0312_create_missing_emails
 > sentry:0313_auto__add_field_commitauthor_external_id__add_unique_commitauthor_orga
 > sentry:0314_auto__add_distribution__add_unique_distribution_release_name__add_fiel
 > sentry:0315_auto__add_field_useroption_organization__add_unique_useroption_user_or
 > sentry:0316_auto__del_field_grouptagvalue_project__del_field_grouptagvalue_group__
 > sentry:0317_drop_grouptagvalue_constraints
 > sentry:0318_auto__add_field_deploy_notified
 > sentry:0319_auto__add_index_deploy_notified
 > sentry:0320_auto__add_index_eventtag_date_added
 > sentry:0321_auto__add_field_projectkey_rate_limit_count__add_field_projectkey_rate
 > sentry:0321_auto__add_unique_environment_organization_id_name
 > sentry:0322_merge_0321_migrations
 > sentry:0323_auto__add_unique_releaseenvironment_organization_id_release_id_environ
 > sentry:0324_auto__add_field_eventuser_name__add_field_userreport_event_user_id
 > sentry:0325_auto__add_scheduleddeletion__add_unique_scheduleddeletion_app_label_mo
 > sentry:0326_auto__add_field_groupsnooze_count__add_field_groupsnooze_window__add_f
 > sentry:0327_auto__add_field_release_commit_count__add_field_release_last_commit_id
 > sentry:0328_backfill_release_stats
 > sentry:0329_auto__del_dsymsymbol__del_unique_dsymsymbol_object_address__del_global
 > sentry:0330_auto__add_field_grouphash_state
 > sentry:0331_auto__del_index_releasecommit_project_id__del_index_releaseenvironment
 > sentry:0332_auto__add_featureadoption__add_unique_featureadoption_organization_fea
 > sentry:0333_auto__add_field_groupresolution_type__add_field_groupresolution_actor_
 > sentry:0334_auto__add_field_project_platform
 > sentry:0334_auto__add_scheduledjob
 > sentry:0335_auto__add_field_groupsnooze_actor_id
 > sentry:0336_auto__add_field_user_last_active
 > sentry:0337_fix_out_of_order_migrations
 > sentry:0338_fix_null_user_last_active
 > sentry:0339_backfill_first_project_feature
 > sentry:0340_auto__add_grouptombstone__add_field_grouphash_group_tombstone_id
 > sentry:0341_auto__add_organizationintegration__add_unique_organizationintegration_
 > sentry:0342_projectplatform
 > sentry:0343_auto__add_index_groupcommitresolution_commit_id
 > sentry:0344_add_index_ProjectPlatform_last_seen
 > sentry:0345_add_citext
 > sentry:0346_auto__del_field_tagkey_project__add_field_tagkey_project_id__del_uniqu
 > sentry:0347_auto__add_index_grouptagvalue_project_id__add_index_grouptagvalue_grou
 > sentry:0348_fix_project_key_rate_limit_window_unit
 > sentry:0349_drop_constraints_filterkey_filtervalue_grouptagkey
 > sentry:0350_auto__add_email
 > sentry:0351_backfillemail
 > sentry:0352_add_index_release_coalesce_date_released_date_added
 > sentry:0353_auto__del_field_eventuser_project__add_field_eventuser_project_id__del
 > sentry:0354_auto__chg_field_commitfilechange_filename
 > sentry:0355_auto__add_field_organizationintegration_config__add_field_organization
 > sentry:0356_auto__add_useridentity__add_unique_useridentity_user_identity__add_ide
 > sentry:0357_auto__add_projectteam__add_unique_projectteam_project_team
 > sentry:0358_auto__add_projectsymcachefile__add_unique_projectsymcachefile_project_
 > sentry:0359_auto__add_index_tagvalue_project_id_key_last_seen
 > sentry:0360_auto__add_groupshare
 > sentry:0361_auto__add_minidumpfile
 > sentry:0362_auto__add_userip__add_unique_userip_user_ip_address
 > sentry:0363_auto__add_grouplink__add_unique_grouplink_group_id_linked_type_linked_
 > sentry:0364_backfill_grouplink_from_groupcommitresolution
 > sentry:0365_auto__del_index_eventtag_project_id_key_id_value_id
 > sentry:0366_backfill_first_project_heroku
 > sentry:0367_auto__chg_field_release_ref__chg_field_release_version
 > sentry:0368_auto__add_deletedorganization__add_deletedteam__add_deletedproject
 > sentry:0369_remove_old_grouphash_last_processed_event_data
Cleaning obsolete data from <HostInfo db='0' host='redis' host_id=0 password='' port='6379' ssl=False ssl_options=None unix_socket_path=None>...
Done cleaning 0 obsolete entries from <HostInfo db='0' host='redis' host_id=0 password='' port='6379' ssl=False ssl_options=None unix_socket_path=None>.
 > sentry:0370_correct_groupsnooze_windows
 > sentry:0371_auto__add_servicehook
 > sentry:0371_auto__del_minidumpfile
 > sentry:0372_resolve_migration_conflict
 > sentry:0373_backfill_projectteam
 > sentry:0374_auto__del_useridentity__del_unique_useridentity_user_identity__del_ide
 > sentry:0375_auto__add_identityprovider__add_unique_identityprovider_type_organizat
 > sentry:0376_auto__add_userpermission__add_unique_userpermission_user_permission
 > sentry:0377_auto__add_pullrequest__add_unique_pullrequest_repository_id_key__add_i
 > sentry:0378_delete_outdated_projectteam
 > sentry:0379_auto__add_unique_projectteam_project
 > sentry:0380_auto__chg_field_servicehook_url
 > sentry:0381_auto__del_field_deletedproject_team_name__del_field_deletedproject_tea
 > sentry:0382_auto__add_groupenvironment__add_unique_groupenvironment_group_id_envir
 > sentry:0383_auto__chg_field_project_team
 > sentry:0384_auto__del_unique_projectteam_project
 > sentry:0385_auto__add_field_rule_environment_id
 > sentry:0386_auto__del_unique_project_team_slug
 > sentry:0387_auto__add_field_groupassignee_team__chg_field_groupassignee_user
 > sentry:0388_auto__add_field_environmentproject_is_hidden
 > sentry:0389_auto__add_field_groupenvironment_first_release_id__add_index_groupenvi
 > sentry:0390_auto__add_field_userreport_environment
 > sentry:0391_auto__add_fileblobowner__add_unique_fileblobowner_blob_organization__a
 > sentry:0392_auto__add_projectownership
 > sentry:0393_auto__add_assistantactivity__add_unique_assistantactivity_user_guide_i
 > sentry:0394_auto__chg_field_project_team
 > sentry:0395_auto__add_releaseprojectenvironment__add_unique_releaseprojectenvironm
 > sentry:0396_auto__del_field_project_team
 > sentry:0397_auto__add_latestrelease__add_unique_latestrelease_repository_id_enviro
 > sentry:0397_auto__add_unique_identity_idp_user
 > sentry:0398_auto__add_pullrequestcommit__add_unique_pullrequestcommit_pull_request
 > sentry:0399_auto__chg_field_user_last_login__add_unique_identity_idp_user
 > sentry:0400_auto__add_projectredirect__add_unique_projectredirect_organization_red
 > sentry:0401_auto__chg_field_projectdsymfile_uuid
 > sentry:0402_auto__add_field_organizationintegration_date_added__add_field_identity
 > sentry:0403_auto__add_teamavatar
 > sentry:0404_auto__del_unique_environment_project_id_name
 > sentry:0405_auto__add_field_user_flags
 > sentry:0406_auto__add_projectavatar
 > sentry:0407_auto__add_field_identityprovider_external_id__add_unique_identityprovi
 > sentry:0408_identity_provider_external_id
 > sentry:0409_auto__add_field_releaseprojectenvironment_last_deploy_id
 > sentry:0410_auto__del_unique_identityprovider_type_organization
 > sentry:0411_auto__add_field_projectkey_data
 > sentry:0412_auto__chg_field_file_name
 > sentry:0413_auto__add_externalissue__add_unique_externalissue_organization_id_inte
 > sentry:0414_backfill_release_project_environment_last_deploy_id
 > sentry:0415_auto__add_relay
 > sentry:0416_auto__del_field_identityprovider_organization__add_field_identityprovi
 > sentry:0417_migrate_identities
Deleting 0 idps with no external_id
0 idps left
0 identities
Deleting 0 bad ids
0 identities left
0 new IDPs and 0 new IDs
 > sentry:0418_delete_old_idps
 > sentry:0419_auto__add_unique_identityprovider_type_external_id
 > sentry:0420_auto__chg_field_identityprovider_organization_id
 > sentry:0421_auto__del_field_identityprovider_organization_id__del_unique_identityp
 > sentry:0422_auto__add_grouphashtombstone__add_unique_grouphashtombstone_project_ha
 > sentry:0423_auto__add_index_grouphashtombstone_deleted_at
 > sentry:0424_auto__add_field_integration_status
 > sentry:0425_auto__add_index_pullrequest_organization_id_merge_commit_sha
 > sentry:0425_remove_invalid_github_idps
 > sentry:0426_auto__add_sentryappinstallation__add_sentryapp__add_field_user_is_sent
 > sentry:0427_auto__add_eventattachment__add_unique_eventattachment_project_id_event
 > sentry:0428_auto__add_index_eventattachment_project_id_date_added
 > sentry:0429_auto__add_integrationexternalproject__add_unique_integrationexternalpr
 > sentry:0430_auto__add_field_organizationintegration_status
 > sentry:0431_auto__add_field_externalissue_metadata
 > sentry:0432_auto__add_field_relay_is_internal
 > sentry:0432_auto__add_index_userreport_date_added__add_index_eventattachment_date_
 > sentry:0433_auto__add_field_relay_is_internal__add_field_userip_country_code__add_
 > sentry:0434_auto__add_discoversavedqueryproject__add_unique_discoversavedqueryproj
 > sentry:0435_auto__add_field_discoversavedquery_created_by
 > sentry:0436_rename_projectdsymfile_to_projectdebugfile
 > sentry:0437_auto__add_field_sentryapp_status
 > sentry:0438_auto__add_index_sentryapp_status__chg_field_sentryapp_proxy_user__chg_
 > sentry:0439_auto__chg_field_sentryapp_owner
 > sentry:0440_auto__del_unique_projectdebugfile_project_debug_id__add_index_projectd
 > sentry:0441_auto__add_field_projectdebugfile_data
 > sentry:0442_auto__add_projectcficachefile__add_unique_projectcficachefile_project_
 > sentry:0443_auto__add_field_organizationmember_token_expires_at
 > sentry:0443_auto__del_dsymapp__del_unique_dsymapp_project_platform_app_id__del_ver
 > sentry:0444_auto__add_sentryappavatar__add_field_sentryapp_redirect_url__add_field
 > sentry:0445_auto__add_promptsactivity__add_unique_promptsactivity_user_feature_org
 > sentry:0446_auto__add_index_promptsactivity_project_id
 > sentry:0447_auto__del_field_promptsactivity_organization__add_field_promptsactivit
 > sentry:0448_auto__add_field_sentryapp_is_alertable
 > sentry:0449_auto__chg_field_release_owner
 > sentry:0450_auto__del_grouphashtombstone__del_unique_grouphashtombstone_project_ha
 > sentry:0451_auto__del_field_projectbookmark_project_id__add_field_projectbookmark_
 > sentry:0452_auto__add_field_sentryapp_events
 > sentry:0452_auto__del_field_releaseenvironment_organization_id__del_field_releasee
 > sentry:0453_auto__add_index_releasefile_release_name
 > sentry:0454_resolve_duplicate_0452
 > sentry:0455_auto__add_field_groupenvironment_first_seen
 > sentry:0456_auto__add_dashboard__add_unique_dashboard_organization_title__add_widg
 > sentry:0457_auto__add_field_savedsearch_is_global__chg_field_savedsearch_project__
 > sentry:0457_auto__add_monitorcheckin__add_monitor__add_index_monitor_type_next_che
 > sentry:0458_global_searches_data_migration
 > sentry:0459_global_searches_unique_constraint
 > sentry:0460_auto__add_field_servicehook_organization_id
 > sentry:0461_event_attachment_indexes
 > sentry:0462_auto__add_servicehookproject
 > sentry:0462_releaseenvironment_project_id
 > sentry:0463_backfill_service_hook_project
 > sentry:0464_auto__add_sentryappcomponent__add_field_sentryapp_schema
 > sentry:0464_groupenvironment_foreignkeys
 > sentry:0465_sync
 > sentry:0466_auto__add_platformexternalissue__add_unique_platformexternalissue_grou
 > sentry:0467_backfill_integration_status
 > sentry:0468_auto__add_field_projectdebugfile_code_id__add_index_projectdebugfile_p
 > sentry:0468_recent_search
 > sentry:0469_fix_state
 > sentry:0470_org_saved_search
 > sentry:0471_global_saved_search_types
 > sentry:0472_auto__add_field_sentryapp_author
Created internal Sentry project (slug=internal, id=1)

Would you like to create a user account now? [Y/n]: y
Email: name@qq.com
Password: 
Repeat for confirmation: 
User created: name@qq.com
Added to organization: sentry
Running migrations for sentry.nodestore:
 - Migrating forwards to 0001_initial.
 > sentry.nodestore:0001_initial
Running migrations for sentry.search:
 - Migrating forwards to 0002_auto__del_searchtoken__del_unique_searchtoken_document_field_token__de.
 > sentry.search:0001_initial
 > sentry.search:0002_auto__del_searchtoken__del_unique_searchtoken_document_field_token__de
Running migrations for social_auth:
 - Migrating forwards to 0004_auto__del_unique_usersocialauth_provider_uid__add_unique_usersocialaut.
 > social_auth:0001_initial
 > social_auth:0002_auto__add_unique_nonce_timestamp_salt_server_url__add_unique_associati
 > social_auth:0003_auto__del_nonce__del_unique_nonce_server_url_timestamp_salt__del_assoc
 > social_auth:0004_auto__del_unique_usersocialauth_provider_uid__add_unique_usersocialaut
Running migrations for sentry.tagstore:
 - Migrating forwards to 0008_auto__chg_field_tagkey_environment_id.
 > sentry.tagstore:0001_initial
 > sentry.tagstore:0002_auto__del_tagkey__del_unique_tagkey_project_id_environment_id_key__del
 > sentry.tagstore:0003_auto__add_tagkey__add_unique_tagkey_project_id_environment_id_key__add
 > sentry.tagstore:0004_auto__del_tagkey__del_unique_tagkey_project_id_environment_id_key__del
 > sentry.tagstore:0005_auto__add_tagvalue__add_unique_tagvalue_project_id__key_value__add_ind
 > sentry.tagstore:0006_auto__del_unique_eventtag_event_id_key_value__add_unique_eventtag_proj
 > sentry.tagstore:0007_auto__chg_field_tagkey_environment_id__chg_field_tagkey_project_id__ch
 > sentry.tagstore:0008_auto__chg_field_tagkey_environment_id
Running migrations for sentry_plugins.hipchat_ac:
 - Migrating forwards to 0002_auto__del_mentionedevent.
 > sentry_plugins.hipchat_ac:0001_initial
 > sentry_plugins.hipchat_ac:0002_auto__del_mentionedevent
Running migrations for sentry_plugins.jira_ac:
 - Migrating forwards to 0001_initial.
 > sentry_plugins.jira_ac:0001_initial

Synced:
 > django.contrib.admin
 > django.contrib.auth
 > django.contrib.contenttypes
 > django.contrib.messages
 > django.contrib.sessions
 > django.contrib.sites
 > django.contrib.staticfiles
 > crispy_forms
 > debug_toolbar
 > rest_framework
 > sentry.plugins.sentry_interface_types
 > sentry.plugins.sentry_mail
 > sentry.plugins.sentry_urls
 > sentry.plugins.sentry_useragents
 > sentry.plugins.sentry_webhooks
 > sudo
 > south

Migrated:
 - sentry
 - sentry.nodestore
 - sentry.search
 - social_auth
 - sentry.tagstore
 - sentry_plugins.hipchat_ac
 - sentry_plugins.jira_ac
Creating missing DSNs
Correcting Group.num_comments counter
Cleaning up...

----------------
You're all done! Run the following command get Sentry running:

  docker-compose up -d

当脚本执行提示如下信息时需要注意,说明数据库已经初始化完毕,需要创建管理员账户:

Would you like to create a user account now? [Y/n]: 

小贴士:经过实际测试发现,此步骤填写的邮箱会导致一个 BUG:在管理员账户页面会提示此邮箱尚未验证,并且重发邮件无响应。

当脚本执行完毕且出现如下提示

----------------
You're all done! Run the following command get Sentry running:

  docker-compose up -d

容器已经构建完毕,可以直接启动即可。

# docker-compose up -d

容器会直接监听至 TCP 9000 端口,若系统内部署了 PHP-FPM ,需要修改端口(建议修改FPM的)然后重启服务。

效果

配置邮箱

搭建完毕后,访问 http://localhost:9000 即可看到页面,此时可以发现无法发送邮件,配置内部邮箱可参考官方文档 - 入站邮件,若配置阿里云、腾讯邮箱等可以在配置文件中进行修改。

一个更加简单配置邮箱服务器的办法如下:修改 docker-compose.yml 中的环境变量即可,找到 environment 行(一般在 #23 附近),注释/删掉原有邮箱变量 SENTRY_EMAIL_HOST: smtp ,在后面加入

    SENTRY_SERVER_EMAIL: 'example@qq.com'         # 发件人
    SENTRY_EMAIL_HOST: 'smtp.exmail.qq.com'       # 提供商服务器
    SENTRY_EMAIL_PORT: 587                        # 端口
    SENTRY_EMAIL_USER: 'example@qq.com'           # 用户名(推荐与发件人一致)
    SENTRY_EMAIL_PASSWORD: 'PassWord123'          # 密码
    SENTRY_EMAIL_USE_TLS: 'true'                  # 是否开启 TLS 支持

注意:反复测试后发现163邮箱及QQ邮箱都无法配置使用,会提示连接超时或报错,经过查询后发现原因:目前 Sentry 仅支持 TLS 加密的 SMTP 协议,不支持 SSL 加密的 SMTP,详见:https://forum.sentry.io/t/smtp-connection-timeout-with-correct-email-config/180https://github.com/getsentry/sentry/issues/4252 经过测试只有腾讯邮箱的 587 端口支持 TLS 加密协议。

常见邮箱端口及协议

协议 地址 SSL 协议端口 非 SSL 协议端口 所属 可用性测试(√通过)(✗未通过)
IMAP imap.163.com 993 143 网易 163 邮箱
SMTP smtp.163.com 465/994 25 网易 163 邮箱
POP3 pop.163.com 995 110 网易 163 邮箱

协议 地址 SSL 协议端口 非 SSL 协议端口 所属 可用性测试(√通过)(✗未通过)
IMAP imap.exmail.qq.com 993 / 腾讯企业邮
POP3 pop.exmail.qq.com 995 / 腾讯企业邮
SMTP smtp.exmail.qq.com 465 / 腾讯企业邮

注意:若邮箱配置正确后依然提示连接超时,请参考此文章进行修改 Django 框架的超时时间即可。

反代

容器方案部署后,会监听在 9000 端口,建议使用 Web 服务器进行反代。

配置文件如下

http {
  # set REMOTE_ADDR from any internal proxies
  # see http://nginx.org/en/docs/http/ngx_http_realip_module.html
  set_real_ip_from 127.0.0.1;
  set_real_ip_from 10.0.0.0/8;
  real_ip_header X-Forwarded-For;
  real_ip_recursive on;

  # SSL configuration -- change these certs to match yours
  ssl_certificate      /etc/ssl/sentry.example.com.crt;
  ssl_certificate_key  /etc/ssl/sentry.example.com.key;

  # NOTE: These settings may not be the most-current recommended
  # defaults
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;
  ssl_prefer_server_ciphers on;
  ssl_session_cache shared:SSL:128m;
  ssl_session_timeout 10m;

  server {
    listen   80;
    server_name sentry.example.com;

    location / {
      if ($request_method = GET) {
        rewrite  ^ https://$host$request_uri? permanent;
      }
      return 405;
    }
  }

  server {
    listen   443 ssl;
    server_name sentry.example.com;

    proxy_set_header   Host                 $http_host;
    proxy_set_header   X-Forwarded-Proto    $scheme;
    proxy_set_header   X-Forwarded-For      $remote_addr;
    proxy_redirect     off;

    # keepalive + raven.js is a disaster
    keepalive_timeout 0;

    # use very aggressive timeouts
    proxy_read_timeout 5s;
    proxy_send_timeout 5s;
    send_timeout 5s;
    resolver_timeout 5s;
    client_body_timeout 5s;

    # buffer larger messages
    client_max_body_size 5m;
    client_body_buffer_size 100k;

    location / {
      proxy_pass        http://localhost:9000;

      add_header Strict-Transport-Security "max-age=31536000";
    }
  }
}

若机器上与其他项目共存,请勿修改 HTTP 段配置,创建虚拟主机配置,例如:/etc/nginx/conf.d/sentry.domain.com.conf

server {
    listen   80;
    server_name sentry.domain.com;

    location / {
      if ($request_method = GET) {
        rewrite  ^ https://$host$request_uri? permanent;
      }
      return 405;
    }
  }

  server {
    listen   443 ssl;
    server_name sentry.domain.com;

    # set REMOTE_ADDR from any internal proxies
    # see http://nginx.org/en/docs/http/ngx_http_realip_module.html
    set_real_ip_from 127.0.0.1;
    set_real_ip_from 10.0.0.0/8;
    real_ip_header X-Forwarded-For;
    real_ip_recursive on;

    # SSL configuration -- change these certs to match yours
    ssl_certificate      cert.d/sentry.domain.com/sentry.pem;
    ssl_certificate_key  cert.d/sentry.domain.com/sentry.key;

    # NOTE: These settings may not be the most-current recommended
    # defaults
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:128m;
    ssl_session_timeout 10m;

    proxy_set_header   Host                 $http_host;
    proxy_set_header   X-Forwarded-Proto    $scheme;
    proxy_set_header   X-Forwarded-For      $remote_addr;
    proxy_redirect     off;

    # keepalive + raven.js is a disaster
    keepalive_timeout 0;

    # use very aggressive timeouts
    proxy_read_timeout 20s;
    proxy_send_timeout 20s;
    send_timeout 20s;
    resolver_timeout 20s;
    client_body_timeout 20s;

    # buffer larger messages
    client_max_body_size 5m;
    client_body_buffer_size 100k;

    location / {
      proxy_pass        http://localhost:9000;

      add_header Strict-Transport-Security "max-age=31536000";
    }
}

然后修改配置文件 sentry.conf.py,重新执行脚本构建即可。

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

附录

相关链接

参考链接

回复