Skip to content

Commit

Permalink
Merge branch 'main' into feature/kino-api
Browse files Browse the repository at this point in the history
# Conflicts:
#	docker-compose.yaml
#	server/api/tumdev/campus_backend.pb.go
#	server/go.mod
#	server/swagger/swagger.json
  • Loading branch information
CommanderStorm committed Sep 14, 2023
2 parents bbbe553 + 4f64a8c commit b01dab1
Show file tree
Hide file tree
Showing 114 changed files with 2,343 additions and 3,920 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ APNS_P8_FILE_PATH=/secrets/AuthKey_XXXX.p8

ENVIRONMENT=dev

SENTRY_DSN=
SENTRY_DSN=
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml → .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
name: CI
name: lint
on:
push:
branches: [ main ]
pull_request:

permissions:
contents: read

jobs:
ci:
lint:
name: lint
runs-on: ubuntu-latest
steps:
Expand All @@ -29,3 +27,7 @@ jobs:
version: v1.54
working-directory: client
args: --timeout=30m
- run: go install golang.org/x/tools/cmd/goimports@latest
- run: bash server/api/installBuf.bash
- name: pre-commit
uses: pre-commit/[email protected]
13 changes: 13 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,21 @@ on:
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache-dependency-path: |
server/go.sum
- name: run tests
run: go test -v ./...
working-directory: ./server
build:
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ __debug_bin
.env.local

apns_auth_key.p8

venv
39 changes: 39 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
exclude: vscode/launch.json
- id: check-yaml
exclude: deployment/.*
- id: check-added-large-files
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.0
hooks:
- id: go-fmt
- id: go-imports
- repo: local
hooks:
- id: regen-protobuf
name: Regenerate protobuf files
files: server/api/
entry: bash server/api/generate.bash
language: system
pass_filenames: false
stages: [commit]
- id: go-mod-tidy-server
name: Check if go.mod and go.sum are up to date for server
files: server/
entry: sh -c "(cd server && go mod tidy)"
language: system
pass_filenames: false
stages: [commit]
- id: go-mod-tidy-client
name: Check if go.mod and go.sum are up to date for server
files: server/
entry: sh -c "(cd client && go mod tidy)"
language: system
pass_filenames: false
stages: [commit]
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
"program": "${workspaceFolder}/client/publicServer/client.go",
}
]
}
}
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ To start the server there are environment variables, as well as command line opt
```bash
cd server
export DB_DSN="Your gorm DB connection string for example: gorm:GORM_USER_PASSWORD@tcp(localhost:3306)/campus_backend"
go run ./main.go [-MensaCron 0]
go run ./main.go
```

