Sentry update from 10.0.0 (Postgres11) to actual release

Hello. We have On-Premise Sentry v10.0.0 that we want to update to the latest version. However, we have a problem, this installation of Sentry v10.0.0 is used with Postgres 11.1 Docker image. In source files, docker-compose Sentry must use Postgres 9.6.

We cannot update Sentry because the update process is crashing.

If use the original docker-compose file on update to Sentry 21.6.0 (Postgres 9.6 Docker image):

**Trace ./install.sh:**
  File "/usr/local/lib/python3.6/site-packages/psycopg2/__init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: could not translate host name "postgres" to address: Temporary failure in name resolution

1
An error occurred, caught SIGERR on line 12
Cleaning up...
**Logs from Postgres (docker logs postgres9.6 docker image):**
Setting up Change Data Capture
Replication config already present in pg_hba. Not changing anything.

PostgreSQL Database directory appears to contain a database; Skipping initialization

FATAL:  "/var/lib/postgresql/data" is not a valid data directory
DETAIL:  File "/var/lib/postgresql/data/PG_VERSION" does not contain valid data.
HINT:  You might need to initdb.

If use the original docker-compose file on update to Sentry 21.6.0 (with Postgres 11.1 Docker image):

**Trace ./install.sh:**
10:57:44 [WARNING] sentry.utils.geo: Error opening GeoIP database: /geoip/GeoLite2-City.mmdb
10:57:44 [WARNING] sentry.utils.geo: Error opening GeoIP database in Rust: /geoip/GeoLite2-City.mmdb
10:57:48 [INFO] sentry.plugins.github: apps-not-configured
Error: It looks like you've skipped a hard stop in our upgrade process. Please follow the upgrade process here: https://develop.sentry.dev/self-hosted/#hard-stops
1
An error occurred, caught SIGERR on line 12
Cleaning up...
**Logs from Postgres (docker logs postgres11.1 docker image):**
Setting up Change Data Capture
Replication config already present in pg_hba. Not changing anything.
You need to install postgresql-server-dev-NN for building a server-side extension or libpq-dev for building a client-side application.
2021-07-21 11:46:11.631 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2021-07-21 11:46:11.631 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2021-07-21 11:46:11.764 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-07-21 11:46:12.114 UTC [32] LOG:  database system was shut down at 2021-07-21 10:57:50 UTC
2021-07-21 11:46:12.538 UTC [1] LOG:  database system is ready to accept connections
2021-07-21 11:46:23.800 UTC [1] LOG:  received smart shutdown request
2021-07-21 11:46:24.077 UTC [1] LOG:  background worker "logical replication launcher" (PID 38) exited with exit code 1
2021-07-21 11:46:24.077 UTC [33] LOG:  shutting down
2021-07-21 11:46:25.160 UTC [1] LOG:  database system is shut down

How can I update Sentry without losing my database? How can the situation be rectified so that this does not happen again in the future?
Thanks.

I think the only possible way is to export your data as SQL from Postgres 11 and then import it into a fresh Postgres 9.6 instance and use that.

Do not use unsupported Postgres versions in the first place? :slight_smile:

Unfortunately it didn’t work for me. When importing into Postgers 9.6, the data is received with errors.

Then I’m sorry, I just don’t know any other way than waiting till we add Postgres 11 support.

I had an idea to deploy a clean install Sentry 10.0.0, then to make a backup of the Sentry 10 (+ PostgreSQL11.1) and restore it on a clean version of the Sentry 10.

I followed the solution suggested by the link

but here, too, I failed:

root@a714bce927e9:/usr/src/sentry# sentry import /data/backup.json
22:30:34 [WARNING] sentry.utils.geo: settings.GEOIP_PATH_MMDB not configured.
22:30:37 [INFO] sentry.plugins.github: apps-not-configured
Traceback (most recent call last):
  File "/usr/local/bin/sentry", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/__init__.py", line 164, in main
    cli(prog_name=get_prog(), obj={}, max_content_width=100)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/decorators.py", line 30, in inner
    return ctx.invoke(f, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/commands/backup.py", line 15, in import_
    for obj in serializers.deserialize("json", src, stream=True, use_natural_keys=True):
  File "/usr/local/lib/python2.7/site-packages/django/core/serializers/json.py", line 85, in Deserializer
    six.reraise(DeserializationError, DeserializationError(e), sys.exc_info()[2])
  File "/usr/local/lib/python2.7/site-packages/django/core/serializers/json.py", line 79, in Deserializer
    for obj in PythonDeserializer(objects, **options):
  File "/usr/local/lib/python2.7/site-packages/django/core/serializers/python.py", line 174, in Deserializer
    raise base.DeserializationError.WithData(e, d['model'], d.get('pk'), field_value)
django.core.serializers.base.DeserializationError: Expecting value: line 1 column 2 (char 1): (sentry.apitoken:pk=1) field_value was '[u'event:admin', u'event:read', u'member:read', u'org:read', u'project:read', u'project:releases', u'team:read', u'project:write']'

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.