librephotos-docker
librephotos-docker copied to clipboard
Static values for Ports in the Proxy/nginx.conf make install in Kubernetes not possible
Host may be an issue as well
I think the Host IP can be set as an EVAR and the nginx.conf would pick it up.
i.e.
environment:
- host=$hostIP
As seen in Proxy/nginx.conf: https://github.com/LibrePhotos/librephotos-docker/blob/main/proxy/nginx.conf
proxy_set_header Host $host;
But this same flexibility is not included in the ports that the backend and front end us.
eg:
proxy_pass http://frontend:3000/;
proxy_pass http://backend:8001;
This negates the possibility of a Docker user changing the ports Librephotos uses if 3000 and 8001 were already taken. In Kubernetes, unless the Kubernetes service load-balancer can provide static IPs (that's more complicated than it sounds, not possible for self hosted without complications), then the Kuberetes users are SOL.
Requested fix:
Set the host machine IP, as well as the backend and frontend ports as environmental variables.
Defaults would be localhost, 3000, and 8001, but non-default users could change those as needed.
Secondary but related issue: https://github.com/LibrePhotos/librephotos-docker/blob/main/proxy/nginx.conf
proxy_pass http://frontend:3000/;
proxy_pass http://backend:8001;
frontend and backend should call host, which should be a configurable variable... This opens up deployment options which may include not having all of the services running on the same 'machine'/localhost.
Left some notes on how to work around the localhost port issue for installs on Kubernetes here: https://github.com/ohthehugemanatee/homenet-documentation/issues/1
Can confirm on recommended solution above.
I copied the dockerfile and nginx.conf from: https://github.com/LibrePhotos/librephotos-docker/tree/main/proxy
Changed the proxy_pass values to my server, changed the ports to reflect the configured ports. Nginx worked as expected.
In kubernetes you can expose the service in any port you like! and you do not need this. See the Helmchart: https://github.com/varet80/publiccharts/tree/main/charts/librephotos It can also be extended to use the targetPort on the generated nginx.conf.
This chart is working on my private setup, and also mounts a storage of Nextcloud! it is following the similar approach you see on Kustomize'd work with some additions.