From 13e627891b99e194f371792a5ac32074661b39b0 Mon Sep 17 00:00:00 2001 From: Finn-Thorben Sell Date: Mon, 29 Jun 2020 15:34:12 +0200 Subject: [PATCH 01/12] make application configurable via kubernetes configmaps --- Dockerfile | 3 +-- k8s/deployment.yml | 16 ++++++++++++++-- k8s/kustomization.yml | 9 --------- kustomization.yml | 14 ++++++++++++++ 4 files changed, 29 insertions(+), 13 deletions(-) delete mode 100644 k8s/kustomization.yml create mode 100644 kustomization.yml diff --git a/Dockerfile b/Dockerfile index 43208c5..354bb24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,9 +33,8 @@ RUN npm run build FROM base as final COPY --from=frontend /app/src/frontend/dist/ /app/static # Setup configs -#ADD docker/uwsgi.ini /etc/uwsgi/lecture2gether.ini +VOLUME /app/config ADD docker/supervisor.conf /etc/supervisor/conf.d/app.conf -RUN mkdir /app/config ADD docker/settings.json /app/config/settings.json RUN ln -sf /app/config/settings.json /app/static/settings.json ADD docker/nginx.conf /etc/nginx/sites-enabled/default diff --git a/k8s/deployment.yml b/k8s/deployment.yml index 776b9d4..401fb29 100644 --- a/k8s/deployment.yml +++ b/k8s/deployment.yml @@ -7,12 +7,17 @@ spec: replicas: 1 selector: matchLabels: - app: "NOT_SET" + app: "lecture2gether" template: metadata: labels: - app: "NOT_SET" + app: "lecture2gether" spec: + volumes: + - name: "frontend-config" + configMap: + name: "frontend" + containers: - image: "docker.io/thenerdful8/lecture2gether" name: "main" @@ -21,4 +26,11 @@ spec: containerPort: 8000 - name: "metrics" containerPort: 5000 + envFrom: + - configMapRef: + name: "backend" + volumeMounts: + - name: "frontend-config" + mountPath: "/app/config" + readOnly: true diff --git a/k8s/kustomization.yml b/k8s/kustomization.yml deleted file mode 100644 index cef2f39..0000000 --- a/k8s/kustomization.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -apiVersion: "kustomize.config.k8s.io/v1beta1" -kind: "Kustomization" -namePrefix: "lecture2gether-" -commonLabels: - app: "lecture2gether" -resources: - - "./deployment.yml" - - "./service.yml" diff --git a/kustomization.yml b/kustomization.yml new file mode 100644 index 0000000..4cec3c6 --- /dev/null +++ b/kustomization.yml @@ -0,0 +1,14 @@ +--- +apiVersion: "kustomize.config.k8s.io/v1beta1" +kind: "Kustomization" +namePrefix: "lecture2gether-" +commonLabels: + app: "lecture2gether" +resources: + - "./k8s/deployment.yml" + - "./k8s/service.yml" +configMapGenerator: + - name: "backend" + - name: "frontend" + files: + - "settings.json=./docker/settings.json" From a89616354962031e858ee109e4262065ee4559fb Mon Sep 17 00:00:00 2001 From: Finn-Thorben Sell Date: Mon, 29 Jun 2020 18:34:00 +0200 Subject: [PATCH 02/12] add github action to test kubernetes config --- .github/workflows/k8s_tests.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/k8s_tests.yml diff --git a/.github/workflows/k8s_tests.yml b/.github/workflows/k8s_tests.yml new file mode 100644 index 0000000..ca2cdf8 --- /dev/null +++ b/.github/workflows/k8s_tests.yml @@ -0,0 +1,18 @@ +name: Kubernetes configuration + +on: [push] + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: docker pull nekottyo/kustomize-kubeval + - name: render kustomization + run: | + docker run -i -w /working -v $(pwd):/working nekottyo/kustomize-kubeval \ + kustomize build . >> k8s.yml + - name: check kubernetes configuration + run: | + docker run -i -w /working -v $(pwd):/working nekottyo/kustomize-kubeval \ + kubeval k8s.yml --strict From 738aa20632405924e7b56c71debc6bdfe97d13a1 Mon Sep 17 00:00:00 2001 From: Florian Vahl Date: Fri, 10 Jul 2020 10:32:53 +0200 Subject: [PATCH 03/12] Add faster playback rate --- lecture2gether-vue/src/components/Player.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lecture2gether-vue/src/components/Player.vue b/lecture2gether-vue/src/components/Player.vue index c6df38b..43240d3 100644 --- a/lecture2gether-vue/src/components/Player.vue +++ b/lecture2gether-vue/src/components/Player.vue @@ -77,7 +77,7 @@ export default class L2gPlayer extends Vue { muted: false, language: 'en', width: '750px', - playbackRates: [0.75, 1.0, 1.25, 1.5, 1.75, 2.0], + playbackRates: [0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 4.0], sources, techOrder: ['youtube', 'html5'], youtube: { From 19e5b63be3043a07338688357f6d7a41e02cdffb Mon Sep 17 00:00:00 2001 From: Timon Engelke Date: Sat, 11 Jul 2020 22:57:24 +0200 Subject: [PATCH 04/12] use different playback rates for youtube and other players --- lecture2gether-vue/src/components/Player.vue | 22 ++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/lecture2gether-vue/src/components/Player.vue b/lecture2gether-vue/src/components/Player.vue index 43240d3..ad29a90 100644 --- a/lecture2gether-vue/src/components/Player.vue +++ b/lecture2gether-vue/src/components/Player.vue @@ -64,9 +64,11 @@ export default class L2gPlayer extends Vue { } get playerOptions() { - const sources = []; + let source; + let playbackRates; try { - sources.push(this.getSourceFromURL(this.url)); + source = this.getSourceFromURL(this.url); + playbackRates = this.getPlaybackRatesFromSource(source.type); } catch (e) { console.error(e); // Show error page @@ -77,8 +79,8 @@ export default class L2gPlayer extends Vue { muted: false, language: 'en', width: '750px', - playbackRates: [0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 4.0], - sources, + playbackRates, + sources: [source], techOrder: ['youtube', 'html5'], youtube: { ytControls: 0, @@ -91,6 +93,15 @@ export default class L2gPlayer extends Vue { return this.$refs.videoPlayer.player; } + getPlaybackRatesFromSource(src: string): Number[] { + if (src === 'video/youtube') { + // YouTube does not support 4x player speed + return [0.75, 1.0, 1.25, 1.5, 1.75, 2.0]; + } else { + return [0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.5]; + } + } + getSourceFromURL(url: string): {type: string; src: string} { // shared media logic in src/mediaURLs.ts checkURL const res = checkURL(url); @@ -262,4 +273,7 @@ export default class L2gPlayer extends Vue { .video-js .vjs-duration { display: block; } +.vjs-menu-button-popup .vjs-menu .vjs-menu-content { + max-height: 16em; +} From d7819808319559bb171446bdc25fdae94549f1bf Mon Sep 17 00:00:00 2001 From: Flova Date: Sun, 12 Jul 2020 14:31:26 +0200 Subject: [PATCH 05/12] Update lecture2gether-vue/src/components/Player.vue Co-authored-by: Jan Gutsche <34797331+JanGut@users.noreply.github.com> --- lecture2gether-vue/src/components/Player.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lecture2gether-vue/src/components/Player.vue b/lecture2gether-vue/src/components/Player.vue index ad29a90..256b168 100644 --- a/lecture2gether-vue/src/components/Player.vue +++ b/lecture2gether-vue/src/components/Player.vue @@ -95,7 +95,7 @@ export default class L2gPlayer extends Vue { getPlaybackRatesFromSource(src: string): Number[] { if (src === 'video/youtube') { - // YouTube does not support 4x player speed + // YouTube does not support player speed above 2x return [0.75, 1.0, 1.25, 1.5, 1.75, 2.0]; } else { return [0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.5]; From d0ebee1954a16056d2ec807b9971511296fafabe Mon Sep 17 00:00:00 2001 From: Flova Date: Tue, 14 Jul 2020 13:31:31 +0200 Subject: [PATCH 06/12] Add kubernetes ci badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e80b67..0bf3806 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Lecture2Gether makes it possible to watch online lectures with friends by pasting a link to a [Lecture2Go](https://github.com/lecture2go/portal-6.2-ce-ga6) Video, a YouTube Video or a simple mp4 link. The video streams are synchronized to partially restore the social aspect of campus life. -![Flask CI](https://github.com/TheNerdful8/Lecture2Gether/workflows/Flask%20CI/badge.svg?branch=master)    ![Node.js CI](https://github.com/TheNerdful8/Lecture2Gether/workflows/Node.js%20CI/badge.svg) +![Flask CI](https://github.com/TheNerdful8/Lecture2Gether/workflows/Flask%20CI/badge.svg?branch=master)    ![Node.js CI](https://github.com/TheNerdful8/Lecture2Gether/workflows/Node.js%20CI/badge.svg)    ![Kubernetes configuration](https://github.com/TheNerdful8/Lecture2Gether/workflows/Kubernetes%20configuration/badge.svg) ### Built With From d0194736749aaf89ce9673093a658c66b55074ea Mon Sep 17 00:00:00 2001 From: Finn-Thorben Sell Date: Thu, 25 Jun 2020 14:28:26 +0200 Subject: [PATCH 07/12] define cache-policy for static production assets --- docker/nginx.conf | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docker/nginx.conf b/docker/nginx.conf index a85e687..3b0d1d7 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -2,12 +2,22 @@ server { listen 8000; server_name default_server; - try_files $uri /index.html; root /app/static/; + location / { + try_files $uri /index.html?$args; + location ~* \.html$ { + add_header "Cache-Control" "no-cache"; + } + location ~* \.(css|js|woff2) { + add_header "Cache-Control" "max-age=31536000"; + } + } + location /api { proxy_pass http://127.0.0.1:5000; } + location = /socket.io/ { proxy_pass http://127.0.0.1:5000/socket.io/; proxy_http_version 1.1; From de28fadd858f0b4b84eabb98533c436e221edcdc Mon Sep 17 00:00:00 2001 From: Finn-Thorben Sell Date: Thu, 25 Jun 2020 14:36:19 +0200 Subject: [PATCH 08/12] add aria-label to copy-url button --- lecture2gether-vue/src/components/Toolbar.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lecture2gether-vue/src/components/Toolbar.vue b/lecture2gether-vue/src/components/Toolbar.vue index a88e715..e9f73a4 100644 --- a/lecture2gether-vue/src/components/Toolbar.vue +++ b/lecture2gether-vue/src/components/Toolbar.vue @@ -25,7 +25,8 @@ From 5344086a1074c9bbde8c6adf347174d3c6518df8 Mon Sep 17 00:00:00 2001 From: Finn-Thorben Sell Date: Thu, 25 Jun 2020 14:39:59 +0200 Subject: [PATCH 09/12] add description meta tag --- lecture2gether-vue/public/index.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lecture2gether-vue/public/index.html b/lecture2gether-vue/public/index.html index e7cea48..d945ec9 100644 --- a/lecture2gether-vue/public/index.html +++ b/lecture2gether-vue/public/index.html @@ -4,6 +4,9 @@ + Lecture2Gether From a4499f9fde2b57f89a74323a93451a1c3ccdd152 Mon Sep 17 00:00:00 2001 From: Finn-Thorben Sell Date: Thu, 25 Jun 2020 15:26:54 +0200 Subject: [PATCH 10/12] enable nginx gzip compression --- docker/nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/nginx.conf b/docker/nginx.conf index 3b0d1d7..0eaeabb 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -1,6 +1,7 @@ server { listen 8000; server_name default_server; + gzip on; root /app/static/; From af29676413fd8cc72826a81bf18efb209aff6459 Mon Sep 17 00:00:00 2001 From: Finn-Thorben Sell Date: Thu, 25 Jun 2020 16:15:11 +0200 Subject: [PATCH 11/12] switch to a-la-carte vuetify components --- lecture2gether-vue/src/plugins/vuetify.ts | 2 +- lecture2gether-vue/tsconfig.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lecture2gether-vue/src/plugins/vuetify.ts b/lecture2gether-vue/src/plugins/vuetify.ts index 81c3950..63b26de 100644 --- a/lecture2gether-vue/src/plugins/vuetify.ts +++ b/lecture2gether-vue/src/plugins/vuetify.ts @@ -1,5 +1,5 @@ import Vue from 'vue'; -import Vuetify from 'vuetify'; +import Vuetify from 'vuetify/lib'; import 'vuetify/dist/vuetify.min.css'; Vue.use(Vuetify); diff --git a/lecture2gether-vue/tsconfig.json b/lecture2gether-vue/tsconfig.json index b57578e..8a0cf1a 100644 --- a/lecture2gether-vue/tsconfig.json +++ b/lecture2gether-vue/tsconfig.json @@ -12,7 +12,8 @@ "sourceMap": true, "baseUrl": ".", "types": [ - "webpack-env" + "webpack-env", + "vuetify" ], "paths": { "@/*": [ From 3754e9a5c20aa07681bf1c30eb6b944ce3d92517 Mon Sep 17 00:00:00 2001 From: Frederico Bormann Date: Sat, 25 Jul 2020 15:44:40 +0200 Subject: [PATCH 12/12] Make distinction between room and player consistent --- lecture2gether-vue/src/plugins/router/routes.ts | 6 +++--- lecture2gether-vue/src/views/Home.vue | 2 +- lecture2gether-vue/src/views/Room.vue | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lecture2gether-vue/src/plugins/router/routes.ts b/lecture2gether-vue/src/plugins/router/routes.ts index e781040..73b1d4f 100644 --- a/lecture2gether-vue/src/plugins/router/routes.ts +++ b/lecture2gether-vue/src/plugins/router/routes.ts @@ -1,6 +1,6 @@ import { RouteConfig } from 'vue-router'; import Home from '@/views/Home.vue'; -import Player from '@/views/Room.vue'; +import Room from '@/views/Room.vue'; export default [ { @@ -10,8 +10,8 @@ export default [ }, { path: '/l/:roomId', - name: 'player', - component: Player, + name: 'room', + component: Room, }, { path: '/sync/debug', diff --git a/lecture2gether-vue/src/views/Home.vue b/lecture2gether-vue/src/views/Home.vue index a50d262..bbbcb26 100644 --- a/lecture2gether-vue/src/views/Home.vue +++ b/lecture2gether-vue/src/views/Home.vue @@ -22,7 +22,7 @@ export default class L2gHome extends Vue { async onConnectedChanged() { await this.$store.dispatch('newRoom'); await this.$router.push({ - name: 'player', + name: 'room', params: { roomId: this.$store.state.rooms.roomId, }, diff --git a/lecture2gether-vue/src/views/Room.vue b/lecture2gether-vue/src/views/Room.vue index 019afd6..0d13e64 100644 --- a/lecture2gether-vue/src/views/Room.vue +++ b/lecture2gether-vue/src/views/Room.vue @@ -1,7 +1,7 @@