Advertisement
huutho_96

Deploy Slave

Dec 23rd, 2018
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.23 KB | None | 0 0
  1.  
  2. sudo apt-get update -y
  3.  
  4. # install ssh
  5. sudo apt-get install openssh-server openssh-client -y
  6. sudo /etc/init.d/ssh restart
  7.  
  8. # add key
  9. sudo mkdir $HOME/.ssh
  10. touch $HOME/.ssh/authorized_keys
  11. sudo chmod 777 $HOME/.ssh/authorized_keys
  12. echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD0TMU5h2Ax+YOnC5el355b0gof8QdQyZsFd3dNXfIyfVxvJ89pb1LDS042sfgAerW9+hJ7HMST0HvLcN89EHXlG5VBRlmdO1bqZr+U0Fr7jkz7Bb5B4UYxxKB214URT8BYlzCHnCn1iSOZr3069BoHNmaIEJHydkOPxtYCalClT/+LrZX55g9m9BH+bcfaOIVcCKKSNz1H74tiXT5JRhUmfgVbO8oqbeIP/L9Mn1lIpa76A+M3lCjotOAR6wMZTp+VvljpLg4fDkjp0aCf6vMggLe0M45Y5M2+rfdUO7plYh9jUGpaX/QXai4/OWowistj1Z75kKF7pe7o9fpnVW2F Louis Nguyen@DESKTOP-KUB139L" >> $HOME/.ssh/authorized_keys
  13.  
  14. # install require package
  15. sudo apt-get update
  16. sudo apt-get install build-essential checkinstall -y
  17. sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev -y
  18.  
  19. # download and install Python 3.5.2
  20. cd /usr/src
  21. wget "https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz"
  22. tar xzf Python-3.5.2.tgz
  23.  
  24. cd /usr/src/Python-3.5.2
  25. sudo ./configure
  26. sudo make altinstall
  27. python3.5 -V
  28. pip3.5 -V
  29.  
  30.  
  31. # Install git
  32. sudo apt-get install git -y
  33.  
  34. # Install node
  35. sudo apt-get update
  36. curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
  37. sudo apt-get install -y nodejs
  38. node -v
  39.  
  40. # Install pm2
  41. npm install pm2 -g
  42.  
  43.  
  44. # Init git hook
  45. sudo mkdir /var/code
  46. sudo chmod 777 /var/code
  47. mkdir /var/code/medusa.git -p
  48. mkdir /var/code/medusa_src -p
  49. cd /var/code/medusa.git
  50. git init --bare
  51.  
  52. touch /var/code/medusa.git/hooks/post-receive
  53. sudo chmod 755 /var/code/medusa.git/hooks/post-receive
  54.  
  55. echo "#!/bin/bash" >> /var/code/medusa.git/hooks/post-receive
  56. echo "echo 'post-receive: Triggered.'" >> /var/code/medusa.git/hooks/post-receive
  57. echo "echo 'post-receive: git check out…'" >> /var/code/medusa.git/hooks/post-receive
  58. echo "git --git-dir=/var/code/medusa.git --work-tree=/var/code/medusa_src checkout deploy-crawler -f" >> /var/code/medusa.git/hooks/post-receive
  59. echo "echo 'post-receive: install project…'" >> /var/code/medusa.git/hooks/post-receive
  60. echo "cd /var/code/medusa_src/Crawler && pip3.5 install --user -r requirement.txt && pm2 start slave.py --interpreter=python3.5 --name=Slave"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement