Merge pull request 'Added excalidraw' (#3) from excalidraw into main
Reviewed-on: #3
This commit is contained in:
commit
d7e433f3c2
22 changed files with 8755 additions and 9 deletions
|
@ -107,9 +107,17 @@ release-to-forgejo:
|
||||||
script:
|
script:
|
||||||
- pyb publish_artifacts
|
- pyb publish_artifacts
|
||||||
|
|
||||||
jitsi-image-test-publish:
|
jitsi-web-image-publish:
|
||||||
<<: *img
|
<<: *img
|
||||||
<<: *tag_only
|
<<: *tag_only
|
||||||
stage: image
|
stage: image
|
||||||
script:
|
script:
|
||||||
- cd infrastructure/app && pyb image publish
|
- cd infrastructure/web && pyb image publish
|
||||||
|
|
||||||
|
jitsi-excalidraw-backend-image-publish:
|
||||||
|
<<: *img
|
||||||
|
<<: *tag_only
|
||||||
|
stage: image
|
||||||
|
script:
|
||||||
|
- cd infrastructure/excalidraw-backend && pyb image publish
|
||||||
|
|
||||||
|
|
5
build.py
5
build.py
|
@ -22,7 +22,8 @@ def initialize(project):
|
||||||
"release_primary_build_file": "project.clj",
|
"release_primary_build_file": "project.clj",
|
||||||
"release_secondary_build_files": [
|
"release_secondary_build_files": [
|
||||||
"package.json",
|
"package.json",
|
||||||
"infrastructure/app/build.py",
|
"infrastructure/web/build.py",
|
||||||
|
"infrastructure/excalidraw-backend/build.py",
|
||||||
],
|
],
|
||||||
"release_artifact_server_url": "https://repo.prod.meissa.de",
|
"release_artifact_server_url": "https://repo.prod.meissa.de",
|
||||||
"release_organisation": "meissa",
|
"release_organisation": "meissa",
|
||||||
|
@ -78,7 +79,7 @@ def package_frontend(project):
|
||||||
run(
|
run(
|
||||||
"cp public/js/main.js target/frontend-build/c4k-jitsi.js",
|
"cp public/js/main.js target/frontend-build/c4k-jitsi.js",
|
||||||
shell=True,
|
shell=True,
|
||||||
check=True,
|
check=Tc4k/c4k-jitsi/infrastructure/excalidraw-backend/excalidraw-backend/package-lock.json c4k/c4k-jitsi/infrastructure/excalidraw-backend/excalidraw-backend/package.json c4k/c4k-jitsi/infrastructure/excalidraw-backend/excalidraw-backend/tsconfig.json c4k/c4k-jitsi/infrastructure/excalidraw-backend/excalidraw-backend/srcrue,
|
||||||
)
|
)
|
||||||
run(
|
run(
|
||||||
"sha256sum target/frontend-build/c4k-jitsi.js > target/frontend-build/c4k-jitsi.js.sha256",
|
"sha256sum target/frontend-build/c4k-jitsi.js > target/frontend-build/c4k-jitsi.js.sha256",
|
||||||
|
|
57
infrastructure/excalidraw-backend/build.py
Normal file
57
infrastructure/excalidraw-backend/build.py
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
from os import environ
|
||||||
|
from datetime import datetime
|
||||||
|
from pybuilder.core import task, init
|
||||||
|
from ddadevops import *
|
||||||
|
|
||||||
|
name = "c4k-jitsi"
|
||||||
|
MODULE = "excalidraw-backend"
|
||||||
|
PROJECT_ROOT_PATH = "../.."
|
||||||
|
version = "1.4.2-SNAPSHOT"
|
||||||
|
|
||||||
|
|
||||||
|
@init
|
||||||
|
def initialize(project):
|
||||||
|
image_tag = version
|
||||||
|
if "dev" in image_tag:
|
||||||
|
image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
|
||||||
|
|
||||||
|
input = {
|
||||||
|
"name": name,
|
||||||
|
"module": MODULE,
|
||||||
|
"stage": "notused",
|
||||||
|
"project_root_path": PROJECT_ROOT_PATH,
|
||||||
|
"build_types": ["IMAGE"],
|
||||||
|
"mixin_types": [],
|
||||||
|
"image_naming": "NAME_AND_MODULE",
|
||||||
|
"image_tag": f"{image_tag}",
|
||||||
|
}
|
||||||
|
|
||||||
|
project.build_depends_on("ddadevops>=4.7.0")
|
||||||
|
|
||||||
|
build = DevopsImageBuild(project, input)
|
||||||
|
build.initialize_build_dir()
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def image(project):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.image()
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def drun(project):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.drun()
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def test(project):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.test()
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def publish(project):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.dockerhub_login()
|
||||||
|
build.dockerhub_publish()
|
14
infrastructure/excalidraw-backend/image/Dockerfile
Normal file
14
infrastructure/excalidraw-backend/image/Dockerfile
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# Taken from: https://github.com/jitsi/excalidraw-backend
|
||||||
|
FROM node:16.17-slim
|
||||||
|
|
||||||
|
WORKDIR /excalidraw-backend
|
||||||
|
|
||||||
|
|
||||||
|
COPY resources/package.json resources/package-lock.json resources/tsconfig.json resources/src ./
|
||||||
|
RUN npm install
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 9090
|
||||||
|
|
||||||
|
CMD ["npm", "start"]
|
1
infrastructure/excalidraw-backend/image/resources/.gitignore
vendored
Normal file
1
infrastructure/excalidraw-backend/image/resources/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
!package-lock.json
|
8425
infrastructure/excalidraw-backend/image/resources/package-lock.json
generated
Normal file
8425
infrastructure/excalidraw-backend/image/resources/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
"name": "excalidraw-backend",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "src/index.js",
|
||||||
|
"description": "Excalidraw backend",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/jitsi/excalidraw-backend"
|
||||||
|
},
|
||||||
|
"private": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0",
|
||||||
|
"npm": ">=7.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@types/debug": "4.1.5",
|
||||||
|
"@types/express": "4.17.11",
|
||||||
|
"@types/node": "14.14.31",
|
||||||
|
"@types/socket.io": "2.1.4",
|
||||||
|
"cross-env": "^7.0.3",
|
||||||
|
"debug": "4.3.1",
|
||||||
|
"dotenv": "^10.0.0",
|
||||||
|
"express": "4.17.1",
|
||||||
|
"socket.io": "^2.5.0",
|
||||||
|
"socket.io-prometheus-metrics": "^1.0.6",
|
||||||
|
"ts-node-dev": "^1.1.8",
|
||||||
|
"typescript": "4.2.3"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"lint-fix": "eslint . --fix",
|
||||||
|
"start": "tsc && node dist/index.js",
|
||||||
|
"start:local": "tsc && DEBUG='engine,app,socket.io:client,server' node dist/index.js",
|
||||||
|
"start:dev": "cross-env NODE_ENV=development ts-node-dev --respawn --transpile-only src/index.ts"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@jitsi/eslint-config": "^4.1.0",
|
||||||
|
"@types/dotenv": "^8.2.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "5.30.5",
|
||||||
|
"@typescript-eslint/parser": "5.30.4",
|
||||||
|
"eslint": "8.1.0",
|
||||||
|
"eslint-plugin-import": "2.25.2",
|
||||||
|
"eslint-plugin-jsdoc": "37.0.3",
|
||||||
|
"eslint-plugin-typescript-sort-keys": "^2.1.0"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"bufferutil": "^4.0.6",
|
||||||
|
"utf-8-validate": "^5.0.9"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
module.exports = {
|
||||||
|
extends: [
|
||||||
|
'@jitsi/eslint-config',
|
||||||
|
'@jitsi/eslint-config/jsdoc',
|
||||||
|
'@jitsi/eslint-config/typescript',
|
||||||
|
],
|
||||||
|
};
|
107
infrastructure/excalidraw-backend/image/resources/src/index.ts
Normal file
107
infrastructure/excalidraw-backend/image/resources/src/index.ts
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
// Taken from: https://github.com/jitsi/excalidraw-backend
|
||||||
|
|
||||||
|
import debug from 'debug';
|
||||||
|
import dotenv from 'dotenv';
|
||||||
|
import express from 'express';
|
||||||
|
import http from 'http';
|
||||||
|
import socketIO from 'socket.io';
|
||||||
|
import * as prometheus from 'socket.io-prometheus-metrics';
|
||||||
|
|
||||||
|
const serverDebug = debug('server');
|
||||||
|
|
||||||
|
dotenv.config(
|
||||||
|
process.env.NODE_ENV === 'development'
|
||||||
|
? { path: '.env.development' }
|
||||||
|
: { path: '.env.production' }
|
||||||
|
);
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
const port = process.env.PORT || 80; // default port to listen
|
||||||
|
|
||||||
|
app.get('/', (req, res) => {
|
||||||
|
res.send('Excalidraw backend is up :)');
|
||||||
|
});
|
||||||
|
|
||||||
|
const server = http.createServer(app);
|
||||||
|
|
||||||
|
server.listen(port, () => {
|
||||||
|
serverDebug(`listening on port: ${port}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
const io = socketIO(server, {
|
||||||
|
handlePreflightRequest: (req, res) => {
|
||||||
|
const headers = {
|
||||||
|
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
|
||||||
|
'Access-Control-Allow-Origin': req.header?.origin ?? 'https://meet.jit.si',
|
||||||
|
'Access-Control-Allow-Credentials': true
|
||||||
|
};
|
||||||
|
|
||||||
|
res.writeHead(200, headers);
|
||||||
|
res.end();
|
||||||
|
},
|
||||||
|
maxHttpBufferSize: 10e6,
|
||||||
|
pingTimeout: 10000
|
||||||
|
});
|
||||||
|
|
||||||
|
// listens on host:9090/metrics
|
||||||
|
prometheus.metrics(io, {
|
||||||
|
collectDefaultMetrics: true
|
||||||
|
});
|
||||||
|
|
||||||
|
io.on('connection', socket => {
|
||||||
|
serverDebug(`connection established! ${socket.conn.request.url}`);
|
||||||
|
io.to(`${socket.id}`).emit('init-room');
|
||||||
|
socket.on('join-room', roomID => {
|
||||||
|
serverDebug(`${socket.id} has joined ${roomID} for url ${socket.conn.request.url}`);
|
||||||
|
socket.join(roomID);
|
||||||
|
if (io.sockets.adapter.rooms[roomID].length <= 1) {
|
||||||
|
io.to(`${socket.id}`).emit('first-in-room');
|
||||||
|
} else {
|
||||||
|
socket.broadcast.to(roomID).emit('new-user', socket.id);
|
||||||
|
}
|
||||||
|
io.in(roomID).emit(
|
||||||
|
'room-user-change',
|
||||||
|
Object.keys(io.sockets.adapter.rooms[roomID].sockets)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on(
|
||||||
|
'server-broadcast',
|
||||||
|
(roomID: string, encryptedData: ArrayBuffer, iv: Uint8Array) => {
|
||||||
|
socket.broadcast.to(roomID).emit('client-broadcast', encryptedData, iv);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
socket.on(
|
||||||
|
'server-volatile-broadcast',
|
||||||
|
(roomID: string, encryptedData: ArrayBuffer, iv: Uint8Array) => {
|
||||||
|
socket.volatile.broadcast
|
||||||
|
.to(roomID)
|
||||||
|
.emit('client-broadcast', encryptedData, iv);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
socket.on('disconnecting', () => {
|
||||||
|
const rooms = io.sockets.adapter.rooms;
|
||||||
|
|
||||||
|
for (const roomID of Object.keys(socket.rooms)) {
|
||||||
|
const clients = Object.keys(rooms[roomID].sockets).filter(id => id !== socket.id);
|
||||||
|
|
||||||
|
if (roomID !== socket.id) {
|
||||||
|
socket.to(roomID).emit('user has left', socket.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clients.length > 0) {
|
||||||
|
socket.broadcast.to(roomID).emit('room-user-change', clients);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('disconnect', (reason, details) => {
|
||||||
|
serverDebug(
|
||||||
|
`${socket.id} was disconnected from url ${socket.conn.request.url} for the following reason: ${reason}
|
||||||
|
${JSON.stringify(details)}`
|
||||||
|
);
|
||||||
|
socket.removeAllListeners();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"target": "es5",
|
||||||
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"strict": true,
|
||||||
|
"moduleResolution": "Node",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"outDir": "dist"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ from pybuilder.core import task, init
|
||||||
from ddadevops import *
|
from ddadevops import *
|
||||||
|
|
||||||
name = "c4k-jitsi"
|
name = "c4k-jitsi"
|
||||||
MODULE = "app"
|
MODULE = "web"
|
||||||
PROJECT_ROOT_PATH = "../.."
|
PROJECT_ROOT_PATH = "../.."
|
||||||
version = "1.4.3-SNAPSHOT"
|
version = "1.4.3-SNAPSHOT"
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ def initialize(project):
|
||||||
"project_root_path": PROJECT_ROOT_PATH,
|
"project_root_path": PROJECT_ROOT_PATH,
|
||||||
"build_types": ["IMAGE"],
|
"build_types": ["IMAGE"],
|
||||||
"mixin_types": [],
|
"mixin_types": [],
|
||||||
"image_naming": "NAME_ONLY",
|
"image_naming": "NAME_AND_MODULE",
|
||||||
"image_tag": f"{image_tag}",
|
"image_tag": f"{image_tag}",
|
||||||
}
|
}
|
||||||
|
|
0
infrastructure/web/test/.keep
Normal file
0
infrastructure/web/test/.keep
Normal file
|
@ -34,8 +34,11 @@
|
||||||
(jitsi/generate-jvb-service)
|
(jitsi/generate-jvb-service)
|
||||||
(jitsi/generate-web-service)
|
(jitsi/generate-web-service)
|
||||||
(jitsi/generate-etherpad-service)
|
(jitsi/generate-etherpad-service)
|
||||||
(jitsi/generate-deployment config)]
|
(jitsi/generate-excalidraw-backend-service)
|
||||||
|
(jitsi/generate-deployment config)
|
||||||
|
(jitsi/generate-excalidraw-deployment)]
|
||||||
(jitsi/generate-ingress-web config)
|
(jitsi/generate-ingress-web config)
|
||||||
(jitsi/generate-ingress-etherpad config)
|
(jitsi/generate-ingress-etherpad config)
|
||||||
|
(jitsi/generate-ingress-excalidraw-backend config)
|
||||||
(when (:contains? config :mon-cfg)
|
(when (:contains? config :mon-cfg)
|
||||||
(mon/generate (:mon-cfg config) (:mon-auth auth)))))))
|
(mon/generate (:mon-cfg config) (:mon-auth auth)))))))
|
||||||
|
|
|
@ -51,6 +51,15 @@
|
||||||
:fqdns [(str "etherpad." (:fqdn config))]}
|
:fqdns [(str "etherpad." (:fqdn config))]}
|
||||||
config)))
|
config)))
|
||||||
|
|
||||||
|
(defn-spec generate-ingress-excalidraw-backend cp/map-or-seq?
|
||||||
|
[config config?]
|
||||||
|
(ing/generate-ingress-and-cert
|
||||||
|
(merge
|
||||||
|
{:service-name "excalidraw-backend"
|
||||||
|
:service-port 3002
|
||||||
|
:fqdns [(str "excalidraw-backend." (:fqdn config))]}
|
||||||
|
config)))
|
||||||
|
|
||||||
(defn-spec generate-secret-jitsi cp/map-or-seq?
|
(defn-spec generate-secret-jitsi cp/map-or-seq?
|
||||||
[auth auth?]
|
[auth auth?]
|
||||||
(let [{:keys [jvb-auth-password jicofo-auth-password jicofo-component-secret]} auth]
|
(let [{:keys [jvb-auth-password jicofo-auth-password jicofo-component-secret]} auth]
|
||||||
|
@ -69,6 +78,9 @@
|
||||||
(defn-spec generate-etherpad-service cp/map-or-seq? []
|
(defn-spec generate-etherpad-service cp/map-or-seq? []
|
||||||
(yaml/load-as-edn "jitsi/etherpad-service.yaml"))
|
(yaml/load-as-edn "jitsi/etherpad-service.yaml"))
|
||||||
|
|
||||||
|
(defn-spec generate-excalidraw-backend-service cp/map-or-seq? []
|
||||||
|
(yaml/load-as-edn "jitsi/excalidraw-backend-service.yaml"))
|
||||||
|
|
||||||
(defn-spec generate-deployment cp/map-or-seq?
|
(defn-spec generate-deployment cp/map-or-seq?
|
||||||
[config config?]
|
[config config?]
|
||||||
(let [{:keys [fqdn]} config]
|
(let [{:keys [fqdn]} config]
|
||||||
|
@ -76,4 +88,9 @@
|
||||||
(yaml/load-as-edn "jitsi/deployment.yaml")
|
(yaml/load-as-edn "jitsi/deployment.yaml")
|
||||||
(cm/replace-all-matching-values-by-new-value "REPLACE_JITSI_FQDN" fqdn)
|
(cm/replace-all-matching-values-by-new-value "REPLACE_JITSI_FQDN" fqdn)
|
||||||
(cm/replace-all-matching-values-by-new-value "REPLACE_ETHERPAD_URL"
|
(cm/replace-all-matching-values-by-new-value "REPLACE_ETHERPAD_URL"
|
||||||
(str "https://etherpad." fqdn "/p/")))))
|
(str "https://etherpad." fqdn "/p/"))
|
||||||
|
(cm/replace-all-matching-values-by-new-value "REPLACE_EXCALIDRAW_BACKEND_URL"
|
||||||
|
(str "https://excalidraw-backend." fqdn)))))
|
||||||
|
|
||||||
|
(defn-spec generate-excalidraw-deployment cp/map-or-seq? []
|
||||||
|
(yaml/load-as-edn "jitsi/excalidraw-deployment.yaml"))
|
||||||
|
|
|
@ -68,7 +68,7 @@ spec:
|
||||||
- name: JVB_TCP_HARVESTER_DISABLED
|
- name: JVB_TCP_HARVESTER_DISABLED
|
||||||
value: "true"
|
value: "true"
|
||||||
- name: web
|
- name: web
|
||||||
image: domaindrivenarchitecture/c4k-jitsi
|
image: domaindrivenarchitecture/c4k-jitsi-web
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
env:
|
env:
|
||||||
- name: PUBLIC_URL
|
- name: PUBLIC_URL
|
||||||
|
@ -97,6 +97,10 @@ spec:
|
||||||
value: "true"
|
value: "true"
|
||||||
- name: ETHERPAD_PUBLIC_URL
|
- name: ETHERPAD_PUBLIC_URL
|
||||||
value: REPLACE_ETHERPAD_URL
|
value: REPLACE_ETHERPAD_URL
|
||||||
|
- name: WHITEBOARD_ENABLED
|
||||||
|
value: "true"
|
||||||
|
- name: WHITEBOARD_COLLAB_SERVER_PUBLIC_URL
|
||||||
|
value: REPLACE_EXCALIDRAW_BACKEND_URL
|
||||||
- name: jvb
|
- name: jvb
|
||||||
image: jitsi/jvb:stable-8922-1
|
image: jitsi/jvb:stable-8922-1
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
|
|
13
src/main/resources/jitsi/excalidraw-backend-service.yaml
Normal file
13
src/main/resources/jitsi/excalidraw-backend-service.yaml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
service: excalidraw-backend
|
||||||
|
name: excalidraw-backend
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: excalidraw-backend
|
||||||
|
port: 3002
|
||||||
|
targetPort: 80
|
||||||
|
selector:
|
||||||
|
app: excalidraw-backend
|
20
src/main/resources/jitsi/excalidraw-deployment.yaml
Normal file
20
src/main/resources/jitsi/excalidraw-deployment.yaml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: excalidraw-backend
|
||||||
|
name: excalidraw-backend
|
||||||
|
spec:
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: excalidraw-backend
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: excalidraw-backend
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: excalidraw-backend
|
||||||
|
image: domaindrivenarchitecture/c4k-jitsi-excalidraw-backend
|
Loading…
Reference in a new issue