Skip to content

Commit

Permalink
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 EW-893
Browse files Browse the repository at this point in the history
psachmann authored Jun 20, 2024
2 parents 971f3ac + 2d62bb3 commit 4cca2d7
Showing 705 changed files with 15,684 additions and 18,675 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ jobs:
- name: npm ci
run: npm ci --prefer-offline --no-audit
- name: nest:test:cov - test all with coverage
timeout-minutes: 11
timeout-minutes: 15
run: export RUN_WITHOUT_JEST_COVERAGE='true' && export NODE_OPTIONS='--max_old_space_size=4096' && ./node_modules/.bin/jest --shard=${{ matrix.shard }}/${{ strategy.job-total }} --coverage --force-exit
- name: save-coverage
run: mv coverage/lcov.info coverage/${{matrix.shard}}.info
Original file line number Diff line number Diff line change
@@ -44,6 +44,8 @@ spec:
name: api-secret
- secretRef:
name: api-h5p-library-management-secret
- secretRef:
name: api-files-secret
volumeMounts:
- name: libraries-list
mountPath: /schulcloud-server/config/h5p-libraries.yaml
Original file line number Diff line number Diff line change
@@ -27,6 +27,8 @@ spec:
name: moin-schule-users-deletion-queueing-cronjob-configmap
- secretRef:
name: moin-schule-sync-secret
- secretRef:
name: api-files-secret
command: ['/bin/sh','-c']
args: ['npm run nest:start:deletion-console -- queue unsynced --systemId $SYSTEM_ID']
resources:
Original file line number Diff line number Diff line change
@@ -27,6 +27,8 @@ spec:
name: moin-schule-users-sync-cronjob-configmap
- secretRef:
name: moin-schule-sync-secret
- secretRef:
name: api-files-secret
command: ['/bin/sh','-c']
args: ['npm run nest:start:idp-console -- sync users --systemType moin.schule --systemId $SYSTEM_ID']
resources:
14 changes: 14 additions & 0 deletions ansible/roles/schulcloud-server-core/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -37,6 +37,13 @@
template: onepassword.yml.j2
when: ONEPASSWORD_OPERATOR is defined and ONEPASSWORD_OPERATOR|bool

- name: File Storage Secret by 1Password
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: api-files-onepassword.yml.j2
when: ONEPASSWORD_OPERATOR is defined and ONEPASSWORD_OPERATOR|bool

- name: Admin Api ingress
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
@@ -322,3 +329,10 @@
template: board-collaboration-ingress.yml.j2
apply: yes
state: "{{ 'present' if WITH_BOARD_COLLABORATION else 'absent'}}"

- name: BoardCollaborationServiceMonitor
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: '{{ NAMESPACE }}'
template: board-collaboration-svc-monitor.yml.j2
state: "{{ 'present' if WITH_BOARD_COLLABORATION else 'absent'}}"
Original file line number Diff line number Diff line change
@@ -13,3 +13,4 @@ data:
FEATURE_PROMETHEUS_METRICS_ENABLED: "true"
CALENDAR_URI: "{{ CALENDAR_URI }}"
ROCKET_CHAT_URI: "{{ ROCKET_CHAT_URI }}"
ETHERPAD__PAD_URI: "https://{{ DOMAIN }}/etherpad/p"
Original file line number Diff line number Diff line change
@@ -54,6 +54,8 @@ spec:
name: admin-api-server-configmap
- secretRef:
name: admin-api-server-secret
- secretRef:
name: api-files-secret
command: ['npm', 'run', 'nest:start:admin-api-server:prod']
resources:
limits:
Original file line number Diff line number Diff line change
@@ -52,6 +52,8 @@ spec:
name: amqp-files-configmap
- secretRef:
name: amqp-files-secret
- secretRef:
name: api-files-secret
command: ['npm', 'run', 'nest:start:files-storage-amqp:prod']
resources:
limits:
Original file line number Diff line number Diff line change
@@ -28,6 +28,8 @@ spec:
name: api-configmap
- secretRef:
name: api-secret
- secretRef:
name: api-files-secret
command: ['/bin/sh', '-c']
args: ['npm run nest:start:console -- files cleanup-job 7']
resources:
Original file line number Diff line number Diff line change
@@ -54,6 +54,8 @@ spec:
name: api-configmap
- secretRef:
name: api-secret
- secretRef:
name: api-files-secret
command: ['npm', 'run', 'nest:start:files-storage:prod']
readinessProbe:
httpGet:
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: onepassword.com/v1
kind: OnePasswordItem
metadata:
name: api-files-secret
namespace: {{ NAMESPACE }}
labels:
app: api-files
spec:
itemPath: "vaults/{{ ONEPASSWORD_OPERATOR_VAULT }}/items/api-files"
Original file line number Diff line number Diff line change
@@ -54,6 +54,8 @@ spec:
name: api-configmap
- secretRef:
name: api-secret
- secretRef:
name: api-files-secret
command: ['npm', 'run', 'nest:start:fwu-learning-contents:prod']
readinessProbe:
httpGet:
Original file line number Diff line number Diff line change
@@ -49,16 +49,18 @@ spec:
- containerPort: 4450
name: websocket
protocol: TCP
# - containerPort: 9090
# name: api-metrics
# protocol: TCP
- containerPort: 9090
name: api-metrics
protocol: TCP
envFrom:
- configMapRef:
name: api-configmap
- configMapRef:
name: board-collaboration-configmap
- secretRef:
name: api-secret
- secretRef:
name: api-files-secret
command: ['npm', 'run', 'nest:start:board-collaboration:prod']
resources:
limits:
Original file line number Diff line number Diff line change
@@ -13,9 +13,9 @@ spec:
targetPort: 4450
protocol: TCP
name: websocket
#- port: {{ PORT_METRICS_SERVER }}
# targetPort: 9090 # TODO
# protocol: TCP
# name: api-metrics
- port: {{ PORT_METRICS_SERVER }}
targetPort: 9090 # TODO
protocol: TCP
name: api-metrics
selector:
app: board-collaboration
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: board-collaboration-svc-monitor
namespace: {{ NAMESPACE }}
labels:
app: board-collaboration
spec:
selector:
matchExpressions:
- key: app.kubernetes.io/name
operator: in
values:
- board-collaboration-svc
endpoints:
- path: /metrics
port: api-metrics
Original file line number Diff line number Diff line change
@@ -54,6 +54,8 @@ spec:
name: common-cartridge-configmap
- secretRef:
name: common-cartridge-secret
- secretRef:
name: api-files-secret
command: ['npm', 'run', 'nest:start:common-cartridge']
resources:
limits:
Original file line number Diff line number Diff line change
@@ -11,3 +11,5 @@ data:
EXIT_ON_ERROR: "true"
SC_DOMAIN: "{{ DOMAIN }}"
FEATURE_PROMETHEUS_METRICS_ENABLED: "true"
ETHERPAD__PAD_URI: "https://{{ DOMAIN }}/etherpad/p"

Original file line number Diff line number Diff line change
@@ -37,6 +37,8 @@ spec:
name: data-deletion-trigger-cronjob-configmap
- secretRef:
name: admin-api-client-secret
- secretRef:
name: api-files-secret
command: ['/bin/sh', '-c']
args: ['npm run nest:start:deletion-console -- execution trigger']
resources:
Original file line number Diff line number Diff line change
@@ -57,6 +57,8 @@ spec:
name: api-configmap
- secretRef:
name: api-secret
- secretRef:
name: api-files-secret
readinessProbe:
httpGet:
path: /internal/health
Original file line number Diff line number Diff line change
@@ -20,6 +20,8 @@ spec:
name: api-configmap
- secretRef:
name: api-secret
- secretRef:
name: api-files-secret
command: ['/bin/sh','-c']
args: ['npm run ensureIndexes && npm run migration:up']
resources:
Original file line number Diff line number Diff line change
@@ -50,6 +50,8 @@ spec:
name: preview-generator-configmap
- secretRef:
name: preview-generator-secret
- secretRef:
name: api-files-secret
command: ['npm', 'run', 'nest:start:preview-generator-amqp:prod']
resources:
limits:
Original file line number Diff line number Diff line change
@@ -28,6 +28,8 @@ spec:
name: api-configmap
- secretRef:
name: api-secret
- secretRef:
name: api-files-secret
command: ['/bin/sh', '-c']
args: ['npm run nest:start:tldraw-console -- files deletion-job 24']
resources:
Original file line number Diff line number Diff line change
@@ -62,6 +62,8 @@ spec:
name: api-secret
- secretRef:
name: tldraw-server-secret
- secretRef:
name: api-files-secret
command: ['npm', 'run', 'nest:start:tldraw:prod']
resources:
limits:
Original file line number Diff line number Diff line change
@@ -56,6 +56,8 @@ spec:
name: api-secret
- secretRef:
name: api-h5p-editor-secret
- secretRef:
name: api-files-secret
command: ['npm', 'run', 'nest:start:h5p:prod']
readinessProbe:
httpGet:
Original file line number Diff line number Diff line change
@@ -15,6 +15,8 @@ spec:
name: api-configmap
- secretRef:
name: api-secret
- secretRef:
name: api-files-secret
env:
- name: K8S_NAMESPACE
valueFrom:
Original file line number Diff line number Diff line change
@@ -53,6 +53,8 @@ spec:
name: api-configmap
- secretRef:
name: api-secret
- secretRef:
name: api-files-secret
command: ['npm', 'run', 'nest:start:management:prod']
readinessProbe:
httpGet:
Original file line number Diff line number Diff line change
@@ -28,6 +28,8 @@ spec:
name: api-configmap
- secretRef:
name: api-secret
- secretRef:
name: api-files-secret
command: ['/schulcloud-server/scripts/ldapSync.sh']
resources:
limits:
Original file line number Diff line number Diff line change
@@ -53,6 +53,8 @@ spec:
name: api-configmap
- secretRef:
name: api-secret
- secretRef:
name: api-files-secret
readinessProbe:
httpGet:
path: /serverversion
Original file line number Diff line number Diff line change
@@ -57,6 +57,8 @@ spec:
name: api-configmap
- secretRef:
name: api-secret
- secretRef:
name: api-files-secret
readinessProbe:
httpGet:
path: /internal/health
Original file line number Diff line number Diff line change
@@ -24,6 +24,8 @@ spec:
envFrom:
- secretRef:
name: api-secret
- secretRef:
name: api-files-secret
command: ['/bin/sh','-c']
args: ['curl -H "X-API-Key: $SYNC_API_KEY" "http://{{ API_TSP_SYNC_SVC|default("api-tsp-sync-svc", true) }}:3030/api/v1/sync?target=tsp-base" | python3 -m json.tool']
restartPolicy: OnFailure
Original file line number Diff line number Diff line change
@@ -54,6 +54,8 @@ spec:
name: api-configmap
- secretRef:
name: api-secret
- secretRef:
name: api-files-secret
readinessProbe:
httpGet:
path: /serverversion
Original file line number Diff line number Diff line change
@@ -24,6 +24,8 @@ spec:
envFrom:
- secretRef:
name: api-secret
- secretRef:
name: api-files-secret
command: ['/bin/sh','-c']
args: ['curl -H "X-API-Key: $SYNC_API_KEY" "http://{{ API_TSP_SYNC_SVC|default("api-tsp-sync-svc", true) }}:3030/api/v1/sync?target=tsp-school" | python3 -m json.tool']
restartPolicy: OnFailure
25 changes: 16 additions & 9 deletions apps/server/src/apps/board-collaboration.app.ts
Original file line number Diff line number Diff line change
@@ -8,43 +8,50 @@ import { install as sourceMapInstall } from 'source-map-support';
// application imports
import { SwaggerDocumentOptions } from '@nestjs/swagger';
import { DB_URL } from '@src/config';
import { LegacyLogger } from '@src/core/logger';
import { LegacyLogger, Logger } from '@src/core/logger';
import { MongoIoAdapter } from '@src/infra/socketio';
import { BoardCollaborationModule } from '@src/modules/board/board-collaboration.module';
import { enableOpenApiDocs } from '@src/shared/controller/swagger';
import express from 'express';
import {
addPrometheusMetricsMiddlewaresIfEnabled,
createAndStartPrometheusMetricsAppIfEnabled,
} from '@src/apps/helpers/prometheus-metrics';
import { ExpressAdapter } from '@nestjs/platform-express';

async function bootstrap() {
sourceMapInstall();

const nestApp = await NestFactory.create(BoardCollaborationModule);

// WinstonLogger
const nestExpress = express();
const nestExpressAdapter = new ExpressAdapter(nestExpress);
const nestApp = await NestFactory.create(BoardCollaborationModule, nestExpressAdapter);
nestApp.useLogger(await nestApp.resolve(LegacyLogger));

// customize nest app settings
nestApp.enableCors({ exposedHeaders: ['Content-Disposition'] });

const mongoIoAdapter = new MongoIoAdapter(nestApp);
await mongoIoAdapter.connectToMongoDb(DB_URL);

nestApp.useWebSocketAdapter(mongoIoAdapter);

const options: SwaggerDocumentOptions = {
operationIdFactory: (_controllerKey: string, methodKey: string) => methodKey,
};
enableOpenApiDocs(nestApp, 'docs', options);
const logger = await nestApp.resolve(Logger);

await nestApp.init();

addPrometheusMetricsMiddlewaresIfEnabled(logger, nestExpress);
const port = 4450;
const basePath = '/board-collaboration';

nestApp.setGlobalPrefix(basePath);
await nestApp.listen(port);
await nestApp.listen(port, () => {
createAndStartPrometheusMetricsAppIfEnabled(logger);
});

console.log('##########################################');
console.log(`### Start Board Collaboration Server ###`);
console.log(`### Port: ${port} ###`);
console.log(`### Port: ${port} ###`);
console.log(`### Base path: ${basePath} ###`);
console.log('##########################################');
}
Loading

0 comments on commit 4cca2d7

Please sign in to comment.