Files
fymious-tg-bot/Jenkinsfile
2026-01-29 15:22:58 +03:00

58 lines
1.8 KiB
Groovy

pipeline {
agent any
environment {
BOT_DIR = '/srv/fymious-tg-bot'
VPS_HOST = '96.126.129.131'
}
stages {
stage('Checkout') {
steps {
echo 'Pulling latest code...'
checkout scm
}
}
stage('Deploy') {
steps {
echo 'Deploying to VPS...'
sshagent(['vps-ssh-key']) {
sh '''
# Copy files to VPS
ssh -o StrictHostKeyChecking=no root@${VPS_HOST} "mkdir -p ${BOT_DIR}"
scp -o StrictHostKeyChecking=no -r * root@${VPS_HOST}:${BOT_DIR}/
# Setup and restart on VPS (force bash)
ssh -o StrictHostKeyChecking=no root@${VPS_HOST} /bin/bash << 'ENDSSH'
cd /srv/fymious-tg-bot
# Remove corrupted venv and recreate
rm -rf .venv
python3 -m venv .venv
# Install dependencies
.venv/bin/pip install --upgrade pip
.venv/bin/pip install -r requirements.txt
# Restart service
systemctl restart fymious-tg-bot
echo "Deployment completed successfully"
ENDSSH
'''
}
}
}
}
post {
success {
echo 'Deployment successful!'
}
failure {
echo 'Deployment failed!'
}
}
}