-
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-5522-impl-of-deletion-api
- Loading branch information
Showing
20 changed files
with
603 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
galaxy_info: | ||
role_name: h5p-library-management | ||
author: Schul-Cloud Verbund | ||
description: h5p library role for the management of libraries | ||
company: Schul-Cloud Verbund | ||
license: license (AGPLv3) | ||
min_ansible_version: 2.8 | ||
galaxy_tags: [] | ||
dependencies: [] |
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,6 @@ | ||
- name: H5pLibraryManagement CronJob | ||
when: WITH_H5P_LIBRARY_MANAGEMENT is defined and WITH_H5P_LIBRARY_MANAGEMENT|bool == true | ||
kubernetes.core.k8s: | ||
kubeconfig: ~/.kube/config | ||
namespace: "{{ NAMESPACE }}" | ||
template: api-h5p-library-management-cronjob.yml.j2 |
33 changes: 33 additions & 0 deletions
33
ansible/roles/h5p-library-management/templates/api-h5p-library-management-cronjob.yml.j2
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 @@ | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
namespace: {{ NAMESPACE }} | ||
labels: | ||
app: api-library-management-cronjob | ||
name: api-library-management-cronjob | ||
spec: | ||
schedule: "{{ SERVER_H5P_LIBRARY_MANAGEMENT_CRONJOB|default("0 3 * * 3,6", true) }}" | ||
concurrencyPolicy: Forbid | ||
jobTemplate: | ||
spec: | ||
activeDeadlineSeconds: {{ SERVER_H5P_LIBRARY_MANAGEMENT_CRONJOB_TIMEOUT|default("39600", true) }} | ||
template: | ||
spec: | ||
containers: | ||
- name: api-h5p-library-management-cronjob | ||
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }} | ||
envFrom: | ||
- configMapRef: | ||
name: api-configmap | ||
- secretRef: | ||
name: api-secret | ||
command: ['/bin/sh', '-c'] | ||
args: ['npm run nest:start:h5p:library-management'] | ||
resources: | ||
limits: | ||
cpu: {{ API_H5P_LIBRARY_MANAGEMENT_CPU_LIMITS|default("2000m", true) }} | ||
memory: {{ API_H5P_LIBRARY_MANAGEMENT_MEMORY_LIMITS|default("2Gi", true) }} | ||
requests: | ||
cpu: {{ API_H5P_LIBRARY_MANAGEMENT_CPU_REQUESTS|default("100m", true) }} | ||
memory: {{ API_H5P_LIBRARY_MANAGEMENT_MEMORY_REQUESTS|default("150Mi", true) }} | ||
restartPolicy: OnFailure |
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,31 @@ | ||
/* istanbul ignore file */ | ||
/* eslint-disable no-console */ | ||
import { NestFactory } from '@nestjs/core'; | ||
import { install as sourceMapInstall } from 'source-map-support'; | ||
import { LegacyLogger } from '@src/core/logger'; | ||
import { H5PLibraryManagementModule, H5PLibraryManagementService } from '@modules/h5p-library-management'; | ||
|
||
async function bootstrap() { | ||
sourceMapInstall(); | ||
|
||
const nestApp = await NestFactory.createApplicationContext(H5PLibraryManagementModule); | ||
|
||
// WinstonLogger | ||
nestApp.useLogger(await nestApp.resolve(LegacyLogger)); | ||
|
||
await nestApp.init(); | ||
|
||
console.log('#########################################'); | ||
console.log(`##### Start H5P Library Management ######`); | ||
console.log('#########################################'); | ||
|
||
// to execute it on this place for the ORM the allowGlobalContext: true must be set, but to executed in this way is a hack | ||
await nestApp.get(H5PLibraryManagementService).run(); | ||
// TODO: properly close app (there is some issue with the logger) | ||
console.log('#########################################'); | ||
console.log(`##### Close H5P Library Management ######`); | ||
console.log('#########################################'); | ||
await nestApp.close(); | ||
process.exit(0); | ||
} | ||
void bootstrap(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from './h5p-editor.module'; | ||
export { H5PEditorModule } from './h5p-editor.module'; | ||
export { ContentStorage, LibraryStorage } from './service'; | ||
export { s3ConfigContent, s3ConfigLibraries } from './h5p-editor.config'; |
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
29 changes: 29 additions & 0 deletions
29
apps/server/src/modules/h5p-library-management/h5p-library-management.module.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,29 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { ConfigModule } from '@nestjs/config'; | ||
import { RabbitMQWrapperModule } from '@infra/rabbitmq'; | ||
import { S3ClientModule } from '@infra/s3-client'; | ||
import { createConfigModuleOptions } from '@src/config'; | ||
import { CoreModule } from '@src/core'; | ||
import { Logger } from '@src/core/logger'; | ||
import { H5PEditorModule, s3ConfigContent, s3ConfigLibraries } from '@modules/h5p-editor'; | ||
import { H5PLibraryManagementService, h5PLibraryManagementConfig } from './service'; | ||
|
||
const imports = [ | ||
ConfigModule.forRoot(createConfigModuleOptions(h5PLibraryManagementConfig)), | ||
CoreModule, | ||
H5PEditorModule, | ||
RabbitMQWrapperModule, | ||
S3ClientModule.register([s3ConfigContent, s3ConfigLibraries]), | ||
]; | ||
|
||
const controllers = []; | ||
|
||
const providers = [Logger, H5PLibraryManagementService]; | ||
|
||
@Module({ | ||
imports, | ||
controllers, | ||
providers, | ||
exports: [], | ||
}) | ||
export class H5PLibraryManagementModule {} |
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,2 @@ | ||
export { H5PLibraryManagementModule } from './h5p-library-management.module'; | ||
export { H5PLibraryManagementService } from './service'; |
12 changes: 12 additions & 0 deletions
12
apps/server/src/modules/h5p-library-management/service/h5p-library-management.config.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,12 @@ | ||
import { h5PLibraryManagementConfig } from './h5p-library-management.config'; | ||
|
||
describe('H5PLibraryManagementConfig', () => { | ||
describe('h5PLibraryManagementConfig', () => { | ||
describe('when h5PLibraryManagementConfig is called', () => { | ||
it('should get Object s3ConfigLibraries', () => { | ||
const config = h5PLibraryManagementConfig(); | ||
expect(config).toBeDefined(); | ||
}); | ||
}); | ||
}); | ||
}); |
11 changes: 11 additions & 0 deletions
11
apps/server/src/modules/h5p-library-management/service/h5p-library-management.config.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,11 @@ | ||
import { Configuration } from '@hpi-schul-cloud/commons'; | ||
|
||
export interface IH5PLibraryManagementConfig { | ||
H5P_EDITOR__LIBRARY_LIST_PATH: string; | ||
} | ||
|
||
export const config: IH5PLibraryManagementConfig = { | ||
H5P_EDITOR__LIBRARY_LIST_PATH: Configuration.get('H5P_EDITOR__LIBRARY_LIST_PATH') as string, | ||
}; | ||
|
||
export const h5PLibraryManagementConfig = () => config; |
Oops, something went wrong.