Advertisement
huutho_96

Deploy Master

Dec 29th, 2018
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.12 KB | None | 0 0
  1.  
  2. apt-get update -y
  3.  
  4. # Shared storage
  5. ifconfig eth1 up
  6. ip addr add 192.168.0.1/24 dev eth1
  7. apt-get install nfs-kernel-server nfs-common -y
  8.  
  9. mkdir /opt/share
  10. chown nobody:nogroup /opt/share
  11. chmod 755 /opt/share
  12.  
  13. echo "/opt/share           192.168.0.2(rw,sync,no_subtree_check)" >> /etc/exports
  14. service nfs-kernel-server restart
  15.  
  16.  
  17.  
  18. # install require package
  19. apt-get update -y
  20. apt-get install build-essential checkinstall -y
  21. apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev -y
  22.  
  23. # download and install Python 3.5.2
  24. cd /usr/src
  25. wget "https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz"
  26. tar xzf Python-3.5.2.tgz
  27.  
  28. cd /usr/src/Python-3.5.2
  29. ./configure
  30. make altinstall
  31. python3.5 -V
  32. pip3.5 -V
  33.  
  34.  
  35. # Install git
  36. apt-get install git -y
  37.  
  38. # Install node
  39. apt-get update
  40. apt-get install curl software-properties-common -y
  41. curl -sL https://deb.nodesource.com/setup_10.x | bash -
  42. apt-get install -y nodejs
  43. node -v
  44.  
  45. # Install bower
  46. npm install pm2 -g --allow-root
  47.  
  48. # Install pm2
  49. npm install pm2 -g
  50. pm2 list
  51.  
  52.  
  53.  
  54. # Install mongodb
  55. apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
  56. echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list
  57. apt-get update
  58. apt-get install -y mongodb-org
  59. service mongod start
  60.  
  61. # Install Redis server
  62. apt-get update
  63. apt-get install build-essential -y
  64. apt-get install tcl8.5 -y
  65. wget http://download.redis.io/releases/redis-stable.tar.gz
  66. tar xzf redis-stable.tar.gz
  67. cd redis-stable
  68. make
  69. make test
  70. make install
  71. cd utils
  72. ./install_server.sh
  73. service redis_6379 start
  74. update-rc.d redis_6379 defaults
  75. cd ~
  76.  
  77.  
  78. # chown ubuntu:ubuntu /home/ubuntu/.pm2/rpc.sock /home/ubuntu/.pm2/pub.sock
  79.  
  80.  
  81.  
  82. # Install laravel
  83. cd ~
  84. apt-get install curl -y
  85. export LANG=C.UTF-8
  86. apt-get install nginx php5-fpm -y
  87. apt-get install zip unzip -y
  88. apt-get install python-software-properties -y
  89. apt-get install php5 php5-mcrypt php5-gd apache2 libapache2-mod-php5 mysql-server php5-mysql -y
  90. curl -sS https://getcomposer.org/installer | php
  91. mv composer.phar /usr/local/bin/composer
  92.  
  93. # Install nginx
  94. apt-get install nginx
  95.  
  96.  
  97.  
  98. mkdir /var/code
  99. # Init git hook GUI
  100. mkdir /var/code/medusa_gui.git -p
  101. mkdir /var/code/medusa_gui_src -p
  102. cd /var/code/medusa_gui.git
  103. git init --bare
  104.  
  105. touch /var/code/medusa_gui.git/hooks/post-receive
  106. chmod 755 /var/code/medusa_gui.git/hooks/post-receive
  107.  
  108. echo "#!/bin/bash" >> /var/code/medusa_gui.git/hooks/post-receive
  109. echo "echo 'post-receive: Triggered.'" >> /var/code/medusa_gui.git/hooks/post-receive
  110. echo "echo 'post-receive: git check out…'" >> /var/code/medusa_gui.git/hooks/post-receive
  111. echo "git --git-dir=/var/code/medusa_gui.git --work-tree=/var/code/medusa_gui_src checkout deploy-gui -f" >> /var/code/medusa_gui.git/hooks/post-receive
  112. echo "echo 'post-receive: install project…'" >> /var/code/medusa_gui.git/hooks/post-receive
  113. echo "cd /var/code/medusa_gui_src/GUI && npm install && bower install --allow-root && pm2 start index.js --name=GUI" >> /var/code/medusa_gui.git/hooks/post-receive
  114.  
  115.  
  116.  
  117. # Init git hook master
  118. mkdir /var/code/medusa_master.git -p
  119. mkdir /var/code/medusa_master_src -p
  120. cd /var/code/medusa_master.git
  121. git init --bare
  122.  
  123. touch /var/code/medusa_master.git/hooks/post-receive
  124. chmod 755 /var/code/medusa_master.git/hooks/post-receive
  125.  
  126. echo "#!/bin/bash" >> /var/code/medusa_master.git/hooks/post-receive
  127. echo "echo 'post-receive: Triggered.'" >> /var/code/medusa_master.git/hooks/post-receive
  128. echo "echo 'post-receive: git check out…'" >> /var/code/medusa_master.git/hooks/post-receive
  129. echo "git --git-dir=/var/code/medusa_master.git --work-tree=/var/code/medusa_master_src checkout deploy-master -f" >> /var/code/medusa_master.git/hooks/post-receive
  130. echo "echo 'post-receive: install project…'" >> /var/code/medusa_master.git/hooks/post-receive
  131. echo "cd /var/code/medusa_master_src/Crawler && pip3.5 install --user -r requirement.txt && pm2 start master.py --interpreter=python3.5 --name=Master" >> /var/code/medusa_master.git/hooks/post-receive
  132.  
  133.  
  134.  
  135.  
  136. # Init git hook master
  137. mkdir /var/code/medusa_resource.git -p
  138. mkdir /var/code/medusa_resource_src -p
  139. cd /var/code/medusa_resource.git
  140. git init --bare
  141.  
  142. touch /var/code/medusa_resource.git/hooks/post-receive
  143. chmod 755 /var/code/medusa_resource.git/hooks/post-receive
  144.  
  145. echo "#!/bin/bash" >> /var/code/medusa_resource.git/hooks/post-receive
  146. echo "echo 'post-receive: Triggered.'" >> /var/code/medusa_resource.git/hooks/post-receive
  147. echo "echo 'post-receive: git check out…'" >> /var/code/medusa_resource.git/hooks/post-receive
  148. echo "git --git-dir=/var/code/medusa_resource.git --work-tree=/var/code/medusa_resource_src checkout deploy-resource -f" >> /var/code/medusa_resource.git/hooks/post-receive
  149. echo "echo 'post-receive: install project…'" >> /var/code/medusa_resource.git/hooks/post-receive
  150. echo "cd /var/code/medusa_resource_src/File && composer update && php artisan key:generate && pm2 start artisan --name Resource --interpreter php -- queue:work --daemon" >> /var/code/medusa_resource.git/hooks/post-receive
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement