Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
9abd831
Refactor authorization checks in EventService to use UserType.LLEIDAH…
Big-Lolo Nov 3, 2024
a760a5c
improving token
tonlls Nov 4, 2024
65c9a70
Merge branch 'integration' into token-improvement
tonlls Nov 4, 2024
6e84876
Automated autoyapf fixes
invalid-email-address Nov 4, 2024
66157ff
Update service.py
tonlls Feb 3, 2025
937b9fe
Merge pull request #310 from LleidaHack/tonlls-patch-1
tonlls Feb 3, 2025
54922b3
Update service.py
tonlls Feb 3, 2025
319c6be
Update service.py
tonlls Feb 3, 2025
44bb904
Update service.py
tonlls Feb 3, 2025
340ef2b
Update service.py
tonlls Feb 3, 2025
d8bc29b
Update service.py
tonlls Feb 3, 2025
f43a4f5
Update service.py
tonlls Feb 3, 2025
1d2788b
Poetry migrated to UV
pllinasv Feb 24, 2025
25c271c
Automated autoyapf fixes
invalid-email-address Feb 24, 2025
c1d75bb
Merge pull request #313 from LleidaHack/BACK-96-migrar-bde-poetry-a-uv
pllinasv Mar 25, 2025
ef1eb16
updated models to sqlalchemy 2.0
tonlls Jun 4, 2025
8987e24
critical fix
tonlls Jun 4, 2025
f4f6c88
refactoring
Jun 9, 2025
8f9d90e
fix ci/cd
Jun 9, 2025
91cfd16
fix alembic
tonlls Jun 10, 2025
f005259
Automated ruff fixes
invalid-email-address Jun 10, 2025
db3ce38
fix alembic
tonlls Jun 10, 2025
108c904
Merge branch 'integration' into fixes-of-deny-hacker
elver5041 Jun 11, 2025
18daedb
docker
Jun 15, 2025
cbbf9ee
Merge pull request #317 from LleidaHack/modernization-end
tonlls Jun 16, 2025
4f1dc72
Merge branch 'integration' into token-improvement
tonlls Jun 16, 2025
1c7aacf
Automated ruff fixes
invalid-email-address Jun 16, 2025
6329e6c
Merge pull request #288 from LleidaHack/token-improvement
tonlls Jun 16, 2025
4cd60eb
Generate mail API client and fix backend startup issues
Jun 16, 2025
575e62e
Complete backend modernization and configuration improvements
Jun 16, 2025
02277eb
fix
Jun 16, 2025
d85a337
Merge branch 'integration' into fixes-of-deny-hacker
Big-Lolo Jun 19, 2025
6a5559b
Refactor Dockerfile CMD and update email/password validation regex pa…
Big-Lolo Jun 26, 2025
12a3a97
Merge pull request #279 from LleidaHack/fixes-of-deny-hacker
Big-Lolo Jul 23, 2025
5a340e7
Update dockerfile
Big-Lolo Aug 27, 2025
d1b03dd
Merge pull request #319 from LleidaHack/dockerfile-changes
Big-Lolo Aug 27, 2025
4995049
Merge remote-tracking branch 'origin/integration' into test
elver5041 Sep 23, 2025
5a77087
Merge pull request #318 from LleidaHack/test
elver5041 Sep 23, 2025
611f26f
Model Fix
Big-Lolo Sep 23, 2025
3e604f2
refix
Big-Lolo Sep 23, 2025
f7f4ddb
little fix
Big-Lolo Sep 23, 2025
d67e473
little fix x2
Big-Lolo Sep 23, 2025
012de0d
Edits on .env struct
Big-Lolo Sep 23, 2025
b2426f9
gitignore elements
Big-Lolo Sep 23, 2025
d1ed9ae
.
Big-Lolo Sep 23, 2025
b575607
.
Big-Lolo Sep 23, 2025
12aa7b0
hackeps finally works?
elver5041 Sep 23, 2025
66b42af
admin token working again
elver5041 Sep 24, 2025
bef17fd
ara si
elver5041 Sep 24, 2025
7fec671
Try to fix set_all_data
Big-Lolo Sep 24, 2025
7061dff
Update Token.py
Big-Lolo Sep 24, 2025
7c53d38
Update Token.py
Big-Lolo Sep 24, 2025
0267d93
Update Token.py
Big-Lolo Sep 24, 2025
dac8e8a
prints
Big-Lolo Sep 24, 2025
d4027a6
Update Token.py
Big-Lolo Sep 24, 2025
415e7d8
Update Token.py
Big-Lolo Sep 24, 2025
9bc199f
Update Token.py
Big-Lolo Sep 24, 2025
dc0442d
Update Token.py
Big-Lolo Sep 24, 2025
132862b
Update Token.py
Big-Lolo Sep 24, 2025
c3e535e
Merge pull request #320 from LleidaHack/testfixes
Big-Lolo Sep 24, 2025
0eebe54
Update service.py
Big-Lolo Sep 24, 2025
04c23da
Update service.py
Big-Lolo Sep 24, 2025
f48cf8c
Merge branch 'integration' into testfixes
Big-Lolo Sep 24, 2025
f350af4
Merge pull request #321 from LleidaHack/testfixes
Big-Lolo Sep 24, 2025
4af4b8e
Fix checktoken
Big-Lolo Sep 24, 2025
b0a8837
Update Token.py
Big-Lolo Sep 24, 2025
3c9608e
Merge branch 'integration' into testfixes
Big-Lolo Sep 24, 2025
a052a3f
Merge pull request #322 from LleidaHack/testfixes
Big-Lolo Sep 24, 2025
04a7c1d
test
tonlls Sep 24, 2025
63d585a
test
tonlls Sep 24, 2025
6d7a09b
fix
tonlls Sep 24, 2025
cd031c6
fix
tonlls Sep 24, 2025
386807e
f
tonlls Sep 24, 2025
1a01aff
fix
tonlls Sep 24, 2025
0c5ced8
fix
tonlls Sep 24, 2025
1d55a32
fix
tonlls Sep 24, 2025
5149df5
fix
tonlls Sep 25, 2025
af24e79
fix
tonlls Sep 25, 2025
85fa0a5
Update Dockerfile
Big-Lolo Sep 25, 2025
5d5af1b
Update .env.main
Big-Lolo Sep 25, 2025
384b8c1
Update .env.main
Big-Lolo Sep 25, 2025
c12c3f7
fix definitiu frfrfrfr
tonlls Sep 25, 2025
84223b8
little check
Big-Lolo Sep 25, 2025
1f211c8
Update Token.py
Big-Lolo Sep 25, 2025
6d75761
Remove prints
Big-Lolo Sep 25, 2025
0567cbf
Update Token.py
Big-Lolo Sep 25, 2025
d13dd85
Update Token.py
Big-Lolo Sep 25, 2025
89291ee
Update service.py
Big-Lolo Sep 25, 2025
b0c5eeb
banner update
elver5041 Sep 25, 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
25 changes: 25 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Main Environment for Backend
ENV=main

