<@ULVA73B9P> I have a self-hosted version of prefe...
# ask-marvin
e
@Marvin I have a self-hosted version of prefect server deployed with following docker-compose. It worked with the image prefecthq/prefect:2-python3.10, but no more with the image prefecthq/prefect:3-latest version I tried to modify PREFECT_SERVER_API_HOST with localhost or 127.0.0.1 but the UI is no more accessible. For reference I have a worker with PREFECT_API_URL=http://server:4200/api How can I fix it ? Below is my docker-compose.yaml services: server: container_name: prefect-server image: prefecthq/prefect:3-latest restart: unless-stopped volumes: - ./server:/root/.prefect - /home/data/flows:/opt/prefect/flows entrypoint: ["prefect", "server", "start"] environment: - PREFECT_SERVER_API_HOST=127.0.0.1 - PREFECT_API_DATABASE_CONNECTION_URL=postgresql+asyncpg://postgres:postgres@db:5432/prefect ports: - 4200:4200 depends_on: - db
m
When transitioning from Prefect 2.x to Prefect 3.x, it's important to note some changes that may affect your self-hosted setup, especially related to Docker and accessing the Prefect UI. 1. Docker Configuration: Your Docker setup for Prefect 3.x might require some adjustments, particularly concerning environment variables and network settings. The error you are experiencing could be related to how the Prefect server expects network interfaces and environment variables to be configured differently in Prefect 3.x. 2. Network Settings: In Prefect 3.x, ensure that the
PREFECT_SERVER_API_HOST
is properly networked to listen on
0.0.0.0
instead of
127.0.0.1
if the UI is intended to be accessed externally, such as from a browser outside the container's local host. This setting ensures that the server is not only listening on a localhost interface, which could restrict accessibility. 3. Documentation Guidance: According to Prefect 3.0 self-hosting guide, ensure that any necessary certificates and proxy settings are configured especially if you're operating behind a proxy or encountering TLS certificate issues. Use the
PREFECT_API_TLS_INSECURE_SKIP_VERIFY
environment variable for testing if certificate issues are suspected. 4. UI Accessibility: One reported issue on GitHub here relates to blank screens in UI, which can occur due to incomplete network responses over certain VPNs. Confirm that network routes and firewalls between your browser (or network) and the Prefect UI are properly configured and responsive. Here's a possible adjustment to your `docker-compose.yaml`:
Copy code
yaml
services:
  server:
    container_name: prefect-server
    image: prefecthq/prefect:3-latest
    restart: unless-stopped
    volumes:
      - ./server:/root/.prefect
      - /home/data/flows:/opt/prefect/flows
    entrypoint: ["prefect", "server", "start"]
    environment:
      - PREFECT_SERVER_API_HOST=0.0.0.0
      - PREFECT_API_DATABASE_CONNECTION_URL=<postgresql+asyncpg://postgres:postgres@db:5432/prefect>
    ports:
      - "4200:4200"
    depends_on:
      - db
Ensure that your
PREFECT_API_URL
on the worker is correctly set with the server's public or accessible IP/domain, reflecting changes made to make the server UI accessible. By making these adjustments, you should be able to launch and access your Prefect UI as expected. Let me know if this helps or if there are any further issues!
n
hi @Emmanuel Rambeau - any way you'd be able to try pip installing newest prefect and trying again?
I think this may fix your issue
e
Hi, thanks for your answer. Pip installing ? What do you mean ? Because I have a VM with docker installed, and I run my docker-compose.yaml to boot my server. No usage of pip.
n
sorry yeah I just mean using newest prefect, so like a
3-latest
or
3.0.9-*
tag
e
@Nate Oh, yes, this is the issue. When I upgraded my server to version 3-latest (it was 3.0.8), I encountered the problem. I just tested it with version 3.0.9 and Python 3.12, but unfortunately, it didn’t resolve the issue. After giving it more thought, I believe the issue could be happening because the Prefect Dashboard is loaded over HTTPS (see my Nginx configuration), while the individual components are being loaded over HTTP. You can see related messages in the console. I'm not sure if this was the best practice, but I don't have a private network, and I wanted to secure access to my Prefect server with authentication to ensure no one else could access it. If it helps, I've included my
docker-compose.yml
and
nginx.conf
files here. I've also added some console logs in case you have any insights.