From d2da2e0249a2eca5fd565aad6e91961a0c2a2961 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 2 Nov 2023 21:14:52 +0100 Subject: [PATCH] improvements --- Dockerfile | 4 ++++ build-docker.sh | 9 +++++++++ docker-compose.yml | 18 ++++++++++++++++++ nginx.conf | 33 +++++++++++++++++++++++++++++++++ src/Components/MyIcon/index.js | 1 - src/utils.js | 2 +- 6 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100755 build-docker.sh create mode 100644 docker-compose.yml create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eb7eec8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:latest + +COPY ./build /usr/share/nginx/html +COPY ./nginx.conf /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/build-docker.sh b/build-docker.sh new file mode 100755 index 0000000..a09cb49 --- /dev/null +++ b/build-docker.sh @@ -0,0 +1,9 @@ +# only allow to run this script as root +if [ "$EUID" -ne 0 ] + then echo "Please run as root" + exit +fi + +echo "Starting static web build of admin-dashboard-web" +npm run build +echo "Finished static web build of admin-dashboard-web" \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6d3847c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3" + +services: + jnx-admin-dashboard-proxy: + image: jnx-admin-dashboard-proxy:latest + restart: always + build: + context: . + dockerfile: nginx/Dockerfile + ports: + # CHANGE HOST/PORT IF NEEDED + #- "127.0.0.1:80:80" + - "80:80" + networks: + - jnx-admin-dashboard-network + depends_on: + - jnx-admin-dashboard-server + - jnx-log-manager-server diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..675ea4f --- /dev/null +++ b/nginx.conf @@ -0,0 +1,33 @@ +# nginx/nginx.conf +server { + listen 80; + + location /api/ { # api server + client_max_body_size 0; + proxy_http_version 1.0; + proxy_pass http://jnx-admin-dashboard-server:8080/; + } + + location /ws { # websocket server + proxy_read_timeout 10800s; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + proxy_pass http://jnx-admin-dashboard-server:8080/ws/; + proxy_http_version 1.1; + } + + location /lm/ { # log manager server + client_max_body_size 0; + proxy_http_version 1.0; + proxy_set_header Connection ""; # needed for sse + proxy_pass http://jnx-log-manager-server:3000/; + } + + location / { # frontend + root /usr/share/nginx/html; + index index.html; + + try_files $uri /index.html; + } +} diff --git a/src/Components/MyIcon/index.js b/src/Components/MyIcon/index.js index 35149d1..559845e 100644 --- a/src/Components/MyIcon/index.js +++ b/src/Components/MyIcon/index.js @@ -1,6 +1,5 @@ import { CopyOutlined, - DisconnectOutlined, EyeInvisibleOutlined, EyeOutlined, ReloadOutlined, diff --git a/src/utils.js b/src/utils.js index abd10bc..631931f 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1425,7 +1425,7 @@ export function myFetch( body: getBody(), }; - if (fetchUrl == "") { + if (fetchUrl === "") { fetchUrl = Constants.API_ADDRESS; }