https://prefect.io logo
c

Christian

10/29/2020, 12:21 PM
Hi 👋 I'm currently trying to get prefect server running on my remote workstation (connected via VPN) - however, it seems that a local agent is not discovered by the gui (zero agents)... Would any of you kind souls have time for a little hand-holding to get me started? I upgraded to the newest version, switched the backend and started server and an agent I see the ui at ip-address:8080 but no agents... I also see this in the ui (which cannot be good):
Copy code
Couldn't connect to Prefect Server at <http://localhost:4200/graphql>
d

Dylan

10/29/2020, 1:50 PM
Hi Christian! The Agent needs to connect to the Apollo service of Prefect Server. Can you see where that is exposed?
c

Christian

10/29/2020, 1:53 PM
Hi. I think the problem is that my config setting is using localhost all over the place... This is my current config:
Copy code
{'debug': False, 'home_dir': '/home/werner-ch/.prefect', 'backend': 'server', 'server': {'host': '<http://localhost>', 'port': 4200, 'host_port': 4200, 'endpoint': '<http://localhost:4200>', 'database': {'host': 'localhost', 'port': 5432, 'host_port': 5432, 'name': 'prefect_server', 'username': 'prefect', 'password': 'test-password', 'connection_url': '<postgresql://prefect:test-password@localhost:5432/prefect_server>', 'volume_path': '/home/werner-ch/.prefect/pg_data'}, 'graphql': {'host': '0.0.0.0', 'port': 4201, 'host_port': 4201, 'debug': False, 'path': '/graphql/'}, 'hasura': {'host': 'localhost', 'port': 3000, 'host_port': 3000, 'admin_secret': '', 'claims_namespace': 'hasura-claims', 'graphql_url': '<http://localhost:3000/v1alpha1/graphql>', 'ws_url': '<ws://localhost:3000/v1alpha1/graphql>', 'execute_retry_seconds': 10}, 'ui': {'host': '<http://localhost>', 'port': 8080, 'host_port': 8080, 'endpoint': '<http://localhost:8080>', 'apollo_url': '<http://localhost:4200/graphql>'}, 'telemetry': {'enabled': True}}, 'cloud': {'api': '<http://localhost:4200>', 'endpoint': '<https://api.prefect.io>', 'graphql': '<http://localhost:4200/graphql>', 'use_local_secrets': True, 'heartbeat_interval': 30.0, 'check_cancellation_interval': 15.0, 'diagnostics': False, 'logging_heartbeat': 5, 'queue_interval': 30.0, 'agent': {'name': 'agent', 'labels': [], 'level': 'INFO', 'auth_token': '', 'agent_address': '', 'resource_manager': {'loop_interval': 60}}}, 'logging': {'level': 'INFO', 'format': '[%(asctime)s] %(levelname)s - %(name)s | %(message)s', 'log_attributes': [], 'datefmt': '%Y-%m-%d %H:%M:%S', 'log_to_cloud': False, 'extra_loggers': []}, 'flows': {'eager_edge_validation': False, 'run_on_schedule': True, 'checkpointing': False, 'defaults': {'storage': {'add_default_labels': True, 'default_class': 'prefect.environments.storage.Local'}}}, 'tasks': {'defaults': {'max_retries': 0, 'retry_delay': None, 'timeout': None}}, 'engine': {'executor': {'default_class': 'prefect.engine.executors.LocalExecutor', 'dask': {'address': '', 'cluster_class': 'distributed.deploy.local.LocalCluster'}}, 'flow_runner': {'default_class': 'prefect.engine.flow_runner.FlowRunner'}, 'task_runner': {'default_class': 'prefect.engine.task_runner.TaskRunner'}}}
n

nicholas

10/29/2020, 2:15 PM
Hi @Christian - have you set the appropriate environment variables to point to your Server deployment? For the UI this means setting
apollo_url
as either an environment variable (
PREFECT__SERVER__UI__APOLLO_URL
) or in your machine's
~/.prefect/config.toml
:
Copy code
# ~/.prefect/config.toml

[server]
  [server.ui]
  apollo_url="your endpoint:4200/graphql"
You can read more about the different configuration options for Prefect Server in the Prefect configuration docs.
c

Christian

10/29/2020, 2:24 PM
Hi @nicholas. I though I did, but it was not picked up by server?!? I now specify the GraphQL url in the UI itself and now it seems to connect... However, I still cannot register an agent. I want to start an agent on the same remote machine that the prefect server runs... How would I tell the agent o find the server instance?!? I tried to use the api flag but to no avail
n

nicholas

10/29/2020, 2:42 PM
You should be able to set
server.endpoint
to point your agent at your Server instance (or
PREFECT__SERVER__ENDPOINT
as an environment variable). There seems to be a visual bug with agents on the UI dashboard right now where agents aren't showing up correctly so you can confirm your agent has started by querying it from the Interactive API on the left sidebar with this query:
Copy code
query {
  agent {
    id
  }
}
c

Christian

10/29/2020, 2:44 PM
Ah ok - I do get something back if here...
Copy code
{
  "agent": [
    {
      "id": "9b662e63-2bc5-4f83-b45c-1556bcf6d9e0",
      "__typename": "agent"
    },
    {
      "id": "f1c70546-ca94-4d10-93b8-bb75e7e8eba5",
      "__typename": "agent"
    },
    {
      "id": "3f50bbac-97c3-4778-9d6b-e9ba8885f3bb",
      "__typename": "agent"
    },
    {
      "id": "f80e19fc-225d-4ba9-9f3e-b227cc1c06b0",
      "__typename": "agent"
    }
  ]
}
Does this look alright to you?
n

nicholas

10/29/2020, 2:46 PM
Yup that looks like your agent is correct but you're experiencing the visual bug - can you confirm your agent is able to pull work from your Server?
c

Christian

10/29/2020, 2:46 PM
I'm about to setup a dummy flow and report back in a minute
n

nicholas

10/29/2020, 2:47 PM
Thanks Christian 🙂
c

Christian

10/29/2020, 2:51 PM
Success! Man, I was going round in circles... 🐕
n

nicholas

10/29/2020, 2:52 PM
Sorry about that! I'm taking a look at the visual bug now so hopefully should get a fix out soon 🙂
c

Christian

10/29/2020, 2:53 PM
Cheers, and thanks for helping me out!
n

nicholas

10/29/2020, 5:41 PM
Following up - we've identified the issue (fixed here) and released the fix to Cloud; I expect the latest Server images will be retagged with the latest UI release shortly 🙂
c

Christian

10/29/2020, 5:42 PM
Awesome!