# General Settings
FRONT_URL=${FRONT_URL}
BACK_URL=${BACK_URL}
STATIC_FOLDER=static
CONTACT_MAIL=${DOMAIN_EMAIL}
LOCAL=false

# Security Settings
SECURITY__SECRET_KEY=${SECRET_KEY}
SECURITY__ALGORITHM=HS256
SECURITY__EXPIRE_TIME=15

# Database Settings - Main uses environment-based password
# DATABASE__URL will be constructed automatically using MAIN_POSTGRES_PASSWORD
SECURITY__SERVICE_TOKEN=${SECURITY__SERVICE_TOKEN}
MAIN_POSTGRES_PASSWORD=${MAIN_POSTGRES_PASSWORD}
INTEGRATION_POSTGRES_PASSWORD=${INTEGRATION_POSTGRES_PASSWORD}
SECRET_KEY=${SECRET_KEY}
MAIL_SERVICE_TOKEN=${MAIL_SERVICE_TOKEN}
CLIENTS__MAIL_CLIENT__URL=${CLIENTS__MAIL_CLIENT__URL}
MAIL_BACKEND_HOST=${MAIL_BACKEND_HOST}
DATABASE__URL=${DATABASE__URL}
24 changes: 24 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Environment Configuration
ENV=main

# General Settings
FRONT_URL=https://frontend.integration.lleidahack.dev/hackeps
BACK_URL=http://localhost:8000/
STATIC_FOLDER=static
CONTACT_MAIL=contacte@lleidahack.dev
LOCAL=true

# Security Settings
SECURITY__SECRET_KEY=your-secret-key-here
SECURITY__ALGORITHM=HS256
SECURITY__EXPIRE_TIME=15
SECURITY__SERVICE_TOKEN=your-service-token-here

# Database Settings
DATABASE__URL=postgresql://username:password@host:port/database

# Client Settings
CLIENTS__MAIL_CLIENT__URL=http://mail:8000/

# Integration Environment (only needed when ENV=integration)
INTEGRATION_POSTGRES_PASSWORD=testpass123
48 changes: 48 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Code Quality

on:
pull_request:
branches:
- main
- integration
paths:
- '**.py'
workflow_dispatch:

jobs:
code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"

- name: Set up Python
run: uv python install 3.12

- name: Install ruff
run: uv tool install ruff

- name: Lint with ruff
run: uv tool run ruff check . --fix

- name: Format with ruff
run: uv tool run ruff format .

- name: Check for modified files
id: git-check
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo 'false'; else echo 'true'; fi)" >> $GITHUB_OUTPUT

- name: Push changes
if: steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "Automated ruff fixes"
git push
98 changes: 98 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Deploy to VPS

on:
push:
branches:
- main
- integration
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
environment: production
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Get current date
id: date
run: echo "date=$(date +'%H:%M_%d-%m-%Y')" >> $GITHUB_OUTPUT

- name: Deploy to server
uses: appleboy/ssh-action@v0.1.7
with:
host: ${{ secrets.SERVER_IP }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
set -euo pipefail

# Variables
BRANCH="${{ steps.extract_branch.outputs.branch }}"
PROJECT_PATH="${{ secrets.PROJECT_PATH }}/${BRANCH}"
SERVICE_NAME="Backend.${BRANCH}"

echo "🚀 Starting deployment for branch: ${BRANCH}"

# Navigate to project directory
cd "${PROJECT_PATH}"

# Git operations
echo "📥 Updating code..."
git fetch --prune
git checkout "${BRANCH}"
git pull origin "${BRANCH}"

# Log deployment
echo "${{ steps.date.outputs.date }} -> ${{ github.actor }} (commit: ${{ github.sha }})" >> deploy.log

# Clear old logs
echo "🧹 Clearing logs..."
> logs/gunicorn_access.log
> logs/gunicorn_error.log

# Install dependencies with uv (faster than poetry)
echo "📦 Installing dependencies..."
if command -v uv &> /dev/null; then
uv sync --frozen
else
${{ secrets.POETRY_BIN }} install --sync --no-dev
fi

# Run database migrations
echo "🗄️ Running migrations..."
if command -v uv &> /dev/null; then
uv run alembic upgrade head
else
${{ secrets.POETRY_BIN }} run alembic upgrade head
fi

# Restart service with better error handling
echo "🔄 Restarting service..."
sudo systemctl restart "${SERVICE_NAME}"

# Wait for service to start
sleep 5

# Check service status
echo "✅ Checking service status..."
if systemctl is-active --quiet "${SERVICE_NAME}"; then
echo "✅ Deployment successful! Service is running."
systemctl status "${SERVICE_NAME}" --no-pager -l
else
echo "❌ Deployment failed! Service is not running."
sudo journalctl -u "${SERVICE_NAME}" --no-pager -l --since "5 minutes ago"
exit 1
fi
- name: Notify deployment status
if: always()
run: |
if [ "${{ job.status }}" == "success" ]; then
echo "✅ Deployment to ${{ steps.extract_branch.outputs.branch }} completed successfully"
else
echo "❌ Deployment to ${{ steps.extract_branch.outputs.branch }} failed"
fi
41 changes: 0 additions & 41 deletions .github/workflows/deployVPS.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/formatting.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/pylint.yml

This file was deleted.

12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@
.config
config.ini
**/__pycache__/
.env
.env.local
.env.integration
.env.production
utils/scripts
.vscode/**
test/ep_test/*
env/
.venv/
src/configuration/*.yaml
generated_src/**
generated_src/**

# Keep example files
!.env.example
.claude/
.ruff_cache/
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: local
hooks:
- id: ruff-check
name: ruff check
entry: uv run ruff check --fix
language: system
types: [python]
require_serial: false
- id: ruff-format
name: ruff format
entry: uv run ruff format
language: system
types: [python]
require_serial: false
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
Loading
Loading