Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
cb0623b
Merge remote-tracking branch 'origin/main' into devops
Locatelli-Flor Dec 10, 2025
c776f6d
Merge branch 'main' into devops
Locatelli-Flor Dec 11, 2025
2e63eeb
Adds initial Docker Compose setup
Locatelli-Flor Dec 11, 2025
89f9ff2
Add initial database setup with tables for documents, document chunks…
Locatelli-Flor Dec 11, 2025
4bc2cb7
Merge remote-tracking branch 'origin/main' into devops
Locatelli-Flor Dec 13, 2025
0bd3a5e
Refactor Docker setup: replace pgvector with new Dockerfiles for Docs…
Locatelli-Flor Dec 13, 2025
38a24d6
Adds CI/CD workflows for deployment and validation
Locatelli-Flor Dec 13, 2025
211feaa
Refactors PR validation workflow for clarity
Locatelli-Flor Dec 13, 2025
7dcbb38
Enhances deployment workflow with summaries
Locatelli-Flor Dec 13, 2025
1302887
Merge remote-tracking branch 'origin/main' into devops
Locatelli-Flor Dec 14, 2025
a1e48e0
Enhances deployment workflow with rollback
Locatelli-Flor Dec 14, 2025
2d0f203
Add GitHub Actions workflows for deployment and PR validation
Locatelli-Flor Dec 14, 2025
e7fd757
Refactor Dockerfiles to streamline installation and add healthcheck
Locatelli-Flor Dec 14, 2025
3719f7e
Refactor Dockerfiles to simplify file copying and improve build process
Locatelli-Flor Dec 15, 2025
60ea4f2
Fix CMD syntax in Dockerfiles for consistency
Locatelli-Flor Dec 15, 2025
958df99
Fix CMD syntax in Dockerfiles for consistency
Locatelli-Flor Dec 15, 2025
b195179
Update Python version to 3.13 and fix CMD syntax in Dockerfiles for c…
Locatelli-Flor Dec 15, 2025
ff38ada
Updates project dependencies
Locatelli-Flor Dec 15, 2025
68ac919
Refactor import statement for clarity and add pdfplumber and minio de…
Locatelli-Flor Dec 15, 2025
8d434dc
Remove rollback step from deployment workflow and adjust script secti…
Locatelli-Flor Dec 15, 2025
c73a517
Replace rollout status with wait for new pods to be ready in deployme…
Locatelli-Flor Dec 15, 2025
3577344
Increase deployment timeout to 8 minutes and update rollout status ch…
Locatelli-Flor Dec 15, 2025
20cafba
Remove redundant wait command from deployment rollout step in workflow
Locatelli-Flor Dec 15, 2025
cf1f966
Refactor deployment workflow to improve rollout checks and update tim…
Locatelli-Flor Dec 15, 2025
9562f67
Add Discord notifications for successful and failed deployments, and …
Locatelli-Flor Dec 15, 2025
34d8a48
Enhance Discord notifications with detailed deployment information fo…
Locatelli-Flor Dec 15, 2025
cb5dfaa
Update PR validation trigger to include opened event and adjust Pytho…
Locatelli-Flor Dec 15, 2025
a99e31c
Reduce rollout timeout to 30s and add debug steps for deployment stat…
Locatelli-Flor Dec 15, 2025
0d1c362
Update rollout timeout to 60s and remove debug steps from deployment …
Locatelli-Flor Dec 15, 2025
b285743
Merge branch 'main' into devops
Locatelli-Flor Dec 15, 2025
b4af608
Merge remote-tracking branch 'origin/devops' into devops
Locatelli-Flor Dec 15, 2025
7efd5a4
Merge remote-tracking branch 'origin/main' into devops
Locatelli-Flor Dec 15, 2025
ad1545f
Add SonarQube scan step to PR validation workflow
Locatelli-Flor Dec 16, 2025
ece3d76
Merge branch 'main' into devops
Locatelli-Flor Dec 16, 2025
b18a510
Refactor configuration settings to use Pydantic Field for environment…
Locatelli-Flor Dec 16, 2025
90b9cb9
Merge branch 'devops' of https://github.com/ucudal/reto-xmas-2025-gol…
Locatelli-Flor Dec 16, 2025
3fcffff
Add env_map for PostgreSQL configuration in Settings
Locatelli-Flor Dec 16, 2025
e3c823f
Refactor PostgreSQL and RabbitMQ configuration to remove env_map and …
Locatelli-Flor Dec 16, 2025
7e210d1
Update Dockerfile to include Python in CMD and improve uv sync command
Locatelli-Flor Dec 17, 2025
2eafa50
Merge branch 'main' into devops
Locatelli-Flor Dec 17, 2025
d36cc75
Merge branch 'main' into devops
Locatelli-Flor Dec 17, 2025
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
79 changes: 66 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ on:
env:
REGISTRY: crretoxmas2024.azurecr.io
NAMESPACE: reto-xmas-2025-goland-ia-backend
DEPLOY_TIMEOUT: 3m

