contrib-helm-chart icon indicating copy to clipboard operation
contrib-helm-chart copied to clipboard

Redash with external postgres throwing Database does not appear to be installed | kubernetes & Helm

Open Sameer1808 opened this issue 2 years ago • 1 comments

Hi Team,

we are trying to setup redash using helm chart on kubernetes with external postgres, for the same we are passing the postgres endpoint as a kubernetes secret, below is the config :

externalPostgreSQL: $(connectionString) externalPostgreSQLSecret: name: redash-postgres ## (kubernetes secret name) key: connectionString

Even tried to pass the above config as it is without substituting the variable just connectionString, but no luck.

but the redash-release-upgrade pods keep on going into error state, with the error as below:

"Status: Traceback (most recent call last):

File "/app/manage.py", line 9, in manager() 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/flask/cli.py", line 380, in main return AppGroup.main(self, *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/flask/cli.py", line 257, in decorator 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 "/app/redash/cli/init.py", line 49, in status print(simplejson.dumps(get_status(), indent=2)) File "/app/redash/monitor.py", line 63, in get_status status.update(get_object_counts()) File "/app/redash/monitor.py", line 16, in get_object_counts status['queries_count'] = Query.query.count() File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 3230, in count return self.from_self(col).scalar() File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2983, in scalar ret = self.one() File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2954, in one ret = self.one_or_none() File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2924, in one_or_none ret = list(self) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2995, in iter return self._execute_and_instances(context) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 3018, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 948, in execute return meth(self, multiparams, params) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement compiled_sql, distilled_params File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1200, in _execute_context context) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception exc_info File "/usr/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context context) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) relation "queries" does not exist LINE 3: FROM queries) AS anon_1 ^ [SQL: 'SELECT count() AS count_1 \nFROM (SELECT queries.query AS queries_query, queries.updated_at AS queries_updated_at, queries.created_at AS queries_created_at, queries.id AS queries_id, queries.version AS queries_version, queries.org_id AS queries_org_id, queries.data_source_id AS queries_data_source_id, queries.latest_query_data_id AS queries_latest_query_data_id, queries.name AS queries_name, queries.description AS queries_description, queries.query_hash AS queries_query_hash, queries.api_key AS queries_api_key, queries.user_id AS queries_user_id, queries.last_modified_by_id AS queries_last_modified_by_id, queries.is_archived AS queries_is_archived, queries.is_draft AS queries_is_draft, queries.schedule AS queries_schedule, queries.schedule_failures AS queries_schedule_failures, queries.options AS queries_options, queries.search_vector AS queries_search_vector, queries.tags AS queries_tags \nFROM queries) AS anon_1'] (Background on this error at: http://sqlalche.me/e/f405) Database does not appear to be installed. Waiting 10 seconds before retrying. Reached 5 attempts, giving up."

I logged into the redash-release-upgrade pod and checked the REDASH_DATABASE_URL env variable, which seems to be alright as per the docs i.e postgres://user:pass@host:5432/redash Even checked the connectivity by deploying a postgres sample pod in the same subnet and tried connecting to my external Postgres which as well works fine.

Regards, Sameer

Sameer1808 avatar Sep 02 '23 08:09 Sameer1808

(old thread, but still open, so let's try to answer it)

I'm using today's helm chart (master branch) + the latest "preview" docker image (24.06-dev) with basically the following HR values:

externalPostgreSQL: postgresql://redash:$(POSTGRESQL_PASSWORD)@pg-redash/redash
externalRedis: redis://:$(REDASH_REDIS_PASSWORD)@redis-redash:6379/
envSecretName: redash
postgresql:
  enabled: false   # disable the integrated PG server
redis:
  enabled: false   # disable the integrated Redis server

And the redash secret looks like that:

kind: Secret
metadata:
  name: redash
data:
  POSTGRESQL_PASSWORD: mySecretPassword
  REDASH_REDIS_PASSWORD: my2ndSecretPassword
  ...

And it works fine with my external postgresql (a cloudsql on GCP) 😃

So, I'm not putting the whole connection-string in the secret as you, but only the password. Maybe it explains the issue ?

Also, when comparing with your config, I see a subtle difference in syntax:

  • you: postgres://
  • mine: postgresql://

I don't know if really relevant, but maybe also something to try 🤷

frivoire avatar Jun 20 '24 13:06 frivoire