Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET http://localhost:8080/api/v1/environments net::ERR_CONNECTION_REFUSED #811

Closed
asntc opened this issue Nov 19, 2024 · 7 comments
Closed

Comments

@asntc
Copy link

asntc commented Nov 19, 2024

Hi @vitabaks, 👋
thanks for this awesome project! just getting started and hoping to use this ...
But currently getting the same error as described by @garry-t in: #785 (comment)
Though the "fix" suggested in that thread has not worked for me ...

http://116.202.31.52/clusters (login with the $PG_CONSOLE_AUTHORIZATION_TOKEN worked, but nothing else)

image

Several errors in the Chrome DevTools Console similar to:

index-BcZ6gpvM.js:185 
   
       GET http://localhost:8080/api/v1/clusters?offset=0&limit=10&project_id=0&sort_by=-created_at net::ERR_CONNECTION_REFUSED

To initiate the console on Hetzner, ran the following:

docker run -d --name pg-console \
  --publish 80:80 \
  --publish 8080:8080 \
  --env PG_CONSOLE_API_URL=$PG_CONSOLE_API_URL \
  --env PG_CONSOLE_AUTHORIZATION_TOKEN=$PG_CONSOLE_AUTHORIZATION_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

Where the two environment variables used above are defined as:

export PG_CONSOLE_AUTHORIZATION_TOKEN=myawesomeauthtoken
export PG_CONSOLE_API_URL=http://116.202.31.52:8080/api/v1

Is there another place I should define the IP address for the API? 🤷‍♂️
What am I doing wrong? 🙃
Thanks! 🙏

@vitabaks
Copy link
Owner

Hi @asntc Thank you for your feedback!

It looks like the address in the PG_CONSOLE_API_URL variable has not been redefined

try to launch the container like this:

docker run -d --name pg-console \
  --publish 80:80 \
  --publish 8080:8080 \
  --env PG_CONSOLE_API_URL=http://116.202.31.52:8080/api/v1 \
  --env PG_CONSOLE_AUTHORIZATION_TOKEN=myawesomeauthtoken \
  --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

P.S. Since it is open-source, everyone can contribute. Feel free to create a PR if you know can help us get better.

@asntc
Copy link
Author

asntc commented Nov 19, 2024

Yeah, I had both vars hard-coded in the launch command before ... trying again ...

Deleted everything:

docker ps 

CONTAINER ID   IMAGE                                       COMMAND                  CREATED       STATUS       PORTS                                                                                    NAMES
96a0ca771b31   vitabaks/postgresql_cluster_console:2.0.0   "/usr/bin/supervisor…"   2 hours ago   Up 2 hours   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 5432/tcp   pg-console

docker kill 96a0ca771b31
96a0ca771b31

docker rm -vf $(docker ps -aq)
96a0ca771b31

Deleted all images to make sure I'm starting from scratch with no history.
ref: https://stackoverflow.com/questions/44785585/how-can-i-delete-all-local-docker-images

docker rmi -f $(docker images -aq)

Untagged: vitabaks/postgresql_cluster:latest
Untagged: vitabaks/postgresql_cluster@sha256:e6a0eb79191b49c1608951c000b9287507d74733c24b0a5957aef7a3611304c7
Deleted: sha256:0517c8800964508938f0948fe902c228d285923a5bc7bd676ed66c04263f4a4f
Deleted: sha256:cce819918581e1909bdcb8ce69e526e33aab63d8e651d030ef8937d6a9d48da8
Deleted: sha256:b0f8303850e136d97cedbf4c863b45a4e26c6baca308adfa716c5b0893a22365
Deleted: sha256:78e7b75933438e7089fafdc1217e3c0bc6419c472a262eaf8adffeade889adc7
Deleted: sha256:c3548211b8264f8bfa47a6727043a64f1791b82ac965a284a7ea187e971a95e2
Untagged: vitabaks/postgresql_cluster_console:2.0.0
Untagged: vitabaks/postgresql_cluster_console@sha256:328b235f70519e9e220b0970bb3bfbf7915dd1d80fd26e13105e7a505207825b
Deleted: sha256:bfda43f72e3c0c47bacdd2660fdc4575bf0d47d4053a122baa58b7249f877513
Deleted: sha256:6039fe2c2eaaf09a93e30194e530a42921eed45cef3b345faffeded05f37f3cc
Deleted: sha256:68410df5104b79a8442ae11a5c6df8eaa042f7137635dd97e811659f98526476
Deleted: sha256:61696999ec5521288a61671662d25e6cbacee2fd5bbebcfb617f6afe4fc75233
Deleted: sha256:d7206992cf134d72ca1a4f4d816986142ead2562fa88b87ed75e05defcab71d8
Deleted: sha256:1dc8d7c47d1958816a57d56acf24acaec33e5ddb568e4da9a5ea5696a23a797c
Deleted: sha256:dca823d03bf4903c136ac31783e0c1ec3ba9be40fbcbc656ce2e1f4d27e5a15f
Deleted: sha256:e1155830eed17e23dc1e3dfd541a69d9d455947dbc9c1cebb55c0a2705f00ba0
Deleted: sha256:fc2713214030d4b8814b28bfe3f1c1fdb6b06547794cb5917c2b257e5cefde56
Deleted: sha256:01a5eefca08e1630a612d472afd46f7422bf2a22b585c65e4b18b2a75823f90f
Deleted: sha256:376311081fb7a6105cb60547b0b43823a5e65205773af614e438ed365ce8775f
Deleted: sha256:f6ace3d35dc453f90cdc54c257b7f2d7cdbd6a7ec5b2b3a94808e22396567ed7
Deleted: sha256:e1c55fdd3a403ca00be66062fcea960fba0da729d2250ec72093192e56f99dc3
Deleted: sha256:dd03df0b7439455eeac0e25422c44e3e71432fed2df4a42520164cbfb522d9cd
Deleted: sha256:b04c2fbe93f80bd3a27acc7a3e498863590a5999b66fdcb42a0c3fda2b12bb87
Deleted: sha256:1e9a7e559f89fcf207554ee6fde0237503f2c32897ad258b6a29679fd0b2d42e
Deleted: sha256:8ece98d08913685cb3885c4f7a07b3e1dcb2a31aaccbd14844a14cafd83cda0f
Deleted: sha256:5875b996ef9ec366425b7e62c48b927cea1b43cef658610e159c67065c0701c4
Deleted: sha256:4e4f6869c995187845acc170d86de6aacee22b56120fdab68d6fc6511f63c60c
Deleted: sha256:54f8980ff145b49141846c66237a2e7870b9dcf8eb6fe6c6be13dc2d2d5158f2
Deleted: sha256:9853575bc4f955c5892dd64187538a6cd02dba6968eba9201854876a7a257034

