Skip to content
Snippets Groups Projects
Unverified Commit feff488b authored by Niaz Faridani-Rad's avatar Niaz Faridani-Rad Committed by GitHub
Browse files

Merge pull request #88 from sickelap/fix_k8s_proxy_config

fix k8s proxy config
parents 00d97785 e3ab1fba
No related branches found
No related tags found
No related merge requests found
...@@ -13,9 +13,7 @@ services: ...@@ -13,9 +13,7 @@ services:
image: reallibrephotos/librephotos-proxy:${tag} image: reallibrephotos/librephotos-proxy:${tag}
container_name: e2e-__proxy_name__ container_name: e2e-__proxy_name__
restart: unless-stopped restart: unless-stopped
environment: command: /bin/bash -c "sed -ri 's/(__backend_name__|__frontend_name__)/e2e-\1/' /etc/nginx/nginx.conf && nginx -g 'daemon off;'"
BACKEND_NAME: e2e-__backend_name__
FRONTEND_NAME: e2e-__frontend_name__
volumes: volumes:
- e2e_scan_directory:/data - e2e_scan_directory:/data
- e2e_protected_media:/protected_media - e2e_protected_media:/protected_media
......
...@@ -13,9 +13,7 @@ services: ...@@ -13,9 +13,7 @@ services:
image: reallibrephotos/librephotos-proxy:${tag} image: reallibrephotos/librephotos-proxy:${tag}
container_name: e2e-proxy container_name: e2e-proxy
restart: unless-stopped restart: unless-stopped
environment: command: /bin/bash -c "sed -ri 's/(backend|frontend)/e2e-\1/' /etc/nginx/nginx.conf && nginx -g 'daemon off;'"
BACKEND_NAME: e2e-backend
FRONTEND_NAME: e2e-frontend
volumes: volumes:
- e2e_scan_directory:/data - e2e_scan_directory:/data
- e2e_protected_media:/protected_media - e2e_protected_media:/protected_media
......
FROM nginx FROM nginx
ENV BACKEND_NAME=${BACKEND_NAME:-backend} COPY nginx.conf /etc/nginx/nginx.conf
ENV FRONTEND_NAME=${FRONTEND_NAME:-frontend}
ENV VAR_PREFIX='$'
COPY nginx.tpl /etc/nginx/nginx.tpl
ENTRYPOINT envsubst < /etc/nginx/nginx.tpl > /etc/nginx/nginx.conf; nginx -g 'daemon off;'
...@@ -16,21 +16,21 @@ http { ...@@ -16,21 +16,21 @@ http {
# Always proxy to root with the same page request when nginx 404s # Always proxy to root with the same page request when nginx 404s
error_page 404 /; error_page 404 /;
proxy_intercept_errors on; proxy_intercept_errors on;
proxy_set_header Host ${VAR_PREFIX}host; proxy_set_header Host $host;
proxy_pass http://${FRONTEND_NAME}:3000/; proxy_pass http://frontend:3000/;
} }
location ~ ^/(api|media)/ { location ~ ^/(api|media)/ {
proxy_set_header X-Forwarded-Proto ${VAR_PREFIX}scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP ${VAR_PREFIX}remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host ${BACKEND_NAME}; proxy_set_header Host backend;
include uwsgi_params; include uwsgi_params;
proxy_pass http://${BACKEND_NAME}:8001; proxy_pass http://backend:8001;
} }
# needed for webpack-dev-server # needed for webpack-dev-server
location /ws { location /ws {
proxy_pass http://${FRONTEND_NAME}:3000; proxy_pass http://frontend:3000;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade ${VAR_PREFIX}http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
} }
# Django media # Django media
...@@ -40,7 +40,7 @@ http { ...@@ -40,7 +40,7 @@ http {
} }
location /static/drf-yasg { location /static/drf-yasg {
proxy_pass http://${BACKEND_NAME}:8001; proxy_pass http://backend:8001;
} }
location /data { location /data {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment