Skip to content

Commit

Permalink
Merge branch 'BC-7882-switch-to-new-tldraw-server' of https://github.…
Browse files Browse the repository at this point in the history
…com/hpi-schul-cloud/tldraw-server into BC-7882-switch-to-new-tldraw-server
  • Loading branch information
bergatco committed Nov 27, 2024
2 parents b1c882b + dfa0806 commit 441dfff
Show file tree
Hide file tree
Showing 38 changed files with 2,523 additions and 1,005 deletions.
1 change: 0 additions & 1 deletion .env.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
REDIS=redis://localhost:6379
API_HOST=http://localhost:3030
ADMIN_API__ALLOWED_API_KEYS=randomString

Expand Down
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

63 changes: 0 additions & 63 deletions .eslintrc.cjs

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ jobs:
- name: Build and push ${{ github.repository }}
if: ${{ env.IMAGE_EXISTS == 0 }}
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: .
file: ./Dockerfile
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@ permissions:
contents: read

env:
NODE_VERSION: '20'
NODE_VERSION: '22'
jobs:
tests_cov:
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1]
services:
rabbitmq:
image: rabbitmq:3
ports:
- 5672:5672
steps:
- name: checkout
uses: actions/checkout@v4
Expand All @@ -32,6 +27,13 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
- name: npm ci
run: npm ci --prefer-offline --no-audit
- name: Start UP MinIO
uses: infleet/[email protected]
with:
port: "9000"
version: "latest"
username: "miniouser"
password: "miniouser"
- name: test:cov - test all with coverage
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
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM docker.io/node:20-alpine
FROM docker.io/node:22-alpine

RUN apk add gcompat
RUN apk add --no-cache gcompat build-base

ENV TZ=Europe/Berlin
RUN mkdir /app && chown -R node:node /app
Expand Down
22 changes: 15 additions & 7 deletions ansible/roles/tldraw-valkey/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@
defaultStorageClass: "{{ SC_DEFAULT_STORAGE_CLASS_NAME }}"
replica:
replicaCount: "{{ TLDRAW_VALKEY_REPLICAS }}"
resources:
limits:
cpu: "{{ TLDRAW_VALKEY_CPU_LIMITS|default('1000m', true) }}"
memory: "{{ TLDRAW_VALKEY_MEMORY_LIMITS|default('4Gi', true) }}"
requests:
cpu: "{{ TLDRAW_VALKEY_CPU_REQUESTS|default('100m', true) }}"
memory: "{{ TLDRAW_VALKEY_MEMORY_REQUESTS|default('1Gi', true) }}"
primary:
resources:
limits:
cpu: "{{ TLDRAW_VALKEY_CPU_LIMITS|default('1000m', true) }}"
memory: "{{ TLDRAW_VALKEY_MEMORY_LIMITS|default('4Gi', true) }}"
requests:
cpu: "{{ TLDRAW_VALKEY_CPU_REQUESTS|default('100m', true) }}"
memory: "{{ TLDRAW_VALKEY_MEMORY_REQUESTS|default('1Gi', true) }}"
auth:
existingSecret: tldraw-valkey-password
existingSecretPasswordKey: REDIS_SENTINEL_PASSWORD
Expand All @@ -45,12 +60,5 @@
create: false
# https://github.com/bitnami/charts/issues/9689
useHostnames: false
resources:
limits:
cpu: "{{ TLDRAW_VALKEY_CPU_LIMITS|default('1000m', true) }}"
memory: "{{ TLDRAW_VALKEY_MEMORY_LIMITS|default('4Gi', true) }}"
requests:
cpu: "{{ TLDRAW_VALKEY_CPU_REQUESTS|default('100m', true) }}"
memory: "{{ TLDRAW_VALKEY_MEMORY_REQUESTS|default('1Gi', true) }}"
tags:
- helm
99 changes: 99 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import typescriptEslintEslintPlugin from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import jest from 'eslint-plugin-jest';
import globals from 'globals';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: ['**/.eslintrc.cjs', '**/ansible', '**/.github', 'src/infra/authorization/authorization-api-client'],
},
...compat.extends('plugin:@typescript-eslint/stylistic-type-checked', 'plugin:prettier/recommended'),
{
plugins: {
'@typescript-eslint': typescriptEslintEslintPlugin,
jest,
},

languageOptions: {
globals: {
...globals.node,
...globals.jest,
},

parser: tsParser,
ecmaVersion: 5,
sourceType: 'module',

parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: '.',
},
},

rules: {
'newline-before-return': 'error',
'require-await': 'error',
'no-return-assign': 'error',
'max-classes-per-file': 'error',
'@typescript-eslint/explicit-member-accessibility': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/unbound-method': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',

'@typescript-eslint/naming-convention': [
'error',
{
selector: 'interface',
format: ['PascalCase'],

custom: {
regex: '^I[A-Z]',
match: false,
},
},
],

'@typescript-eslint/no-empty-interface': [
'error',
{
allowSingleExtends: true,
},
],
},
},
{
files: ['**/*spec.ts'],

plugins: {
jest,
},

languageOptions: {
globals: {
...globals.jest,
},
},

rules: {
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'jest/unbound-method': 'error',
'jest/prefer-spy-on': 'error',
},
},
];
2 changes: 2 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ module.exports = {
collectCoverageFrom: ['**/*.(t|j)s'],
coverageDirectory: '../coverage',
testEnvironment: 'node',
globalSetup: '<rootDir>/../scripts/testing/globalSetup.ts',
globalTeardown: '<rootDir>/../scripts/testing/globalTeardown.ts',
};
Loading

0 comments on commit 441dfff

Please sign in to comment.