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

Include TUM-Live-Worker-v2 in TUM-Live #369

Merged
merged 18 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 24 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,32 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
- package-ecosystem: "docker" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: "gomod"
directory: "/worker"
schedule:
interval: "monthly"
- package-ecosystem: "gomod"
directory: "/worker/edge"
schedule:
interval: "monthly"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
- package-ecosystem: "docker"
directory: "/worker"
schedule:
interval: "monthly"
- package-ecosystem: "docker"
directory: "/worker/nginx"
schedule:
interval: "monthly"
- package-ecosystem: "docker"
directory: "/worker/edge"
schedule:
interval: "monthly"
- package-ecosystem: "npm" # See documentation for possible values
directory: "/web/" # Location of package manifests
- package-ecosystem: "npm"
directory: "/web/"
schedule:
interval: "monthly"
- package-ecosystem: "github-actions"
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/deploy-workers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build & Deploy

on:
push:
tags:
- *

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
module: ["worker", "worker/nginx", "worker/edge"]

steps:
- name: get container name
run: |
echo "containername=${{ matrix.module }}" | sed 's/\//-/g' > $GITHUB_ENV
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Docker meta (${{ matrix.module }})
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/joschahenningsen/tum-live/${{ env.containername }}
tags: |
type=sha
flavor: |
latest=true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set outputs
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Build and push Docker images (${{ matrix.module }})
uses: docker/build-push-action@v2
with:
context: ./${{ matrix.module }}
pull: true
push: true
build-args: version=${{ steps.vars.outputs.sha_short }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
8 changes: 8 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ COPY --from=node /app/web/node_modules ./web/node_modules

# bundle version into binary if specified in build-args, dev otherwise.
ARG version=dev
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-w -extldflags '-static' -X main.VersionTag=${version}" -o /go/bin/server app/server/main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-w -extldflags '-static' -X main.VersionTag=${version}" -o /go/bin/tumlive cmd/tumlive/tumlive.go

FROM alpine:3.15
RUN apk add --no-cache tzdata
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ go_dependencies:
go get ./...

bundle:
go build -ldflags="-X 'main.VersionTag=$(VERSION)'" app/server/main.go
go build -o main -ldflags="-X 'main.VersionTag=$(VERSION)'" cmd/tumlive/tumlive.go

clean:
rm -fr web/node_modules
Expand Down
6 changes: 3 additions & 3 deletions api/chat.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package api

import (
"TUM-Live/dao"
"TUM-Live/model"
"TUM-Live/tools"
"context"
"database/sql"
"encoding/json"
"errors"
"fmt"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"net/http"
"strconv"
"time"
Expand Down
8 changes: 4 additions & 4 deletions api/courseimport.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package api

import (
"TUM-Live/dao"
"TUM-Live/model"
"TUM-Live/tools"
"TUM-Live/tools/tum"
"bytes"
"errors"
"fmt"
campusonline "github.com/RBG-TUM/CAMPUSOnline"
"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"github.com/joschahenningsen/TUM-Live/tools/tum"
uuid "github.com/satori/go.uuid"
log "github.com/sirupsen/logrus"
"html/template"
Expand Down
8 changes: 4 additions & 4 deletions api/courses.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package api

import (
"TUM-Live/dao"
"TUM-Live/model"
"TUM-Live/tools"
"TUM-Live/tools/tum"
"context"
"encoding/json"
"errors"
"fmt"
"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"github.com/joschahenningsen/TUM-Live/tools/tum"
uuid "github.com/satori/go.uuid"
log "github.com/sirupsen/logrus"
"gorm.io/gorm"
Expand Down
6 changes: 3 additions & 3 deletions api/download.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package api

import (
"TUM-Live/dao"
"TUM-Live/model"
"TUM-Live/tools"
"errors"
"fmt"
"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
log "github.com/sirupsen/logrus"
"net/http"
"os"
Expand Down
6 changes: 3 additions & 3 deletions api/lecture_halls.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package api

import (
"TUM-Live/dao"
"TUM-Live/model"
"TUM-Live/tools"
"embed"
"encoding/json"
"errors"
"fmt"
"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
log "github.com/sirupsen/logrus"
"io/ioutil"
"net/http"
Expand Down
6 changes: 3 additions & 3 deletions api/notifications.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package api

import (
"TUM-Live/dao"
"TUM-Live/model"
"TUM-Live/tools"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
log "github.com/sirupsen/logrus"
"net/http"
"strconv"
Expand Down
6 changes: 3 additions & 3 deletions api/progress.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package api

import (
"TUM-Live/dao"
"TUM-Live/model"
"TUM-Live/tools"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"net/http"
"sync"
"time"
Expand Down
6 changes: 3 additions & 3 deletions api/server-notifications.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package api

import (
"TUM-Live/dao"
"TUM-Live/model"
"TUM-Live/tools"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"log"
"net/http"
"time"
Expand Down
2 changes: 1 addition & 1 deletion api/sexy.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package api

import (
"TUM-Live/dao"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"net/http"
"time"
)
Expand Down
6 changes: 3 additions & 3 deletions api/statistics.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package api

import (
"TUM-Live/dao"
"TUM-Live/model"
"TUM-Live/tools"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
log "github.com/sirupsen/logrus"
"net/http"
)
Expand Down
6 changes: 3 additions & 3 deletions api/stream.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package api

import (
"TUM-Live/dao"
"TUM-Live/tools"
"TUM-Live/tools/bot"
"errors"
"fmt"
go_anel_pwrctrl "github.com/RBG-TUM/go-anel-pwrctrl"
goextron "github.com/RBG-TUM/go-extron"
"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/tools"
"github.com/joschahenningsen/TUM-Live/tools/bot"
log "github.com/sirupsen/logrus"
"net/http"
"strings"
Expand Down
6 changes: 3 additions & 3 deletions api/token.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package api

import (
"TUM-Live/dao"
"TUM-Live/model"
"TUM-Live/tools"
"database/sql"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
uuid "github.com/satori/go.uuid"
log "github.com/sirupsen/logrus"
"net/http"
Expand Down
6 changes: 3 additions & 3 deletions api/users.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package api

import (
"TUM-Live/dao"
"TUM-Live/model"
"TUM-Live/tools"
"context"
"database/sql"
"encoding/json"
"errors"
"fmt"
"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
log "github.com/sirupsen/logrus"
"gorm.io/gorm"
"net/http"
Expand Down
8 changes: 4 additions & 4 deletions api/worker.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package api

import (
"TUM-Live/dao"
"TUM-Live/tools"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/tools"
log "github.com/sirupsen/logrus"
"net/http"
)

func configWorkerRouter(r *gin.Engine){
func configWorkerRouter(r *gin.Engine) {
g := r.Group("/api/workers")
g.Use(tools.Admin)
g.DELETE("/:id", deleteWorker)
}

func deleteWorker(c *gin.Context){
func deleteWorker(c *gin.Context) {
id := c.Param("id")
err := dao.DeleteWorker(id)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions api/worker_grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package api

// worker_grpc.go handles communication with workers via grpc
import (
"TUM-Live/dao"
"TUM-Live/model"
"TUM-Live/tools"
"context"
"errors"
"fmt"
go_anel_pwrctrl "github.com/RBG-TUM/go-anel-pwrctrl"
"github.com/getsentry/sentry-go"
"github.com/joschahenningsen/TUM-Live-Worker-v2/pb"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/model"
"github.com/joschahenningsen/TUM-Live/tools"
"github.com/joschahenningsen/TUM-Live/worker/pb"
uuid "github.com/satori/go.uuid"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc"
Expand Down
4 changes: 2 additions & 2 deletions api/wsHub.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package api

import (
"TUM-Live/dao"
"TUM-Live/tools"
"context"
"encoding/json"
"errors"
"fmt"
"github.com/gabstv/melody"
"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
"github.com/joschahenningsen/TUM-Live/dao"
"github.com/joschahenningsen/TUM-Live/tools"
log "github.com/sirupsen/logrus"
"sync"
"time"
Expand Down
Loading