feat: add Redis cache, gzip, CI/CD via Gitea self-hosted runner
This commit is contained in:
47
.github/workflows/deploy.yml
vendored
47
.github/workflows/deploy.yml
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user