Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
626bc76a35 | ||
|
|
aa846e4b8e |
@@ -1,39 +1,17 @@
|
||||
FROM ubuntu:16.04
|
||||
FROM nginx
|
||||
|
||||
RUN apt update && apt -y full-upgrade
|
||||
RUN apt autoclean && apt update
|
||||
|
||||
RUN apt -y install apache2 \
|
||||
&& apt -y autoremove \
|
||||
&& apt -y autoclean
|
||||
|
||||
RUN a2enmod proxy proxy_http proxy_html proxy_wstunnel rewrite ssl
|
||||
RUN a2dissite 000-default.conf default-ssl.conf
|
||||
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
RUN mkdir -p /opt/metasfresh-webui-frontend
|
||||
RUN ln -s /usr/share/nginx/html /opt/metasfresh-webui-frontend/dist
|
||||
|
||||
COPY sources/dist /opt/metasfresh-webui-frontend/dist
|
||||
COPY sources/configs/metasfresh_webui.conf /opt/
|
||||
COPY sources/configs/metasfresh_webui_ssl.conf /opt/
|
||||
COPY sources/dist /usr/share/nginx/html
|
||||
COPY sources/configs/config.js /opt/metasfresh-webui-frontend/dist/
|
||||
|
||||
#add apache config
|
||||
COPY sources/configs/metasfresh_webui.conf /etc/apache2/sites-available/
|
||||
COPY sources/configs/metasfresh_webui_ssl.conf /etc/apache2/sites-available/
|
||||
|
||||
#set environment
|
||||
RUN . /etc/apache2/envvars
|
||||
|
||||
ENV APACHE_RUN_USER www-data
|
||||
ENV APACHE_RUN_GROUP www-data
|
||||
ENV APACHE_PID_FILE /var/run/apache2.pid
|
||||
ENV APACHE_RUN_DIR /var/run/apache2
|
||||
ENV APACHE_LOCK_DIR /var/lock/apache2
|
||||
ENV APACHE_LOG_DIR /var/log/apache2
|
||||
|
||||
RUN chown www-data:www-data -R /opt/metasfresh-webui-frontend/
|
||||
|
||||
#add entry-script
|
||||
COPY sources/start_webui.sh /
|
||||
RUN chmod +x /start_webui.sh
|
||||
|
||||
EXPOSE 80 443
|
||||
ENTRYPOINT ["/start_webui.sh"]
|
||||
|
||||
@@ -1,86 +1,62 @@
|
||||
<VirtualHost *:80>
|
||||
ProxyRequests Off
|
||||
DocumentRoot /opt/metasfresh-webui-frontend/dist/
|
||||
ErrorLog ${APACHE_LOG_DIR}/webui_error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/webui_access.log combined
|
||||
server {
|
||||
listen 80 default_server;
|
||||
|
||||
<Location /rest>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
ProxyPass http://webapi:8080/rest/ retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/rest/
|
||||
</Location>
|
||||
proxy_buffering off;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
<Location /stomp>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
RewriteEngine on
|
||||
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
|
||||
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
|
||||
RewriteRule .* ws://webapi:8080%{REQUEST_URI} [P]
|
||||
ProxyPass ws://webapi:8080/stomp/ retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse ws://webapi:8080/stomp/ retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPass http://webapi:8080/stomp/ retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/stomp/
|
||||
</Location>
|
||||
location /rest {
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/rest/;
|
||||
}
|
||||
|
||||
location /stomp {
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
client_max_body_size 50M;
|
||||
proxy_set_header X-Frame-Options SAMEORIGIN;
|
||||
proxy_buffers 256 16k;
|
||||
proxy_buffer_size 16k;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/stomp/;
|
||||
}
|
||||
|
||||
<Location /info>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
ProxyPass http://webapi:8080/info retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/info
|
||||
</Location>
|
||||
|
||||
<Location /swagger-ui.html>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
ProxyPass http://webapi:8080/swagger-ui.html retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/swagger-ui.html
|
||||
</Location>
|
||||
location /info {
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/info;
|
||||
}
|
||||
|
||||
<Location /v2/api-docs>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
ProxyPass http://webapi:8080/v2/api-docs/ retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/v2/api-docs/
|
||||
</Location>
|
||||
location /swagger-ui.html {
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/swagger-ui.html;
|
||||
}
|
||||
|
||||
<Location /swagger-resources>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
ProxyPass http://webapi:8080/swagger-resources/ retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/swagger-resources/
|
||||
</Location>
|
||||
location /v2/api-docs {
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/v2/api-docs;
|
||||
}
|
||||
|
||||
<Location /webjars/springfox-swagger-ui>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
ProxyPass http://webapi:8080/webjars/springfox-swagger-ui/ retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/webjars/springfox-swagger-ui/
|
||||
</Location>
|
||||
location /swagger-resources{
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/swagger-resources/;
|
||||
}
|
||||
|
||||
<Location /configuration>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
ProxyPass http://webapi:8080/configuration/ retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/configuration/
|
||||
</Location>
|
||||
location /webjars/springfox-swagger-ui{
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/webjars/springfox-swagger-ui/;
|
||||
}
|
||||
|
||||
<Location /info>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
ProxyPass http://webapi:8080/info retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/info
|
||||
</Location>
|
||||
location /configuration{
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/configuration/;
|
||||
}
|
||||
|
||||
<Directory /opt/metasfresh-webui-frontend/dist/>
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
RewriteEngine On
|
||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
|
||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
|
||||
RewriteRule ^ - [L]
|
||||
RewriteRule ^ /index.html
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
location /msv3 {
|
||||
resolver 127.0.0.1;
|
||||
set $msvproxy "MSV3_API_PROXYPASS_HOST:MSV3_API_PROXYPASS_PORT";
|
||||
|
||||
proxy_pass http://$msvproxy/;
|
||||
}
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,82 +1,72 @@
|
||||
<IfModule mod_ssl.c>
|
||||
<VirtualHost *:443>
|
||||
ProxyRequests Off
|
||||
DocumentRoot /opt/metasfresh-webui-frontend/dist/
|
||||
ErrorLog ${APACHE_LOG_DIR}/webui_error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/webui_access.log combined
|
||||
<Location /rest>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
ProxyPass http://webapi:8080/rest/ retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/rest/
|
||||
</Location>
|
||||
|
||||
<Location /stomp>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
RewriteEngine on
|
||||
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
|
||||
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
|
||||
RewriteRule .* ws://webapi:8080%{REQUEST_URI} [P]
|
||||
ProxyPass ws://webapi:8080/stomp/ retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse ws://webapi:8080/stomp/
|
||||
ProxyPass http://webapi:8080/stomp/ retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/stomp/
|
||||
</Location>
|
||||
|
||||
<Location /info>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
ProxyPass http://webapi:8080/info retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/info
|
||||
</Location>
|
||||
|
||||
<Location /swagger-ui.html>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
ProxyPass http://webapi:8080/swagger-ui.html retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/swagger-ui.html
|
||||
</Location>
|
||||
server {
|
||||
listen 443 ssl default_server;
|
||||
|
||||
<Location /v2/api-docs>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
ProxyPass http://webapi:8080/v2/api-docs/ retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/v2/api-docs/
|
||||
</Location>
|
||||
ssl_certificate /etc/ssl/certs/cert.pem;
|
||||
ssl_certificate_key /etc/ssl/certs/privkey.pem;
|
||||
|
||||
ssl_session_timeout 30m;
|
||||
ssl_session_cache builtin:1000 shared:SSL:10m;
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
<Location /swagger-resources>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
ProxyPass http://webapi:8080/swagger-resources/ retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/swagger-resources/
|
||||
</Location>
|
||||
proxy_buffering off;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
<Location /webjars/springfox-swagger-ui>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
ProxyPass http://webapi:8080/webjars/springfox-swagger-ui/ retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/webjars/springfox-swagger-ui/
|
||||
</Location>
|
||||
location /rest {
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/rest/;
|
||||
}
|
||||
|
||||
location /stomp {
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
client_max_body_size 50M;
|
||||
proxy_set_header X-Frame-Options SAMEORIGIN;
|
||||
proxy_buffers 256 16k;
|
||||
proxy_buffer_size 16k;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/stomp/;
|
||||
}
|
||||
|
||||
<Location /configuration>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
ProxyPass http://webapi:8080/configuration/ retry=0 acquire=3000 timeout=600 Keepalive=On
|
||||
ProxyPassReverse http://webapi:8080/configuration/
|
||||
</Location>
|
||||
location /info {
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/info;
|
||||
}
|
||||
|
||||
<Directory /opt/metasfresh-webui-frontend/dist/>
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
RewriteEngine On
|
||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
|
||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
|
||||
RewriteRule ^ - [L]
|
||||
RewriteRule ^ /index.html
|
||||
</Directory>
|
||||
SSLCertificateFile /etc/apache2/certs/fullchain.pem
|
||||
SSLCertificateKeyFile /etc/apache2/certs/privkey.pem
|
||||
</VirtualHost>
|
||||
</IfModule>
|
||||
location /swagger-ui.html {
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/swagger-ui.html;
|
||||
}
|
||||
|
||||
location /v2/api-docs {
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/v2/api-docs;
|
||||
}
|
||||
|
||||
location /swagger-resources{
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/swagger-resources/;
|
||||
}
|
||||
|
||||
location /webjars/springfox-swagger-ui{
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/webjars/springfox-swagger-ui/;
|
||||
}
|
||||
|
||||
location /configuration{
|
||||
proxy_pass http://WEBUI_API_PROXYPASS_HOST:WEBUI_API_PROXYPASS_PORT/configuration/;
|
||||
}
|
||||
|
||||
location /msv3 {
|
||||
resolver 127.0.0.1;
|
||||
set $msvproxy "MSV3_API_PROXYPASS_HOST:MSV3_API_PROXYPASS_PORT";
|
||||
|
||||
proxy_pass http://$msvproxy/;
|
||||
}
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
|
||||
# thx to https://github.com/react-boilerplate/react-boilerplate/blob/master/app/.nginx.conf
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
webapi_client_host=${WEBUI_API_CLIENT_HOST:-webapi}
|
||||
webapi_client_port=${WEBUI_API_CLIENT_PORT:-8080}
|
||||
|
||||
webapi_proxypass_host=${WEBUI_API_PROXYPASS_HOST:-webapi}
|
||||
webapi_proxypass_port=${WEBUI_API_PROXYPASS_PORT:-8080}
|
||||
|
||||
msv3_proxypass_host=${MSV3_API_PROXYPASS_HOST:-msv3}
|
||||
msv3_proxypass_port=${MSV3_API_PROXYPASS_PORT:-8080}
|
||||
|
||||
|
||||
#Using the env-variable in docker-compose.yml to populate config.js
|
||||
if [[ ! -z $WEBAPI_URL ]]; then
|
||||
sed -i 's,http\:\/\/MYDOCKERHOST\:PORT,'$WEBAPI_URL',g' /opt/metasfresh-webui-frontend/dist/config.js
|
||||
fi
|
||||
|
||||
if [[ -f "/etc/apache2/certs/fullchain.pem" ]] && [[ -f "/etc/apache2/certs/privkey.pem" ]]; then
|
||||
if [[ -f "/etc/ssl/certs/cert.pem" ]] && [[ -f "/etc/ssl/certs/privkey.pem" ]]; then
|
||||
sed -i 's/\bhttp\b/https/g' /opt/metasfresh-webui-frontend/dist/config.js
|
||||
a2ensite metasfresh_webui_ssl.conf
|
||||
echo "[METASFRESH] Activated SSL!"
|
||||
cat /opt/metasfresh_webui_ssl.conf > /etc/nginx/conf.d/default.conf
|
||||
SSL_ACTIVE="SSL"
|
||||
else
|
||||
sed -i 's/\https\b/http/g' /opt/metasfresh-webui-frontend/dist/config.js
|
||||
a2ensite metasfresh_webui.conf
|
||||
a2dissite metasfresh_webui_ssl.conf
|
||||
echo "[METASFRESH] Runnning Non-SSL!"
|
||||
cat /opt/metasfresh_webui.conf > /etc/nginx/conf.d/default.conf
|
||||
SSL_ACTIVE="NON-SSL"
|
||||
fi
|
||||
|
||||
/usr/sbin/apache2ctl -DFOREGROUND
|
||||
sed -i 's/WEBUI_API_PROXYPASS_HOST/'${webapi_proxypass_host}'/g' /etc/nginx/conf.d/default.conf
|
||||
sed -i 's/WEBUI_API_PROXYPASS_PORT/'${webapi_proxypass_port}'/g' /etc/nginx/conf.d/default.conf
|
||||
sed -i 's/MSV3_API_PROXYPASS_HOST/'${msv3_proxypass_host}'/g' /etc/nginx/conf.d/default.conf
|
||||
sed -i 's/MSV3_API_PROXYPASS_PORT/'${msv3_proxypass_port}'/g' /etc/nginx/conf.d/default.conf
|
||||
|
||||
|
||||
echo "*************************************************************"
|
||||
echo "Display the variable values we run with"
|
||||
echo "*************************************************************"
|
||||
echo ""
|
||||
echo "WEBUI_API_PROXYPASS_HOST=$webapi_proxypass_host"
|
||||
echo "WEBUI_API_PROXYPASS_PORT=$webapi_proxypass_port"
|
||||
echo ""
|
||||
echo "MSV3_API_PROXYPASS_HOST=$msv3_proxypass_host"
|
||||
echo "MSV3_API_PROXYPASS_PORT=$msv3_proxypass_port"
|
||||
echo ""
|
||||
echo "SSL_ACTIVE=$SSL_ACTIVE"
|
||||
|
||||
|
||||
echo "Start nginx -g 'daemon off;'"
|
||||
nginx -g 'daemon off;'
|
||||
|
||||
+4
-19
@@ -1,26 +1,11 @@
|
||||
FROM metasfresh/metasfresh-webui:5.101
|
||||
|
||||
COPY sources/certs /etc/ssl/certs
|
||||
COPY sources/configs/config.js /opt/metasfresh-webui-frontend/dist/
|
||||
COPY sources/configs/metasfresh_webui.conf /opt/
|
||||
COPY sources/configs/metasfresh_webui_ssl.conf /opt/
|
||||
|
||||
#add apache config
|
||||
COPY sources/configs/metasfresh_webui.conf /etc/apache2/sites-available/
|
||||
RUN mkdir -p /etc/apache2/certs/
|
||||
COPY sources/certs /etc/apache2/certs
|
||||
|
||||
RUN a2ensite metasfresh_webui.conf
|
||||
|
||||
#set environment
|
||||
RUN . /etc/apache2/envvars
|
||||
|
||||
ENV APACHE_RUN_USER www-data
|
||||
ENV APACHE_RUN_GROUP www-data
|
||||
ENV APACHE_PID_FILE /var/run/apache2.pid
|
||||
ENV APACHE_RUN_DIR /var/run/apache2
|
||||
ENV APACHE_LOCK_DIR /var/lock/apache2
|
||||
ENV APACHE_LOG_DIR /var/log/apache2
|
||||
|
||||
RUN chown www-data:www-data -R /opt/metasfresh-webui-frontend/
|
||||
|
||||
RUN chown www-data:www-data -R /opt/
|
||||
|
||||
EXPOSE 80 443
|
||||
ENTRYPOINT ["/start_webui.sh"]
|
||||
|
||||
Reference in New Issue
Block a user