From adebcee48e3f5a6008b41786ec2daaaf52e02866 Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Mon, 13 Jun 2022 22:50:04 +0100 Subject: [PATCH] fix nginx loader --- Accounts/Dockerfile.dev | 4 +- Accounts/package.json | 2 +- Accounts/public/index.html | 2 +- Accounts/src/Pages/Register.tsx | 1 + Accounts/webpack.config.js | 2 +- Dashboard/package.json | 2 +- Dashboard/webpack.config.js | 2 +- Nginx/default.conf | 100 +++----------------------------- docker-compose.dev.yml | 1 + 9 files changed, 18 insertions(+), 98 deletions(-) diff --git a/Accounts/Dockerfile.dev b/Accounts/Dockerfile.dev index 42a4eea763..40941f26e5 100644 --- a/Accounts/Dockerfile.dev +++ b/Accounts/Dockerfile.dev @@ -54,7 +54,9 @@ COPY ./Accounts/package-lock.json /usr/src/app/package-lock.json # Install app dependencies RUN npm install - +RUN npm link ../CommonUI/node_modules/react +RUN npm link ../CommonUI/node_modules/react-dom +RUN npm link ../CommonUI/node_modules/react-router-dom # Create .cache folder with necessary permissions for React-based apps # https://stackoverflow.com/questions/67087735/eacces-permission-denied-mkdir-usr-app-node-modules-cache-how-can-i-creat RUN mkdir -p node_modules/.cache && chmod -R 777 node_modules/.cache diff --git a/Accounts/package.json b/Accounts/package.json index 6c93929ff6..54320a85d4 100644 --- a/Accounts/package.json +++ b/Accounts/package.json @@ -22,7 +22,7 @@ "compile": "tsc", "start": "node index.ts", "audit": "npm audit --audit-level=low", - "preinstall": "npm link ../CommonUI/node_modules/react && npx npm-force-resolutions || echo 'No package-lock.json file. Skipping force resolutions'", + "preinstall": "npx npm-force-resolutions || echo 'No package-lock.json file. Skipping force resolutions'", "dep-check": "depcheck ./ --skip-missing=true'" }, "browserslist": { diff --git a/Accounts/public/index.html b/Accounts/public/index.html index fd7717a790..09203566fa 100644 --- a/Accounts/public/index.html +++ b/Accounts/public/index.html @@ -64,7 +64,7 @@ The build step will place the bundled scripts into the tag. To begin the development, run `npm start` or `yarn start`. - To create a production bundle, use `npm run build` or `yarn build`. + To create a production bundle, use `npm run build` or `yarn build`. --> diff --git a/Accounts/src/Pages/Register.tsx b/Accounts/src/Pages/Register.tsx index fe8853efcc..851d4585a0 100644 --- a/Accounts/src/Pages/Register.tsx +++ b/Accounts/src/Pages/Register.tsx @@ -6,6 +6,7 @@ import FormValues from 'CommonUI/src/Components/Forms/Types/FormValues'; import Footer from '../Footer'; import Container from 'CommonUI/src/Container'; import IdentityAPI from 'CommonUI/src/Utils/API/IdentityAPI'; + import Route from 'Common/Types/API/Route'; import { JSONObject } from 'Common/Types/JSON'; import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType'; diff --git a/Accounts/webpack.config.js b/Accounts/webpack.config.js index d1c44fabb6..bb3c21f3d5 100644 --- a/Accounts/webpack.config.js +++ b/Accounts/webpack.config.js @@ -19,7 +19,7 @@ module.exports = { output: { filename: "bundle.js", path: path.resolve(__dirname, "dist"), - publicPath: "/accounts/assets/", + publicPath: "//assets/", }, resolve: { extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.css', '.scss'] diff --git a/Dashboard/package.json b/Dashboard/package.json index b9cc69c889..b86e683fcb 100644 --- a/Dashboard/package.json +++ b/Dashboard/package.json @@ -24,7 +24,7 @@ "compile": "tsc", "start": "node index.ts", "audit": "npm audit --audit-level=low", - "preinstall": "npm link ../CommonUI/node_modules/react && npx npm-force-resolutions || echo 'No package-lock.json file. Skipping force resolutions'", + "preinstall": "npx npm-force-resolutions || echo 'No package-lock.json file. Skipping force resolutions'", "dep-check": "depcheck ./ --skip-missing=true'" }, "browserslist": { diff --git a/Dashboard/webpack.config.js b/Dashboard/webpack.config.js index 5bd35e0360..9cf6b8a743 100644 --- a/Dashboard/webpack.config.js +++ b/Dashboard/webpack.config.js @@ -19,7 +19,7 @@ module.exports = { output: { filename: "bundle.js", path: path.resolve(__dirname, "dist"), - publicPath: "/dashboard/assets/", + publicPath: "//assets/", }, resolve: { extensions: ['.ts', '.tsx', '.js', '.json', '.css', '.scss'] diff --git a/Nginx/default.conf b/Nginx/default.conf index e802aa3581..77417f9028 100644 --- a/Nginx/default.conf +++ b/Nginx/default.conf @@ -1,17 +1,17 @@ upstream accounts { - server accounts:3003; + server accounts:3003 weight=10 max_fails=3 fail_timeout=30s; } upstream identity { - server identity:3087; + server identity:3087 weight=10 max_fails=3 fail_timeout=30s; } upstream dashboard { - server dashboard:3009; + server dashboard:3009 weight=10 max_fails=3 fail_timeout=30s; } upstream home { - server home:1444; + server home:1444 weight=10 max_fails=3 fail_timeout=30s; } # upstream admin { @@ -62,7 +62,7 @@ server { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; - proxy_pass http://home; + proxy_pass http://home/; } location /accounts { @@ -75,7 +75,7 @@ server { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; - proxy_pass http://accounts; + proxy_pass http://accounts/; } location /dashboard { @@ -88,7 +88,7 @@ server { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; - proxy_pass http://dashboard; + proxy_pass http://dashboard/; } location /identity { @@ -101,90 +101,6 @@ server { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; - proxy_pass http://identity; + proxy_pass http://identity/; } - # location /admin { - # proxy_set_header Host $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; - - # # enable WebSockets (for ws://sockjs not connected error in the admin source: https://stackoverflow.com/questions/41381444/websocket-connection-failed-error-during-websocket-handshake-unexpected-respon) - # proxy_http_version 1.1; - # proxy_set_header Upgrade $http_upgrade; - # proxy_set_header Connection "upgrade"; - # proxy_pass http://admin/; - # } - # location /dashboard { - # proxy_set_header Host $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; - - # # enable WebSockets (for ws://sockjs not connected error in the dashboard source: https://stackoverflow.com/questions/41381444/websocket-connection-failed-error-during-websocket-handshake-unexpected-respon) - # proxy_http_version 1.1; - # proxy_set_header Upgrade $http_upgrade; - # proxy_set_header Connection "upgrade"; - # proxy_pass http://dashboard/; - # } - # location /statuspage { - # proxy_set_header Host $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; - - # # enable WebSockets (for ws://sockjs not connected error in the statuspage source: https://stackoverflow.com/questions/41381444/websocket-connection-failed-error-during-websocket-handshake-unexpected-respon) - # proxy_http_version 1.1; - # proxy_set_header Upgrade $http_upgrade; - # proxy_set_header Connection "upgrade"; - # proxy_pass http://StatusPage/; - # } - # location /api { - # rewrite ^/api/(.*) /$1 break; - # proxy_set_header Host $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; - # proxy_pass http://api/; - # } - # location /realtime { - # rewrite ^/realtime/(.*) /$1 break; - # proxy_set_header Host $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; - # proxy_pass http://realtime/; - # } - # location /docs { - # rewrite ^/docs/(.*) /$1 break; - # proxy_set_header Host $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; - # proxy_pass http://docs/; - # } - # location /ingestor { - # rewrite ^/ingestor/(.*) /$1 break; - # proxy_set_header Host $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; - # proxy_pass http://ingestor/; - # } - # location /probe1 { - # rewrite ^/probe1/(.*) /$1 break; - # proxy_set_header Host $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; - # proxy_pass http://probe1/; - # } - # location /probe2 { - # rewrite ^/probe2/(.*) /$1 break; - # proxy_set_header Host $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; - # proxy_pass http://probe2/; - # } } \ No newline at end of file diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 0a80d2ae71..0ab0fb58dc 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -5,6 +5,7 @@ version: '3.7' x-common-variables: &common-variables IS_SAAS_SERVICE: ${IS_SAAS_SERVICE} + DEBUG: 'express:*' services: ##IMPORTANT: