Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bc4710 Integrate tldraw board in the column #19

Merged
merged 106 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from 93 commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
8c968aa
Add ansible
Jul 31, 2023
804539a
Fix
Jul 31, 2023
10bed1a
Add bingo token
Jul 31, 2023
de2f140
Add port
Jul 31, 2023
3ce376f
Renaming
Aug 1, 2023
66553f9
Change port
Aug 1, 2023
877b0bf
Change port
Aug 1, 2023
171db05
Change group vars
Aug 1, 2023
1122fec
change workflows files
Aug 1, 2023
a9d8d9a
change deployment file
Aug 1, 2023
7f8eb13
Change dockerfile
Aug 7, 2023
a6777b0
reformat nginx.conf
bn-pass Aug 8, 2023
ca5db8b
rename nginx configuration file to indicate it will be used as a temp…
bn-pass Aug 8, 2023
d2143e4
reformat Dockerfile, make nginx configuration a template file
bn-pass Aug 8, 2023
213f22e
add /runtime.config.json location in nginx config
bn-pass Aug 8, 2023
0d15ff0
add API_URL to the tldraw configmap
bn-pass Aug 8, 2023
5541805
replace API URL (as its not currently being used) with the Tldraw ser…
bn-pass Aug 9, 2023
f01e967
modify location of the served tldraw-client runtime config
bn-pass Aug 9, 2023
a3c9a6d
Fetch tldraw Server url
Aug 10, 2023
840d8bd
Merge branch 'BC-4256-Integration-tldraw' of https://github.com/hpi-s…
Aug 10, 2023
39a0729
add content to html
Aug 10, 2023
6ed548c
update .gitignore
Aug 10, 2023
3b61940
update .gitignore
Aug 10, 2023
16ef942
Delete fetch
Aug 14, 2023
bcf9ff6
Add fetch
Aug 14, 2023
f2b7513
Add fetch
Aug 14, 2023
fd1c84c
Change tsconfig
Aug 14, 2023
b8742b5
Delete build for git
Aug 17, 2023
c904b27
Uncomment build folder
Aug 17, 2023
b3dbb35
Change to main
Aug 18, 2023
c669b37
Fix tests
Aug 18, 2023
63ec5a1
Change dockerfile
Aug 18, 2023
daac4ed
Testing
Aug 18, 2023
bc78a00
Change to main
Aug 22, 2023
b76f202
Change to BC-4256-Integration-tldraw
Aug 22, 2023
b9f9cec
Check deploy for tldraw
Aug 28, 2023
79d20d6
delete async
Aug 29, 2023
5092cba
Add async
Aug 29, 2023
94345f7
delete async
Aug 29, 2023
cbf03fc
Add cookies
Sep 8, 2023
f265ed5
Delete console log
Sep 8, 2023
21595fa
Change docker push version
Sep 8, 2023
bc98aab
Delete svc tldraw
Sep 8, 2023
cf94c7c
Call function inside configure
Sep 8, 2023
32e02fc
for test
Sep 8, 2023
8f450d6
some changes
Sep 8, 2023
3376f5b
prettierrc check
Sep 8, 2023
ee5a63b
some changes
Sep 8, 2023
a2bc8fc
Add path
Sep 8, 2023
a5d8ed8
Add path
Sep 8, 2023
35bf430
some changes
Sep 8, 2023
2af38c9
some changes
Sep 8, 2023
9de796f
Add ClientIP
Sep 11, 2023
cab0e5e
Change affinity to None
Sep 11, 2023
5956718
Change affinity
Sep 11, 2023
69666dd
Change affinity
Sep 11, 2023
9ce2c3e
change to clientIP
Sep 13, 2023
6f16516
change the name of cookies
Sep 13, 2023
f3f8108
set timezone and locale in docker file
Sep 19, 2023
d477693
Change docker file
Sep 21, 2023
cbec3f5
Hide multiplayer menu
Oct 5, 2023
d0174a4
Show the multiplayer
Oct 5, 2023
12d7bfa
Add branch_meta
Oct 10, 2023
0a597be
For testing
Oct 10, 2023
e8be3e1
Delete function
Oct 11, 2023
50e83fd
Check jwt
Oct 18, 2023
0f874c4
Delete check jwt
Oct 19, 2023
e7248c4
Add icon
Oct 19, 2023
933a5ce
Add jwt check again
Oct 23, 2023
04c5d2c
Fix the fileSystem
Oct 24, 2023
c8105de
update configs
Oct 24, 2023
99866d4
fix react root rendering
davwas Nov 8, 2023
df64812
set default tldraw language
davwas Nov 8, 2023
e08c7d5
remove docker language set
davwas Nov 8, 2023
89cacfa
fix multiplayer state and user settings persistence
davwas Nov 8, 2023
38021b3
add onMount method
davwas Nov 9, 2023
c57c743
Fix uploading
Nov 10, 2023
264459f
revert deletion of setAppInstance method
davwas Nov 10, 2023
d9e098a
change persistent settings key to room name
davwas Nov 10, 2023
345385e
add assets support
davwas Nov 10, 2023
32fd78d
add user settings persistence via local storage
davwas Nov 13, 2023
ce46daa
Comment assets
Nov 14, 2023
0972749
Delete some changes
Nov 15, 2023
b4103be
Fix comments
Nov 17, 2023
0b43ff5
Add ingress
Nov 20, 2023
68e73fe
Fix comments
Nov 20, 2023
7301af0
add port specific value
blazejpass Nov 21, 2023
23578ba
Add ingress to main
Nov 21, 2023
422abb8
delete some lines in ingress
Nov 21, 2023
e47b50c
Added
Nov 21, 2023
ba2173e
Hide open and creating new project
Nov 22, 2023
5c3bc58
Change ingress annotations
Nov 22, 2023
0c19aaf
Add some annotations
Nov 23, 2023
041e998
Add apply, fix client deployment
Nov 23, 2023
40d923b
fix
Nov 24, 2023
495a3eb
fix
Nov 24, 2023
3fb8884
fix
Nov 24, 2023
2824ad1
fix
Nov 24, 2023
f72165f
Fix
Nov 24, 2023
c115255
fix deployment
Nov 25, 2023
94de1c3
Change path
Nov 27, 2023
02a2d8c
Add path
Nov 27, 2023
dd230e4
delete path
Nov 27, 2023
fb68866
Add path
Nov 27, 2023
addc40a
Fix comments
Nov 27, 2023
b0c36db
Change to main
Nov 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ jobs:
clean:
permissions:
contents: read
uses: hpi-schul-cloud/dof_app_deploy/.github/workflows/clean_workflow.yml@main
uses: hpi-schul-cloud/dof_app_deploy/.github/workflows/clean_workflow.yml@BC-4710-new-tldraw-manage
VikDavydiuk marked this conversation as resolved.
Show resolved Hide resolved
with:
branch: ${{ github.event.ref }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
DEV_KUBE_CONFIG: ${{ secrets.DEV_KUBE_CONFIG }}
DEV_KUBE_CONFIG: ${{ secrets.DEV_KUBE_CONFIG }}
23 changes: 21 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

- name: Build and push ${{ github.repository }}
if: ${{ env.IMAGE_EXISTS == 0 }}
uses: docker/build-push-action@v4
uses: docker/build-push-action@v4.1.1
VikDavydiuk marked this conversation as resolved.
Show resolved Hide resolved
with:
context: .
file: ./Dockerfile
Expand All @@ -54,6 +54,24 @@ jobs:
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
labels: ${{ steps.docker_meta_img.outputs.labels }}

branch_meta:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.extract_branch_meta.outputs.branch }}
sha: ${{ steps.extract_branch_meta.outputs.sha }}
steps:
- name: Extract branch meta
shell: bash
id: extract_branch_meta
run: |
if [ "${{ github.event_name }}" == 'pull_request' ]; then
echo "branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
echo "sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
else
echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
echo "sha=${{ github.sha }}" >> $GITHUB_OUTPUT
fi

