Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tower_nest",
"version": "3.2.0",
"version": "3.6.0",
"description": "",
"author": "",
"private": true,
Expand Down
13 changes: 10 additions & 3 deletions backend/src/modules/members/members.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -430,7 +432,12 @@ export class MembersService implements OnModuleInit {
* @return {Promise<boolean>} 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;
}

Expand All @@ -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;
Expand Down
24 changes: 11 additions & 13 deletions backend/test/performance/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand All @@ -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;

Expand All @@ -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(
Expand Down
30 changes: 22 additions & 8 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tower",
"version": "3.3.1",
"version": "3.6.0",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/configuration/configurationPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
>
Expand Down