#### Environment Variables
Expand All @@ -72,10 +72,6 @@ There are a few environment variables available:
* [REQUIRED] `DB_DSN`: The [GORM](https://gorm.io/) [DB connection string](https://gorm.io/docs/connecting_to_the_database.html#MySQL) for connecting to the MySQL DB. Example: `gorm@tcp(localhost:3306)/campus_backend`
* [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.

#### Command Line Arguments

* [OPTIONAL] `-MensaCron 0`: Providing this argument deactivates the Mensa Rating cronjobs if not needed in a local setup. Be aware, this option will change in a future version ([#117](https://github.com/TUM-Dev/Campus-Backend/issues/117) and [#115](https://github.com/TUM-Dev/Campus-Backend/issues/115)).

## Running the Server (Docker)
```bash
docker compose up -d
Expand Down Expand Up @@ -126,3 +122,18 @@ Take a look at the [`lauch.json`](.vscode/launch.json) file for more details.


Please be respectful with its usage!

## pre-commit

To ensure that that common pitfalls which can be automated are not done, we recommend you to install `pre-commit`.
You can do so via

```bash
python -m venv venv
source venv/bin/activate
pip install pre-commit
pre-commit install
```

Certain `pre-commit` hooks will now be run on every commit where you change specific files.
If you want to run all files instead, run `pre-commit run -a`
2 changes: 1 addition & 1 deletion client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ standard system TLS CA's configured to securely connect via `api-grpc.tum.app` t
Alternatively you can also test the API using [grpcurl](https://github.com/fullstorydev/grpcurl) (also located in the `testLiveApi.sh`):
```
grpcurl -protoset <(buf build -o -) -H "x-device-id:grpc-tests" api-grpc.tum.app:443 api.Campus/GetNewsSources
```
```
22 changes: 9 additions & 13 deletions client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,19 @@ module github.com/TUM-Dev/Campus-Backend/client
go 1.21

require (
github.com/TUM-Dev/Campus-Backend/api v0.0.0-20221212204029-68b05b451617
github.com/TUM-Dev/Campus-Backend/server v0.0.0-20230111021245-cd17e382bda3
github.com/TUM-Dev/Campus-Backend/server v0.0.0-20230913203125-6bbe13013fa5
github.com/sirupsen/logrus v1.9.3
google.golang.org/grpc v1.57.0
google.golang.org/grpc v1.58.0
google.golang.org/protobuf v1.31.0
)

require (
github.com/golang/glog v1.1.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.17.1 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
)
50 changes: 20 additions & 30 deletions client/go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
github.com/TUM-Dev/Campus-Backend/api v0.0.0-20221212204029-68b05b451617 h1:/o27aY5kfd4JnrqtbsMLIGwe+VBqS7j3ovCG/cXtAWk=
github.com/TUM-Dev/Campus-Backend/api v0.0.0-20221212204029-68b05b451617/go.mod h1:hDLh5lxHD53m8/eDGsXJDqc9ONXqbJPa9b6uzpfl8Ow=
github.com/TUM-Dev/Campus-Backend/server v0.0.0-20230111021245-cd17e382bda3 h1:b585GRp+ZPA9j2EM0KQSSFiknR2SVF18FcRHRHnIIA4=
github.com/TUM-Dev/Campus-Backend/server v0.0.0-20230111021245-cd17e382bda3/go.mod h1:1gTg0lAImFNZiYKrJ/5OLM2UWoj7zeLzTX1WLJhF7LY=
github.com/TUM-Dev/Campus-Backend/server v0.0.0-20230913203125-6bbe13013fa5 h1:/yMB5hJjFjEPB/HVP6wLTJWGqoCqQksXke+DiV2xUWY=
github.com/TUM-Dev/Campus-Backend/server v0.0.0-20230913203125-6bbe13013fa5/go.mod h1:7XoRdXmxK852GxcyraiovgyS5z/eZ9wsofV9on7wvGQ=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -13,45 +11,37 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 h1:lLT7ZLSzGLI08vc9cpd+tYmNWjdKDqyr/2L+f6U12Fk=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.17.1 h1:LSsiG61v9IzzxMkqEr6nrix4miJI62xlRjwT7BYD2SM=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.17.1/go.mod h1:Hbb13e3/WtqQ8U5hLGkek9gJvBLasHuPFI0UEGfnQ10=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 h1:9NWlQfY2ePejTmfwUH1OWwmznFa+0kKcHGPDvcPza9M=
google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54/go.mod h1:zqTuNwFlFRsw5zIts5VnzLQxSRqh+CGOTVMlYbY0Eyk=
google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 h1:m8v1xLLLzMe1m5P+gCTF8nJB9epwZQUBERm20Oy1poQ=
google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA=
google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0 h1:TLkBREm4nIsEcexnCjgQd5GQWaHcqMzwQV0TX9pq8S0=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0/go.mod h1:DNq5QpG7LJqD2AamLZ7zvKE0DEpVl2BSEVjFycAAjRY=
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g=
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8=
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q=
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M=
google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o=
google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"os"
"time"

pb "github.com/TUM-Dev/Campus-Backend/server/api"
pb "github.com/TUM-Dev/Campus-Backend/server/api/tumdev"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
Expand Down Expand Up @@ -48,7 +48,7 @@ func canteenHeadCount(c pb.CampusClient, ctx context.Context) {
})

if err != nil {
log.Error(err)
log.WithError(err).Error("Canteen HeadCount data request failed.")
} else {
log.WithField("res", res).Info("Canteen HeadCount data request successful.")
}
Expand Down Expand Up @@ -245,8 +245,7 @@ func getImageToBytes(path string) []byte {
}

defer func(file *os.File) {
err := file.Close()
if err != nil {
if err := file.Close(); err != nil {
log.WithError(err).Error("could not close file")
}
}(file)
Expand Down Expand Up @@ -291,8 +290,7 @@ func storeImage(path string, i []byte) (string, error) {
log.WithError(errFile).Error("Unable to create the new testfile")
}
defer func(out *os.File) {
err := out.Close()
if err != nil {
if err := out.Close(); err != nil {
log.WithError(err).Error("File was not closed successfully")
}
}(out)
Expand Down
10 changes: 5 additions & 5 deletions client/publicServer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package main
import (
"context"
"crypto/x509"
pb "github.com/TUM-Dev/Campus-Backend/api"
"time"

pb "github.com/TUM-Dev/Campus-Backend/server/api/tumdev"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/metadata"
"google.golang.org/protobuf/types/known/emptypb"
"time"
)

const (
Expand All @@ -25,11 +26,10 @@ func main() {

conn, err := grpc.Dial(address, grpc.WithTransportCredentials(creds))
if err != nil {
log.WithError(err).Fatalf("did not connect")
log.WithError(err).Fatal("did not connect")
}
defer func(conn *grpc.ClientConn) {
err := conn.Close()
if err != nil {
if err := conn.Close(); err != nil {
log.WithError(err).Error("did not close connection")
}
}(conn)
Expand Down
2 changes: 1 addition & 1 deletion client/testLiveApi.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

grpcurl -protoset <(buf build -o -) -plaintext -H "x-device-id:grpc-tests" api.tum.app:50052 api.Campus/GetNewsSources
grpcurl -protoset <(buf build -o -) -plaintext -H "x-device-id:grpc-tests" api.tum.app:50052 api.Campus/GetNewsSources
2 changes: 1 addition & 1 deletion deployment/charts/backend/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ dependencies:
- condition: mariadb.enabled
name: mariadb
repository: https://charts.bitnami.com/bitnami
version: 12.x.x
version: 12.x.x
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ spec:
env:
- name: ENVIRONMENT
value: prod
- name: MensaCronDisabled
value: "false"
- name: APNS_P8_FILE_PATH
value: /etc/apns_auth_key.p8
- name: SENTRY_DSN
Expand Down
2 changes: 1 addition & 1 deletion deployment/charts/backend/templates/deployments/hpas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ spec:
target:
type: Utilization
averageUtilization: 75
{{ end }}
{{ end }}
7 changes: 6 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ services:
- APNS_KEY_ID=${APNS_KEY_ID}
- APNS_TEAM_ID=${APNS_TEAM_ID}
- APNS_P8_FILE_PATH=${APNS_P8_FILE_PATH}
- MensaCronDisabled=false
- OMDB_API_KEY=${OMDB_API_KEY}
volumes:
- backend-storage:/Storage
- ./apns_auth_key.p8:${APNS_P8_FILE_PATH}
user: 1000:3000
depends_on:
db:
condition: service_healthy
Expand All @@ -42,4 +45,6 @@ services:

volumes:
campus-db-data:
driver: local
driver: local
backend-storage:
driver: local
6 changes: 6 additions & 0 deletions server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ COPY go.mod go.sum ./
RUN go mod download

# Copy source code
COPY api/tumdev/campus_backend.swagger.json ./swagger/swagger.json
COPY . .

# bundle version into binary if specified in build-args, dev otherwise.
Expand All @@ -29,6 +30,11 @@ COPY --from=builder /backend /backend
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /etc/passwd /etc/passwd

# make sure that /Storage is mounted with the correct access permissions even in docker-compose
RUN mkdir /Storage
RUN chown appuser /Storage
VOLUME /Storage

# Use an unprivileged user
USER appuser

Expand Down
Loading

0 comments on commit b01dab1

Please sign in to comment.