Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

[cetic/pgadmin] Unable to start pgadmin #17

Open
gau1991 opened this issue Jan 9, 2020 · 2 comments
Open

[cetic/pgadmin] Unable to start pgadmin #17

gau1991 opened this issue Jan 9, 2020 · 2 comments

Comments

@gau1991
Copy link

gau1991 commented Jan 9, 2020

With default parameters for the pv, on the kubernetes cluster getting following error:

Traceback (most recent call last):
  File "run_pgadmin.py", line 4, in <module>
    from pgAdmin4 import app
  File "/pgadmin4/pgAdmin4.py", line 109, in <module>
    app = create_app()
  File "/pgadmin4/pgadmin/__init__.py", line 244, in create_app
    create_app_data_directory(config)
  File "/pgadmin4/pgadmin/setup/data_directory.py", line 40, in create_app_data_directory
    _create_directory_if_not_exists(config.SESSION_DB_PATH)
  File "/pgadmin4/pgadmin/setup/data_directory.py", line 16, in _create_directory_if_not_exists
    os.mkdir(_path)
PermissionError: [Errno 13] Permission denied: '/var/lib/pgadmin/sessions'
[2020-01-09 12:06:45 +0000] [1] [INFO] Starting gunicorn 19.9.0
[2020-01-09 12:06:45 +0000] [1] [INFO] Listening at: http://[::]:80 (1)
[2020-01-09 12:06:45 +0000] [1] [INFO] Using worker: threads
[2020-01-09 12:06:45 +0000] [19] [INFO] Booting worker with pid: 19
[2020-01-09 12:06:46 +0000] [19] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 104, in init_process
    super(ThreadWorker, self).init_process()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/pgadmin4/run_pgadmin.py", line 4, in <module>
    from pgAdmin4 import app
  File "/pgadmin4/pgAdmin4.py", line 109, in <module>
    app = create_app()
  File "/pgadmin4/pgadmin/__init__.py", line 244, in create_app
    create_app_data_directory(config)
  File "/pgadmin4/pgadmin/setup/data_directory.py", line 40, in create_app_data_directory
    _create_directory_if_not_exists(config.SESSION_DB_PATH)
  File "/pgadmin4/pgadmin/setup/data_directory.py", line 16, in _create_directory_if_not_exists
    os.mkdir(_path)
PermissionError: [Errno 13] Permission denied: '/var/lib/pgadmin/sessions'
[2020-01-09 12:06:46 +0000] [19] [INFO] Worker exiting (pid: 19)
WARNING: Failed to set ACL on the directory containing the configuration database: [Errno 1] Operation not permitted: '/var/lib/pgadmin'
[2020-01-09 12:06:46 +0000] [1] [INFO] Shutting down: Master
[2020-01-09 12:06:46 +0000] [1] [INFO] Reason: Worker failed to boot.

Here are the values that are used:

image:
  repository: dpage/pgadmin4
  tag: 4.17
  pullPolicy: IfNotPresent

service:
  type: ClusterIP

pgadmin:
  username: [email protected]
  password: test123
  tls: false
  scriptname: /pgadmin

readinessProbe:
 httpGet:
   path: /
   port: http
 initialDelaySeconds: 60
 periodSeconds: 15
 timeoutSeconds: 10
livenessProbe:
  httpGet:
    path: /
    port: http
  initialDelaySeconds: 60
  periodSeconds: 30
  timeoutSeconds: 10
@nicorikken
Copy link
Contributor

nicorikken commented Jan 14, 2020

I have the same issue. It worked flawlessly before, and it seems that nothing has changed really.

I checked the Docker image, but that didn't change.

Going by this StackOverflow thread it seems to be a permission issue. Not sure how it arises though. I'll check it.

@nicorikken
Copy link
Contributor

I managed to fix my issue:

Check the user-id of the pgadmin user, using:

$ cat /etc/passwd
...
pgadmin:x:5050:5050::/home/pgadmin:/bin/ash

In this case it is 5050.

Temporarily edit the deployment for getting a editable pod for chowning the /var/lib/pgadmin directory. It is best to back up the image name or command beforehand, or be able to redeploy the chart.

spec:
  template:
    spec:
      containers:
      - image: alpine:latest
        command: ["tail", "-f", "dev/null"]

Now a new pod will be deployed, which you can access using:

$ kubectl -n <namespace> exec -it <pod> sh

Then from this shell you can chown the directory to the correct user-id:

# chown -R 5050:5050 /var/lib/pgadmin

Still it would be better to have this chart resolve this issue automatically.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants