Attempt to deploy

This commit is contained in:
Tom Butcher 2025-06-01 21:27:22 +01:00
parent f98ab2896b
commit ae6a7a0ae1

29
Jenkinsfile vendored
View File

@ -31,20 +31,23 @@ pipeline {
}
}
stage('Deploy') {
stage('Deploy to printer1') {
steps {
echo 'Deploying application...'
sshagent(['printer1.tombutcher.local']) {
sh '''
# Create backup of current build
if [ -d /path/to/app/build ]; then mv /path/to/app/build /path/to/app/build.backup; fi
# Transfer new build
scp -r build/* /path/to/app/build/
# Restart the service
sudo systemctl restart your-service-name
'''
script {
def remote = [
name: 'printer1',
host: 'printer1.tombutcher.local',
user: 'ci',
port: 22,
credentialsId: 'ci_ssh',
allowAnyHosts: true
]
// Upload the build folder
sshPut remote: remote, from: 'build/', into: '/srv/farmcontrol-server/', flatten: false
// Restart the service
sshCommand remote: remote, command: 'sudo /bin/systemctl restart farmcontrol-server.service'
}
}
}