https://prefect.io logo
g

García Gimenez Ignacio - 6to 2da

10/08/2021, 3:10 PM
Hi all! Im having an issue trying to create a tenant, it throws the following exception: "HTTPConnectionPool(host='localhost', port=4200): Max retries exceeded with url....". I'm running my own docker compose file. Apollo's server is running fine, it connects to the UI. But it seems like wont connect when trying to create the tenant with the command "prefect server create-tenant --name default --slug default". Is there any way to change the default ip "localhost" to a custom one?
k

Kevin Kho

10/08/2021, 3:14 PM
Hey @García Gimenez Ignacio - 6to 2da, if you are connecting to Prefect Server from another machine, and your Prefect version is 0.15.5 and above, you need to start it with the expose flag like
prefect server start --expose
Before you do that, you can edit the config.toml to point to the IP
Copy code
[server]
  [server.ui]
    apollo_url = "<http://YOUR_MACHINES_PUBLIC_IP:4200/graphql>"
And on your machine connecting there:
Copy code
[server]
endpoint = "YOUR_MACHINES_PUBLIC_IP:4200/graphql"
g

García Gimenez Ignacio - 6to 2da

10/08/2021, 3:17 PM
I've already have that in my Docker Compose file
The ui connects ok, but then when trying to create the tenant, it fails, because is trying to point to localhost
🙌 1
k

Kevin Kho

10/08/2021, 3:21 PM
The second one is the
config.toml
for the machine you’re trying to hit the API with.
Copy code
[server]
endpoint = "YOUR_MACHINES_PUBLIC_IP:4200/graphql"
This should change the API query from localhost
g

García Gimenez Ignacio - 6to 2da

10/08/2021, 3:55 PM
Is there anyway to specify that endpoint via Enviroment Variable?
k

Kevin Kho

10/08/2021, 3:58 PM
Try
Copy code
PREFECT__SERVER__ENDPOINT
g

García Gimenez Ignacio - 6to 2da

10/08/2021, 4:16 PM
Still not working 😞
k

Kevin Kho

10/08/2021, 4:50 PM
Are you trying on to connect from the same machine or different machine?
g

García Gimenez Ignacio - 6to 2da

10/08/2021, 5:27 PM
I'm just attached to the container, via the docker terminal. And trying to create the tenant
k

Kevin Kho

10/08/2021, 5:50 PM
Sorry a bit confused. Is your command line running in the container or on the host machine? If it’s still
localhost
, I think it didn’t get the environment variable? Maybe you can check if the env variable is set. This has to be set on machine communicating with the API
g

García Gimenez Ignacio - 6to 2da

10/08/2021, 6:16 PM
I have a docker-compose file in a VM (192.168.0.43) with a Docker Environment. And via SSH I'm running "docker-compose up" in the VM to get Prefect working. I can connect to the UI using the IP of the VM and the :8080 port. I'm algo trying to run commands using "docker exec -u 0 -it server_graphql_1 bash" and accessing the terminal of the Prefect's UI Docker Instance.
k

Kevin Kho

10/08/2021, 6:21 PM
Ah ok and you are creating the tenant via the SSH terminal? or on your machine that is connecting through SSH?
g

García Gimenez Ignacio - 6to 2da

10/12/2021, 12:29 PM
Im creating the tenant in the SSH Terminal
n

nicholas

10/12/2021, 2:20 PM
@García Gimenez Ignacio - 6to 2da - since you can connect to the API with your browser, would you mind trying to leave the SSH session and use your local terminal (with the endpoint set as Kevin described) to run the create tenant command? It sounds like there’s some mixup of environments happening right now
g

García Gimenez Ignacio - 6to 2da

10/12/2021, 2:34 PM
But how? I'm running a Windows Machine, how i'm supposed to run "prefect server create-tenant --name default --slug default"? Do I need to install something?
n

nicholas

10/12/2021, 2:58 PM
You would need to install the prefect python package on your machine to do that; alternatively you can try SSHing into your VM and checking that the environment variable described above is correctly set with
printenv
It sounds like you’re running docker in docker though, is that correct?
4 Views