branch_name:
runs-on: ubuntu-latest
outputs:
Expand All @@ -68,13 +86,14 @@ jobs:
needs:
- build_and_push
- branch_name
uses: hpi-schul-cloud/dof_app_deploy/.github/workflows/deploy.yml@main
uses: hpi-schul-cloud/dof_app_deploy/.github/workflows/deploy.yml@BC-4710-new-tldraw-manage
VikDavydiuk marked this conversation as resolved.
Show resolved Hide resolved
with:
branch: ${{ needs.branch_name.outputs.branch }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
DEV_VAULT: ${{ secrets.DEV_VAULT }}
DEV_KUBE_CONFIG: ${{ secrets.DEV_KUBE_CONFIG }}
BINGO_REPO_TOKEN: ${{ secrets.BINGO_REPO_TOKEN }}

deploy-successful:
needs:
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,24 @@ jobs:
id: docker_meta_img_hub
uses: docker/metadata-action@v3
with:
images: schulcloud/tldraw-client
images: docker.io/schulcloud/tldraw-client, quay.io/schulcloud/tldraw-client
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}

- name: Log into registry
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Log into quay registry
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}

- name: Build and push ${{ github.repository }}
uses: docker/build-push-action@v2
with:
Expand Down
23 changes: 16 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
# build stage
FROM docker.io/node:18-bullseye as build-stage

