mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-05 12:41:20 +00:00
Split nginx configuration to several files
This commit is contained in:
parent
0ec79fe8d0
commit
c99630172b
10
Dockerfile
10
Dockerfile
@ -58,20 +58,24 @@ ENV TFW_TERMINADO_WD="/home/${AVATAO_USER}"
|
|||||||
ENV TFW_LIB_DIR="/usr/local/lib/"
|
ENV TFW_LIB_DIR="/usr/local/lib/"
|
||||||
ENV TFW_SUPERVISORD_CONF="/etc/supervisor/supervisord.conf"
|
ENV TFW_SUPERVISORD_CONF="/etc/supervisor/supervisord.conf"
|
||||||
ENV TFW_SUPERVISORD_COMPONENTS="/etc/supervisor/conf"
|
ENV TFW_SUPERVISORD_COMPONENTS="/etc/supervisor/conf"
|
||||||
|
ENV TFW_NGINX_CONF="/etc/nginx/sites-enabled/default"
|
||||||
|
ENV TFW_NGINX_COMPONENTS="/etc/nginx/components"
|
||||||
ENV PYTHONPATH=${TFW_LIB_DIR}
|
ENV PYTHONPATH=${TFW_LIB_DIR}
|
||||||
|
|
||||||
COPY nginx /etc/nginx
|
|
||||||
COPY lib ${TFW_LIB_DIR}
|
COPY lib ${TFW_LIB_DIR}
|
||||||
COPY supervisor/supervisord.conf ${TFW_SUPERVISORD_CONF}
|
COPY supervisor/supervisord.conf ${TFW_SUPERVISORD_CONF}
|
||||||
COPY supervisor/components/ ${TFW_SUPERVISORD_COMPONENTS}
|
COPY supervisor/components/ ${TFW_SUPERVISORD_COMPONENTS}
|
||||||
|
COPY nginx/nginx.conf ${TFW_NGINX_CONF}
|
||||||
|
COPY nginx/components/ ${TFW_NGINX_COMPONENTS}
|
||||||
COPY src/app ${TFW_APP_DIR}
|
COPY src/app ${TFW_APP_DIR}
|
||||||
COPY src/event_handlers ${TFW_EVENT_HANDLERS_DIR}
|
COPY src/event_handlers ${TFW_EVENT_HANDLERS_DIR}
|
||||||
|
|
||||||
RUN chown -R ${AVATAO_USER}: /var/log/nginx /var/lib/nginx &&\
|
RUN chown -R ${AVATAO_USER}: /var/log/nginx /var/lib/nginx &&\
|
||||||
# nginx runs as a regular user, and can't write to /run
|
# nginx runs as a regular user, and can't write to /run
|
||||||
sed -i 's#pid /run/nginx.pid;#pid /tmp/nginx.pid;#g' /etc/nginx/nginx.conf &&\
|
sed -i 's#pid /run/nginx.pid;#pid /tmp/nginx.pid;#g' /etc/nginx/nginx.conf &&\
|
||||||
envsubst "$(printenv | cut -d= -f1 | grep TFW_ | sed -e 's/^/$/g')" \
|
for f in "${TFW_NGINX_CONF}" ${TFW_NGINX_COMPONENTS}/*.conf; do \
|
||||||
< /etc/nginx/sites-available/default > /etc/nginx/sites-available/default &&\
|
envsubst "$(printenv | cut -d= -f1 | grep TFW_ | sed -e 's/^/$/g')" < $f > $f ;\
|
||||||
|
done &&\
|
||||||
mv /data/dist ${TFW_FRONTEND_DIR}
|
mv /data/dist ${TFW_FRONTEND_DIR}
|
||||||
|
|
||||||
USER ${AVATAO_USER}
|
USER ${AVATAO_USER}
|
||||||
|
3
nginx/components/login.conf
Normal file
3
nginx/components/login.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
location = /login {
|
||||||
|
proxy_pass http://127.0.0.1:${TFW_LOGIN_APP_PORT};
|
||||||
|
}
|
6
nginx/components/terminal.conf
Normal file
6
nginx/components/terminal.conf
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
location = /terminal {
|
||||||
|
proxy_pass http://127.0.0.1:${TFW_TERMINADO_PORT};
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
}
|
@ -12,16 +12,7 @@ server {
|
|||||||
proxy_set_header Connection "Upgrade";
|
proxy_set_header Connection "Upgrade";
|
||||||
}
|
}
|
||||||
|
|
||||||
location = /terminal {
|
include ${TFW_NGINX_COMPONENTS}/*.conf;
|
||||||
proxy_pass http://127.0.0.1:${TFW_TERMINADO_PORT};
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
}
|
|
||||||
|
|
||||||
location = /login {
|
|
||||||
proxy_pass http://127.0.0.1:${TFW_LOGIN_APP_PORT};
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
root ${TFW_FRONTEND_DIR};
|
root ${TFW_FRONTEND_DIR};
|
Loading…
Reference in New Issue
Block a user