Skip to content

Week8 backend#50

Merged
DuGuYifei merged 32 commits intomainfrom
week8-backend
Jul 18, 2025
Merged

Week8 backend#50
DuGuYifei merged 32 commits intomainfrom
week8-backend

Conversation

@DuGuYifei
Copy link
Collaborator

@DuGuYifei DuGuYifei commented Jul 17, 2025

Closes #45
Closes #46
Closes #47
Closes #48
Closes #49
Closes #51

This pull request introduces several updates across deployment workflows, Docker Compose configurations, Ansible scripts, and Helm charts to enhance deployment flexibility, security, and scalability. Key changes include improved input handling in workflows, better resource management with Helm, and updates to Ansible and Docker configurations for compatibility and security.

Workflow Enhancements

  • Added support for optional image input in the Deploy to AWS workflow for custom image tags and adjusted logic to prioritize this input. (.github/workflows/deploy-aws.yml, [1] [2]
  • Updated docker-publish.yml to include a new unit-test job that runs tests before building and pushing images, ensuring code quality. (.github/workflows/docker-publish.yml, .github/workflows/docker-publish.ymlL8-R41)

Security and Configuration Improvements

  • Replaced environment variables with GitHub secrets for sensitive data like AWS_EC2_USER and SERVER_SSH_KEY in deployment workflows. (.github/workflows/deploy-aws.yml, [1] [2]
  • Added new environment variables (OLLAMA_BASE_URL, OLLAMA_MODEL, OLLAMA_API_KEY) to the .env setup for enhanced configuration management. (.github/workflows/deploy-aws.yml, .github/workflows/deploy-aws.ymlR64-R79)

Ansible Updates

  • Switched Docker installation to use the official Docker script for better compatibility and added a become directive for privilege escalation. (ansible/deploy.yml, ansible/deploy.ymlL11-R17)
  • Updated Ansible to create required directories (letsencrypt) and files (acme.json) instead of copying .env and docker-compose.prod.yml. (ansible/deploy.yml, ansible/deploy.ymlL31-R41)
  • Added an example hosts.ini file for AWS deployments. (ansible/hosts.ini.example, ansible/hosts.ini.exampleR1-R2)

Docker Compose Adjustments

  • Updated docker-compose.prod.deploy.yml to use secure HTTPS endpoints for Traefik and removed unnecessary labels and ports for a cleaner configuration. (docker-compose.prod.deploy.yml, [1] [2]
  • Enhanced database health checks to ensure the existence of the ai_db database instead of checking for a specific table. (docker-compose.prod.deploy.yml, [1]; docker-compose.yml, [2]

Helm Chart Enhancements

  • Added resource requests and limits for service-application, service-auth, and service-genai deployments to ensure better resource allocation. (helm/aihr/charts/service-application/templates/deployment.yaml, [1]; helm/aihr/charts/service-auth/templates/deployment.yaml, [2]; helm/aihr/charts/service-genai/templates/deployment.yaml, [3]
  • Introduced HorizontalPodAutoscaler (HPA) configurations for autoscaling based on CPU utilization for the above services. (helm/aihr/charts/service-application/templates/hpa.yaml, [1]; helm/aihr/charts/service-auth/templates/hpa.yaml, [2]; helm/aihr/charts/service-genai/templates/hpa.yaml, [3]

These changes collectively improve the deployment process, enhance security, and optimize resource utilization across the application stack.

@DuGuYifei DuGuYifei requested a review from Copilot July 17, 2025 04:20
@DuGuYifei DuGuYifei self-assigned this Jul 17, 2025
@DuGuYifei DuGuYifei added area:backend Backend related tasks area:devops CI/CD, infrastructure tasks labels Jul 17, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements Week 8 backend enhancements focusing on Kubernetes autoscaling, logging improvements, and a new Normal QA feature. The changes enable horizontal pod autoscaling for microservices, standardize logging formats, and add RAG-based question answering capabilities.

Key changes:

  • Added HorizontalPodAutoscaler configurations for all microservices (service-application, service-auth, service-genai, service-job)
  • Implemented NormalQA RPC method with RAG integration for company-specific question answering
  • Enhanced logging with JSON format across services and improved error handling

Reviewed Changes

Copilot reviewed 28 out of 33 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
helm/aihr/charts/*/templates/hpa.yaml Added HPA templates for autoscaling based on CPU utilization
helm/aihr/charts/*/values.yaml Added autoscaling configuration values
service-*/src/main/resources/logback.xml Configured JSON logging with LogstashEncoder
service-genai/app/rag/retrieval.py Implemented RAG pipeline for document retrieval and QA
service-genai/app/main.py Added NormalQA endpoint and improved logging
service-application/src/main/java/de/tum/devops/application/service/ChatService.java Enhanced chat service with fallback QA for completed interviews
proto/ai.proto Added NormalQARequest message and NormalQA RPC method
k8s-install.sh Updated JWT key handling to use PEM files
Comments suppressed due to low confidence (1)

service-application/src/main/java/de/tum/devops/application/service/ChatService.java:42

  • [nitpick] The variable name 'aiMessageLimit' is ambiguous. Consider renaming to 'maxAiMessagesPerSession' or 'aiMessageCountLimit' to clearly indicate it's a maximum count per session.
    private final int aiMessageLimit = 2;

@DuGuYifei DuGuYifei merged commit c8eef2c into main Jul 18, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend Backend related tasks area:devops CI/CD, infrastructure tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BE: RAG pipeline BE: Add test to CI/CD CI: fix AWS CICD CI: advanced settings BE: json log

2 participants