boot.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/bin/bash
  2. cd /root
  3. if test ! -e "reset.sh" ; then
  4. cat > "reset.sh" << FIN
  5. #!/bin/bash
  6. curl https://s3.amazonaws.com/finalsclub.org/boot.sh | sh
  7. FIN
  8. chmod 500 reset.sh
  9. fi
  10. echo "Booting" `date`
  11. yes | yum --nogpgcheck install gcc-c++
  12. yes | yum --nogpgcheck install openssl-devel
  13. yes | yum --nogpgcheck install make
  14. yes | yum --nogpgcheck install git
  15. yes | yum --nogpgcheck install sqlite-devel
  16. yes | yum --nogpgcheck install mysql-server
  17. # /etc/init.d/mysqld start
  18. # /usr/bin/mysqladmin -u root password 'foobarbazquX'
  19. # install mongodb
  20. mongover="1.8.2"
  21. if test ! -e mongodb.tgz ; then
  22. curl http://fastdl.mongodb.org/linux/mongodb-linux-i686-$mongover.tgz > mongodb-linux-i686-$mongover.tgz
  23. tar xzf mongodb-linux-i686-$mongover.tgz
  24. cd mongodb-linux-i686-$mongover/bin
  25. chmod a+rx *
  26. chmod uo-w *
  27. cp -f * /usr/local/bin
  28. echo "/usr/local/bin &> /var/log/mongod.log &" >> /etc/rc.local
  29. mkdir -p /data/db
  30. /usr/local/bin/mongod -v --rest --replSet finalsclubset &> /var/log/mongod.log &
  31. ## optional arbiter start command
  32. ## mkdir -p /data/arbiterdb
  33. ## /usr/local/bin/mongod -v --dbpath /data/arbiterdb --port 27021 --rest --replSet finalsclubset &> /var/log/mongod-arbiter.log &
  34. fi
  35. # install node
  36. nodever="v0.4.10"
  37. if test ! -e node-$nodever ; then
  38. curl http://nodejs.org/dist/node-$nodever.tar.gz > node-$nodever.tar.gz
  39. tar xzvf node-$nodever.tar.gz
  40. cd node-$nodever
  41. ./configure
  42. make
  43. make install
  44. fi
  45. # install npm
  46. if test ! -e npm ; then
  47. git clone http://github.com/isaacs/npm.git
  48. cd npm
  49. sudo make install
  50. cd ..
  51. fi
  52. npm install nodemon -g
  53. npm install forever -g
  54. ## make it easier for root to run node
  55. cd /usr/bin
  56. ln -sf /usr/local/bin/node .
  57. ln -sf /usr/local/bin/forever .
  58. ## haproxy install (optional)
  59. # assumes this script is running as root
  60. mkdir /usr/local/haproxy
  61. cd /usr/local/haproxy
  62. wget http://haproxy.1wt.eu/download/1.4/bin/haproxy-1.4.17-pcre-40kses-linux-i586.notstripped.gz
  63. gunzip haproxy-1.4.17-pcre-40kses-linux-i586.notstripped.gz
  64. ln -sf haproxy-1.4.17-pcre-40kses-linux-i586.notstripped haproxy
  65. chmod 770 haproxy*
  66. wget https://s3.amazonaws.com/finalsclub.org/haproxy.cfg
  67. chmod 660 haproxy.cfg
  68. ## command to start haproxy (from /usr/local/haproxy dir)
  69. # sudo /usr/local/haproxy/haproxy -f /usr/local/haproxy/haproxy.cfg -p /var/run/haproxy.pid &
  70. curl https://s3.amazonaws.com/finalsclub.org/start.sh | sudo -u ec2-user sh