vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on Patroni). Automating with Ansible.
https://postgresql-cluster.org
MIT License
1.83k stars 418 forks source link

Unable to access UI #774

Closed JY-210 closed 1 month ago

JY-210 commented 1 month ago

Hi, I tried to use docker to setup PostgreSQL Cluster Console using below command:

docker run -d --name pg-console \
  --publish 80:80 \
  --publish 8080:8080 \
  --env PG_CONSOLE_API_URL=http://serverip:8080/api/v1 \
  --env PG_CONSOLE_AUTHORIZATION_TOKEN=secret_token \
  --env PG_CONSOLE_DOCKER_IMAGE=vitabaks/postgresql_cluster:latest \
  --volume console_postgres:/var/lib/postgresql \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume /tmp/ansible:/tmp/ansible \
  --restart=unless-stopped \
  vitabaks/postgresql_cluster_console:2.0.0

docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
b3091ec2001f vitabaks/postgresql_cluster_console:2.0.0 "/usr/bin/supervisor…" About an hour ago Up 56 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:8080->8080/tcp, :::8080-

~/postgres_test$ docker logs pg-console 2024-09-30 09:09:26,736 INFO Set uid to user 0 succeeded 2024-09-30 09:09:26,741 INFO RPC interface 'supervisor' initialized 2024-09-30 09:09:26,741 CRIT Server 'unix_http_server' running without any HTTP authentication checking 2024-09-30 09:09:26,741 INFO supervisord started with pid 1 2024-09-30 09:09:27,745 INFO spawned: 'pg-console-db' with pid 7 2024-09-30 09:09:27,748 INFO spawned: 'pg-console-api' with pid 8 2024-09-30 09:09:27,750 INFO spawned: 'pg-console-ui' with pid 9 2024-09-30 09:09:27,775 WARN exited: pg-console-api (exit status 0; not expected) 2024-09-30 09:09:28,880 INFO spawned: 'pg-console-api' with pid 75 2024-09-30 09:09:33,015 INFO success: pg-console-db entered RUNNING state, process has stayed up for > than 5 seconds (startsecs) 2024-09-30 09:09:33,015 INFO success: pg-console-ui entered RUNNING state, process has stayed up for > than 5 seconds (startsecs) 2024-09-30 09:09:34,016 INFO success: pg-console-api entered RUNNING state, process has stayed up for > than 5 seconds (startsecs)

However, when i try to curl inside the docker container, it shows path not found for :8000/api/v1

root@b3091ec2001f:/# curl -H "Authorization: Bearer secret_token" http://serverip:8080/api/v1 {"code":404,"message":"path /api/v1 was not found"}root@b3091ec2001f:/# root@b3091ec2001f:/# root@b3091ec2001f:/# curl -H "Authorization: Bearer secret_token" http://serverip:8080/api/
{"code":404,"message":"path /api/ was not found"}root@b3091ec2001f:/# root@b3091ec2001f:/# root@b3091ec2001f:/# root@b3091ec2001f:/# curl -H "Authorization: Bearer secret_token" http://serverip:8080
{"code":404,"message":"path / was not found"}root@b3091ec2001f:/# root@b3091ec2001f:/# root@b3091ec2001f:/# curl -H "Authorization: Bearer secret_token" http://serverip
<!doctype html>

PostgreSQL Cluster Console

I tried to browse http://serverip:8080 and passed in authorization token using ModHeader, it is also unable to access. On my server that host the docker, I already allow the firewall on port 8080 and port 80.

Can I have a guide on what step I am missing? Thank you and appreciate!

vitabaks commented 1 month ago

Hi @JY-210

If you log in on port 80 to the web ui, are there also problems with API availability?

JY-210 commented 1 month ago

hi @vitabaks

Yes, you can refer to the image below where I am browsing http://serverip/api/v1 image

This is the ModHeader I use. image

Ping works well from my laptop to the VM that hosted docker, but telnet port 8080 and port 80 unable to reach.

JY-210 commented 1 month ago

hi @vitabaks

The site can be reached already. Thanks!