jobs:
build-and-deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -51,6 +53,7 @@ jobs:
${{ env.REGISTRY }}/${{ matrix.service.image }}:${{ github.sha }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ matrix.service.image }}:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ matrix.service.image }}:buildcache,mode=max
provenance: false

- name: Set up kubectl
uses: azure/setup-kubectl@v3
Expand All @@ -63,28 +66,66 @@ jobs:
echo "${{ secrets.KUBECONFIG }}" | base64 -d > $HOME/.kube/config
chmod 600 $HOME/.kube/config

- name: Restart deployment
- name: Update deployment image
run: |
kubectl rollout restart deployment/${{ matrix.service.deployment }} -n ${{ env.NAMESPACE }}
kubectl rollout status deployment/${{ matrix.service.deployment }} -n ${{ env.NAMESPACE }} --timeout=5m
kubectl set image deployment/${{ matrix.service.deployment }} \
api=${{ env.REGISTRY }}/${{ matrix.service.image }}:${{ github.sha }} \
-n ${{ env.NAMESPACE }}

- name: Wait for rollout
timeout-minutes: 5
run: |
kubectl rollout status deployment/${{ matrix.service.deployment }} \
-n ${{ env.NAMESPACE }} \
--timeout=${{ env.DEPLOY_TIMEOUT }} || {
echo "Deployment failed or timed out"
kubectl get pods -n ${{ env.NAMESPACE }} -l app=${{ matrix.service.deployment }}
exit 1
}

- name: Verify deployment
if: success()
run: |
echo "Deployment successful for ${{ matrix.service.name }}"
echo "Deployment successful for ${{ matrix.service.name }}"
kubectl get pods -n ${{ env.NAMESPACE }} -l app=${{ matrix.service.deployment }}

- name: Get logs on failure
if: failure()
run: |
echo "=== Pod Logs ==="
kubectl logs -n ${{ env.NAMESPACE }} \
-l app=${{ matrix.service.deployment }} \
--tail=100 \
--all-containers=true \
--prefix=true || echo "Could not fetch logs"

- name: Rollback on failure
if: failure()
run: |
echo "Rolling back deployment"
kubectl rollout undo deployment/${{ matrix.service.deployment }} -n ${{ env.NAMESPACE }}

- name: Deployment Summary
if: always()
run: |
echo "### 🚀 Deployment Summary" >> $GITHUB_STEP_SUMMARY
STATUS="${{ job.status }}"

echo "### Deployment - ${{ matrix.service.name }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Service:** ${{ matrix.service.name }}" >> $GITHUB_STEP_SUMMARY
echo "**Image:** ${{ env.REGISTRY }}/${{ matrix.service.image }}:${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
echo "**Status:** ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
echo "| Property | Value |" >> $GITHUB_STEP_SUMMARY
echo "|----------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| Image | \`${{ env.REGISTRY }}/${{ matrix.service.image }}:${{ github.sha }}\` |" >> $GITHUB_STEP_SUMMARY

if [ "$STATUS" == "success" ]; then
echo "| Status | Success |" >> $GITHUB_STEP_SUMMARY
else
echo "| Status | Failed |" >> $GITHUB_STEP_SUMMARY
fi

echo "" >> $GITHUB_STEP_SUMMARY
echo "#### Pods:" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
kubectl get pods -n ${{ env.NAMESPACE }} -l app=${{ matrix.service.deployment }} >> $GITHUB_STEP_SUMMARY
kubectl get pods -n ${{ env.NAMESPACE }} -l app=${{ matrix.service.deployment }} >> $GITHUB_STEP_SUMMARY || true
echo '```' >> $GITHUB_STEP_SUMMARY

notify-success:
Expand All @@ -95,8 +136,20 @@ jobs:
steps:
- name: Success Summary
run: |
echo "### ✅ Deployment Successful!" >> $GITHUB_STEP_SUMMARY
echo "### ll Services Deployed!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Live URLs:**" >> $GITHUB_STEP_SUMMARY
echo "- [DocsManager](https://goland-ia-backend-docs-manager.reto-ucu.net/docs)" >> $GITHUB_STEP_SUMMARY
echo "- [RAGManager](https://goland-ia-backend-rag-manager.reto-ucu.net/docs)" >> $GITHUB_STEP_SUMMARY

