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

Failed to upgrade Sentry , now have sql errors

Open LipSoft opened this issue 5 years ago • 11 comments

Version

21.8.0.dev0

Steps to Reproduce

I had an existing installation of sentry and tried to upgrade using install.sh

Expected Result

updated version of sentry

Actual Result

Creating sentry_onpremise_snuba-subscription-consumer-transactions_1 ... done
Creating sentry_onpremise_web_run                                    ... 
Creating sentry_onpremise_web_run                                    ... done
14:06:15 [INFO] sentry.plugins.github: apps-not-configured
Running migrations for default
Traceback (most recent call last):
  File "/usr/local/bin/sentry", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/sentry/runner/__init__.py", line 197, in main
    func(**kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/sentry/runner/decorators.py", line 29, in inner
    return ctx.invoke(f, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/sentry/runner/commands/upgrade.py", line 100, in upgrade
    _upgrade(not noinput, traceback, verbosity, not no_repair, with_nodestore)
  File "/usr/local/lib/python3.6/site-packages/sentry/runner/commands/upgrade.py", line 56, in _upgrade
14:06:16 [ERROR] sentry_sdk.errors: Unexpected status code: 502 (body: b'<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>nginx/1.21.0</center>\r\n</body>\r\n</html>\r\n')
    verbosity=verbosity,
  File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 148, in call_command
    return command.execute(*args, **defaults)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 85, in handle
    executor.loader.check_consistent_history(connection)
  File "/usr/local/lib/python3.6/site-packages/django/db/migrations/loader.py", line 297, in check_consistent_history
    connection.alias,
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration social_auth.0001_initial is applied before its dependency sentry.0001_squashed_0200_release_indices on database 'default'.
An error occurred, caught SIGERR on line 12
Cleaning up...

2021-08-15T13:51:40.265069714Z django.db.utils.ProgrammingError: ProgrammingError('column "adopted" of relation "sentry_release_project" does not exist\nLINE 1: ...oject" ("project_id", "release_id", "new_groups", "adopted",...\n ^\n',)

LipSoft avatar Aug 15 '21 14:08 LipSoft

Our upgrade from 21.7.0 to 21.8.0 failed as well (but unfortunately I didn't capture the error log). Rolling back to 21.7.0 didn't work either because of inconsistent database state...

chrisvdb avatar Aug 16 '21 14:08 chrisvdb

@LipSoft Were you also upgrading from 21.7.0?

@chrisvdb Is your inconsistent database state the same as @LipSoft's?

chadwhitacre avatar Aug 16 '21 23:08 chadwhitacre

@chadwhitacre Most likely yes , my installation is only 1 or 2 months old.

Some projects are working and getting issues , the Web ones.

The nodejs and React Native i get errors of sql

but not 100% all issues are recorded , some projects i cant even open on the app

image

LipSoft avatar Aug 17 '21 08:08 LipSoft

@LipSoft since you are not sure, can you try going to 21.6.3 first and then jumping to 21.8.0?

@chrisvdb - I recommend filing a new issue as yours doesn't seem very related to this one.

BYK avatar Aug 17 '21 12:08 BYK

@BYK could you provide me the steps ?

I don't know how to "rollback" versions

LipSoft avatar Aug 17 '21 12:08 LipSoft

@LipSoft you just checkout the 21.6.3 tag from this repo and run ./install.sh :)

BYK avatar Aug 17 '21 12:08 BYK

@BYK So i was able to run 21.6.3 , and its up , can i upgrade to latest version now ?

LipSoft avatar Aug 17 '21 16:08 LipSoft

@BYK Edit : was able to install 21.7.0 So something is strange when i go to 21.8.0 i get an error , but i cant find out what it is

root@Server:~/sentry# git checkout tags/21.8.0
Previous HEAD position was 4da1069 release: 21.6.3
HEAD is now at 9327228 release: 21.8.0
root@Server:~/sentry# ./install.sh 
▶ Parsing command line ...

▶ Setting up error handling ...

▶ Checking minimum requirements ...
Define and run multi-container applications with Docker.

Usage:
  docker-compose [-f <arg>...] [options] [--] [COMMAND] [ARGS...]
  docker-compose -h|--help

Options:
  -f, --file FILE             Specify an alternate compose file
                              (default: docker-compose.yml)
  -p, --project-name NAME     Specify an alternate project name
                              (default: directory name)
  -c, --context NAME          Specify a context name
  --verbose                   Show more output
  --log-level LEVEL           Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  --no-ansi                   Do not print ANSI control characters
  -v, --version               Print version and exit
  -H, --host HOST             Daemon socket to connect to

  --tls                       Use TLS; implied by --tlsverify
  --tlscacert CA_PATH         Trust certs signed only by this CA
  --tlscert CLIENT_CERT_PATH  Path to TLS certificate file
  --tlskey TLS_KEY_PATH       Path to TLS key file
  --tlsverify                 Use TLS and verify the remote
  --skip-hostname-check       Don't check the daemon's hostname against the
                              name specified in the client certificate
  --project-directory PATH    Specify an alternate working directory
                              (default: the path of the Compose file)
  --compatibility             If set, Compose will attempt to convert keys
                              in v3 files to their non-Swarm equivalent (DEPRECATED)
  --env-file PATH             Specify an alternate environment file

Commands:
  build              Build or rebuild services
  config             Validate and view the Compose file
  create             Create services
  down               Stop and remove containers, networks, images, and volumes
  events             Receive real time events from containers
  exec               Execute a command in a running container
  help               Get help on a command
  images             List images
  kill               Kill containers
  logs               View output from containers
  pause              Pause services
  port               Print the public port for a port binding
  ps                 List containers
  pull               Pull service images
  push               Push service images
  restart            Restart services
  rm                 Remove stopped containers
  run                Run a one-off command
  scale              Set number of containers for a service
  start              Start services
  stop               Stop services
  top                Display the running processes
  unpause            Unpause services
  up                 Create and start containers
  version            Show version information and quit
An error occurred, caught SIGERR on line 11
Cleaning up...

LipSoft avatar Aug 17 '21 16:08 LipSoft

@LipSoft That looks like #1062, you need to upgrade docker-compose.

chadwhitacre avatar Aug 17 '21 16:08 chadwhitacre

@chadwhitacre should be fixed now , i'm on 21.8.0 thanks all

LipSoft avatar Aug 17 '21 17:08 LipSoft

Awesome, glad you got it sorted @LipSoft. :)

chadwhitacre avatar Aug 17 '21 18:08 chadwhitacre