feast-dev / feast

The Open Source Feature Store for Machine Learning
https://feast.dev
Apache License 2.0
5.52k stars 986 forks source link

feast ui root_path isn't working as expected #4373

Open dean-n opened 2 months ago

dean-n commented 2 months ago

Expected Behavior

After running feast ui root_path=/test, I thought I should be able to access the feast ui at localhost:8888/test.

Current Behavior

The routing doesn't seem to work and is unable to get the registry configuration.

INFO:     Uvicorn running on http://0.0.0.0:8888 (Press CTRL+C to quit)
INFO:     127.0.0.1:48274 - "GET /test/ HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:48274 - "GET /test HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:48274 - "GET /projects-list.json HTTP/1.1" 200 OK
INFO:     127.0.0.1:48274 - "GET /test/registry HTTP/1.1" 404 Not Found

Steps to reproduce

feast ui root_path=/test
curl localhost:8888/test

Specifications

Possible Solution

Other

I haven't seen any documentation on the root_path feature, please let me know how to configure it correctly if I'm making a mistake.

tokoko commented 2 months ago

Hey, that's not what root_path means, you need to specify it only if instead of exposing feast UI directly to the users, you've decided to put it behind some sort of a load balancer under a specific path, for example if a load balancer is forwarding requests starting with /test to your feast ui server. In that scenario, you need to specify /test as a root_path in order for server calls coming from the browser to work correctly.

dean-n commented 2 months ago

Hi @tokoko, thank you for your quick response 👍

I'm just trying to create a small local example, to replicate what I think we'll eventually deploy in my org.

I've setup an nginx reverse proxy:

server {
    listen 80; 
    server_name localhost;          

    location /app/ {              
        rewrite /app/(.*) /$1  break;    
        proxy_pass http://localhost:8888; 
    }
    location / {
        proxy_pass http://localhost:8888;
    }
}

My aim with the above was to replicate how it'll be deployed, accessible under a specific path.

Would I need to run my ui via feast ui root_path=/app/ with the above setup?

I've tried this, and get a 404: image

Please note: I added the second location block to successfully retrieve some style files e.g. http://localhost/static/css/main.4b6d8029.css

If I don't have it, I get the following errors: image

tokoko commented 2 months ago

sorry, I'm not familiar with the UI codebase, so mostly speculating here. The style files issue seems like a bug, looks like root_path is only used in ui_server.py to specify path for a /registry endpoint.

js7309 commented 1 month ago

index.html page change path

    spec:
      containers:
      - name: feature-ui
        image: feastdev/feature-server:0.40.1
        pullPolicy: IfNotPresent
        command:
          - /bin/bash
          - '-c'
        args:
            - |
              sed -i "s|href=\"|href=\"$PUBLIC_URL|g" /usr/local/lib/python3.11/site-packages/feast/ui/build/index.html
              sed -i "s|src=\"|src=\"$PUBLIC_URL|g" /usr/local/lib/python3.11/site-packages/feast/ui/build/index.html
              sed -i "s|/projects-list.json|${PUBLIC_URL}/projects-list.json|g" /usr/local/lib/python3.11/site-packages/feast/ui/build/static/js/main.2ebff4ed.js
              feast ui -h 0.0.0.0 --root_path ${PUBLIC_URL}
        env:
          - name: PUBLIC_URL
            value: /app