这是indexloc提供的服务,不要输入任何密码
Skip to content

cannot start pgAdmin container with external database for pgAdmin user settings #7556

@aremund

Description

@aremund

Describe the bug

I configured pgAdmin to use PostgreSQL instead of SQLite for user settings. Now, it cannot start up anymore.

To Reproduce

Steps to reproduce the behavior:

  1. create database pgadmindb
  2. create schema pgadmin
  3. deploy pgAdmin with the following deployment.yaml file
kind: Deployment
apiVersion: apps/v1
metadata:
  name: pgadmin
spec:
  selector:
   matchLabels:
    app: pgadmin
  replicas: 1
  template:
    metadata:
      labels:
        app: pgadmin
    spec:
      containers:
      - name: pgadmin4
        image: dpage/pgadmin4:8.8
        imagePullPolicy: IfNotPresent
        env:
        - name: PGADMIN_DEFAULT_EMAIL
          value: test@test.com
        - name: PGADMIN_DEFAULT_PASSWORD
          value: testsecret
        - name: PGADMIN_CONFIG_CONFIG_DATABASE_URI
          value: "'postgresql://pgadmin:secret@db-host:5432/pgadmindb?options=-csearch_path=pgadmin'"

Expected behavior

pgAdmin should successfully create the tables in the empty database and then start.

Error message

On the database pgadmindb

2024-06-07 19:28:14.142 CEST [2133648] pgadmin@pgadmindb ERROR:  relation "version" does not exist at character 75
2024-06-07 19:28:14.142 CEST [2133648] pgadmin@pgadmindb STATEMENT:  SELECT version.name AS version_name, version.value AS version_value
        FROM version
        WHERE version.name = $1::VARCHAR
         LIMIT $2::INTEGER
2024-06-07 19:28:14.550 CEST [2133648] pgadmin@pgadmindb LOG:  could not receive data from client: Connection reset by peer

In the Container-Log:

2024-06-07 17:27:42,133: INFO	pgadmin:	########################################################
2024-06-07 17:27:42,133: INFO	pgadmin:	Starting pgAdmin 4 v8.8...
2024-06-07 17:27:42,133: INFO	pgadmin:	########################################################
2024-06-07 17:27:42,133: DEBUG	pgadmin:	Python syspath: ['/pgadmin4', '/venv/bin', '/pgadmin4', '/usr/lib/python312.zip', '/usr/lib/python3.12', '/usr/lib/python3.12/lib-dynload', '/venv/lib/python3.12/site-packages', '/usr/lib/python3.12/site-packages']
NOTE: Configuring authentication for SERVER mode.

Enter the email address and password to use for the initial pgAdmin user account:

[2024-06-07 17:27:42 +0000] [90] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/venv/lib/python3.12/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker
    worker.init_process()
  File "/venv/lib/python3.12/site-packages/gunicorn/workers/gthread.py", line 95, in init_process
    super().init_process()
  File "/venv/lib/python3.12/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/venv/lib/python3.12/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
                ^^^^^^^^^^^^^^^
  File "/venv/lib/python3.12/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
                    ^^^^^^^^^^^
  File "/venv/lib/python3.12/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
           ^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.12/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.12/site-packages/gunicorn/util.py", line 371, in import_app
    mod = importlib.import_module(module)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/pgadmin4/run_pgadmin.py", line 4, in <module>
    from pgAdmin4 import app
  File "/pgadmin4/pgAdmin4.py", line 103, in <module>
    app = create_app()
          ^^^^^^^^^^^^
  File "/pgadmin4/pgadmin/__init__.py", line 471, in create_app
    run_migration_for_others()
  File "/pgadmin4/pgadmin/__init__.py", line 456, in run_migration_for_others
    db_upgrade(app)
  File "/pgadmin4/pgadmin/setup/db_upgrade.py", line 25, in db_upgrade
    flask_migrate.upgrade(migration_folder)
  File "/venv/lib/python3.12/site-packages/flask_migrate/__init__.py", line 111, in wrapped
    f(*args, **kwargs)
  File "/venv/lib/python3.12/site-packages/flask_migrate/__init__.py", line 200, in upgrade
    command.upgrade(config, revision, sql=sql, tag=tag)
  File "/venv/lib/python3.12/site-packages/alembic/command.py", line 403, in upgrade
    script.run_env()
  File "/venv/lib/python3.12/site-packages/alembic/script/base.py", line 583, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/venv/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 95, in load_python_file
    module = load_module_py(module_id, path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 113, in load_module_py
    spec.loader.exec_module(module)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pgadmin4/pgadmin/setup/../../migrations/env.py", line 95, in <module>
    run_migrations_online()
  File "/pgadmin4/pgadmin/setup/../../migrations/env.py", line 87, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/venv/lib/python3.12/site-packages/alembic/runtime/environment.py", line 948, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/venv/lib/python3.12/site-packages/alembic/runtime/migration.py", line 627, in run_migrations
    step.migration_fn(**kw)
  File "/pgadmin4/migrations/versions/fdc58d9bd449_.py", line 38, in upgrade
    email, password = user_info()
                      ^^^^^^^^^^^
  File "/pgadmin4/pgadmin/setup/user_info.py", line 75, in user_info
    email, p1 = user_info_server()
                ^^^^^^^^^^^^^^^^^^
  File "/pgadmin4/pgadmin/setup/user_info.py", line 52, in user_info_server
    email = input(ENTER_EMAIL_ADDRESS)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
EOFError: EOF when reading a line
[2024-06-07 17:27:42 +0000] [90] [INFO] Worker exiting (pid: 90)
[2024-06-07 17:27:42 +0000] [1] [ERROR] Worker (pid:90) exited with code 3
[2024-06-07 17:27:42 +0000] [1] [ERROR] Shutting down: Master
[2024-06-07 17:27:42 +0000] [1] [ERROR] Reason: Worker failed to boot.
Email address: 

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions