ci: install rsync+ssh, fix SSH config
This commit is contained in:
@@ -40,23 +40,28 @@ jobs:
|
|||||||
NUXT_PUBLIC_FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
|
NUXT_PUBLIC_FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
|
||||||
NUXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.FIREBASE_MESSAGING_SENDER_ID }}
|
NUXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.FIREBASE_MESSAGING_SENDER_ID }}
|
||||||
|
|
||||||
|
- name: Install deploy tools
|
||||||
|
run: apk add --no-cache openssh-client rsync
|
||||||
|
|
||||||
- name: Setup SSH with jump host
|
- name: Setup SSH with jump host
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/id_rsa
|
printf '%s' "${{ secrets.DEPLOY_SSH_KEY }}" | tr -d '\r' > ~/.ssh/id_rsa
|
||||||
chmod 600 ~/.ssh/id_rsa
|
chmod 600 ~/.ssh/id_rsa
|
||||||
cat >> ~/.ssh/config << EOF
|
cat > ~/.ssh/config << EOF
|
||||||
Host jumphost
|
Host jumphost
|
||||||
HostName ${{ secrets.JUMP_HOST }}
|
HostName ${{ secrets.JUMP_HOST }}
|
||||||
User ${{ secrets.JUMP_USER }}
|
User ${{ secrets.JUMP_USER }}
|
||||||
IdentityFile ~/.ssh/id_rsa
|
IdentityFile ~/.ssh/id_rsa
|
||||||
StrictHostKeyChecking no
|
StrictHostKeyChecking no
|
||||||
|
UserKnownHostsFile /dev/null
|
||||||
Host target
|
Host target
|
||||||
HostName ${{ secrets.DEPLOY_HOST }}
|
HostName ${{ secrets.DEPLOY_HOST }}
|
||||||
User ${{ secrets.DEPLOY_USER }}
|
User ${{ secrets.DEPLOY_USER }}
|
||||||
ProxyJump jumphost
|
ProxyJump jumphost
|
||||||
IdentityFile ~/.ssh/id_rsa
|
IdentityFile ~/.ssh/id_rsa
|
||||||
StrictHostKeyChecking no
|
StrictHostKeyChecking no
|
||||||
|
UserKnownHostsFile /dev/null
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: Copy .output to server
|
- name: Copy .output to server
|
||||||
@@ -67,22 +72,4 @@ jobs:
|
|||||||
|
|
||||||
- name: Run migrations & restart container
|
- name: Run migrations & restart container
|
||||||
run: |
|
run: |
|
||||||
ssh target << 'ENDSSH'
|
ssh target 'cd /opt/xflow && docker compose up -d --force-recreate xflow && echo "✅ XFlow deployed"'
|
||||||
cd /opt/xflow
|
|
||||||
|
|
||||||
# Запустить миграции Prisma
|
|
||||||
docker run --rm \
|
|
||||||
--network infra \
|
|
||||||
-e DATABASE_URL="$DATABASE_URL" \
|
|
||||||
-v /opt/xflow/prisma:/app/prisma \
|
|
||||||
-v /opt/xflow/node_modules:/app/node_modules \
|
|
||||||
-w /app \
|
|
||||||
node:20-alpine \
|
|
||||||
sh -c "npx prisma migrate deploy"
|
|
||||||
|
|
||||||
# Перезапустить xflow контейнер
|
|
||||||
cd /opt/xflow
|
|
||||||
docker compose up -d --force-recreate xflow
|
|
||||||
|
|
||||||
echo "✅ XFlow deployed at $(date)"
|
|
||||||
ENDSSH
|
|
||||||
|
|||||||
Reference in New Issue
Block a user