From 16d9499dd453c4259f6ae3d7883b010651366a01 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Tue, 16 Jan 2024 16:41:52 +0100 Subject: [PATCH] remvoed the calendar deployment --- .github/workflows/server-cicd.yml | 18 ----- .../calendar/calendar-cronjob.yaml | 56 -------------- .../calendar/calendar-deployment.yaml | 73 ------------------- .../posgres-deployment.yaml | 0 .../postgres-volume.yaml | 0 .../deployments/webclient-deployment.yaml | 2 - docker-compose.yml | 20 ----- server/README.md | 4 - webclient/Dockerfile | 2 +- webclient/nginx.conf | 3 - 10 files changed, 1 insertion(+), 177 deletions(-) delete mode 100644 deployment/k3s/templates/deployments/calendar/calendar-cronjob.yaml delete mode 100644 deployment/k3s/templates/deployments/calendar/calendar-deployment.yaml rename deployment/k3s/templates/deployments/{calendar => postgres}/posgres-deployment.yaml (100%) rename deployment/k3s/templates/deployments/{calendar => postgres}/postgres-volume.yaml (100%) diff --git a/.github/workflows/server-cicd.yml b/.github/workflows/server-cicd.yml index cbb0df9d3..d390ebd43 100644 --- a/.github/workflows/server-cicd.yml +++ b/.github/workflows/server-cicd.yml @@ -69,21 +69,3 @@ jobs: deployment: feedback secrets: ARGOCD_TOKEN: ${{ secrets.ARGOCD_TOKEN }} - calendar-deployment: - uses: ./.github/workflows/_restart-argocd.yml - if: ${{ github.ref }} == 'refs/heads/main' - needs: - - server-build - with: - deployment: calendar - secrets: - ARGOCD_TOKEN: ${{ secrets.ARGOCD_TOKEN }} - server-deployment: - uses: ./.github/workflows/_restart-argocd.yml - if: ${{ github.ref }} == 'refs/heads/main' - needs: - - server-build - with: - deployment: server - secrets: - ARGOCD_TOKEN: ${{ secrets.ARGOCD_TOKEN }} diff --git a/deployment/k3s/templates/deployments/calendar/calendar-cronjob.yaml b/deployment/k3s/templates/deployments/calendar/calendar-cronjob.yaml deleted file mode 100644 index 12d418fc5..000000000 --- a/deployment/k3s/templates/deployments/calendar/calendar-cronjob.yaml +++ /dev/null @@ -1,56 +0,0 @@ -{{- if eq "nav.tum.de" $.Values.url }} -{{ range $scrape_task := $.Values.calendar.scrape_tasks }} ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: {{ $scrape_task.name }} - labels: - app.kubernetes.io/part-of: navigatum - app.kubernetes.io/name: maps - namespace: {{ $.Values.namespace }} -spec: - schedule: {{ $scrape_task.schedule | quote }} - jobTemplate: - spec: - template: - spec: - priorityClassName: {{ $.Values.url }} - containers: - - name: {{ $scrape_task.name }} - image: "ghcr.io/tum-dev/navigatum-server:{{ $.Values.tag }}" - imagePullPolicy: Always - command: ["/bin/navigatum-calendar-scraper"] - env: - - name: PUSHGATEWAY_URL - value: prometheus-pushgateway.monitoring.svc.cluster.local:9091 - - name: POSTGRES_URL - value: postgres-rw.navigatum.svc.cluster.local - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: postgres-db-secret - key: user - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: postgres-db-secret - key: password - - name: SCRAPED_TIME_WINDOW_MONTHS - value: {{ $scrape_task.scraped_time_window_months | quote }} - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - capabilities: - drop: - - ALL - resources: - requests: - cpu: 500m - memory: 100Mi - limits: - cpu: 1000m - memory: 500Mi - restartPolicy: OnFailure -{{ end }} -{{ end }} diff --git a/deployment/k3s/templates/deployments/calendar/calendar-deployment.yaml b/deployment/k3s/templates/deployments/calendar/calendar-deployment.yaml deleted file mode 100644 index 8117886c2..000000000 --- a/deployment/k3s/templates/deployments/calendar/calendar-deployment.yaml +++ /dev/null @@ -1,73 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: calendar - labels: - app.kubernetes.io/part-of: navigatum - app.kubernetes.io/name: calendar - namespace: {{ $.Values.namespace }} -spec: - replicas: 1 - revisionHistoryLimit: 0 - selector: - matchLabels: - app.kubernetes.io/part-of: navigatum - app.kubernetes.io/name: calendar - template: - metadata: - labels: - app.kubernetes.io/part-of: navigatum - app.kubernetes.io/name: calendar - {{- if eq "nav.tum.de" $.Values.url }} - annotations: - prometheus.io/path: /metrics - prometheus.io/port: '8060' - prometheus.io/scrape: 'true' - {{- end }} - spec: - priorityClassName: {{ $.Values.url }} - containers: - - name: calendar - image: "ghcr.io/tum-dev/navigatum-server:{{ $.Values.tag }}" - imagePullPolicy: Always - command: ["/bin/navigatum-calendar"] - ports: - - containerPort: 3005 - name: calendar - env: - - name: POSTGRES_URL - value: postgres-rw.navigatum.svc.cluster.local - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: postgres-db-secret - key: user - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: postgres-db-secret - key: password - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - capabilities: - drop: - - ALL - resources: - requests: - cpu: 10m - memory: 50Mi - limits: - memory: 500Mi - livenessProbe: - httpGet: - path: /api/calendar/status - port: calendar - failureThreshold: 5 - periodSeconds: 1 - startupProbe: - httpGet: - path: /api/calendar/status - port: calendar - failureThreshold: 240 - periodSeconds: 1 diff --git a/deployment/k3s/templates/deployments/calendar/posgres-deployment.yaml b/deployment/k3s/templates/deployments/postgres/posgres-deployment.yaml similarity index 100% rename from deployment/k3s/templates/deployments/calendar/posgres-deployment.yaml rename to deployment/k3s/templates/deployments/postgres/posgres-deployment.yaml diff --git a/deployment/k3s/templates/deployments/calendar/postgres-volume.yaml b/deployment/k3s/templates/deployments/postgres/postgres-volume.yaml similarity index 100% rename from deployment/k3s/templates/deployments/calendar/postgres-volume.yaml rename to deployment/k3s/templates/deployments/postgres/postgres-volume.yaml diff --git a/deployment/k3s/templates/deployments/webclient-deployment.yaml b/deployment/k3s/templates/deployments/webclient-deployment.yaml index 7eaeb7aa9..ff7c91826 100644 --- a/deployment/k3s/templates/deployments/webclient-deployment.yaml +++ b/deployment/k3s/templates/deployments/webclient-deployment.yaml @@ -41,8 +41,6 @@ spec: value: http://api-svc.navigatum.svc.cluster.local:3003 - name: FEEDBACK_API_URL value: http://feedback-svc.navigatum.svc.cluster.local:3004 - - name: CALENDAR_API_URL - value: http://calendar-svc.navigatum.svc.cluster.local:3005 resources: requests: cpu: 5m diff --git a/docker-compose.yml b/docker-compose.yml index 372c5e406..47ddf2337 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,6 @@ services: CDN_URL: http://data:3002 MAIN_API_URL: http://main-api:3003 FEEDBACK_API_URL: http://feedback-api:3004 - CALENDAR_API_URL: http://calendar-api:3005 depends_on: tileserver: condition: service_healthy @@ -112,25 +111,6 @@ services: test: wget -q --spider http://localhost:3004/api/feedback/status retries: 5 start_period: 10s - calendar-api: - image: ghcr.io/tum-dev/navigatum-server:latest - restart: always - build: ./server - command: /bin/navigatum-calendar - environment: - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - POSTGRES_USER: ${POSTGRES_USER} - POSTGRES_DB: ${POSTGRES_DB} - POSTGRES_URL: db:5432 - depends_on: - db: - condition: service_healthy - ports: - - "3005:3005" - healthcheck: - test: wget -q --spider http://localhost:3005/api/calendar/status - retries: 5 - start_period: 10s db: image: postgres:16 restart: unless-stopped diff --git a/server/README.md b/server/README.md index 4ab6bda9c..756e7389a 100644 --- a/server/README.md +++ b/server/README.md @@ -3,10 +3,6 @@ Our server is architected in different microservices, each of which is responsible for a specific task. - [main-api](/server/main-api): The main API server, which serves the API endpoints -- [calendar](/server/calendar): The calendar microservice, which scrapes and serves calendar data - This is separated from the server because: - - it has virtually no shared dependencies (natural fault line) - - we need a persistent database (postgres) for this microservice, but not for the main server (sqlite) - [feedback](/server/feedback): The feedback microservice, which allows users to submit feedback This is separated from the server because: - it has virtually no shared dependencies (natural faultline) diff --git a/webclient/Dockerfile b/webclient/Dockerfile index 81da14a9a..05f280598 100644 --- a/webclient/Dockerfile +++ b/webclient/Dockerfile @@ -19,4 +19,4 @@ COPY --from=build-stage /dist /app EXPOSE 3000 HEALTHCHECK CMD curl --fail localhost:3000/health || exit 1 -CMD sh -c "sed -i 's|TILESERVER_URL|${TILESERVER_URL}|g' /etc/nginx/nginx.conf && sed -i 's|CDN_URL|${CDN_URL}|g' /etc/nginx/nginx.conf && sed -i 's|MAIN_API_URL|${MAIN_API_URL}|g' /etc/nginx/nginx.conf && sed -i 's|FEEDBACK_API_URL|${FEEDBACK_API_URL}|g' /etc/nginx/nginx.conf && sed -i 's|CALENDAR_API_URL|${CALENDAR_API_URL}|g' /etc/nginx/nginx.conf && nginx -g 'daemon off;'" +CMD sh -c "sed -i 's|TILESERVER_URL|${TILESERVER_URL}|g' /etc/nginx/nginx.conf && sed -i 's|CDN_URL|${CDN_URL}|g' /etc/nginx/nginx.conf && sed -i 's|MAIN_API_URL|${MAIN_API_URL}|g' /etc/nginx/nginx.conf && sed -i 's|FEEDBACK_API_URL|${FEEDBACK_API_URL}|g' /etc/nginx/nginx.conf && nginx -g 'daemon off;'" diff --git a/webclient/nginx.conf b/webclient/nginx.conf index 57ae3704b..7dfc5b0ec 100644 --- a/webclient/nginx.conf +++ b/webclient/nginx.conf @@ -70,9 +70,6 @@ http { location /api/feedback { proxy_pass FEEDBACK_API_URL; } - location /api/calendar { - proxy_pass CALENDAR_API_URL; - } location /cdn { proxy_pass CDN_URL; }