Advertisement
Guest User

Untitled

a guest
Jul 10th, 2017
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. ######################
  3. ## LOCAL OPERATIONS ##
  4. ######################
  5.  
  6. deploycontent=$(readlink -f '../shlink.io_website_deploy')
  7. projectdir=$(pwd)
  8.  
  9. # Copy everything to parent directory
  10. rm -rf "$deploycontent"
  11. cp -R . "$deploycontent"
  12. cd "$deploycontent"
  13.  
  14. # Install dependencies
  15. rm -rf vendor
  16. rm -rf composer.lock
  17. composer self-update
  18. composer install --no-dev --optimize-autoloader --prefer-dist --no-interaction
  19.  
  20. # Run Grunt tasks
  21. rm -rf node_modules
  22. npm install
  23. grunt
  24.  
  25. # Remove everything that shouldn't be deployed
  26. rm -rf node_modules
  27. rm -rf .git*
  28. rm -rf .idea
  29. rm -rf composer.*
  30. rm -rf package.json
  31. rm -rf README.md
  32. rm -rf LICENSE
  33. rm -rf Gruntfile.js
  34. rm -rf config/autoload/local.php
  35. rm -rf config/autoload/local.php.dist
  36. rm -rf config/autoload/*.local.php
  37. rm -rf config/autoload/*.local.php.dist
  38. rm -rf build
  39. rm -rf phpunit.xml.dist
  40. rm -rf phpcs.xml
  41.  
  42.  
  43. #######################
  44. ## REMOTE OPERATIONS ##
  45. #######################
  46.  
  47. # Deploy application
  48. remotepath='/home/alejandro/apps/shlink.io/website'
  49. temp="$remotepath-temp"
  50. now=`date +'%Y-%m-%d_%T'`
  51. ssh root@shlink.io "mkdir $temp"
  52. rsync -avz --no-owner --no-group ./ root@shlink.io:${temp}
  53. ssh root@shlink.io "mv $remotepath $remotepath-$now"
  54. ssh root@shlink.io "mv $temp $remotepath"
  55.  
  56. # Set write access
  57. ssh root@shlink.io "chown www-data:www-data $remotepath/data/cache"
  58.  
  59. # Restart nginx and php-fpm
  60. ssh root@shlink.io "service php7.1-fpm restart"
  61. ssh root@shlink.io "service nginx restart"
  62.  
  63. # Delete deploy artifacts
  64. ssh root@shlink.io "rm $remotepath/data/cache/.gitignore"
  65. ssh root@shlink.io "rm $remotepath/deploy.sh"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement