feat: add Redis cache, gzip, CI/CD via Gitea self-hosted runner
Some checks failed
CI - Build and Lint / build (push) Failing after 3s
Deploy API-Ubigeo / deploy (push) Failing after 1s

This commit is contained in:
Gianpierre Mio
2026-03-09 23:43:25 -05:00
parent a789d33bee
commit c48dc3cd0b
17 changed files with 567 additions and 248 deletions

BIN
.github/.DS_Store vendored

Binary file not shown.

31
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
name: CI - Build and Lint
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
build:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Generate Prisma client
run: npx prisma generate
- name: Lint
run: npm run lint --if-present || true
- name: Build
run: npm run build
- name: Verify build output
run: |
[ -d dist ] && echo "✅ Build OK" || (echo "❌ dist not found" && exit 1)

View File

@@ -1,4 +1,4 @@
name: Deploy API Ubigeo
name: Deploy API-Ubigeo
on:
push:
@@ -6,40 +6,25 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy al VPS via SSH
uses: appleboy/ssh-action@v1.0.3
with:
host: 158.220.106.131
username: root
password: ${{ secrets.VPS_PASSWORD }}
script: |
set -e
cd /home/deployer/api-ubigeo || (mkdir -p /home/deployer/api-ubigeo && cd /home/deployer/api-ubigeo)
- name: Copy source to server
run: |
rsync -av --delete \
--exclude='.git' \
--exclude='node_modules' \
--exclude='dist' \
--exclude='.env' \
. /home/deployer/api-ubigeo/
# Pull o clone
if [ -d ".git" ]; then
git pull origin main
else
git clone https://github.com/${{ github.repository }} .
fi
- name: Build & deploy
run: bash /home/deployer/deploy-ubigeo.sh
# Build imagen
docker build -t ubigeo-api:latest .
# Deploy con compose
docker compose -f docker-compose.production.yml up -d --force-recreate api
# Ejecutar migraciones
docker exec ubigeo-api npx prisma migrate deploy
# Verificar health
sleep 10
curl -f http://localhost:3200/api/v1/health || exit 1
echo "✅ Deploy exitoso"
- name: Health check
run: |
sleep 10
curl -f https://api-ubigeo.darkcodex.dev/api/v1/health || exit 1