Error on initializing fresh instance

Hi.

I’m using Docker to install and run Sentry. This is docker-compose.yml file:

version: '2'
services:
    redis:
        image: redis:3.0-alpine
        volumes:
           - ./data/redis:/data
        restart: always
        env_file: .env

    postgres:
        image: postgres:9.6-alpine
        volumes:
            - ./data/postgres:/var/lib/postgresql/data
        restart: always
        env_file: .env

    sentry:
        image: sentry:8.10
        links:
            - postgres
            - redis
        restart: always
        env_file: .env

.env file:

# postgres config
POSTGRES_DB=sentry
POSTGRES_USER=sentry
POSTGRES_PASSWORD=some-password

# sentry
## common
SENTRY_SECRET_KEY=some-secret-key
 
## links
### postgres
SENTRY_POSTGRES_HOST=postgres
SENTRY_DB_NAME=sentry
SENTRY_DB_USER=sentry
SENTRY_DB_PASSWORD=some-password
### redis
SENTRY_REDIS_HOST=redis

## email
SENTRY_EMAIL_HOST=some-host
SENTRY_EMAIL_PORT=587
SENTRY_EMAIL_USER=sentry
SENTRY_EMAIL_PASSWORD=some-password
SENTRY_EMAIL_USE_TLS=false

Then, when postgres and redis containers started, I’m running docker-compose run --rm setry bash and inside container execute sentry upgrade. Output:

root@41f62c31d706:/# sentry upgrade
Syncing...
Traceback (most recent call last):
  File "/usr/local/bin/sentry", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/__init__.py", line 158, in main
    cli(prog_name=get_prog(), obj={}, max_content_width=100)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 534, 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 36, in inner
    return ctx.invoke(f, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 534, 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/commands/upgrade.py", line 60, in upgrade
    _upgrade(not noinput, traceback, verbosity, not no_repair)
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/commands/upgrade.py", line 20, in _upgrade
    verbosity=verbosity,
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 159, in call_command
    return klass.execute(*args, **defaults)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
    return self.handle_noargs(**options)
  File "/usr/local/lib/python2.7/site-packages/south/management/commands/syncdb.py", line 92, in handle_noargs
    syncdb.Command().execute(**options)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
    return self.handle_noargs(**options)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 60, in handle_noargs
    tables = connection.introspection.table_names()
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 1226, in table_names
    return sorted(self.get_table_list(cursor))
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/introspection.py", line 39, in get_table_list
    AND pg_catalog.pg_table_is_visible(c.oid)""")
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/util.py", line 51, in execute
    return self.cursor.execute(sql)
  File "/usr/local/lib/python2.7/site-packages/sentry/db/postgres/decorators.py", line 75, in inner
    raise_the_exception(self.db, e)
  File "/usr/local/lib/python2.7/site-packages/sentry/db/postgres/decorators.py", line 73, in inner
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/sentry/db/postgres/decorators.py", line 21, in inner
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/sentry/db/postgres/decorators.py", line 95, in inner
    six.reraise(exc_info[0], exc_info[0](msg), exc_info[2])
  File "/usr/local/lib/python2.7/site-packages/sentry/db/postgres/decorators.py", line 88, in inner
    return func(self, sql, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/sentry/db/postgres/base.py", line 40, in execute
    return self.cursor.execute(sql)
django.db.utils.InternalError: InternalError('current transaction is aborted, commands ignored until end of transaction block\n',)
SQL: 
            SELECT c.relname
            FROM pg_catalog.pg_class c
            LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
            WHERE c.relkind IN ('r', 'v', '')
                AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
                AND pg_catalog.pg_table_is_visible(c.oid)

Previously, I had no experience with PostresSQL, so maybe my problem is too stupid… What I’m doing wrong?

Can you try again Postgres 9.5 and the non-Alpine version? It’s unclear why this would happen, but we’ve never run again 9.6 or the Alpine variant since it’s really new. So there might be something different there.

Yes, using 9.5 non-alpine version solved problem. Thanks for help!