https://prefect.io logo
#prefect-server
Title
# prefect-server
f

Faizan Qazi

12/06/2021, 10:51 AM
Hi guys. I am running prefect server locally and trying to access it using the ip_address which i also configured in the
config.toml
file . But as i access it at
<http://ip.add.re.ss:8080>
, the page displays but then redirects to the getting started page . So basically i want to access my prefect instance from any other machine.
Copy code
[server]
  [server.ui]
  apollo_url="<http://ip.add.re.ss:4200/graphql>"
a

Anna Geller

12/06/2021, 10:54 AM
Can you share a screenshot of what you see in the UI that seems confusing?
f

Faizan Qazi

12/06/2021, 10:57 AM
so page opens up but it never loads
and redirects to
so apparently my instance is in azure where certain port is allowed , so i guess 4200 is not accessible. so is there a way for port mapping?
a

Anna Geller

12/06/2021, 11:44 AM
oh, in that case you would need to open up port 4200 in your firewall rules/security groups
@Faizan Qazi you can follow this guide if you don’t know how to do it https://docs.microsoft.com/en-us/azure/virtual-machines/windows/nsg-quickstart-portal
f

Faizan Qazi

12/06/2021, 4:02 PM
@Anna Geller well we are only allowed to open specific ports. so isnt there a way to host prefect at a preferred port?
a

Anna Geller

12/06/2021, 4:08 PM
it’s definitely best practice for security to be mindful of which ports you open to the world. The port 4200 must be opened for ingress traffic though, otherwise your GraphQL cannot communicate with your agents. Perhaps this post explains it better than I do: https://medium.com/the-prefect-blog/prefect-server-101-deploying-to-google-cloud-platform-47354b16afe2 - it shows how to do it on GCP but the steps should be applicable to Azure as well
f

Faizan Qazi

12/07/2021, 5:57 AM
@Anna Geller Okay so what i am doing is i used the command
prefect server start --postgres-port=5433 --server-port=5001 --hasura-port=5002  --graphql-port=5003  --expose
to use the allowed ports. And when i do a docker ps i get
Copy code
CONTAINER ID   IMAGE                          COMMAND                  CREATED          STATUS                    PORTS                                   NAMES
873bfa5bd6bc   prefecthq/ui:core-0.15.7       "/docker-entrypoint.…"   23 minutes ago   Up 23 minutes (healthy)   80/tcp, 0.0.0.0:8080->8080/tcp          tmp_ui_1
9ca79a768265   prefecthq/apollo:core-0.15.7   "tini -g -- bash -c …"   23 minutes ago   Up 23 minutes (healthy)   0.0.0.0:5003->4200/tcp                  tmp_apollo_1
ab7c87ddbabb   prefecthq/server:core-0.15.7   "tini -g -- python s…"   23 minutes ago   Up 23 minutes                                                     tmp_towel_1
ef230baeddb5   prefecthq/server:core-0.15.7   "tini -g -- bash -c …"   23 minutes ago   Up 23 minutes (healthy)   127.0.0.1:5001->4201/tcp                tmp_graphql_1
410c38f08f83   hasura/graphql-engine:v1.3.3   "graphql-engine serve"   23 minutes ago   Up 23 minutes (healthy)   127.0.0.1:5002->3000/tcp                tmp_hasura_1
82748fbc9f4d   postgres:11                    "docker-entrypoint.s…"   23 minutes ago   Up 23 minutes (healthy)   127.0.0.1:5433->5432/tcp                tmp_postgres_1
my
~/.prefect/config.toml
is
Copy code
[server]
  endpoint = "<http://ipaddress:5003/graphql>"

  [server.ui]
  apollo_url = "<http://ipaddress:5003/graphql>"
Then as i start the server the status goes as in figure
I checked the logs of the
tmp_towel_1
container and found out
Copy code
[Errno 111] Connect call failed ('some_ipaddress_which_i_dont_know_about', 3000)"}
a

Anna Geller

12/07/2021, 9:34 AM
@Faizan Qazi what I meant was opening the ports on the firewall rules configuration on the VM rather than changing the default ports in docker-compose. Do you have any specific reasons why you cannot use the default ports? Additionally, I’m not sure about this but the linked tutorial says that you should set:
Copy code
[server]
endpoint = "YOUR_MACHINES_PUBLIC_IP:4200/graphql"
but you did:
Copy code
[server]
endpoint = "<http://YOUR_MACHINES_PUBLIC_IP:4200/graphql>"
Only the apollo_url is given with http://
Copy code
[server]
  [server.ui]
    apollo_url = "<http://YOUR_MACHINES_PUBLIC_IP:4200/graphql>"
You could try and see whether this changes anything.
@Faizan Qazi I saw you asked the same on SO. I will not copy-paste my answer there for now 😄 let me try to check this with you via slack since it’S easier to communicate. Can you try the above first?
😆 1
f

Faizan Qazi

12/07/2021, 10:25 AM
@Anna Geller The ports are not managed by me and hence I have to use whatever is available. Well I tried removing http in the endpoint. Still didnt work. Lol yea. i did.
a

Anna Geller

12/07/2021, 11:47 AM
for posterity, this has been resolved for now and SO contains the answer
f

Faizan Qazi

12/07/2021, 12:25 PM
@Anna Geller Thankyou so much for your patience and efforts. Worked perfectly fine :)
🙌 1