https://prefect.io logo
Title
j

Javier Ebrero

05/27/2022, 11:54 AM
Hello all! I am trying to start the prefect server in my local using the backend as server and running prefect server start. I never had a problem using it but currently I buy other laptop and I am getting an error from hasura service (which a connection refuse to the postgres database) the traceback error is inside the thread. The prefect version is 0.15.13 and the OS version is ubuntu 22.04
k

Kevin Kho

05/27/2022, 1:30 PM
Hey Javier, so you installed 0.15.13 and then just did a fresh
prefect server start
and ran into this? When you get a chance, could you move the traceback to the thread to keep the main channel cleaner?
j

Javier Ebrero

05/27/2022, 1:31 PM
The error is:
{"type":"pg-client","timestamp":"2022-05-27T11:44:45.827+0000","level":"warn","detail":{"message":"postgres connection failed, retrying(0)."}}
{"type":"pg-client","timestamp":"2022-05-27T11:44:45.827+0000","level":"warn","detail":{"message":"postgres connection failed, retrying(1)."}}
{"type":"startup","timestamp":"2022-05-27T11:44:45.827+0000","level":"error","detail":{"kind":"catalog_migrate","info":{"internal":"could not connect to server: Connection refused\n\tIs the server running on host \"postgres\" (172.23.0.2) and accepting\n\tTCP/IP connections on port 5432?\n","path":"$","error":"connection error","code":"postgres-error"}}}
{"internal":"could not connect to server: Connection refused\n\tIs the server running on host \"postgres\" (172.23.0.2) and accepting\n\tTCP/IP connections on port 5432?\n","path":"$","error":"connection error","code":"postgres-error"}
{"type":"startup","timestamp":"2022-05-27T11:44:46.878+0000","level":"error","detail":{"kind":"catalog_migrate","info":{"internal":{"statement":"CREATE EXTENSION IF NOT EXISTS pgcrypto SCHEMA public","prepared":false,"error":{"exec_status":"FatalError","hint":null,"message":"duplicate key value violates unique constraint \"pg_extension_name_index\"","status_code":"23505","description":"Key (extname)=(pgcrypto) already exists."},"arguments":[]},"path":"$","error":"pgcrypto extension is required, but it could not be created; encountered unknown postgres error","code":"postgres-error"}}}
{"internal":{"statement":"CREATE EXTENSION IF NOT EXISTS pgcrypto SCHEMA public","prepared":false,"error":{"exec_status":"FatalError","hint":null,"message":"duplicate key value violates unique constraint \"pg_extension_name_index\"","status_code":"23505","description":"Key (extname)=(pgcrypto) already exists."},"arguments":[]},"path":"$","error":"pgcrypto extension is required, but it could not be created; encountered unknown postgres error","code":"postgres-error"}
{"type":"unstructured","timestamp":"2022-05-27T11:44:47.849+0000","level":"warn","detail":"The following environment variables are deprecated: HASURA_GRAPHQL_QUERY_PLAN_CACHE_SIZE"}
k

Kevin Kho

05/27/2022, 1:33 PM
Thanks!
j

Javier Ebrero

05/27/2022, 1:33 PM
I did a fresh install and ran into this error yep. I was looking for the error and try several things but I still continue with the error
k

Kevin Kho

05/27/2022, 1:33 PM
Can you check hasura version?
j

Javier Ebrero

05/27/2022, 1:33 PM
Sure
hasura v2.1.1
k

Kevin Kho

05/27/2022, 1:39 PM
Oh that actually looks right
Did you have an existing database you connected to? Or started a new one?
j

Javier Ebrero

05/27/2022, 3:18 PM
started new one (included in the prefect docker compose)
k

Kevin Kho

05/27/2022, 3:20 PM
Honestly I think something weird just happened and I would try to start it again? Specifically the uniqueness constraint looks weird
j

Javier Ebrero

05/27/2022, 3:23 PM
I restarted my computer and restart many times the prefect server and keeps happening
k

Kevin Kho

05/27/2022, 3:25 PM
Ok i’ll ask the team for more ideas
j

Javier Ebrero

05/27/2022, 3:28 PM
thank you!
a

Anna Geller

05/27/2022, 5:55 PM
Javier, could you install a higher Prefect version? On your Ubuntu version you have Python version that should automatically install Prefect 1.2 rather than a lower than that version
j

Javier Ebrero

05/30/2022, 7:47 AM
I can but my agents in production are in this version that is why I want to have this version. Anyways I need to update the version so I will try to update it
🙌 1
@Anna Geller still dropping the same error. When I start all the services with prefect server start:
{"type":"pg-client","timestamp":"2022-05-30T10:20:21.565+0000","level":"warn","detail":{"message":"postgres connection failed, retrying(0)."}}
{"type":"pg-client","timestamp":"2022-05-30T10:20:21.565+0000","level":"warn","detail":{"message":"postgres connection failed, retrying(1)."}}
{"type":"startup","timestamp":"2022-05-30T10:20:21.565+0000","level":"error","detail":{"kind":"catalog_migrate","info":{"internal":"could not connect to server: Connection refused\n\tIs the server running on host \"postgres\" (172.19.0.2) and accepting\n\tTCP/IP connections on port 5432?\n","path":"$","error":"connection error","code":"postgres-error"}}}
{"internal":"could not connect to server: Connection refused\n\tIs the server running on host \"postgres\" (172.19.0.2) and accepting\n\tTCP/IP connections on port 5432?\n","path":"$","error":"connection error","code":"postgres-error"}
{"type":"unstructured","timestamp":"2022-05-30T10:20:22.792+0000","level":"warn","detail":"The following environment variables are deprecated: HASURA_GRAPHQL_QUERY_PLAN_CACHE_SIZE"}
a

Anna Geller

05/30/2022, 10:38 AM
What did you do differently than before? Can you perhaps write down all steps you have taken so far in a README, publish as a GitHub gist and share it with us?
j

Javier Ebrero

05/30/2022, 10:48 AM
I did the same than before but in other new laptop and the steps are few so I think I can write here: 1. Create a virtualenv with python 3.10.4 (python3 -m venv venv) 2. Then install the python requirements using pip (one of then is prefect prefect[aws,viz]==1.2.2") 3. prefect backend server 4. prefect server start
a

Anna Geller

05/30/2022, 11:02 AM
this looks fine when running only locally - if you run on a remote VM, you would need the --expose flag:
prefect server start --expose
also, are you just getting started with Prefect? if that's the case I would recommend Prefect 2.0
j

Javier Ebrero

05/30/2022, 11:08 AM
I am not starting with prefect, I started using it 2 years ago and I can't change currently all the flows to orion 😞 (time/priority). Also, I am not in a VM but I notice that the postgres service is refusing the connections so I will try to deploy in my local one and use this.
a

Anna Geller

05/30/2022, 11:09 AM
sure, keep us posted, thanks for the update
j

Javier Ebrero

05/30/2022, 11:13 AM
Exists any kind of argument to start prefect in network host mode?
a

Anna Geller

05/30/2022, 11:29 AM
all components run by default on the same host - is your question about a Docker agent running on the same network as other Docker containers used by your Prefect Server? if so, this is how you can do it:
prefect agent docker start --network prefect-server
this thread explains it more