Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Mar 10, 2024
1 parent f83d6b5 commit 1d3c565
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 53 deletions.
48 changes: 48 additions & 0 deletions docker-compose.local.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
services:
backend-v2:
image: ghcr.io/tum-dev/campus-backend/backend-server:latest
restart: always
ports:
- "50051:50051"
environment:
- DB_DSN=root:${DB_ROOT_PASSWORD}@tcp(db:${DB_PORT:-3306})/${DB_NAME}?charset=utf8mb4&parseTime=True&loc=Local
- ENVIRONMENT=${ENVIRONMENT:-dev}
- SENTRY_DSN=${SENTRY_DSN}
- APNS_KEY_ID=${APNS_KEY_ID}
- APNS_TEAM_ID=${APNS_TEAM_ID}
- APNS_P8_FILE_PATH=${APNS_P8_FILE_PATH}
- OMDB_API_KEY=${OMDB_API_KEY}
- CAMPUS_API_TOKEN=${CAMPUS_API_TOKEN}
- SMTP_PASSWORD=${SMTP_PASSWORD}
- SMTP_URL=${SMTP_URL:-postout.lrz.de}
- SMTP_USERNAME=${SMTP_USERNAME:[email protected]}
- SMTP_PORT=${SMTP_PORT:-587}
volumes:
- backend-storage:/Storage
- ./apns_auth_key.p8:${APNS_P8_FILE_PATH}:ro
user: 1000:3000
read_only: true
depends_on:
db:
condition: service_healthy
db:
image: bitnami/mariadb:latest
restart: unless-stopped
ports:
- "${DB_PORT:-3306}:3306"
environment:
- MARIADB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
- MARIADB_DATABASE=${DB_NAME}
volumes:
- campus-db-data:/bitnami/mariadb
healthcheck:
test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh']
interval: 15s
timeout: 5s
retries: 6

volumes:
campus-db-data:
driver: local
backend-storage:
driver: local
34 changes: 0 additions & 34 deletions docker-compose.prod.yaml

This file was deleted.

49 changes: 40 additions & 9 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ services:
context: server/
args:
version: dev # compiled with the git sha in prod
ports:
- 50051:50051
expose:
- "50051"
environment:
- DB_DSN=root:${DB_ROOT_PASSWORD}@tcp(db:${DB_PORT:-3306})/${DB_NAME}?charset=utf8mb4&parseTime=True&loc=Local
- ENVIRONMENT=dev
- ENVIRONMENT=${ENVIRONMENT:-dev}
- SENTRY_DSN=${SENTRY_DSN}
- APNS_KEY_ID=${APNS_KEY_ID}
- APNS_TEAM_ID=${APNS_TEAM_ID}
- APNS_P8_FILE_PATH=${APNS_P8_FILE_PATH}
- MensaCronDisabled=true
- OMDB_API_KEY=${OMDB_API_KEY}
- CAMPUS_API_TOKEN=${CAMPUS_API_TOKEN}
- SMTP_PASSWORD=${SMTP_PASSWORD}
Expand All @@ -33,8 +32,8 @@ services:
db:
image: bitnami/mariadb:latest
restart: unless-stopped
ports:
- ${DB_PORT:-3306}:3306
expose:
- "${DB_PORT:-3306}"
environment:
- MARIADB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
- MARIADB_DATABASE=${DB_NAME}
Expand All @@ -58,16 +57,48 @@ services:
- backend-v2
- --log-level
- info
ports:
- 8081:8081
#- 9901:9901 # admin interface, not very useful
expose:
- "8081"
#- "9901" # admin interface, not very useful
volumes:
- ./config/envoy.yaml:/etc/envoy/envoy.yaml:ro
depends_on:
- backend-v2
backend-v1-accesslogs:
image: alpine:1.36
command: [ /bin/sh, -c, 'tail -n+1 -F /var/log/apache2/access.log' ]
volumes:
- legacybackend-logs:/var/log/:ro
depends_on:
- backend-v1
backend-v1-errorlogs:
image: alpine:1.36
command: [ /bin/sh, -c, 'tail -n+1 -F /var/log/apache2/error.log' ]
volumes:
- legacybackend-logs:/var/log/:ro
depends_on:
- backend-v1
backend-v1:
image: ghcr.io/kordianbruck/tca-backend/tca-server:latest
restart: always
read_only: true
tmpfs:
- /app/Tmp/
- /var/www/html/tmp/
- /var/run/apache2/
volumes:
- legacybackend-logs:/var/log/
- legacybackend-config:/app/Config/cfg.ini:ro
- backend-storage:/app/Storage/
expose:
- "80"

volumes:
campus-db-data:
driver: local
backend-storage:
driver: local
legacybackend-config:
driver: local
legacybackend-logs:
driver: local
7 changes: 1 addition & 6 deletions server/backend/cron/cronjobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package cron
import (
"time"

"github.com/TUM-Dev/Campus-Backend/server/env"

"github.com/TUM-Dev/Campus-Backend/server/model"
"github.com/mmcdole/gofeed"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -42,7 +40,6 @@ func New(db *gorm.DB) *CronService {
}

func (c *CronService) Run() error {
log.WithField("MensaCronActive", env.IsMensaCronActive()).Debug("running cron service")
for {
g := new(errgroup.Group)
log.Trace("Cron: checking for pending")
Expand Down Expand Up @@ -78,9 +75,7 @@ func (c *CronService) Run() error {
case FileDownloadType:
g.Go(func() error { return c.fileDownloadCron() })
case DishNameDownload:
if env.IsMensaCronActive() {
g.Go(c.dishNameDownloadCron)
}
g.Go(func() error { return c.dishNameDownloadCron() })
case MovieType:
g.Go(func() error { return c.movieCron() })
/*
Expand Down
4 changes: 0 additions & 4 deletions server/env/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ func IsDev() bool {
func IsProd() bool {
return GetEnvironment() == "prod"
}

func IsMensaCronActive() bool {
return os.Getenv("MensaCronDisabled") != "true"
}

0 comments on commit 1d3c565

Please sign in to comment.