diff --git a/backend/package.json b/backend/package.json index 92aa390..72ac46c 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "tower_nest", - "version": "3.2.0", + "version": "3.6.0", "description": "", "author": "", "private": true, diff --git a/backend/src/modules/members/members.service.ts b/backend/src/modules/members/members.service.ts index f634304..c46b2e7 100644 --- a/backend/src/modules/members/members.service.ts +++ b/backend/src/modules/members/members.service.ts @@ -339,7 +339,9 @@ export class MembersService implements OnModuleInit { if ( member.lastInvalidLoginAttemptDate && new Date().getTime() - member.lastInvalidLoginAttemptDate.getTime() >= - Number(process.env.BLOCK_USER_AFTER_INVALID_PASS_TIMEOUT_SECONDS) * + Number( + process.env.BLOCK_USER_AFTER_INVALID_PASS_TIMEOUT_SECONDS ?? 900, + ) * 1000 ) { member.temporaryBlocked = false; @@ -430,7 +432,12 @@ export class MembersService implements OnModuleInit { * @return {Promise} Returns a promise that resolves to `true` if the user is already temporarily blocked, or `false` otherwise. */ private async temporaryBlockUser(member: MemberDocument) { - if (process.env.BLOCK_USER_AFTER_INVALID_PASS !== 'true') { + const BLOCK_USER_AFTER_INVALID_PASS = + process.env.BLOCK_USER_AFTER_INVALID_PASS ?? 'true'; + const BLOCK_USER_AFTER_INVALID_PASS_ATTEMPTS_COUNT = + process.env.BLOCK_USER_AFTER_INVALID_PASS_ATTEMPTS_COUNT ?? 3; + + if (BLOCK_USER_AFTER_INVALID_PASS !== 'true') { return; } @@ -444,7 +451,7 @@ export class MembersService implements OnModuleInit { if ( member.invalidLoginAttempts >= - Number(process.env.BLOCK_USER_AFTER_INVALID_PASS_ATTEMPTS_COUNT) + Number(BLOCK_USER_AFTER_INVALID_PASS_ATTEMPTS_COUNT) ) { member.invalidLoginAttempts++; member.temporaryBlocked = true; diff --git a/backend/test/performance/test.js b/backend/test/performance/test.js index ae91205..14973f4 100644 --- a/backend/test/performance/test.js +++ b/backend/test/performance/test.js @@ -24,13 +24,13 @@ export const options = { contacts: { executor: 'constant-vus', vus: 10, - duration: '30s', + duration: '600s', }, }, }; export const setup = () => { - const url = 'http://localhost:3000'; + const url = 'http://localhost:5000'; const temp = http.post( `${url}/members/login`, @@ -47,12 +47,16 @@ export const setup = () => { }; export default (data) => { - const Environments = ['DEV', 'INT', 'UAT', 'PRD']; - const Apps = ['App1', 'App2', 'App3', 'App4']; + const Environments = []; + const Apps = []; + for (let i = 0; i < 100; i++) { + Environments.push(`Environment_${i}`); + Apps.push(`Apps_${i}`); + } http.get('https://test.k6.io'); - const url = 'http://localhost:3000'; + const url = 'http://localhost:5000'; const token = data.token; @@ -65,14 +69,8 @@ export default (data) => { }); } - // const randomEnv = 'oyfr0'; - // const randomApp = 'jwsw7'; - - // const randomApp = Math.random().toString(36).substring(2, 7); - // const randomEnv = Math.random().toString(36).substring(2, 7); - - const randomApp = Apps[Math.floor(Math.random() * 4)]; - const randomEnv = Environments[Math.floor(Math.random() * 4)]; + const randomApp = Apps[Math.floor(Math.random() * Environments.length)]; + const randomEnv = Environments[Math.floor(Math.random() * Apps.length)]; // try { // http.post( diff --git a/docker/Dockerfile b/docker/Dockerfile index ac96191..0bc946e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,6 @@ -FROM node:21-alpine3.18 +FROM node:22-alpine -ARG VERSION=3.1.0 +ARG VERSION=3.6.0 LABEL TOWER_VERSION=${VERSION} RUN mkdir -p /home/tower @@ -9,18 +9,32 @@ WORKDIR /home/tower RUN addgroup -S tower && adduser -D -G tower tower -COPY . . +COPY ui ui +COPY backend backend + RUN chown -R tower:tower . USER tower -RUN cd ui && npm --production=false ci -RUN cd backend && npm --production=false ci +RUN ls -lha + +WORKDIR /home/tower/ui +RUN yarn install + +WORKDIR /home/tower/backend +RUN yarn install + +ENV NODE_ENV=production -ENV NODE_ENV production +WORKDIR /home/tower/ui +RUN yarn run build + +WORKDIR /home/tower/backend +RUN yarn run build + + +WORKDIR /home/tower -RUN npm run build:ui -RUN npm run build:backend RUN mv backend/.env_template backend/.env RUN mkdir -p backend/client RUN cp -R ui/dist/spa/* backend/client/ diff --git a/package.json b/package.json index ef4e33e..17e63c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tower", - "version": "3.3.1", + "version": "3.6.0", "description": "", "main": "index.js", "scripts": { diff --git a/ui/src/components/configuration/configurationPanel.vue b/ui/src/components/configuration/configurationPanel.vue index b21de26..027e720 100644 --- a/ui/src/components/configuration/configurationPanel.vue +++ b/ui/src/components/configuration/configurationPanel.vue @@ -349,7 +349,7 @@ :class="{ 'tw-col-span-2': configurationVariablesArchive.length > 0, }" - class="tw-overflow-auto" + class="tw-overflow-auto tw-h-full" transition="fade" v-else >