diff --git a/infrastructure/excalidraw-backend/build.py b/infrastructure/excalidraw-backend/build.py index cd6831f..cab801a 100644 --- a/infrastructure/excalidraw-backend/build.py +++ b/infrastructure/excalidraw-backend/build.py @@ -4,9 +4,9 @@ from pybuilder.core import task, init from ddadevops import * name = "c4k-jitsi" -MODULE = "excalidraw-backend" +MODULE = "excalidraw-testbackend" PROJECT_ROOT_PATH = "../.." -version = "1.5.2-SNAPSHOT" +version = "1.0.1-SNAPSHOT" @init diff --git a/infrastructure/excalidraw-backend/image/resources/install.sh b/infrastructure/excalidraw-backend/image/resources/install.sh index e92cc44..64eb947 100755 --- a/infrastructure/excalidraw-backend/image/resources/install.sh +++ b/infrastructure/excalidraw-backend/image/resources/install.sh @@ -1,10 +1,10 @@ #!/bin/bash -set -Eeo pipefail +set -eux apt-get update > /dev/null apt-get upgrade -y > /dev/null apt-get clean -npm install -g npm +npm install -g npm@latest npm ci npm run build diff --git a/infrastructure/excalidraw-backend/image/resources/src/index.ts b/infrastructure/excalidraw-backend/image/resources/src/index.ts index 4c85892..9b34fb6 100644 --- a/infrastructure/excalidraw-backend/image/resources/src/index.ts +++ b/infrastructure/excalidraw-backend/image/resources/src/index.ts @@ -3,8 +3,8 @@ import debug from 'debug'; import dotenv from 'dotenv'; import express from 'express'; -import http from 'http'; -import {Server} from 'socket.io'; +import { createServer } from 'node:http'; +import { Server } from 'socket.io'; /* import * as prometheus from 'socket.io-prometheus-metrics'; @@ -13,10 +13,12 @@ wich is moderate vulnerable to regular expression denial of service when untrust input is passed into the o formatter. alternatively could be used prom-client -import */ -const serverDebug = debug('server'); +const serverDebug = debug('httpServer'); +const app = express(); +const port = process.env.PORT || 80; // default port to listen +const httpServer = createServer(app); dotenv.config( process.env.NODE_ENV === 'development' @@ -24,25 +26,24 @@ dotenv.config( : { 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, () => { +httpServer.listen(port, () => { serverDebug(`listening on port: ${port}`); }); -const io = require("socket.io")(Server, { - cors: { - origin: "https://jitsi.test.meissa.de", - credentials: true - }, - maxHttpBufferSize: 10e6, +const corsOptions = { + origin: 'https://meet.jit.si', + methods: ["GET", "POST"], + credentials: true +}; + +const io = new Server(httpServer, { + allowEIO3: true, + cors: corsOptions, + maxHttpBufferSize: 1e6, pingTimeout: 10000 }); @@ -65,21 +66,19 @@ or more: https://codersociety.com/blog/articles/nodejs-application-monitoring-with-prometheus-and-grafana */ - -io.on('connection', socket => { +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) { + if (io.sockets.adapter.rooms.get(roomID)?.size ?? 0 <= 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) + 'room-user-change', Array.from(io.sockets.adapter.rooms.get(roomID) ?? []) ); }); @@ -87,8 +86,7 @@ io.on('connection', socket => { 'server-broadcast', (roomID: string, encryptedData: ArrayBuffer, iv: Uint8Array) => { socket.broadcast.to(roomID).emit('client-broadcast', encryptedData, iv); - } - ); + }); socket.on( 'server-volatile-broadcast', @@ -96,15 +94,14 @@ io.on('connection', socket => { 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); - + const clients = Array.from(rooms.get(roomID) ?? []).filter(id => id !== socket.id); + if (roomID !== socket.id) { socket.to(roomID).emit('user has left', socket.id); } diff --git a/infrastructure/excalidraw-backend/image/resources/tsconfig.json b/infrastructure/excalidraw-backend/image/resources/tsconfig.json index fff8e47..2877abc 100644 --- a/infrastructure/excalidraw-backend/image/resources/tsconfig.json +++ b/infrastructure/excalidraw-backend/image/resources/tsconfig.json @@ -12,7 +12,7 @@ "resolveJsonModule": true, "isolatedModules": true, "outDir": "dist", - "noImplicitAny": false + //"noImplicitAny": false } } \ No newline at end of file diff --git a/infrastructure/web/build.py b/infrastructure/web/build.py index c41f2e5..b9ec266 100644 --- a/infrastructure/web/build.py +++ b/infrastructure/web/build.py @@ -4,9 +4,9 @@ from pybuilder.core import task, init from ddadevops import * name = "c4k-jitsi" -MODULE = "web" +MODULE = "webtest" PROJECT_ROOT_PATH = "../.." -version = "1.5.2-SNAPSHOT" +version = "1.0.1-SNAPSHOT" @init diff --git a/infrastructure/web/image/resources/install.sh b/infrastructure/web/image/resources/install.sh index 1f55e4c..ce36a25 100755 --- a/infrastructure/web/image/resources/install.sh +++ b/infrastructure/web/image/resources/install.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -Eeo pipefail +set -eux apt-get update > /dev/null apt-get upgrade -y > /dev/null diff --git a/package.json b/package.json index 021c3ce..7b2c04d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "c4k-jitsi", "description": "Generate c4k yaml for a jitsi deployment.", "author": "meissa GmbH", - "version": "1.5.2-SNAPSHOT", + "version": "1.6.0-SNAPSHOT", "homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-jitsi#readme", "repository": "https://www.npmjs.com/package/c4k-jitsi", "license": "APACHE2", diff --git a/project.clj b/project.clj index 7bfde58..872f855 100644 --- a/project.clj +++ b/project.clj @@ -1,11 +1,11 @@ -(defproject org.domaindrivenarchitecture/c4k-jitsi "1.5.2-SNAPSHOT" +(defproject org.domaindrivenarchitecture/c4k-jitsi "1.6.0-SNAPSHOT" :description "jitsi c4k-installation package" :url "https://domaindrivenarchitecture.org" :license {:name "Apache License, Version 2.0" :url "https://www.apache.org/licenses/LICENSE-2.0.html"} :dependencies [[org.clojure/clojure "1.11.1"] - [org.clojure/tools.reader "1.3.6"] - [org.domaindrivenarchitecture/c4k-common-clj "6.0.3"] + [org.clojure/tools.reader "1.3.7"] + [org.domaindrivenarchitecture/c4k-common-clj "6.1.0"] [hickory "0.7.1" :exclusions [viebel/codox-klipse-theme]]] :target-path "target/%s/" :source-paths ["src/main/cljc" diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 1c7058c..02a193d 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -4,7 +4,7 @@ "src/test/cljc" "src/test/cljs" "src/test/resources"] - :dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "6.0.3"] + :dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "6.1.0"] [hickory "0.7.1"]] :builds {:frontend {:target :browser :modules {:main {:init-fn dda.c4k-jitsi.browser/init}} diff --git a/src/main/cljc/dda/c4k_jitsi/jitsi.cljc b/src/main/cljc/dda/c4k_jitsi/jitsi.cljc index f7112a5..b258917 100644 --- a/src/main/cljc/dda/c4k_jitsi/jitsi.cljc +++ b/src/main/cljc/dda/c4k_jitsi/jitsi.cljc @@ -8,7 +8,8 @@ [dda.c4k-common.common :as cm] [dda.c4k-common.ingress :as ing] [dda.c4k-common.base64 :as b64] - [dda.c4k-common.predicate :as cp])) + [dda.c4k-common.predicate :as cp] + #?(:cljs [dda.c4k-common.macros :refer-macros [inline-resources]]))) (s/def ::fqdn cp/fqdn-string?) (s/def ::issuer cp/letsencrypt-issuer?) @@ -25,16 +26,8 @@ #?(:cljs (defmethod yaml/load-resource :jitsi [resource-name] - (case resource-name - "jitsi/deployment.yaml" (rc/inline "jitsi/deployment.yaml") - "jitsi/etherpad-service.yaml" (rc/inline "jitsi/etherpad-service.yaml") - "jitsi/jvb-service.yaml" (rc/inline "jitsi/jvb-service.yaml") - "jitsi/excalidraw-backend-service.yaml" (rc/inline "jitsi/excalidraw-backend-service.yaml") - "jitsi/excalidraw-deployment.yaml" (rc/inline "jitsi/excalidraw-deployment.yaml") - "jitsi/secret.yaml" (rc/inline "jitsi/secret.yaml") - "jitsi/web-service.yaml" (rc/inline "jitsi/web-service.yaml") - (throw (js/Error. "Undefined Resource!"))))) - + (get (inline-resources "jitsi") resource-name))) + (defn-spec generate-ingress-web cp/map-or-seq? [config config?] (ing/generate-ingress-and-cert diff --git a/src/main/resources/jitsi/deployment.yaml b/src/main/resources/jitsi/deployment.yaml index c1ef365..1a2c683 100644 --- a/src/main/resources/jitsi/deployment.yaml +++ b/src/main/resources/jitsi/deployment.yaml @@ -68,7 +68,7 @@ spec: - name: JVB_TCP_HARVESTER_DISABLED value: "true" - name: web - image: domaindrivenarchitecture/c4k-jitsi-web + image: domaindrivenarchitecture/c4k-jitsi-webtest imagePullPolicy: IfNotPresent env: - name: PUBLIC_URL diff --git a/src/main/resources/jitsi/excalidraw-deployment.yaml b/src/main/resources/jitsi/excalidraw-deployment.yaml index 587c93b..5eb63ab 100644 --- a/src/main/resources/jitsi/excalidraw-deployment.yaml +++ b/src/main/resources/jitsi/excalidraw-deployment.yaml @@ -17,4 +17,4 @@ spec: spec: containers: - name: excalidraw-backend - image: domaindrivenarchitecture/c4k-jitsi-excalidraw-backend \ No newline at end of file + image: domaindrivenarchitecture/c4k-jitsi-excalidraw-testbackend \ No newline at end of file diff --git a/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc b/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc index 0b09620..aa9b77a 100644 --- a/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc +++ b/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc @@ -19,7 +19,7 @@ :spec {:containers [{:name "jicofo", - :image "jitsi/jicofo:stable-8922-1", + :image "jitsi/jicofo:stable-8960-1", :imagePullPolicy "IfNotPresent", :env [{:name "XMPP_SERVER", :value "localhost"} @@ -29,7 +29,7 @@ {:name "JICOFO_AUTH_PASSWORD", :valueFrom {:secretKeyRef {:name "jitsi-config", :key "JICOFO_AUTH_PASSWORD"}}} {:name "TZ", :value "Europe/Berlin"}]} {:name "prosody", - :image "jitsi/prosody:stable-8922-1", + :image "jitsi/prosody:stable-8960-1", :imagePullPolicy "IfNotPresent", :env [{:name "PUBLIC_URL", :value "xy.xy.xy"} @@ -62,7 +62,7 @@ {:name "WHITEBOARD_ENABLED", :value "true"} {:name "WHITEBOARD_COLLAB_SERVER_PUBLIC_URL", :value "https://excalidraw-backend.xy.xy.xy"}]} {:name "jvb", - :image "jitsi/jvb:stable-8922-1", + :image "jitsi/jvb:stable-8960-1", :imagePullPolicy "IfNotPresent", :env [{:name "PUBLIC_URL", :value "xy.xy.xy"} @@ -76,7 +76,7 @@ {:name "JICOFO_AUTH_PASSWORD", :valueFrom {:secretKeyRef {:name "jitsi-config", :key "JICOFO_AUTH_PASSWORD"}}} {:name "TZ", :value "Europe/Berlin"}]} {:name "etherpad", - :image "etherpad/etherpad:1.9.2", + :image "etherpad/etherpad:1.9.3", :env [{:name "XMPP_SERVER", :value "localhost"} {:name "JICOFO_COMPONENT_SECRET",