RUN mkdir /app && chown -R node:node /app

WORKDIR /app

COPY package.json .
COPY package-lock.json .
COPY package.json package-lock.json ./
RUN npm ci
COPY . ./
RUN npm run build

# production environment
COPY babel.config.js .eslintrc.js LICENSE.md tsconfig.json .prettierrc.js ./
COPY public ./public
COPY src ./src
RUN NODE_ENV=production npm run build

# runtime image stage
FROM docker.io/nginx:1.25
COPY nginx.conf /etc/nginx/conf.d/default.conf

RUN mkdir /etc/nginx/templates

COPY nginx.conf.template /etc/nginx/templates/default.conf.template
COPY --from=build-stage /app/build /usr/share/nginx/html
EXPOSE 83

EXPOSE 3046

CMD ["nginx", "-g", "daemon off;"]
2 changes: 2 additions & 0 deletions ansible/group_vars/all/tldraw-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
TLDRAW_CLIENT_IMAGE: quay.io/schulcloudverbund/tldraw-client
2 changes: 2 additions & 0 deletions ansible/group_vars/develop/tldraw-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
TLDRAW_CLIENT_IMAGE: ghcr.io/hpi-schul-cloud/tldraw-client
9 changes: 9 additions & 0 deletions ansible/roles/tldraw-client-core/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
galaxy_info:
role_name: tldraw-client-core
author: Schul-Cloud Verbund
description: core role for the tldraw-client
company: Schul-Cloud Verbund
license: license (AGPLv3)
min_ansible_version: 2.8
galaxy_tags: []
dependencies: []
24 changes: 24 additions & 0 deletions ansible/roles/tldraw-client-core/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
- name: TldrawClientService
VikDavydiuk marked this conversation as resolved.
Show resolved Hide resolved
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: tldraw-client-svc.yml.j2

- name: TldrawClientConfigmap
VikDavydiuk marked this conversation as resolved.
Show resolved Hide resolved
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: tldraw-client-configmap.yml.j2
apply: yes

- name: TldrawClientDeployment
VikDavydiuk marked this conversation as resolved.
Show resolved Hide resolved
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: tldraw-client-deployment.yml.j2

- name: TldrawClientIngress
VikDavydiuk marked this conversation as resolved.
Show resolved Hide resolved
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: tldraw-client-ingress.yml.j2
VikDavydiuk marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: tldraw-client-configmap
namespace: {{ NAMESPACE }}
labels:
app: tldraw-client
data:
NODE_ENV: "production"
TZ: "Europe/Berlin"
PORT: "3046"
TLDRAW_SERVER_URL: "wss://{{ DOMAIN }}/tldraw-server"
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: tldraw-client-deployment
namespace: {{ NAMESPACE }}
labels:
app: tldraw-client
spec:
replicas: {{ TLDRAW_CLIENT_REPLICAS|default("1", true) }}
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
revisionHistoryLimit: 4
paused: false
selector:
labels:
app: tldraw-client
VikDavydiuk marked this conversation as resolved.
Show resolved Hide resolved
app.kubernetes.io/part-of: schulcloud-verbund
app.kubernetes.io/version: {{ SCHULCLOUD_SERVER_IMAGE_TAG }}
app.kubernetes.io/name: tldraw-client
app.kubernetes.io/component: tldraw
app.kubernetes.io/managed-by: ansible
git.branch: {{ SCHULCLOUD_SERVER_BRANCH_NAME }}
git.repo: {{ SCHULCLOUD_SERVER_REPO_NAME }}
VikDavydiuk marked this conversation as resolved.
Show resolved Hide resolved
template:
metadata:
labels:
labels:
app: tldraw-client
app.kubernetes.io/part-of: schulcloud-verbund
app.kubernetes.io/version: {{ SCHULCLOUD_SERVER_IMAGE_TAG }}
app.kubernetes.io/name: tldraw-client
app.kubernetes.io/component: tldraw
app.kubernetes.io/managed-by: ansible
git.branch: {{ SCHULCLOUD_SERVER_BRANCH_NAME }}
git.repo: {{ SCHULCLOUD_SERVER_REPO_NAME }}
annotations:
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
containers:
- name: tldraw-client
image: {{ TLDRAW_CLIENT_IMAGE }}:{{ TLDRAW_CLIENT_IMAGE_TAG }}
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 3046
protocol: TCP
envFrom:
- configMapRef:
name: tldraw-client-configmap
volumeMounts:
- mountPath: /var/run
name: pid-dir
- mountPath: /var/cache/nginx
name: cache-dir
- mountPath: /etc/nginx/conf.d
name: conf-dir
resources:
limits:
cpu: {{ TLDRAW_CLIENT_CPU_LIMITS|default("1000m", true) }}
memory: {{ TLDRAW_CLIENT_MEMORY_LIMITS|default("256Mi", true) }}
requests:
cpu: {{ TLDRAW_CLIENT_CPU_REQUESTS|default("100m", true) }}
memory: {{ TLDRAW_CLIENT_MEMORY_REQUESTS|default("32Mi", true) }}
VikDavydiuk marked this conversation as resolved.
Show resolved Hide resolved
volumes:
- name: pid-dir
emptyDir: {}
- name: cache-dir
emptyDir: {}
- name: conf-dir
emptyDir: {}

Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ NAMESPACE }}-tldraw-client-ingress
namespace: {{ NAMESPACE }}
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "{{ TLS_ENABELD|default("false") }}"
nginx.ingress.kubernetes.io/proxy-body-size: "{{ INGRESS_MAX_BODY_SIZE|default("2560") }}m"
nginx.org/client-max-body-size: "{{ INGRESS_MAX_BODY_SIZE|default("2560") }}m"
# The following properties added with BC-3606.
# The header size of the request is too big. For e.g. state and the permanent growing jwt.
# Nginx throws away the Location header, resulting in the 502 Bad Gateway.
nginx.ingress.kubernetes.io/client-header-buffer-size: 100k
nginx.ingress.kubernetes.io/http2-max-header-size: 96k
nginx.ingress.kubernetes.io/large-client-header-buffers: 4 100k
nginx.ingress.kubernetes.io/proxy-buffer-size: 96k
{% if CLUSTER_ISSUER is defined %}
cert-manager.io/cluster-issuer: {{ CLUSTER_ISSUER }}
{% endif %}

spec:
ingressClassName: nginx
{% if CLUSTER_ISSUER is defined or (TLS_ENABLED is defined and TLS_ENABLED | bool) %}
tls:
- hosts:
- {{ DOMAIN }}
{% if CLUSTER_ISSUER is defined %}
secretName: {{ DOMAIN }}-tls
{% endif %}
{% endif %}
rules:
- host: {{ DOMAIN }}
http:
paths:
- path: /tldraw
pathType: Prefix
backend:
service:
name: tldraw-client-svc
port:
number: 3046
- path: /static
pathType: Prefix
backend:
service:
name: tldraw-client-svc
port:
number: 3046

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: tldraw-client-svc
namespace: {{ NAMESPACE }}
labels:
app: tldraw-client
spec:
ports:
- port: 3046
targetPort: 3046
protocol: TCP
name: tldraw-client
selector:
app: tldraw-client
sessionAffinity: ClientIP
16 changes: 0 additions & 16 deletions nginx.conf

This file was deleted.

25 changes: 25 additions & 0 deletions nginx.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
server {
listen 3046;
server_name localhost;

location /tldraw-client-runtime.config.json {
return 200 '{ "tldrawServerURL" : "${TLDRAW_SERVER_URL}" }';
add_header Content-Type application/json;
}

location /static {
alias /usr/share/nginx/html/static/;
}

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri /index.html;
}

error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
}
}
Loading
Loading