refactor: simplify docker deployment without ssh acting as native socket executor
This commit is contained in:
+23
-27
@@ -2,38 +2,34 @@ name: Deploy Iddaai Backend
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [main]
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Kodu Cek
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install sshpass
|
- name: Docker Build
|
||||||
run: sudo apt-get update && sudo apt-get install -y sshpass
|
run: docker build -t iddaai-be:latest .
|
||||||
|
|
||||||
- name: Deploy to Raspberry Pi via rsync
|
- name: Eski Konteyneri Sil
|
||||||
env:
|
run: docker rm -f iddaai-be || true
|
||||||
SERVER_PASSWORD: ${{ secrets.SERVER_PASSWORD }}
|
|
||||||
SERVER_IP: "95.70.252.214"
|
- name: Yeni Versiyonu Baslat
|
||||||
SERVER_PORT: "2222"
|
|
||||||
SERVER_USER: "haruncan"
|
|
||||||
run: |
|
run: |
|
||||||
export SSHPASS=$SERVER_PASSWORD
|
docker run -d \
|
||||||
sshpass -e rsync -avz --exclude node_modules --exclude .git --exclude dist --exclude .next --exclude .DS_Store --exclude venv --exclude 'ai-engine/venv' --exclude __pycache__ -e "ssh -o StrictHostKeyChecking=no -p $SERVER_PORT" ./ $SERVER_USER@$SERVER_IP:~/apps/iddaai/be/
|
--name iddaai-be \
|
||||||
|
--restart unless-stopped \
|
||||||
- name: Restart Backend Docker Service
|
--network iddaai_iddaai-network \
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
-p 127.0.0.1:1810:3000 \
|
||||||
with:
|
-e NODE_ENV=production \
|
||||||
host: "95.70.252.214"
|
-e DATABASE_URL='postgresql://iddaai_user:IddaA1_S4crET!@iddaai-postgres:5432/iddaai_db?schema=public' \
|
||||||
port: "2222"
|
-e REDIS_HOST='iddaai-redis' \
|
||||||
username: "haruncan"
|
-e REDIS_PORT='6379' \
|
||||||
password: ${{ secrets.SERVER_PASSWORD }}
|
-e REDIS_PASSWORD='IddaA1_Redis_Pass!' \
|
||||||
script: |
|
-e AI_ENGINE_URL='http://iddaai-ai-engine:8000' \
|
||||||
cd ~/apps/iddaai
|
-e JWT_SECRET='b7V8jM2wP1L5mQxs2RdfFkAsLpI2oG!w' \
|
||||||
docker compose build backend
|
-e JWT_ACCESS_EXPIRATION='1d' \
|
||||||
docker compose up -d backend
|
iddaai-be:latest /bin/sh -c "npx prisma migrate deploy && node dist/src/main.js"
|
||||||
|
|||||||
Reference in New Issue
Block a user