Mailu / helm-charts

Development repo for helm charts
126 stars 130 forks source link

fix(admin): relation "domain" does not exist for postgres #320

Closed jjangga0214 closed 9 months ago

jjangga0214 commented 10 months ago

I know the team officially recommends SQLite because RDB is only used for static config, but anyway I tried using external Postgres.

Environment & Version

Description

I think initializing database schema has an issue.

Replication Steps

Install the official helm chart(v1.5.0) and configure to use external postgres database. For example,

      externalDatabase:
          enabled: true
          type: postgresql
          host: postgresql-ha-pgpool.postgresql-ha.svc.cluster.local
          port: 5432
    # ....

Observed behaviour

See log. It has a problem. But the more strange thing is that admin starts to work. I think it should refuse to say ok from health check for readiness.

Expected behaviour

It should just work.

Logs

This log is from admin.

LINE 2: FROM domain
             ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/venv/lib/python3.10/site-packages/flask/app.py", line 2529, in wsgi_app
    response = self.full_dispatch_request()
  File "/app/venv/lib/python3.10/site-packages/flask/app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/app/venv/lib/python3.10/site-packages/flask_restx/api.py", line 674, in error_router
    return original_handler(e)
  File "/app/venv/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "/app/venv/lib/python3.10/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/app/mailu/internal/views/rspamd.py", line 31, in rspamd_local_domains
    return '\n'.join(domain[0] for domain in models.Domain.query.with_entities(models.Domain.name).all() + models.Alternative.query.with_entities(models.Alternative.name).all())
  File "/app/venv/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2772, in all
    return self._iter().all()
  File "/app/venv/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2907, in _iter
    result = self.session.execute(
  File "/app/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1714, in execute

relation "domain" does not exist 
github-actions[bot] commented 9 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.