anyone know how i can setup prefect in docker behi...
# ask-community
s
anyone know how i can setup prefect in docker behind nginx? i have the following:
Copy code
podman run \
    -it \
    --name prefect \
    -v /home/admin/apps/prefect/.env:/app/.env \
	-v /home/admin/apps/prefect/.prefect:/root/.prefect \
    -p 4200:4200 \
    prefect \
    /bin/bash
with this nginx:
Copy code
# prefect
              location /prefect/ {
                  proxy_pass <http://10.235.77.21:4200>;
                  proxy_set_header X-Script-Name /prefect;
                  proxy_set_header Host $host;
                  proxy_redirect off;
                  proxy_http_version 1.1;
                  proxy_set_header Upgrade $http_upgrade;
                  proxy_set_header Connection "upgrade";
              }
i set the envs:
Copy code
PREFECT_PROFILE='default'
PREFECT_API_URL='<http://127.0.0.1:4200/api>' (from profile)
PREFECT_UI_API_URL='<http://127.0.0.1>' (from profile)
i had tried all kinds of combos with add /prefect to the urls but no dice
s
Have you tried
PREFECT_SERVER_API_HOST="0.0.0.0"
instead of
127.0.0.1
all around?
s
i tried
prefect server start --host 0.0.0.0
but let me try that
no bueno
this is what i get from nginx:
Copy code
10.0.2.100 - - [29/Aug/2023:14:46:47 +0000] "GET /prefect/ HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36" "-"
2023/08/29 14:46:47 [error] 30#30: *211 open() "/usr/share/nginx/html/assets/index-02a86edf.js" failed (2: No such file or directory), client: 10.0.2.100, server: 10.235.77.21, request: "GET /assets/index-02a86edf.js HTTP/1.1", host: "10.235.77.21", referrer: "<http://10.235.77.21/prefect/>"
10.0.2.100 - - [29/Aug/2023:14:46:47 +0000] "GET /assets/index-02a86edf.js HTTP/1.1" 404 555 "<http://10.235.77.21/prefect/>" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36" "-"
2023/08/29 14:46:47 [error] 30#30: *213 open() "/usr/share/nginx/html/assets/index-c3bd5f27.css" failed (2: No such file or directory), client: 10.0.2.100, server: 10.235.77.21, request: "GET /assets/index-c3bd5f27.css HTTP/1.1", host: "10.235.77.21", referrer: "<http://10.235.77.21/prefect/>"
10.0.2.100 - - [29/Aug/2023:14:46:47 +0000] "GET /assets/index-c3bd5f27.css HTTP/1.1" 404 555 "<http://10.235.77.21/prefect/>" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36" "-"
it just shows a blank page
s
Not an expert on nginx, sorry. But when I run the Prefect server on a docker container, running in a server with, let’s say 10.235.77.21 as ip, I have to do like this to make it work:
Copy code
prefect config set PREFECT_SERVER_API_HOST="0.0.0.0"
prefect config set PREFECT_UI_API_URL="<http://10.235.77.21:4200/api>"
prefect config set PREFECT_UI_URL="<http://10.235.77.21:4200>"
s
seems to be similar to this guy: https://github.com/PrefectHQ/prefect/issues/10452
s
try setting the port in the url: like
<http://10.235.77.21:4200>
s
my setup is basically 8080-->firewall-->8081---> nginx
so can't really do that. but the app is running with curl
s
ok, I see
s
as a test i got rid of the prefix and it works - so i guess prefect doesn't allow /prefect after the domain?
🎉 1
for anyone looking for a solution - i just went with adding a proxy using duckdns