Skip to content

Commit 99d519a

Browse files
Merge branch 'main' into feature/alarm-cronjob
2 parents 6c30fbf + 3b4cac0 commit 99d519a

File tree

100 files changed

+4279
-3377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+4279
-3377
lines changed

.github/workflows/client_update.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ on:
77
paths:
88
- 'server/api/tumdev/campus_backend.proto'
99

10+
workflow_dispatch:
11+
1012
jobs:
1113
deploy:
1214
runs-on: macos-latest
1315

1416
steps:
1517
- name: Fetch Changes
16-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1719
with:
1820
fetch-depth: 0 # Checkout everything to get access to the tags
1921
ref: main
@@ -36,7 +38,7 @@ jobs:
3638
echo "BRANCH_NAME=chore/update-protos-to-\$LATEST_TAG" >> $GITHUB_ENV
3739
3840
- name: Clone Repository
39-
run: git clone --depth=1 --branch=development https://runner:${{ secrets.CAMPUS_FLUTTER_TOKEN }}@github.com/${{ env.REPOSITORY }} ${{ env.FOLDER }}
41+
run: git clone --depth=1 --branch=main https://runner:${{ secrets.CAMPUS_FLUTTER_TOKEN }}@github.com/${{ env.REPOSITORY }} ${{ env.FOLDER }}
4042

4143
- name: Update Proto Files
4244
run: |
@@ -74,7 +76,7 @@ jobs:
7476
--body "" \
7577
--title "Chore: Update Protos to ${{ env.LATEST_TAG }}" \
7678
--head "${{ env.BRANCH_NAME }}" \
77-
--base "development"
79+
--base "main"
7880
7981
- name: Error Message
8082
if: steps.commit.outcome != 'success'

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
14-
- uses: actions/setup-go@v4
14+
- uses: actions/setup-go@v5
1515
with:
1616
go-version: '1.21'
1717
cache: false
@@ -31,6 +31,6 @@ jobs:
3131
- run: bash server/api/installBuf.bash
3232
- name: pre-commit
3333
uses: pre-commit/[email protected]
34-
- uses: ls-lint/action@v2.0.1
34+
- uses: ls-lint/action@v2.2.2
3535
with:
3636
config: .ls-lint.yaml

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12-
- uses: actions/setup-go@v4
12+
- uses: actions/setup-go@v5
1313
with:
1414
go-version: '1.21'
1515
cache-dependency-path: |

