<@ULVA73B9P> I’m currently not using prefect cloud...
# ask-marvin
b
@Marvin I’m currently not using prefect cloud, and currently deploying only prefect server to Openshift, when setting PREFECT_API_URL, do I need to set that value of the service or the Route? Also, is it true that if I only deploy prefect server, I should be able to access the UI without deploying the worker?
m
When setting up Prefect on OpenShift, you have some flexibility with the
PREFECT_API_URL
. If you're only hosting a local instance of Prefect Server, you'll likely want to set
PREFECT_API_URL
to the Route that your OpenShift setup exposes. This way, any components or tools trying to communicate with the Prefect API (like workers or agents) can do so through the publicly accessible route. For more detailed configuration, you might want to consult the documentation here for Prefect 2.x and here for Prefect 3.x. Regarding accessing the UI without deploying a worker: Yes, it is possible to interact with the Prefect UI without deploying any workers. Workers in Prefect are responsible for executing flows, so if your intention is only to manage flows (for example, configuring and tracking but not running), you can access the UI without having any active workers. The UI configuration and proper Prefect Server setup should allow you to manage flows appropriately. The UI is accessible via the server itself, which is detailed in their setup documentation. For more information, please refer to the respective version's documentation: Prefect 2.x Kubernetes Deployment and Prefect 3.x Infrastructure Examples. If you have any more questions or need further help, feel free to ask!
b
@Marvin the following is my openshift template for deploying only the server, and I would like to access the UI through the route, but after my deployment, it complains about “This site can’t be reached”, what’s wrong with my template?
Copy code
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: bowen
  name: prefect-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: bowen
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: bowen
    spec:
      containers:
      - name: prefect-server
        image: prefecthq/prefect:3-python3.12-conda
        command: ["/bin/bash", "-c"]
        args: ["source activate prefect && prefect server start"]
        env:
        - name: PREFECT_UI_STATIC_DIRECTORY
          value: /cache
        - name: PREFECT_API_DATABASE_CONNECTION_URL
          value: <postgresql+asyncpg://postgres_user:postgres_password@bowen-db-service:5432/postgres_db>
        - name: PREFECT_API_URL
          value: <http://prefect-bowen-ui.apps.ocp-scc-rnd.fg.rbc.com:4200/api>
        resources: {}
        ports:
        - name: ui
          containerPort: 4200
        volumeMounts:
        - mountPath: /cache
          name: cache-volume
      volumes:
      - name: cache-volume
        emptyDir:
          sizeLimit: 500Mi
---
apiVersion: v1
kind: Service
metadata:
  name: prefect-bowen-service
spec:
  ports:
  - name: ui
    port: 4200
    protocol: TCP
    targetPort: 4200
  selector:
    app: bowen
--- 
apiVersion: <http://route.openshift.io/v1|route.openshift.io/v1>
kind: Route
metadata:
  name: bowen-prefect-webserver-route
spec:
  host: <http://prefect-bowen-ui.apps.ocp-scc-rnd.fg.rbc.com|prefect-bowen-ui.apps.ocp-scc-rnd.fg.rbc.com> 
  port:
    targetPort: ui
  to:
    kind: Service
    name: prefect-bowen-service
m
Your message was too long by 212 tokens - please shorten it and try again. For reference, here's your message at the allowed limit:
the following is my openshift template for deploying only the server, and I would like to access the UI through the route, but after my deployment, it complains about “This site can’t be reached”, what’s wrong with my template?
```--- apiVersion: apps/v1 kind: Deployment metadata: labels: app: bowen name: prefect-server spec: replicas: 1 selector: matchLabels: app: bowen strategy: {} template: metadata: creationTimestamp: null labels: app: bowen spec: containers: - name: prefect-server image: prefecthq/prefect:3-python3.12-conda command: ["/bin/bash", "-c"] args: ["source activate prefect && prefect server start"] env: - name: PREFECT_UI_STATIC_DIRECTORY value: /cache - name: PREFECT_API_DATABASE_CONNECTION_URL value: postgresql+asyncpg://postgres_user:postgres_password@bowen-db-service:5432/postgres_db - name: PREFECT_API_URL value: http://prefect-bowen-ui.apps.ocp-scc-rnd.fg.rbc.com:4200/api resources: {} ports: - name: ui containerPort: 4200 volumeMount
Your message was too long by 171 tokens - please shorten it and try again. For reference, here's your message at the allowed limit:
what’s wrong with following template
```--- apiVersion: apps/v1 kind: Deployment metadata: labels: app: bowen name: prefect-server spec: replicas: 1 selector: matchLabels: app: bowen strategy: {} template: metadata: creationTimestamp: null labels: app: bowen spec: containers: - name: prefect-server image: prefecthq/prefect:3-python3.12-conda command: ["/bin/bash", "-c"] args: ["source activate prefect && prefect server start"] env: - name: PREFECT_UI_STATIC_DIRECTORY value: /cache - name: PREFECT_API_DATABASE_CONNECTION_URL value: postgresql+asyncpg://postgres_user:postgres_password@bowen-db-service:5432/postgres_db - name: PREFECT_API_URL value: http://prefect-bowen-ui.apps.ocp-scc-rnd.fg.rbc.com:4200/api resources: {} ports: - name: ui containerPort: 4200 volumeMounts: - mountPath: /cache name: cache-volume volumes: - name: cache-volume emptyDir: sizeLimit: 500Mi --- apiVersion