Skip to content

9.1.2 install problem missing postgres #493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jbjuin opened this issue May 14, 2020 · 9 comments
Closed

9.1.2 install problem missing postgres #493

jbjuin opened this issue May 14, 2020 · 9 comments

Comments

@jbjuin
Copy link

jbjuin commented May 14, 2020

Dear Sentry community,
first of all thank you for this wonderful tool.

I encountered a problem installing sentry 9.1.2 on ubuntu.
I followed the step in the README.

  • git clone
  • git checkout 9.1.2
  • ./install.sh

Docker version 19.03.6, build 369ce74a3c
docker-compose version 1.25.0, build unknown
ubuntu 20.04

Docker-compose file is the default one:

# NOTE: This docker-compose.yml is meant to be just an example of how
# you could accomplish this on your own. It is not intended to work in
# all use-cases and must be adapted to fit your needs. This is merely
# a guideline.

# See docs.getsentry.com/on-premise/server/ for full
# instructions

version: '3.4'

x-defaults: &defaults
  restart: unless-stopped
  build:
    context: .
  depends_on:
    - redis
    - postgres
    - memcached
    - smtp
  env_file: .env
  environment:
    SENTRY_MEMCACHED_HOST: memcached
    SENTRY_REDIS_HOST: redis
    SENTRY_POSTGRES_HOST: postgres
    SENTRY_EMAIL_HOST: smtp
  volumes:
    - sentry-data:/var/lib/sentry/files


services:
  smtp:
    restart: unless-stopped
    image: tianon/exim4

  memcached:
    restart: unless-stopped
    image: memcached:1.5-alpine

  redis:
    restart: unless-stopped
    image: redis:3.2-alpine

  postgres:
    restart: unless-stopped
    image: postgres:9.5
    volumes:
      - sentry-postgres:/var/lib/postgresql/data

  web:
    <<: *defaults
    ports:
      - '9000:9000'

  cron:
    <<: *defaults
    command: run cron

  worker:
    <<: *defaults
    command: run worker


volumes:
    sentry-data:
      external: true
    sentry-postgres:
      external: true

Console output with stacktrace is the following:

Checking minimum requirements...

Creating volumes for persistent storage...
Created sentry-data.
Created sentry-postgres.

.env already exists, skipped creation.

Building and tagging Docker images...

smtp uses an image, skipping
memcached uses an image, skipping
redis uses an image, skipping
postgres uses an image, skipping
Building web
Step 1/2 : ARG SENTRY_IMAGE
Step 2/2 : FROM ${SENTRY_IMAGE:-sentry:9.1.2}-onbuild
# Executing 4 build triggers
 ---> Running in 8950cc97cbca
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Removing intermediate container 8950cc97cbca
 ---> Running in 4b949ea2cc86
Removing intermediate container 4b949ea2cc86
 ---> Running in f832130f50bc
Removing intermediate container f832130f50bc
 ---> db94b17c0d6d

Successfully built db94b17c0d6d
Successfully tagged onpremise_web:latest
Building cron
Step 1/2 : ARG SENTRY_IMAGE
Step 2/2 : FROM ${SENTRY_IMAGE:-sentry:9.1.2}-onbuild
# Executing 4 build triggers
 ---> Using cache
 ---> Using cache
 ---> Using cache
 ---> Using cache
 ---> db94b17c0d6d

Successfully built db94b17c0d6d
Successfully tagged onpremise_cron:latest
Building worker
Step 1/2 : ARG SENTRY_IMAGE
Step 2/2 : FROM ${SENTRY_IMAGE:-sentry:9.1.2}-onbuild
# Executing 4 build triggers
 ---> Using cache
 ---> Using cache
 ---> Using cache
 ---> Using cache
 ---> db94b17c0d6d

Successfully built db94b17c0d6d
Successfully tagged onpremise_worker:latest

Docker images built.

Generating secret key...
Secret key written to .env

Setting up database...
Starting onpremise_smtp_1 ... done
Starting onpremise_redis_1     ... done
Starting onpremise_memcached_1 ... done
Starting onpremise_postgres_1  ... done
20:27:32 [WARNING] sentry.utils.geo: settings.GEOIP_PATH_MMDB not configured.
20:27:36 [INFO] sentry.plugins.github: apps-not-configured
Syncing...
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 162, 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 36, 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/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 75, in upgrade
    _upgrade(not noinput, traceback, verbosity, not no_repair)
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/commands/upgrade.py", line 30, in _upgrade
    ignore_ghost_migrations=True,
  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 119, in handle_noargs
    self.sync_apps(apps_needing_sync, app_name_to_app_map, options)
  File "/usr/local/lib/python2.7/site-packages/south/management/commands/syncdb.py", line 174, in sync_apps
    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 57, in handle_noargs
    cursor = connection.cursor()
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 162, in cursor
    cursor = util.CursorWrapper(self._cursor(), self)
  File "/usr/local/lib/python2.7/site-packages/sentry/db/postgres/decorators.py", line 44, in inner
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/sentry/db/postgres/base.py", line 95, in _cursor
    cursor = super(DatabaseWrapper, self)._cursor()
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 132, in _cursor
    self.ensure_connection()
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 127, in ensure_connection
    self.connect()
  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/__init__.py", line 127, in ensure_connection
    self.connect()
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 115, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 115, in get_new_connection
    return Database.connect(**conn_params)
  File "/usr/local/lib/python2.7/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: Name or service not known

