Record a sentry upgrade history

Keywords: Web Server Docker Nginx git iOS

Start at: My blog

cause

IOS colleagues said he found a bug in sentry. It was said that the debug file prompt was uploaded successfully because of the bug of 9.0.0, but the website found that there was no upload at all. So I started my upgrade.

Investigation and research

Because my Sentry is not only used on the server side, but also on the client side. So I need to figure out how to solve the problem of request waiting if sentry stops.

Nginx

So my first thought is to modify the configuration file of nginx.

Here's my update

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

    set_real_ip_from 127.0.0.1;
    real_ip_header X-Forwarded-For;
    real_ip_recursive on;

    location / {
        // Add these two lines
        default_type text/html; // Setting content-type indicates that this is a web page
        return 202; # Return 202 indicates that it has been received, but not processed
        client_max_body_size    100M;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header Host-Real-IP  $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-Pcol http;
        proxy_pass http://localhost:10000;
    }
}

Using these two lines ensures that the client requests the data normally, but I discard it. Ensure the normal browsing of the client.

sentry upgrade

The next step is to upgrade sentry.

First, go to the specified directory

cd /data/

Backup the relevant directories (backup is a good habit, don't discard it)

cp -r onpremise onpremise2

Then enter the directory

cd onpremise

Stop sentry running

docker-compose down

Pull up-to-date code

git pull

The following errors may be prompted at this time:

error: Your local changes to the following files would be overwritten by merge:
    docker-compose.yml
Please commit your changes or stash them before you merge.

First, we diff the content to see the modified part:

git diff docker-compose.yml

Record the output to restore the file after updating the code.

This is because you have modified the document. However, the file is tracked, so it needs to be restored first, then pulled again to execute the following code:

git checkout docker-compose.yml
git pull

When the execution is completed, it means that the latest version library has been pulled successfully.

Now we need to restore the docker-compse.yml content of the configuration.

The next step is to set the environment variables:

export SENTRY_IMAGE='sentry:9.1.2'

Why do you set it up like this? Because by reading the Dockerfile file, you can see that it needs to read the environment variable SENTRY_IMAGE to pull the relevant docker file.

Build our services again

docker-compose build --pull

In operation, you may be prompted:

09:31:05 [WARNING] sentry.utils.geo: settings.GEOIP_PATH_MMDB not configured.

This prompt should not have the address of the GEO database configured. No matter what, we can study it later.

Now it's time to perform the migration:

docker-compose run --rm web upgrade

The following message may be prompted during migration:

The following content types are stale and need to be deleted:

    sentry | dsymapp
    sentry | versiondsymfile
    sentry | projectdsymfile
    sentry | grouphashtombstone

Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
If you're unsure, answer 'no'.

    Type 'yes' to continue, or 'no' to cancel:

Because I don't know what happened. So my answer is no.

When the migration is complete, the startup service is left:

docker-compose up -d

Business as usual.

Finally, we cancel our nginx 202 response and restart nginx to ok ay.

summary

After re-entry, some changes were found in the UI. And the IOS Big Brother's problem has been solved. But there are also some problems, that is, there are no statistical bug statistics. It doesn't matter, as long as the bug data is still there.

Through this upgrade, I know a lot of things, which is very helpful for my growth.

Posted by ajfton on Wed, 07 Aug 2019 08:06:11 -0700