{"id":7686,"date":"2024-07-09T21:01:01","date_gmt":"2024-07-09T13:01:01","guid":{"rendered":""},"modified":"2024-07-09T21:01:01","modified_gmt":"2024-07-09T13:01:01","slug":"\u5229\u7528docker\u642d\u5efahttp\u670d\u52a1\u5668_\u642d\u5efadocker\u955c\u50cf\u4ed3\u5e93","status":"publish","type":"post","link":"https:\/\/mushiming.com\/7686.html","title":{"rendered":"\u5229\u7528docker\u642d\u5efahttp\u670d\u52a1\u5668_\u642d\u5efadocker\u955c\u50cf\u4ed3\u5e93"},"content":{"rendered":"
sentry\u662f\u4e00\u6b3e\u9519\u8bef\u65e5\u5fd7\u6536\u96c6\u5e73\u53f0\uff0c\u53ef\u4ee5\u5c06\u4ee3\u7801\u9519\u8bef\u4fe1\u606f\u8fdb\u884c\u6536\u96c6\u3002<\/p>\n
\u5e73\u5e38\u6211\u4eec\u5f00\u53d1\u5b8c\u6210\u4ee5\u540e\uff0c\u53d1\u73b0\u95ee\u9898\u7684\u624b\u6bb5\u4ec5\u81ea\u6d4b-\u300b\u6d4b\u8bd5\u4eba\u5458-\u300b\u6700\u540e\u5e02\u573a\u53cd\u9988\u3002\u4e00\u822c\u6211\u4eec\u6536\u5230\u5e02\u573a\u53cd\u9988\u7684\u65f6\u5019\u5df2\u7ecf\u4ea7\u751f\u4e86\u4e8b\u6545\uff0c\u4f5c\u4e3a\u4e00\u4e2a\u5408\u683c\u7684\u7a0b\u5e8f\u733f\uff0c\u5982\u679c\u9ed8\u9ed8\u7b49\u7740\u5e02\u573a\u63d0\u95ee\u9898\u80af\u5b9a\u662f\u4e0d\u591f\u6ef4\uff01<\/p>\n
sentry\u5c31\u975e\u5e38\u8d34\u5fc3\u7684\u5e2e\u52a9\u6211\u4eec\u6536\u96c6\u4e86\u6240\u6709\u7684\u9519\u8bef\u5f02\u5e38\uff08\u6ce8\u610f\u4e0d\u662f\u65e5\u5fd7\uff01\uff09
<\/p>\n
<\/p>\n
\u914d\u7f6eyum\u6e90<\/p>\n
\nsudo yum install -y yum-utils
sudo yum-config-manager \\
--add-repo \\
http:\/\/mirrors.aliyun.com\/docker-ce\/linux\/centos\/docker-ce.repo<\/p>\n<\/blockquote>\nsudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin <\/code><\/pre>\n
2\u3001\u6dfb\u52a0\u56fd\u5185\u955c\u50cf<\/h3>\n
sudo yum install -y yum-utils sudo yum-config-manager \\ --add-repo \\ http:\/\/mirrors.aliyun.com\/docker-ce\/linux\/centos\/docker-ce.repo <\/code><\/pre>\n
3\u3001\u542f\u52a8Docker\u540e\u53f0\u670d\u52a1<\/strong><\/h3>\n
systemctl start docker <\/code><\/pre>\n
4\u3001\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8<\/strong><\/h3>\n
systemctl enable docker <\/code><\/pre>\n
5\u3001\u67e5\u770bDocker\u7248\u672c<\/strong><\/h3>\n
docker --version <\/code><\/pre>\n
6\u3001\u67e5\u770bDocker compose\u7248\u672c<\/strong><\/h3>\n
docker compose version <\/code><\/pre>\n
\u4e09\u3001\u5b89\u88c5git<\/h2>\n
yum install git <\/code><\/pre>\n
\u4e0b\u8f7donpremise<\/strong><\/h3>\n
git clone https:\/\/github.com\/getsentry\/onpremise.git \u8fd9\u4e2a\u662f\u65e7\u7684 git https:\/\/github.com\/getsentry\/self-hosted.git \u8fd9\u4e2a\u662f\u65b0\u4ed3\u5e93 \u4e24\u4e2a\u5730\u5740\u53ef\u4ee5\u62c9\u53d6\uff0c\u7f51\u4e0a\u5927\u591a\u6570\u90fd\u662f\u65e7\u7684\uff0c\u540e\u9762\u4f30\u8ba1\u4ed3\u5e93\u8fc1\u79fb\u4e86\uff0c\u4f46\u65e7\u7684\u4e5f\u80fd\u7528\u3002 <\/code><\/pre>\n
\u56db\u3001\u7ed9sentry\u914d\u7f6ehttps<\/h2>\n
1\u3001\u4fee\u6539nginx.conf<\/h3>\n
user nginx;\nworker_processes 1;\n\nerror_log \/var\/log\/nginx\/error.log warn;\npid \/var\/run\/nginx.pid;\n\n\nevents {\n worker_connections 1024;\n}\n\n\n\nhttp {\n # set REMOTE_ADDR from any internal proxies\n # see http:\/\/nginx.org\/en\/docs\/http\/ngx_http_realip_module.html\n set_real_ip_from 127.0.0.1;\n set_real_ip_from 10.0.0.0\/8;\n real_ip_header X-Forwarded-For;\n real_ip_recursive on;\n \n # SSL configuration -- change these certs to match yours\n ssl_certificate \/etc\/nginx\/pinyiche.club_bundle.crt;\n ssl_certificate_key \/etc\/nginx\/pinyiche.club.key;\n \n # NOTE: These settings may not be the most-current recommended\n # defaults\n ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\n 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;\n ssl_prefer_server_ciphers on;\n ssl_session_cache shared:SSL:128m;\n ssl_session_timeout 10m;\n \n server {\n listen 80;\n server_name sentry.pinyiche.club; \n location \/ {\n if ($request_method = GET) {\n rewrite ^ https:\/\/$host$request_uri? permanent;\n }\n return 405;\n }\n }\n \n server {\n listen 443 ssl;\n server_name sentry.pinyiche.club;\n proxy_set_header Host $http_host;\n proxy_set_header X-Forwarded-Proto $scheme;\n proxy_set_header X-Forwarded-For $remote_addr;\n proxy_redirect off;\n \n # keepalive + raven.js is a disaster\n keepalive_timeout 0;\n \n # use very aggressive timeouts\n proxy_read_timeout 5s;\n proxy_send_timeout 5s;\n send_timeout 5s;\n resolver_timeout 5s;\n client_body_timeout 5s;\n \n # buffer larger messages\n client_max_body_size 5m;\n client_body_buffer_size 100k;\n \n location \/api\/store\/ {\n proxy_pass http:\/\/relay:3000;\n }\n location ~ ^\/api\/[1-9]\\d*\/ {\n proxy_pass http:\/\/relay:3000;\n }\n location \/ {\n proxy_pass http:\/\/web:9000;\n }\n\n add_header Strict-Transport-Security \"max-age=31536000\";\n }\n}<\/code><\/pre>\n
<\/h3>\n
\u4e3a\u4e86\u80fd\u52a0\u5165https\u8981\u5c06\u914d\u7f6e\u6587\u4ef6\u653e\u5230\u6307\u5b9a\u4f4d\u7f6e<\/p>\n
\/data\/onpremise\/nginx<\/p>\n
<\/p>\n
2\u3001\u4fee\u6539 onpremise\/sentry\/config.yml
system.url-prefix<\/code> \u914d\u7f6e\uff0c\u5c06\u5176\u8bbe\u7f6e\u4e3a\u6211\u4eec\u8bbf\u95ee\u7684 Sentry \u57df\u540d\u3002
url-prefix<\/code> \u7ec4\u6210\u4e86\u9879\u76ee\u7684 DSN \u5730\u5740\uff0c\u4e00\u5b9a\u8981\u4fdd\u8bc1\u683c\u5f0f\u6b63\u786e\u3002<\/h3>\n
3\u3001onpremise\/sentry\/sentry.conf.py \u6587\u4ef6\u4e0b\u7684 SSL\/TLS \u914d\u7f6e\uff0c\u5c06\u539f\u6765\u6ce8\u91ca\u7684\u90e8\u5206\u5168\u90e8\u6253\u5f00\u3002<\/h3>\n
<\/p>\n
4\u3001\u66f4\u65b0\u914d\u7f6e\uff08\u4f1a\u5220\u9664\u5bb9\u5668\u91cd\u65b0\u521b\u5efa\uff09<\/h3>\n
docker compose down docker compose up -d<\/code><\/pre>\n
\u4e94\u3001\u521d\u59cb\u5316\u9879\u76ee<\/h2>\n
import * as Sentry from \"@sentry\/browser\"; Sentry.init({ dsn: \"https:\/\/314a71ddbaa90f3e6d444cb12be449d6@sentry.pinyiche.club:9000\/4\", integrations: [ new Sentry.BrowserTracing({ tracePropagationTargets: [\"localhost\", \/^https:\\\/\\\/yourserver\\.io\\\/api\/], }), new Sentry.Replay({ maskAllText: false, blockAllMedia: false, }), ], tracesSampleRate: 1.0, replaysSessionSampleRate: 0.1, replaysOnErrorSampleRate: 1.0, });<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"\u5229\u7528docker\u642d\u5efahttp\u670d\u52a1\u5668_\u642d\u5efadocker\u955c\u50cf\u4ed3\u5e93sentry\u662f\u4e00\u6b3e\u9519\u8bef\u65e5\u5fd7\u6536\u96c6\u5e73\u53f0\uff0c\u53ef\u4ee5\u5c06\u4ee3\u7801\u9519\u8bef\u4fe1\u606f\u8fdb\u884c\u6536\u96c6","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/7686"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=7686"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/7686\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=7686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=7686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=7686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}