diff --git a/Dockerfile b/Dockerfile index 5690c8f..89ef851 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ USER appuser # copy data COPY . . -# install +# install and test USER root RUN . /etc/profile && apk add --virtual .npm-install-virt --no-cache git USER appuser @@ -31,9 +31,6 @@ RUN apk del .npm-install-virt USER appuser ENV NODE_ENV production -# test -RUN npm test - # cleanup USER root RUN rm -r ./src ./public/js-source ./bio-proxy-configuration-for-docker && \ diff --git a/docker-compose.debug.yml b/docker-compose.debug.yml index 7f85a83..e7498e5 100644 --- a/docker-compose.debug.yml +++ b/docker-compose.debug.yml @@ -15,20 +15,20 @@ services: depends_on: - redis environment: - - NODE_ENV=debug - - PORT=3000 - - EXTERNAL_BASE_URL=http://localhost - - REDIS_URL=redis://redis:6379 - - WELLKNOWN_CONFIG_URI=https://nodejs1-2.biotronik.int/auth/realms/CoE-BS/.well-known/openid-configuration - - CLIENT_ID=demo - - CLIENT_SECRET=fb49b346-c515-4680-adb1-beee0bd5b66e - - CLIENT_SCOPE=openid email profile roles groups - - EXT_REDIRECT_URI=http://localhost/oauth/redirect - - EXT_POST_LOGOUT_REDIRECT_URI=http://localhost - - EXT_POST_LOGIN_REDIRECT_URI=http://localhost - - PROXY_TARGET_URI=http://localhost:3000 - - SSL_VERIFY=false - - BASE_PATH=/base + - "NODE_ENV=debug" + - "PORT=3000" + - "EXTERNAL_BASE_URL=http://localhost" + - "REDIS_URL=redis://redis:6379" + - "WELLKNOWN_CONFIG_URI=https://nodejs1-2.biotronik.int/auth/realms/CoE-BS/.well-known/openid-configuration" + - "CLIENT_ID=demo" + - "CLIENT_SECRET=fb49b346-c515-4680-adb1-beee0bd5b66e" + - "CLIENT_SCOPE=openid email profile roles groups" + - "EXT_REDIRECT_URI=http://localhost/oauth/redirect" + - "EXT_POST_LOGOUT_REDIRECT_URI=http://localhost" + - "EXT_POST_LOGIN_REDIRECT_URI=http://localhost" + - "PROXY_TARGET_URI=http://host.docker.internal:3000" + - "SSL_VERIFY=false" + - "NO_PROXY=redis:6379" ports: - 3001:3000 networks: diff --git a/docker-compose.yml b/docker-compose.yml index 4a98fb5..fd2d3e2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,7 @@ services: - "SESSION_SECRET=replace with random" - "USERINFO_HEADER=X-Userinfo-Token" - "AUTH_PROXY_URL=http://proxy:3000/oauth" - - "NO_PROXY=redis:6379" + - "NO_PROXY=redis:6379,proxy:3000" depends_on: - redis networks: @@ -29,19 +29,20 @@ services: - app - redis environment: - - "PROXY_USERINFO_SECRET=3d513168-c92d-4f57-8c78-8fb2efad8a34" - - "PROXY_TARGET_URI=http://app:3000" - - "HOST=0.0.0.0" - - "COOKIE_SECRET=05e8cc4b-f95f-4a70-b4a1-b22ce295348d" + - "NODE_ENV=debug" + - "PORT=3000" + - "EXTERNAL_BASE_URL=http://localhost" + - "REDIS_URL=redis://redis:6379" - "WELLKNOWN_CONFIG_URI=https://nodejs1-2.biotronik.int/auth/realms/CoE-BS/.well-known/openid-configuration" - "CLIENT_ID=demo" - "CLIENT_SECRET=fb49b346-c515-4680-adb1-beee0bd5b66e" - "CLIENT_SCOPE=openid email profile roles groups" - - "NODE_ENV=debug" + - "EXT_REDIRECT_URI=http://localhost/oauth/redirect" + - "EXT_POST_LOGOUT_REDIRECT_URI=http://localhost" + - "EXT_POST_LOGIN_REDIRECT_URI=http://localhost" + - "PROXY_TARGET_URI=http://app:3000" - "SSL_VERIFY=false" - - "EXT_RESOURCE_URI=http://localhost" - - "REDIS_URL=redis://redis:6379" - - "NO_PROXY=redis:6379" + - "NO_PROXY=redis:6379,app:3000" networks: - backend - frontend diff --git a/package.json b/package.json index 68c70da..5ae535c 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "build": "tsc", "production": "node --use-openssl-ca --unhandled-rejections=strict ./out/index", "install-debug": "npm install && npm run build", - "install-prod": "npm install --only=dev && npm install --only=prod && npm run build && npm run del-node-module && npm install --only=prod", + "install-prod": "npm install --only=dev && npm install --only=prod && npm run build && npm test && npm run del-node-module && npm install --only=prod", "del-node-module:default": "rm -r node_modules", "del-node-module:windows": "if exist node_modules rmdir /Q/S node_modules", "del-node-module": "run-script-os" diff --git a/public/js-source/test/SomeModule.ts b/public/js-source/test/SomeModule.ts index 5c3da80..bafead1 100644 --- a/public/js-source/test/SomeModule.ts +++ b/public/js-source/test/SomeModule.ts @@ -9,7 +9,7 @@ import {UserInfo} from '../src/utils/userinfo'; describe('frontend:SomeModule', () => { const CONFIG = {EXTERNAL_BASE_URL: 'http://demo.url'}; - before(() => { + beforeEach(() => { setConfig(CONFIG); fetchMock.config.overwriteRoutes = true; }); diff --git a/src/routes/healthcheck.ts b/src/routes/healthcheck.ts index de9aa92..b8150e1 100644 --- a/src/routes/healthcheck.ts +++ b/src/routes/healthcheck.ts @@ -3,6 +3,7 @@ import * as express from 'express'; const healthRouter = express.Router(); healthRouter.get('/', async (req, res) => { + req.noHttpLogging = true; res.sendStatus(200); });