self-hosted icon indicating copy to clipboard operation
self-hosted copied to clipboard

recurrent nginx 502 bad gateway after about 5 days no access sentry

Open nicky132 opened this issue 3 years ago • 7 comments

Self-Hosted Version

23.8.0

CPU Architecture

x86_64

Docker Version

22.0.5

Docker Compose Version

2.6.0

Steps to Reproduce

image When i firstly accessed sentry to find any error logs after almost about 5 days,then i got this 502. But if i refreshed this page again, then i accessed sentry successfully. Also after very long days to access my sentry, i will got 502 again, :c, super noisy.

Expected Result

I can access my sentry successfully every single time!

Actual Result

image 2 questions: 一、 When i firstly accessed sentry to find any error logs after almost about 5 days,then i got this 502. But if i refreshed this page again, then i accessed sentry successfully. Also after very long days to access my sentry, i will got 502 again, :c, super noisy.

二、 image

image

I am not sure, dose the nginx.conf file work with sentry. I cannot find access.log or error.log work with sentry either.

Event ID

c2d85058-d3b0-4d85-a509-e2ba965845d7

nicky132 avatar Oct 21 '23 05:10 nicky132

You can try the instructions here to enable more nginx logs.

azaslavsky avatar Oct 23 '23 21:10 azaslavsky

You can try the instructions here to enable more nginx logs.

Firstly,still no idea,about how could i enable more nginx logs.

Secondly,how to solve the 502 problem.

nicky132 avatar Nov 02 '23 14:11 nicky132

You will probably need to enable proxy buffering in your nginx configs on your machine. I'm suspecting the issue is similar to this one: https://github.com/getsentry/self-hosted/issues/2256

hubertdeng123 avatar Nov 03 '23 21:11 hubertdeng123

One thing that caught me out was that Sentry takes ages to start-up fully. Don't try anything until your server has been up and running for about 10 minutes.

Once the RAM usage gets upto about 6 GB it should be online. I use htop and watch the RAM usage climb up... ;)

As for Nginx this is the config I am using

# force https
server {
    listen 80;
    server_name sentry.mydomain.com;
    return 301 https://$host$request_uri;
}

# main site processing
server {

    # Set server name
    server_name sentry.mydomain.com;

    # Set default files to use for homepage
    index index.html index.htm;

    # route to port 9000
    location / {
        proxy_pass http://localhost:9000;
        include proxy_params;
    }

    # deny other hidden files
    location ~ /\.(?!well-known).* {
        deny all;
    }

    # communicate with the browser over HTTPS
    #listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/sentry.mydomain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/sentry.mydomain.com/privkey.pem; # managed by Certbot
    #include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    #ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

darrelajonas avatar Nov 08 '23 16:11 darrelajonas

Forgot something...

Contents of the /etc/nginx/proxy_params file in the above config

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

darrelajonas avatar Nov 08 '23 17:11 darrelajonas

...also in ~/.sentry/sentry/sentry.conf.py

image

darrelajonas avatar Nov 08 '23 17:11 darrelajonas

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

getsantry[bot] avatar Dec 01 '23 08:12 getsantry[bot]