Problems connecting with Indico Postgres Database (SOLVED!)

Hi,

When I try to execute: indico db prepare in Indico Installation, I get the following:

(env) [fpramos@IndicoProd01 indico]$ indico db prepare
Traceback (most recent call last):
  File "/home/fpramos/dev/indico/env/bin/indico", line 11, in <module>
    load_entry_point('indico', 'console_scripts', 'indico')()
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/flask/cli.py", line 569, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/fpramos/dev/indico/src/indico/cli/util.py", line 110, in invoke
    return self._impl.invoke(ctx)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/flask/cli.py", line 419, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/fpramos/dev/indico/src/indico/cli/database.py", line 49, in prepare
    return prepare_db()
  File "/home/fpramos/dev/indico/src/indico/core/db/sqlalchemy/migration.py", line 84, in prepare_db
    if not _require_pg_version('9.6'):
  File "/home/fpramos/dev/indico/src/indico/core/db/sqlalchemy/migration.py", line 66, in _require_pg_version
    cur_version = db.engine.execute("SELECT current_setting('server_version_num')::int").scalar()
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2165, in execute
    connection = self._contextual_connect(close_with_result=True)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2226, in _contextual_connect
    self._wrap_pool_connect(self.pool.connect, None),
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2266, in _wrap_pool_connect
    e, dialect, self
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1536, in _handle_dbapi_exception_noconnection
    util.raise_from_cause(sqlalchemy_exception, exc_info)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 399, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2262, in _wrap_pool_connect
    return fn()
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 363, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 760, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 492, in checkout
    rec = pool._do_get()
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/pool/impl.py", line 139, in _do_get
    self._dec_overflow()
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/pool/impl.py", line 136, in _do_get
    return self._create_connection()
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 308, in _create_connection
    return _ConnectionRecord(self)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 437, in __init__
    self.__connect(first_connect_check=True)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 639, in __connect
    connection = pool._invoke_creator(self)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 451, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/home/fpramos/dev/indico/env/lib/python2.7/site-packages/psycopg2/__init__.py", line 126, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL:  Ident authentication failed for user "indico"

(Background on this error at: http://sqlalche.me/e/e3q8)

I already checked the user that is on the file: vim ~/dev/indico/src/indico/indico.conf
and it is correct:

SQLALCHEMY_DATABASE_URI = 'postgresql://indico:PASSWORDHERE@localhost:5432/indico'

What can I do?

If I want to recreate users and databases what is the sequence of commands I should run?

Try postgresql:///indico as the connection string; for a local connection you don’t have/need a password by default (ident authentication means the linux system username is used, and over a unix socket that’s secure since you can’t fake that username).

1 Like

Thanks a million!! It worked!!