m

    matt forbes

    2 years ago
    this issue to override the default apollo url was closed a few days ago but I am still unable to get this to default to anything other than localhost: https://github.com/PrefectHQ/ui/issues/99
    I am setting the PREFECT_SERVER__APOLLO_URL environment variable in the ui container to my backend url
    in dev console I can print out the settings
    docker run --rm -e PREFECT_SERVER__APOLLO_URL=<https://my-apollo.backend/> -p 8080:8080 prefe
    cthq/ui:latest
    it is propagating
    but still trying to talk to localhost
    nicholas

    nicholas

    2 years ago
    Hi @matt forbes - can you try opening your console and typing
    localStorage.clear()
    and pressing enter?
    And then refreshing the page?
    m

    matt forbes

    2 years ago
    that did it
    local storage persists even in incognito? that's interesting
    it takes a few tries of clearing/refreshing to get it to stick
    this is pretty weird behavior
    nicholas

    nicholas

    2 years ago
    Yeah that does sound odd, I can look into that some more if it persists - this is a pretty non-standard feature for an SPA like this so it may take some tweaking to get right
    m

    matt forbes

    2 years ago
    it gets a little weirder on the server
    since VUE_APP_BASE_URL is set to localhost by default
    I think I may need to override this as well?
    nicholas

    nicholas

    2 years ago
    Hm, I think you should be ok without doing that but I could be wrong; what are you seeing?
    m

    matt forbes

    2 years ago
    in public/index.html it tries to load the settings for the app
    it does that by requesting settings.json
    and that VUE_APP_BASE_URL is set to localhost
    so on the server, this does not work
    nicholas

    nicholas

    2 years ago
    Ah I see, that makes sense. A quick fix would be to modify
    index.html
    to update that call to
    process.env.VUE_APP_BASE_URL
    To match the endpoint of your server
    m

    matt forbes

    2 years ago
    does that url get baked in or can I override
    VUE_APP_BASE_URL
    when I start the container?
    nicholas

    nicholas

    2 years ago
    That gets baked in, unfortunately, which is why we need to have this weird async call at the start in the first place
    m

    matt forbes

    2 years ago
    ohhh this is just a static site... hm
    yeah this is making more sense now
    ok I can just replace it in the dockerfile
    thanks
    nicholas

    nicholas

    2 years ago
    Exactly - I can look into a better way to deliver that, I have a few ideas
    m

    matt forbes

    2 years ago
    can't it just fetch
    /settings.json?
    nicholas

    nicholas

    2 years ago
    Yeah that might work!
    m

    matt forbes

    2 years ago
    👍
    RUN sed -i 's/http:\/\/localhost:8080//g' /var/www/index.html
    in the dockerfile did do the trick
    and it loads the settings.json fine
    and in
    prefect_ui_settings
    it is pointing to the right url
    nicholas

    nicholas

    2 years ago
    Fantastic! If you want to PR that change to the UI that’s be great!
    m

    matt forbes

    2 years ago
    and lots of
    localStorage.clear()
    and still pointing to localhost
    😕
    yeah I can send a PR for that
    but still having an issue
    getting closer though
    nicholas

    nicholas

    2 years ago
    Hm ok, I can look into it over the weekend or early next week
    m

    matt forbes

    2 years ago
    sounds good, I may just try to brute force replace it on my end, but would be nice to have the apollo_url override actually work
    thanks for your help