Backup deployment scripts

This commit is contained in:
2023-06-23 17:51:34 +02:00
parent 990a2dff19
commit 7b88f5e792
4 changed files with 150 additions and 7 deletions

62
Deployment/release.yml Normal file
View File

@@ -0,0 +1,62 @@
Prepare config:
steps:
- task: qetza.replacetokens.replacetokens-task.replacetokens@5
displayName: 'Prepare config'
inputs:
rootDirectory: '$(System.DefaultWorkingDirectory)/_Duina/drop'
targetFiles: |
Frontend/main*.js
WebAPI/appsettings.json
WebAPI/client_secrets.json
verbosity: detailed
actionOnMissing: fail
actionOnNoFiles: warn
Create fronternd archive:
steps:
- task: ArchiveFiles@2
displayName: 'Create Frontend archive'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/_Duina/drop/Frontend'
archiveFile: '$(System.DefaultWorkingDirectory)/_Duina/drop/zip/DiunaBI-Staging-Frontend.zip'
Create backend archive:
steps:
- task: ArchiveFiles@2
displayName: 'Create Backend archive'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/_Duina/drop/WebAPI'
archiveFile: '$(System.DefaultWorkingDirectory)/_Duina/drop/zip/DiunaBI-Staging-WebAPI.zip'
Securely copy files to the remote machine:
steps:
- task: ArchiveFiles@2
displayName: 'Create Backend archive'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/_Duina/drop/WebAPI'
archiveFile: '$(System.DefaultWorkingDirectory)/_Duina/drop/zip/DiunaBI-Staging-WebAPI.zip'
Run shell commands on remote machine:
steps:
- task: SSH@0
displayName: 'Run shell commands on remote machine'
inputs:
sshEndpoint: 'crm.bim-it.pl'
commands: |
rm -rf /srv/diunabi.bim-it.pl/*
unzip -o /home/mz/deployment/DiunaBI-Staging-Frontend.zip -d /home/mz/deployment
bash /home/mz/deployment/updateSWHash.sh
cp -R /home/mz/deployment/Frontend/* /srv/diunabi.bim-it.pl/
sudo systemctl stop DiunaBI-WebAPI
rm -rf /home/mz/services/DiunaBI-WebAPI/*
unzip -o /home/mz/deployment/DiunaBI-Staging-WebAPI.zip -d /home/mz/deployment
cp -R /home/mz/deployment/WebAPI/* /home/mz/services/DiunaBI-WebAPI/
sudo systemctl start DiunaBI-WebAPI
rm -rf /home/mz/deployment/Frontend
rm -rf /home/mz/deployment/WebAPI