My understanding is that this nuked everything on the VPS. 🤞

Then ran:

docker run -d --name pg-console \
  --publish 80:80 \
  --publish 8080:8080 \
  --env PG_CONSOLE_API_URL=http://116.202.31.52:8080/api/v1 \
  --env PG_CONSOLE_AUTHORIZATION_TOKEN=myawesomeauthtoken \
  --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

Output:

vitabaks/postgresql_cluster_console:2.0.0
Unable to find image 'vitabaks/postgresql_cluster_console:2.0.0' locally
2.0.0: Pulling from vitabaks/postgresql_cluster_console
e4fff0779e6d: Pull complete 
57bfd8b087cd: Pull complete 
955fc5fe26b2: Pull complete 
8f50a2be0867: Pull complete 
29852a384601: Pull complete 
b4872c95011a: Pull complete 
4f5185938b7c: Pull complete 
c823d38a5c69: Pull complete 
274f428fb651: Pull complete 
865a6893f717: Pull complete 
32eca27339c3: Pull complete 
be9675fa3b92: Pull complete 
2e73748c94d7: Pull complete 
ab2c3e0a0b15: Pull complete 
9c47f04a9288: Pull complete 
b9c35426cdce: Pull complete 
5af543bbf7ca: Pull complete 
16faa38e41ac: Pull complete 
80773219b976: Pull complete 
bf014a24948a: Pull complete 
Digest: sha256:328b235f70519e9e220b0970bb3bfbf7915dd1d80fd26e13105e7a505207825b
Status: Downloaded newer image for vitabaks/postgresql_cluster_console:2.0.0
3bb2ed0a6d41d49031f20e9d2f44c000c5c9605423ffc540ce375ee692ea0377

Now run ps again and get:

docker ps

CONTAINER ID   IMAGE                                       COMMAND                  CREATED              STATUS              PORTS                                                                                    NAMES
3bb2ed0a6d41   vitabaks/postgresql_cluster_console:2.0.0   "/usr/bin/supervisor…"   About a minute ago   Up About a minute   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 5432/tcp   pg-console

Then opened a different browser (Safari incognito to make sure I don't have any session saved):

image

Authenticated using the Auth Token:

image

Opened Dev Tools in Safari:

image

Don't appear to have the same errors anymore. 🤞
Will report back if I have any issues. 📝
But for now it looks like it's working. 🎉

P.S. I'm recording a screencast of the setup. 📺
That's why I was attempting to use Environment Variables to not show the Auth Token ... 🔑 🙈
But I will just blur them in the edit. 😉

@vitabaks
Copy link
Owner

vitabaks commented Nov 19, 2024

@asntc I couldn’t resist diving into the related issue and sharing my thoughts:

This gives us confidence that the project is maintained and we are making a good choice to use it.

This project is not just maintained—it’s gaining significant momentum!

We have ambitious plans to transform it into a true alternative to cloud-managed databases. This tool, proven in production over the years, is evolving into what I call an “automated self-managed database.” With high-quality automation, it will be as easy to maintain as Managed Postgres, while remaining open-source and completely free out of the box.

I an expert in Postgres with strong automation skills, I’ve made great progress. However, I’m not a Frontend/Backend developer, so I’m actively looking for companies willing to support the project—either by helping implement these ambitious plans (and there are many!) or by sponsoring so we can bring on developers.

I firmly believe open source can create incredible opportunities. It just takes the right people to make it happen!

@platinumnh
Copy link

im having same issue. tried to update consol api url and change the secret but it looks like those ENV variables arent making their way into the container.

@platinumnh
Copy link

docker run -d --name autobase-console
--publish 80:80
--publish 8080:8080
--env PG_CONSOLE_API_URL=http://192.168.20.4:8080/api/v1
--env PG_CONSOLE_AUTHORIZATION_TOKEN=secret_token
--env PG_CONSOLE_DOCKER_IMAGE=autobase/automation:latest
--volume console_postgres:/var/lib/postgresql
--volume /var/run/docker.sock:/var/run/docker.sock
--volume /tmp/ansible:/tmp/ansible
--restart=unless-stopped
autobase/console:latest

image

@vitabaks
Copy link
Owner

vitabaks commented Dec 2, 2024

@platinumnh could you run docker exec autobase-console env to check which variables are set inside the container?

@platinumnh
Copy link

@vitabaks I ended up getting it working, but i was experiencing the same systems from this. weirdly enough i kept deleting and relaunching containers and repulling them.

i got a 3 node cluster working on prem. very cool platform.

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

No branches or pull requests

3 participants