.github/workflows/test_migration.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Migration Test
2+
on:
3+
pull_request:
4+
branches: [ main ]
5+
concurrency:
6+
group: ${{ github.head_ref }}
7+
cancel-in-progress: true
8+
jobs:
9+
test_migrations:
10+
runs-on: ubuntu-latest
11+
services:
12+
auto_mariadb:
13+
image: bitnami/mariadb:latest
14+
ports:
15+
- 3306:3306
16+
env:
17+
MARIADB_ROOT_PASSWORD: super_secret_passw0rd
18+
MARIADB_DATABASE: campus_db
19+
manual_mariadb:
20+
image: bitnami/mariadb:latest
21+
ports:
22+
- 3300:3306
23+
env:
24+
MARIADB_ROOT_PASSWORD: super_secret_passw0rd
25+
MARIADB_DATABASE: campus_db
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-go@v5
29+
with:
30+
go-version: '1.21'
31+
cache-dependency-path: |
32+
server/go.sum
33+
- name: run manual migrations
34+
run: go run main.go
35+
working-directory: ./server
36+
env:
37+
CI_EXIT_AFTER_MIGRATION: "true"
38+
CI_AUTO_MIGRATION: "false"
39+
DB_DSN: root:super_secret_passw0rd@tcp(localhost:3306)/campus_db?charset=utf8mb4&parseTime=True&loc=Local
40+
ENVIRONMENT: dev
41+
- name: run auto migrations
42+
run: go run main.go
43+
working-directory: ./server
44+
env:
45+
CI_EXIT_AFTER_MIGRATION: "true"
46+
CI_AUTO_MIGRATION: "true"
47+
DB_DSN: root:super_secret_passw0rd@tcp(localhost:3300)/campus_db?charset=utf8mb4&parseTime=True&loc=Local
48+
ENVIRONMENT: dev
49+
- uses: ariga/setup-atlas@master
50+
- name: export diff the migrations
51+
id: diff_migrations
52+
run: |
53+
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) &&
54+
echo "local_to_auto<<$EOF" >> $GITHUB_OUTPUT &&
55+
atlas schema diff --from "maria://root:super_secret_passw0rd@localhost:3306/campus_db" --to "maria://root:super_secret_passw0rd@localhost:3300/campus_db" --format '{{ sql . " " }}' >> $GITHUB_OUTPUT &&
56+
echo "$EOF" >> $GITHUB_OUTPUT
57+
echo "auto_to_local<<$EOF" >> $GITHUB_OUTPUT &&
58+
atlas schema diff --from "maria://root:super_secret_passw0rd@localhost:3306/campus_db" --to "maria://root:super_secret_passw0rd@localhost:3300/campus_db" --format '{{ sql . " " }}' >> $GITHUB_OUTPUT &&
59+
echo "$EOF" >> $GITHUB_OUTPUT
60+
- name: Find Comment
61+
uses: peter-evans/find-comment@v2
62+
id: fc
63+
with:
64+
issue-number: "${{ github.event.number }}"
65+
body-includes: Found the following differences in the sql schema
66+
comment-author: github-actions[bot]
67+
- name: Create comment
68+
uses: peter-evans/create-or-update-comment@v3
69+
with:
70+
issue-number: "${{ github.event.number }}"
71+
comment-id: "${{ steps.fc.outputs.comment-id }}"
72+
body: |
73+
:eyes: Found the following differences in the sql schema:
74+
75+
<details>
76+
<summary>Needed get from <b>local</b> to <b>auto</b> migration state</summary>
77+
78+
```sql
79+
${{ steps.diff_migrations.outputs.local_to_auto }}
80+
```
81+
82+
</details>
83+
<details>
84+
<summary>Needed from <b>auto</b> to <b>local</b> migration state</summary>
85+
86+
```sql
87+
${{ steps.diff_migrations.outputs.auto_to_local }}
88+
```
89+
90+
</details>
91+
edit-mode: replace

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,13 @@ The docker compose will start the server and a mariadb instance.
8080
The server will be available at `localhost:50051` and the mariadb instance at `localhost:3306`.
8181
Additionally, docker creates the volume `campus-db-data` to persist the data of the mariadb instances.
8282

83-
### Setting up the Database
84-
The mariadb schema can be installed by executing the following command inside the mariadb container:
85-
```bash
86-
mysql --user=root --password=secret_root_password campus_db < /entrypoint/schema.sql
87-
```
88-
8983
### Environment Variables
9084
The following environment variables need to be set for the server to work properly:
9185
* [REQUIRED] `DB_NAME`: The name of the database to use.
9286
* [REQUIRED] `DB_ROOT_PASSWORD`: The password of the root user.
9387
* [OPTIONAL] `DB_PORT`: The port of the database server. Defaults to `3306`.
9488
* [OPTIONAL] `SENTRY_DSN`: The Sentry [Data Source Name](https://sentry-docs-git-patch-1.sentry.dev/product/sentry-basics/dsn-explainer/) for reporting issues and crashes.
89+
* [OPTIONAL] `OMDB_API_KEY`: The key to get more information for tu-film movies from [omdbapi](https://omdbapi.com/). See [omdbapi](https://omdbapi.com/apikey.aspx) for a key.
9590
* **[iOS Push Notification Service [OPTIONAL]](#ios-push-notifications-service)**:
9691
* [REQUIRED] `APNS_KEY_ID`: The key ID of the APNs key => APNs Key needs to be downloaded from the Apple Developer Portal the name of the file also contains the key ID.
9792
* [REQUIRED] `APNS_TEAM_ID`: The team ID of the iOS app can be found in AppStoreConnect.

client/go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.21
55
require (
66
github.com/TUM-Dev/Campus-Backend/server v0.0.0-20231009133538-1a7f37e5f27c
77
github.com/sirupsen/logrus v1.9.3
8-
google.golang.org/grpc v1.58.2
8+
google.golang.org/grpc v1.60.1
99
)
1010

1111
require (
@@ -14,8 +14,8 @@ require (
1414
golang.org/x/net v0.17.0 // indirect
1515
golang.org/x/sys v0.13.0 // indirect
1616
golang.org/x/text v0.13.0 // indirect
17-
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect
18-
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect
19-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb // indirect
17+
google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 // indirect
18+
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect
19+
google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect
2020
google.golang.org/protobuf v1.31.0 // indirect
2121
)

client/go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ github.com/TUM-Dev/Campus-Backend/server v0.0.0-20231009133538-1a7f37e5f27c/go.m
33
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
44
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
55
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
6-
github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE=
7-
github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ=
6+
github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo=
7+
github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ=
88
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
99
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
1010
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
@@ -29,14 +29,14 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
2929
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
3030
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
3131
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
32-
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb h1:XFBgcDwm7irdHTbz4Zk2h7Mh+eis4nfJEFQFYzJzuIA=
33-
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4=
34-
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb h1:lK0oleSc7IQsUxO3U5TjL9DWlsxpEBemh+zpB7IqhWI=
35-
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk=
36-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb h1:Isk1sSH7bovx8Rti2wZK0UZF6oraBDK74uoyLEEVFN0=
37-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M=
38-
google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I=
39-
google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
32+
google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0=
33+
google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97/go.mod h1:t1VqOqqvce95G3hIDCT5FeO3YUc6Q4Oe24L/+rNMxRk=
34+
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU=
35+
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0=
36+
google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0=
37+
google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY=
38+
google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU=
39+
google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
4040
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
4141
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
4242
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=

deployment/charts/backend/templates/backend-pvc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ spec:
1212
- ReadWriteMany
1313
resources:
1414
requests:
15-
storage: 1Gi
15+
storage: 3Gi

deployment/charts/backend/templates/deployments/backend-v1.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ spec:
2323
app.kubernetes.io/part-of: tum-campus-app
2424
app.kubernetes.io/name: backend-v1
2525
spec:
26+
priorityClassName: tca-backend
2627
volumes:
2728
- name: legacybackend-config
2829
secret:

deployment/charts/backend/templates/deployments/backend-v2.yaml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ spec:
2424
app.kubernetes.io/part-of: tum-campus-app
2525
app.kubernetes.io/name: backend-v2
2626
spec:
27+
priorityClassName: tca-backend
2728
volumes:
2829
- name: storage-vol
2930
persistentVolumeClaim:
@@ -61,6 +62,26 @@ spec:
6162
secretKeyRef:
6263
name: backend-api-keys
6364
key: CAMPUS_API_TOKEN
65+
- name: SMTP_PASSWORD
66+
valueFrom:
67+
secretKeyRef:
68+
name: backend-api-keys
69+
key: SMTP_PASSWORD
70+
- name: SMTP_URL
71+
valueFrom:
72+
secretKeyRef:
73+
name: backend-api-keys
74+
key: SMTP_URL
75+
- name: SMTP_USERNAME
76+
valueFrom:
77+
secretKeyRef:
78+
name: backend-api-keys
79+
key: SMTP_USERNAME
80+
- name: SMTP_PORT
81+
valueFrom:
82+
secretKeyRef:
83+
name: backend-api-keys
84+
key: SMTP_PORT
6485
- name: DB_DSN
6586
value: "{{ $db.username }}:{{ $db.password }}@tcp(tca-backend-mariadb.{{ $.Values.namespace }}.svc.cluster.local:3306)/{{ $db.database }}?charset=utf8mb4&parseTime=True&loc=Local"
6687
- name: APNS_KEY_ID
@@ -91,8 +112,8 @@ spec:
91112
readOnlyRootFilesystem: true
92113
resources:
93114
requests:
94-
cpu: 1000m
95-
memory: 100Mi
115+
cpu: 100m
116+
memory: 50Mi
96117
limits:
97118
memory: 500Mi
98119
livenessProbe:
@@ -158,6 +179,10 @@ data:
158179
apns_auth_key.p8: {{ $.Values.backend.apns.auth_key }}
159180
APNS_KEY_ID: {{ $.Values.backend.apns.key_id | b64enc }}
160181
APNS_TEAM_ID: {{ $.Values.backend.apns.team_id | b64enc }}
182+
SMTP_PASSWORD: {{ $.Values.backend.smtp.password | b64enc }}
183+
SMTP_URL: {{ $.Values.backend.smtp.url | b64enc }}
184+
SMTP_USERNAME: {{ $.Values.backend.smtp.username | b64enc }}
185+
SMTP_PORT: {{ $.Values.backend.smtp.port | b64enc }}
161186
---
162187
apiVersion: v1
163188
kind: ConfigMap

0 commit comments

Comments
 (0)