Cleaning up...

Any idea ?

@jarrin
Copy link

jarrin commented May 15, 2020

I'm having the same issue. Any help would be appreciated.

@VentyCZ
Copy link

VentyCZ commented May 15, 2020

Changing docker-compose.yml fixed it, will try full installation now, but the postgres container starts!
See the new environment section below:

postgres:
  restart: unless-stopped
  image: postgres:9.5
  environment:
    - POSTGRES_HOST_AUTH_METHOD=trust
  volumes:
    - sentry-postgres:/var/lib/postgresql/data

--- OLD MESSAGE ---

Got an update on the issue, postgres just does not want to start because of ... misconfiguration ?

postgres_1   | Error: Database is uninitialized and superuser password is not specified.
postgres_1   |        You must specify POSTGRES_PASSWORD to a non-empty value for the
postgres_1   |        superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
postgres_1   |
postgres_1   |        You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
postgres_1   |        connections without a password. This is *not* recommended.
postgres_1   |
postgres_1   |        See PostgreSQL documentation about "trust":
postgres_1   |        https://www.postgresql.org/docs/current/auth-trust.html
sentry_postgres_1 exited with code 1

@VentyCZ
Copy link

VentyCZ commented May 15, 2020

The edit from previous comment worked, got fully working installation!

@jbjuin
Copy link
Author

jbjuin commented May 16, 2020

Yep ! It seems to work... I wonder if there is a real security issue here that could be avoided by a cleaner fix ?

@VentyCZ
Copy link

VentyCZ commented May 16, 2020

Yep ! It seems to work... I wonder if there is a real security issue here that could be avoided by a cleaner fix ?

It's a security issue, if you are running postgres outside of a container ...
Because postgres is running without the need of a password, everyone would be able to access/change the data in the database.
But, because it is running in a container - isolated from the rest of the network - it SHOULD be fine :)

@BYK
Copy link
Member

BYK commented May 18, 2020

I think this is due to docker-library/postgres#658. I'm going to close this out as we are not planning to service or update the 9.1.2.

Will reconsider if this keeps coming up but I wonder why you haven't preferred the latest version which has a lot more to offer than 9.1.2?

@BYK BYK closed this as completed May 18, 2020
@jbjuin
Copy link
Author

jbjuin commented May 18, 2020

Thank you for pointing to the origin of the issue !

"A lot more" may sometime be too much.

I don't need a large scale installation, few internal apps to monitor, few customer apps. To be honest, before finding out that the 9.1.2 was still available, I was looking for a simpler alternative - but couldn't find one. I just need dedupe exceptions & create an issue in gitlab. I don't need to manage all my deployments in sentry... I already have gitlab for all this stuff.

I'm quite sure it fits the need for many companies & teams but installing & running 22 services in 10 instead of 7 in 9.1.2 was kind of surprising when I looked at the compose file.

Again nothing against this wonderful piece of software (that I used early back then). I just feel that it may be too much for my needs.

Thanks again !

@BYK
Copy link
Member

BYK commented May 18, 2020

I don't need to manage all my deployments in sentry... I already have gitlab for all this stuff.

They serve different purposes but I see your point regarding the complexity 🙂

I'm quite sure it fits the need for many companies & teams but installing & running 22 services in 10 instead of 7 in 9.1.2 was kind of surprising when I looked at the compose file.

This is good feedback, thank you. Most of those new "services" are message processors detached from the main app. The terminology compose uses makes them seem heavier than they are. I think we may think about making some of these optional (such as Symbolicator, if you are not using native crash reports).

@VentyCZ
Copy link

VentyCZ commented May 18, 2020

I think this is due to docker-library/postgres#658. I'm going to close this out as we are not planning to service or update the 9.1.2.

Will reconsider if this keeps coming up but I wonder why you haven't preferred the latest version which has a lot more to offer than 9.1.2?

For me, I was migrating my old Python setup to a new server and Sentry v10.
So I had to first replicate the setup I had (9.1.2) in Docker and then migrate to v10.

I can safely say, no problems arise after migrating! (I did not migrate events though, just the important stuff like users and projects - wanted to keep the DSNs the same)

@github-actions github-actions bot locked and limited conversation to collaborators Dec 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants