Hello, I can’t seem to find the local development ...
# prefect-server
r
Hello, I can’t seem to find the local development guide in the docs anymore, how do I start prefect server & agent locally for the first time?
k
Hey @Raed Shabbir,
prefect server start
and
prefect agent local start
In 0.15.5 if you are conencting from different machines to server, you need the
--expose
flag
r
Hey Kevin, prefect server starts the UI correctly, but how can I connect to my K8S deployment with external postgresql as in earlier versions?
Also
prefect agent local start
fails with
Copy code
RuntimeError: Error while contacting API at <https://api.prefect.io>
But why would the local agent have to connect to prefect-cloud? (note we are not using prefect-cloud and initially deployed via this guide
Copy code
<https://www.youtube.com/watch?v=EwsMecjSYEU>
k
I think you edit this to point to another postgres db. The agent contacts Prefect Cloud by default. To point it to server, you need to do
prefect backend server
r
I see, so the correct order of operations for purely local development would be 1. prefect backend server 2. prefect server start 3. prefect local agent start ?
k
Yep
r
Great and what would be the recommend way to switch from local agent to our K8s deployed server?
Would it be just adding the following lines into the flow file?
Copy code
# comment out 
# flow.executor = LocalExecutor()
#! For using kube 
flow.executor = DaskExecutor()

# flow.run_config = KubernetesRun(
#     image=<path to docker image>
#     env={
#         "PREFECT__CONTEXT__SECRETS__BITBUCKET_CLOUD_USERNAME": os.environ[
#             "BITBUCKET_CLOUD_USERNAME"
#         ],
#         "PREFECT__CONTEXT__SECRETS__BITBUCKET_CLOUD_APP_PASSWORD": os.environ[
#             "BITBUCKET_ACCESS_TOKEN"
#         ],
#         "PREFECT__LOGGING__LEVEL": "DEBUG",
#     },
#     image_pull_policy="Always",
# )
k
The agent will connect to the Server after doing
prefect backend server
. Flows that are registered will also be registered on the server
1