-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into BC-7561-batch-delete-fix
- Loading branch information
Showing
58 changed files
with
814 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,46 @@ | ||
FROM docker.io/node:22 AS git | ||
FROM docker.io/node:22-alpine AS builder | ||
|
||
RUN mkdir /app && chown -R node:node /app | ||
WORKDIR /app | ||
COPY .git . | ||
RUN git config --global --add safe.directory /app && echo "{\"sha\": \"$(git rev-parse HEAD)\", \"version\": \"$(git describe --tags --abbrev=0)\", \"commitDate\": \"$(git log -1 --format=%cd --date=format:'%Y-%m-%dT%H:%M:%SZ')\", \"birthdate\": \"$(date +%Y-%m-%dT%H:%M:%SZ)\"}" > /app/serverversion | ||
|
||
COPY package.json package-lock.json tsconfig.json tsconfig.build.json nest-cli.json ./ | ||
COPY apps apps | ||
COPY config config | ||
COPY esbuild esbuild | ||
COPY src src | ||
|
||
RUN apk add --no-cache git | ||
COPY .git ./.git | ||
RUN git config --global --add safe.directory /app \ | ||
&& echo "{\"sha\": \"$(git rev-parse HEAD)\", \"version\": \"$(git describe --tags --abbrev=0)\", \"commitDate\": \"$(git log -1 --format=%cd --date=format:'%Y-%m-%dT%H:%M:%SZ')\", \"birthdate\": \"$(date +%Y-%m-%dT%H:%M:%SZ)\"}" > apps/server/static-assets/serverversion | ||
|
||
RUN npm ci && npm run build | ||
|
||
|
||
FROM docker.io/node:22-alpine | ||
|
||
ENV TZ=Europe/Berlin | ||
RUN apk add --no-cache git make python3 | ||
# to run ldap sync as script curl is needed | ||
RUN apk add --no-cache curl | ||
RUN apk add --no-cache python3 curl | ||
|
||
WORKDIR /schulcloud-server | ||
COPY tsconfig.json tsconfig.build.json package.json package-lock.json .eslintrc.js .eslintignore nest-cli.json ./ | ||
COPY esbuild ./esbuild | ||
RUN npm ci && npm cache clean --force | ||
COPY config /schulcloud-server/config | ||
COPY backup /schulcloud-server/backup | ||
COPY src /schulcloud-server/src | ||
COPY apps /schulcloud-server/apps | ||
COPY --from=git /app/serverversion /schulcloud-server/apps/server/static-assets | ||
COPY scripts/ldapSync.sh /schulcloud-server/scripts/ | ||
RUN npm run build | ||
|
||
COPY package.json package-lock.json ./ | ||
COPY backup backup | ||
COPY config config | ||
COPY scripts/ldapSync.sh scripts/ | ||
COPY src src | ||
|
||
COPY --from=builder /app/dist dist | ||
|
||
# The postinstall script must be disabled, because esbuild is a dev dependency and not installed here. | ||
RUN npm pkg delete scripts.postinstall \ | ||
&& npm ci --omit=dev \ | ||
&& npm cache clean --force | ||
|
||
# The modules transpiled by esbuild need to be copied manually from the build stage. | ||
COPY --from=builder /app/node_modules/@keycloak/keycloak-admin-client-cjs node_modules/@keycloak/keycloak-admin-client-cjs | ||
COPY --from=builder /app/node_modules/file-type-cjs node_modules/file-type-cjs | ||
|
||
ENV NODE_ENV=production | ||
ENV NO_COLOR="true" | ||
CMD npm run start | ||
|
||
CMD npm run nest:start:prod | ||
Check warning on line 46 in Dockerfile
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
apps/server/src/infra/sync/tsp/loggable/tsp-data-sync-batch-finished.loggable.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { faker } from '@faker-js/faker'; | ||
import { TspDataSyncBatchFinishedLoggable } from './tsp-data-sync-batch-finished.loggable'; | ||
|
||
describe(TspDataSyncBatchFinishedLoggable.name, () => { | ||
describe('getLogMessage is called', () => { | ||
const setup = () => { | ||
const processedCount = faker.number.int(); | ||
const batchSize = faker.number.int(); | ||
const batchCount = faker.number.int(); | ||
const batchIndex = faker.number.int(); | ||
|
||
const expected = { | ||
message: `Processed ${processedCount} of ${batchSize} users in batch ${batchIndex} of ${batchCount}.`, | ||
data: { | ||
processedCount, | ||
batchSize, | ||
batchCount, | ||
batchIndex, | ||
}, | ||
}; | ||
|
||
return { processedCount, batchSize, batchCount, batchIndex, expected }; | ||
}; | ||
|
||
it('should return a log message', () => { | ||
const { processedCount, batchSize, batchCount, batchIndex, expected } = setup(); | ||
|
||
const loggable = new TspDataSyncBatchFinishedLoggable(processedCount, batchSize, batchCount, batchIndex); | ||
|
||
expect(loggable.getLogMessage()).toEqual(expected); | ||
}); | ||
}); | ||
}); |
24 changes: 24 additions & 0 deletions
24
apps/server/src/infra/sync/tsp/loggable/tsp-data-sync-batch-finished.loggable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Loggable, LogMessage } from '@core/logger'; | ||
|
||
export class TspDataSyncBatchFinishedLoggable implements Loggable { | ||
constructor( | ||
private readonly processedCount: number, | ||
private readonly batchSize: number, | ||
private readonly batchCount: number, | ||
private readonly batchIndex: number | ||
) {} | ||
|
||
public getLogMessage(): LogMessage { | ||
const message: LogMessage = { | ||
message: `Processed ${this.processedCount} of ${this.batchSize} users in batch ${this.batchIndex} of ${this.batchCount}.`, | ||
data: { | ||
processedCount: this.processedCount, | ||
batchSize: this.batchSize, | ||
batchCount: this.batchCount, | ||
batchIndex: this.batchIndex, | ||
}, | ||
}; | ||
|
||
return message; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.