notify-failure:
name: Deployment Failed
runs-on: ubuntu-latest
needs: [build-and-deploy]
if: failure()
steps:
- name: Failure Summary
run: |
echo "### Deployment Failed" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "All services deployed successfully:" >> $GITHUB_STEP_SUMMARY
echo "- 🌐 DocsManager: https://goland-ia-backend-docs-manager.reto-ucu.net" >> $GITHUB_STEP_SUMMARY
echo "- 🌐 RAGManager: https://goland-ia-backend-rag-manager.reto-ucu.net" >> $GITHUB_STEP_SUMMARY
echo "Automatic rollback initiated" >> $GITHUB_STEP_SUMMARY
20 changes: 16 additions & 4 deletions DocsManager/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
FROM python:3.12-slim

WORKDIR /app

COPY pyproject.toml uv.lock* ./
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*

RUN uv sync --frozen --no-cache || uv sync --no-cache
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
mv /root/.local/bin/uv /usr/local/bin/uv && \
mv /root/.local/bin/uvx /usr/local/bin/uvx

COPY pyproject.toml ./
COPY uv.lock* ./

RUN uv sync --no-dev --no-cache

COPY . .

EXPOSE 8000

CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1

CMD ["uv", "run", "--no-sync", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
8 changes: 5 additions & 3 deletions DocsManager/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ name = "goland-ia"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.14"
requires-python = ">=3.13"
dependencies = [
"fastapi>=0.124.2",
"ipython>=9.8.0",
"sqlalchemy>=2.0.35",
"asyncpg>=0.29.0",
"psycopg2-binary>=2.9.9",
"langgraph>=1.0.4",
"typing-extensions>=4.15.0",
"uvicorn>=0.38.0",
Expand All @@ -23,7 +25,7 @@ dev = [

[tool.ruff]
# Enable pyproject.toml support
target-version = "py314"
target-version = "py313"
line-length = 120

# Enable auto-fix
Expand Down
20 changes: 16 additions & 4 deletions RAGManager/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
FROM python:3.12-slim

WORKDIR /app

COPY pyproject.toml uv.lock* ./
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*

RUN uv sync --frozen --no-cache || uv sync --no-cache
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
mv /root/.local/bin/uv /usr/local/bin/uv && \
mv /root/.local/bin/uvx /usr/local/bin/uvx

COPY pyproject.toml ./
COPY uv.lock* ./

RUN uv sync --no-dev --no-cache

COPY . .

EXPOSE 8000

CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1

CMD ["uv", "run", "--no-sync", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
32 changes: 6 additions & 26 deletions RAGManager/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[project]
name = "goland-ia"
name = "rag-manager"
version = "0.1.0"
description = "Add your description here"
description = "RAG Manager for document processing"
readme = "README.md"
requires-python = ">=3.14"
requires-python = ">=3.12,<3.14"
dependencies = [
"fastapi>=0.124.2",
"fastapi>=0.124.2",
"ipython>=9.8.0",
"langgraph>=1.0.4",
"langchain-core>=0.3.0",
Expand All @@ -15,8 +15,6 @@ dependencies = [
"psycopg2-binary>=2.9.0",
"pgvector>=0.3.0",
"pydantic-settings>=2.0.0",
"typing-extensions>=4.15.0",
"uvicorn>=0.38.0",
"guardrails-ai>=0.5.10",
]

Expand All @@ -26,14 +24,9 @@ dev = [
]

[tool.ruff]
# Enable pyproject.toml support
target-version = "py314"
target-version = "py312"
line-length = 120

# Enable auto-fix
fix = true

# Exclude directories
exclude = [
".git",
".venv",
Expand All @@ -45,7 +38,6 @@ exclude = [
]

[tool.ruff.lint]
# Enable a comprehensive set of rules
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
Expand All @@ -57,27 +49,15 @@ select = [
"C4", # flake8-comprehensions
"SIM", # flake8-simplify
]

ignore = [
"E501", # Line too long (handled by formatter)
"E501", # Line too long
]

# Allow autofix for all enabled rules
fixable = ["ALL"]
unfixable = []

# Allow unused variables when underscore-prefixed
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.format]
# Use double quotes for strings (like Black)
quote-style = "double"

# Indent with spaces
indent-style = "space"

# Respect magic trailing commas
skip-magic-trailing-comma = false

# Automatically detect line ending
line-ending = "auto"
Loading