Trying to install 9.1.2 version - method 2

Hello,

So I managed to get 9.1.2 from a tar file in github, but during the installation process by using the ./install.sh, on the line that calls:
docker-compose run --rm web upgrade
I get the following errors:

Setting up database...
Starting onpremise-912_smtp_1     ... done
Starting onpremise-912_postgres_1 ... done
Starting onpremise-912_redis_1    ... done
Starting onpremise-912_memcached_1 ... done
13:21:18 [WARNING] sentry.utils.geo: settings.GEOIP_PATH_MMDB not configured.
13:21:20 [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: No address associated with hostname

I googled a lot for this “could not translate host name “postgres” to address: No address associated with hostname” but couldn’t find the solution to work.
Can you help me please?
Thanks!

You really don’t need to dig that much, we have this to help you: GitHub - getsentry/self-hosted at 9.1.2

This indicates a network/DNS problem with your Docker container so I’d look there to see what’s going wrong.

Hi BYK.

Thank you for replying to my post.
I’m not sure what to do in order to check if the problem is indeed the DNS service.
I’ve looked at my /etc/resolv.conf file, and to my /etc/hosts, and couldn’t find any problem.
Do you recommend me to look somewhere else?

Many thanks!

It looks similar to this issue:

I searched for “docker-compose dns not working”.

Hy BYK,

I failed trying to solve the DNS issue.

Can you please let me know if I am even on the right way to install 9.1.2 sentry?

On the github page provided by you , it says “Latest commit e2b7c74 on Nov 6, 2019”, so I supose this is the commit I need to install for sentry 9.1.2 and I should use “git checkout e2b7c74”

Steps:
git clone https://github.com/getsentry/onpremise.git
cd onpremise
git checkout e2b7c74
HEAD is now at e2b7c74 meta(LICENSE): Switch to Business Source License 1.1 (#267)
./install

But the error “django.db.utils.OperationalError: could not translate host name “postgres” to address: No address associated with hostname” still persists.

I tried installing locally on hyper-v, and in google cloud, and on aws, using both centos 7 and ubuntu 16. It’s hard to believe on all of them I have DNS problems :frowning:

Maybe the process of installation done by me is incorrect?

Thank you very much,
Catalin

There’s a tag for 9.1.2 so you should be able to do git checkout 9.1.2. That resolves to the same commit anyway so, yeah what you did was correct.

The installation method seems correct. The error you are getting is related to Docker compose networking as I mentioned earlier. I think the way you are installing or configuring your Docker and Docker Compose is the root of the issue.

FWIW, I had the same error when I was trying to upgrade a sentry installation to 9.1.2. In my case it was because the postgres container wasn’t starting up properly. If you do sudo docker ps, you might see the postgres container’s uptime is just a few seconds, meaning it’s failing to start and then restarting over and over. Try doing something like docker logs postgres (not sure of the exact command) to see what the error might be. In my case postgres was refusing to start without a superuser password being set.

1 Like

Oh, right this is a somewhat recent change and required a new environment variable to be passed:

Regarding logs and status, you can use the docker-compose versions of these commands for easier access:

docker-compose ps
docker-compose logs postgres
1 Like

Yes, the postgres container keeps restarting:

[root@sentry9 onpremise]# docker ps
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS                          PORTS                    NAMES
810291b91ccd        onpremise_web          "/entrypoint.sh run …"   2 minutes ago       Up 2 minutes                    0.0.0.0:9000->9000/tcp   onpremise_web_1
d1aad5cb5771        onpremise_cron         "/entrypoint.sh run …"   2 minutes ago       Up 2 minutes                    9000/tcp                 onpremise_cron_1
b10053da1b61        onpremise_worker       "/entrypoint.sh run …"   2 minutes ago       Up 2 minutes                    9000/tcp                 onpremise_worker_1
f9650cf55dcb        postgres:9.5           "docker-entrypoint.s…"   5 minutes ago       Restarting (1) 55 seconds ago                            onpremise_postgres_1
78236edffeb5        memcached:1.5-alpine   "docker-entrypoint.s…"   5 minutes ago       Up 2 minutes                    11211/tcp                onpremise_memcached_1
fcb9b2975485        tianon/exim4           "docker-entrypoint.s…"   5 minutes ago       Up 2 minutes                    25/tcp                   onpremise_smtp_1
698aeaa6d821        redis:3.2-alpine       "docker-entrypoint.s…"   5 minutes ago       Up 2 minutes                    6379/tcp                 onpremise_redis_1

Indeed docker logs container_id (postres one) outputs the password error:

Error: Database is uninitialized and superuser password is not specified.
           You must specify POSTGRES_PASSWORD to a non-empty value for the
           superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".

You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
connections without a password. This is *not* recommended.
See PostgreSQL documentation about "trust":
https://www.postgresql.org/docs/current/auth-trust.html

I’ve tried editing the “.env” file using POSTGRES_PASSWORD=postgres and it didn’t work.
Then I tried editing the “.env” file using POSTGRES_HOST_AUTH_METHOD=trust and it didn’t work either.

Isn’t this the way to do it?
Thank you!

Thank you @vkurup and @BYK for guiding me on the road to solve it.
I have managed to make it work by doing the following:

edit the docker-compose.yml before executing the install.sh script.
On the postgres line
replace from:

postgres:

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

to:

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

Then, I have executed the install.sh script and it worked.
Maybe in the future, someone will need it too.

Regards and thanks!
Catalin

2 Likes