Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hmidani-abdelilah/a91a26433dec5d406216a1b5406897ff to your computer and use it in GitHub Desktop.
Save hmidani-abdelilah/a91a26433dec5d406216a1b5406897ff to your computer and use it in GitHub Desktop.
Noob way to automate my web deploy { ignore this please }
# Noob Web Deploy
# Made by @Tester2009
# February 26, 2019
# backup first from VPS backup_public
echo "Start backup remote to local"
rsync -ravz --relative --progress -e 'ssh -i /Users/tester2009/.ssh/tester2009.pem' [email protected]:/home/ubuntu/backup_public/ /Volumes/Backups/26Feb2019
echo "Done backup from /home/ubuntu/backup_public/"
# then delete content from backup_public
echo "Start deleting content on remote"
ssh -i ~/.ssh/tester2009.pem -t [email protected] 'rm -Rfv /home/ubuntu/backup_public/*'
echo "Done delete /home/ubuntu/backup_public/*"
# now copy public to backup_public
echo "Start copy content on remote"
ssh -i ~/.ssh/tester2009.pem -t [email protected] 'cp -Rv /home/ubuntu/public/* /home/ubuntu/backup_public/'
echo "Done copying public to backup_public"
# now delete public
echo "Delete public"
ssh -i ~/.ssh/tester2009.pem -t [email protected] 'rm -Rfv /home/ubuntu/public/*'
echo "Done delete /home/ubuntu/public/*"
# upload new code
echo "Uploading new code from local to remote"
rsync -ravz --progress -e 'ssh -i /Users/tester2009/.ssh/tester2009.pem' /Users/tester2009/new/master/public/* [email protected]:/home/ubuntu/public/
echo "Done deploy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment