Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
659 views
in Technique[技术] by (71.8m points)

postgresql - Run pgAdmin as a service

I'm stuck on an issue on pgadmin, and I did not find any similar situation in other discussions about. I am not experienced in docker and databases, and I am taking over the work from someone else following some corporate rules and processes.

Situation

On a VM, I have

  • a postgresql docker compose run as a service
  • a pgadmin docker compose run as a service

What I manage to do

  • I can log in postgres using psql so it seems to work.
  • I can launch a pgadmin using docker docker run -p 5490:80 -e '[email protected]' -e 'PGADMIN_DEFAULT_PASSWORD=SuperSecret' -d dpage/pgadmin4 with this pgadmin, I can connect to the postgresql and everything is working fine.

What I am stuck on

When I start the pgadmin.service, I am getting this error :

janv. 08 17:46:20 VM001 docker-compose[22141]: Starting pgadmin ...
janv. 08 17:46:21 VM001 docker-compose[22141]: [59B blob data]
janv. 08 17:46:21 VM001 docker-compose[22141]: pgadmin    | sudo: setrlimit(RLIMIT_CORE): Operation not permitted
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    | [2021-01-08 16:46:23 +0000] [1] [INFO] Starting gunicorn 19.9.0
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    | [2021-01-08 16:46:23 +0000] [1] [INFO] Listening at: http://[::]:80 (1)
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    | [2021-01-08 16:46:23 +0000] [1] [INFO] Using worker: threads
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    | /usr/local/lib/python3.8/os.py:1023: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |   return io.open(fd, *args, **kwargs)
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    | [2021-01-08 16:46:23 +0000] [87] [INFO] Booting worker with pid: 87
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    | [2021-01-08 16:46:23 +0000] [87] [ERROR] Exception in worker process
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    | Traceback (most recent call last):
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |     worker.init_process()
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/gthread.py", line 104, in init_process
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |     super(ThreadWorker, self).init_process()
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/base.py", line 129, in init_process
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |     self.load_wsgi()
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |     self.wsgi = self.app.wsgi()
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |     self.callable = self.load()
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |     return self.load_wsgiapp()
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |     return util.import_app(self.app_uri)
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |   File "/usr/local/lib/python3.8/site-packages/gunicorn/util.py", line 350, in import_app
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |     __import__(module)
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |   File "/pgadmin4/run_pgadmin.py", line 4, in <module>
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |     from pgAdmin4 import app
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |   File "/pgadmin4/pgAdmin4.py", line 93, in <module>
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |     app = create_app()
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |   File "/pgadmin4/pgadmin/__init__.py", line 335, in create_app
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |     if not os.path.exists(SQLITE_PATH) or get_version() == -1:
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |   File "/pgadmin4/pgadmin/setup/db_version.py", line 19, in get_version
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |     return version.value
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    | AttributeError: 'NoneType' object has no attribute 'value'
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    | [2021-01-08 16:46:23 +0000] [87] [INFO] Worker exiting (pid: 87)
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    | /usr/local/lib/python3.8/os.py:1023: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    |   return io.open(fd, *args, **kwargs)
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    | [2021-01-08 16:46:23 +0000] [1] [INFO] Shutting down: Master
janv. 08 17:46:23 VM001 docker-compose[22141]: pgadmin    | [2021-01-08 16:46:23 +0000] [1] [INFO] Reason: Worker failed to boot.
janv. 08 17:46:24 VM001 docker-compose[22141]: pgadmin exited with code 3`

I tried a lot of things in the docker compose : adding external_links to postgresql service, changing listening port, verifying permissions for logs and data, syntax for environment variable but nothing seems to work.

Here is one of my docker-compose-pgadmin.yml try :

version: "2.2"
services:
 pgadmin:
  image: dpage/pgadmin4
  container_name : pgadmin_test
  environment:
    - PGADMIN_DEFAULT_EMAIL='[email protected]'
    - PGADMIN_DEFAULT_PASSWORD='secret'
    - PGADMIN_LISTEN_PORT=5050
  volumes:
    - /app/myapp/data/pgadmin/:/var/lib/pgadmin
  ports:
    - 5491:5050

For the pgadmin.service basically

  • it is creating a specific docker network (which is the same for pgadmin and postgresql, I can see it during the few seconds of starting with docker inspect)
  • it is executing a docker-compose up and defining how to stop and reload. I use the same for other docker-compose, I don't think the issue is coming from here.

Thinks for the solving ideas,


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...