Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: licogi/vcap
base: 90e4b7e
...
head fork: licogi/vcap
compare: 95d519e
  • 1 commit
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 25, 2011
@genedna genedna Add a gentoo script 95d519e
Showing with 351 additions and 0 deletions.
  1. +351 −0 setup/vcap_setup_gentoo
View
351 setup/vcap_setup_gentoo
@@ -0,0 +1,351 @@
+#!/bin/bash
+# Copyright (c) 2009-2011 VMware, Inc.
+# Try to detect platform. VCAP installs well on Ubuntu and MacOS X Systems.
+
+OS=`uname -s`
+if [[ $OS == 'Linux' ]]; then
+ PLATFORM='Linux'
+elif [[ $OS == 'Darwin' ]]; then
+ PLATFORM='MacOSX'
+else
+ echo "Unknown System, cancelling setup"
+ exit 1
+fi
+
+echo ""
+echo '-----------------------------------------------------------'
+echo "($PLATFORM) Setup for VMware's Cloud Application Platform!"
+echo '-----------------------------------------------------------'
+echo ""
+
+
+echo "Just hit <enter> to skip any item"
+echo ""
+
+if [ "$(id -u)" != "0" ]; then
+ echo '** Setup must be run as root **'
+ exit 1
+fi
+
+read -p "Setup all components? default: individual components? [y/N]"
+if [[ $REPLY =~ ^[yY]$ ]]; then
+ ALL=true
+fi
+
+# Defaults, done for everyone
+
+echo "Installing default packages"
+if [[ $PLATFORM == 'Linux' ]]; then
+ apt-get install -qqy wget curl libcurl3 libcurl3-dev bison build-essential zlib1g-dev libssl-dev libreadline5-dev libxml2 libxml2-dev libxslt1.1 libxslt1-dev git-core sqlite3 libsqlite3-ruby libsqlite3-dev unzip zip
+fi
+
+if [[ $PLATFORM == 'Linux' ]]; then
+ # Probably should make this something different instead of apt_get
+ echo "Installing Ruby"
+ apt-get install -qqy ruby-full rake
+fi
+
+# This is site/setup specific, can be commented out if not needed.
+# export http_proxy='http://192.168.208.20:3128'
+
+RUBYGEMS_VERSION=1.6.2
+echo "Checking rubygems version"
+if [ "$(gem -v)" != $RUBYGEMS_VERSION ]; then
+ echo "Installing rubygems $RUBYGEMS_VERSION"
+ pushd .
+ cd /tmp
+ wget http://production.cf.rubygems.org/rubygems/rubygems-$RUBYGEMS_VERSION.tgz
+ tar -zxf rubygems-$RUBYGEMS_VERSION.tgz
+ cd rubygems-$RUBYGEMS_VERSION
+ ruby setup.rb
+ if [ -f /usr/local/bin/gem ]; then
+ rm /usr/local/bin/gem
+ fi
+ cd ..
+ rm rubygems-$RUBYGEMS_VERSION.tgz
+ rm -fr rubygems-$RUBYGEMS_VERSION
+ popd
+fi
+ln -sf /usr/bin/gem1.8 /usr/bin/gem
+
+echo "Creating default directories at /var/vcap"
+
+if [ ! -d '/var/vcap' ]; then
+ mkdir /var/vcap
+ mkdir /var/vcap/sys
+ mkdir /var/vcap/sys/log
+ mkdir /var/vcap/shared
+ mkdir /var/vcap/services
+ chmod -R 777 /var/vcap
+fi
+
+if [[ ! "$(bundle -v)" =~ "1.0.10" ]]; then
+ echo "Installing bundler 1.0.10"
+ gem install bundler -v 1.0.10 --no-rdoc --no-ri
+fi
+
+#######################################################################
+
+# Router
+if [[ $ALL != true ]]; then
+ echo ""
+ read -p "Should I do a Router setup? [y/N] "
+ if [[ $REPLY =~ ^[yY]$ ]]; then
+ ROUTER=true
+ fi
+fi
+
+if [[ $ROUTER == true || $ALL == true ]]; then
+
+ echo "Installing Nginx."
+ if [[ $PLATFORM == 'Linux' ]]; then
+ apt-get install -qqy nginx
+ elif [[ $PLATFORM == 'MacOSX' ]]; then
+ echo -e "\033[31mFIXME: Implement for MacOSX \033[0m"
+ fi
+ echo ""
+fi
+
+# CloudController
+if [[ $ALL != true ]]; then
+ read -p "Should I do a CloudController setup? [y/N] "
+ if [[ $REPLY =~ ^[yY]$ ]]; then
+ CC=true
+ fi
+fi
+
+if [[ $CC == true || $ALL == true ]]; then
+ if [[ $PLATFORM == 'Linux' ]]; then
+ read -p "Should I do a production setup as well (Postgres/MySQL)? [y/N] "
+ if [[ $REPLY =~ ^[yY]$ ]]; then
+ echo "Installing PostgreSQL server and support"
+ apt-get install -qqy postgresql
+ echo "Installing pg gems"
+ gem install pg --no-rdoc --no-ri
+ echo ""
+ echo "Installing MySQL server and support"
+ apt-get install -qqy mysql-server ruby-dev libmysql-ruby libmysqlclient-dev
+ echo "Installing mysql gems"
+ gem install mysql --no-rdoc --no-ri
+ echo ""
+ fi
+ elif [[ $PLATFORM == 'MacOSX' ]]; then
+ echo -e "\033[31mFIXME: Implement for MacOSX \033[0m"
+ fi
+
+
+ # note: vcap start runs db:migrate on each cloud boot
+ # no need to run anything during setup
+fi
+
+# DEA
+if [[ $ALL != true ]]; then
+ read -p "Should I do a DEA setup (Java, Ruby, Node, etc)? [y/N] "
+ if [[ $REPLY =~ ^[yY]$ ]]; then
+ DEA=true
+ fi
+fi
+
+if [[ $DEA == true || $ALL == true ]]; then
+ echo "Setting up for support for DEA"
+
+ # lsof support for secure dea monitoring, psmisc is for JeOS, which has killall5, not killall
+ if [[ $PLATFORM == 'Linux' ]]; then
+ apt-get install -qqy lsof psmisc
+ elif [[ $PLATFORM == 'MacOSX' ]]; then
+ echo -e "\033[31mFIXME: Implement for MacOSX \033[0m"
+ fi
+
+ # For Ruby
+ if [[ $PLATFORM == 'Linux' ]]; then
+ apt-get install -qqy librmagick-ruby
+ elif [[ $PLATFORM == 'MacOSX' ]]; then
+ echo -e "\033[31mFIXME: Implement for MacOSX \033[0m"
+ fi
+
+ # Java
+ if [[ $PLATFORM == 'Linux' ]]; then
+ JAVA=`dpkg --get-selections | grep sun-java6`
+ echo $JAVA
+ elif [[ $PLATFORM == 'MacOSX' ]]; then
+ JAVA=`java -version | grep 'build 1.6.0_22'`
+ fi
+
+ if [[ $JAVA == '' ]]; then
+ echo "Installing Sun Java 1.6"
+ if [[ $PLATFORM == 'Linux' ]]; then
+ apt-get install -qqy python-software-properties
+ add-apt-repository "deb http://archive.canonical.com/ lucid partner"
+ apt-get -qqy update
+ apt-get install -qqy curl sun-java6-bin sun-java6-jre sun-java6-jdk
+ elif [[ $PLATFORM == 'MacOSX' ]]; then
+ echo -e "\033[31mFIXME: Implement for MacOSX \033[0m"
+ fi
+ fi
+
+ # Node
+ pushd .
+ cd /tmp
+
+ NODE_VERSION=0.4.5
+
+ if [[ ! `node -v` == 'v'$NODE_VERSION ]]; then
+ wget http://nodejs.org/dist/node-v$NODE_VERSION.tar.gz
+ tar -zxf node-v$NODE_VERSION.tar.gz
+ cd node-v$NODE_VERSION
+ ./configure
+ make
+ make install
+ cd ..
+ rm node-v$NODE_VERSION.tar.gz
+ rm -fr node-v$NODE_VERSION
+ popd
+ fi
+
+ echo "App Platform Support"
+ echo "===================="
+
+ echo -e "\nRuby should now be installed -->"
+ ruby -v
+
+ echo -e "\nJava should now be installed -->"
+ java -version
+
+ echo -e "\nNode should now be installed -->"
+ node -v
+ echo ""
+
+ echo "Setting up Ruby System Gems and Support"
+ if [[ $PLATFORM == 'Linux' ]]; then
+ apt-get install -qqy ruby-dev libmysql-ruby libmysqlclient-dev libpq-dev postgresql-client
+ elif [[ $PLATFORM == 'MacOSX' ]]; then
+ echo -e "\033[31mFIXME: Implement for MacOSX \033[0m"
+ fi
+
+ echo "Installing some default system gems"
+ echo "gem: --no-rdoc --no-ri" > ~/.gemrc
+ gem install rack rake thin sinatra eventmachine
+
+ if [ ! -d '/var/vcap.local' ]; then
+ echo "Creating directory /var/vcap.local"
+ mkdir "/var/vcap.local"
+ chmod 777 "/var/vcap.local"
+ fi
+
+ if [[ $ALL != true ]]; then
+ read -p "Should I do a production setup and secure this system? [y/N] "
+ if [[ $REPLY =~ ^[yY]$ ]]; then
+ # Setup var directory
+ echo "Securing directories and permissions"
+ chmod 755 "/var"
+ chmod -R 700 "/var/vcap/sys"
+ chmod -R 700 "/var/vcap/shared"
+ chmod -R 700 "/var/vcap.local"
+ chmod -R 711 "/var/vcap.local"
+ chmod -R 711 "/var/vcap.local/apps"
+ chmod -R 700 "/tmp"
+ chmod -R 700 "/var/tmp"
+ fi
+ echo ""
+ fi
+fi
+
+###################
+
+echo ""
+echo "Additional Optional Services"
+
+# if you answered no to the production setup
+# question than you should answer yes here for sure
+X=`which mysqld`
+if [ $? != 0 ]; then
+ read -p "Should I add MySQL Server? [y/N] "
+ if [[ $REPLY =~ ^[yY]$ ]]; then
+ echo "Installing MySQL server and support"
+ apt-get install -qqy mysql-server ruby-dev libmysql-ruby libmysqlclient-dev
+ echo "Installing mysql gems"
+ gem install mysql --no-rdoc --no-ri
+ echo ""
+ fi
+fi
+
+REDIS_VERSION=2.2.4
+
+redis_current=`redis-server -v | grep $REDIS_VERSION`
+
+if [[ -z "$redis_current" ]]; then
+ read -p "Should I add Redis Server? [y/N] "
+ if [[ $REPLY =~ ^[yY]$ ]]; then
+ echo "Installing Redis (version $REDIS_VERSION)"
+ pushd .
+ cd /tmp
+ wget --no-check-certificate -O redis_master.tgz http://redis.googlecode.com/files/redis-$REDIS_VERSION.tar.gz
+ tar -zxf redis_master.tgz
+ cd redis-$REDIS_VERSION/src
+ make
+ cp redis-server /usr/bin
+ cp redis-cli /usr/bin
+ cd ../..
+ rm redis_master.tgz
+ rm -fr redis-$REDIS_VERSION
+ popd
+ fi
+else
+ echo "Redis Server (version 2.2.2) is current"
+fi
+
+RABBITMQ_VERSION=2.4.0
+RABBITMQ_VERSION_FULL=2.4.0-1_all
+
+read -p "Should I add RabbitMQ Server? [y/N] "
+if [[ $REPLY =~ ^[yY]$ ]]; then
+ echo "Installing RabbitMQ Server (version $RABBITMQ_VERSION)"
+ pushd .
+ cd /tmp
+ wget http://www.rabbitmq.com/releases/rabbitmq-server/v$RABBITMQ_VERSION/rabbitmq-server_$RABBITMQ_VERSION_FULL.deb
+ dpkg -i rabbitmq-server_$RABBITMQ_VERSION_FULL.deb
+ rm rabbitmq-server_$RABBITMQ_VERSION_FULL.deb
+ popd
+fi
+
+MONGODB_VERSION=1.8.1
+
+mongodb_current=`mongod --version | grep $MONGODB_VERSION`
+
+if [[ -z "$mongodb_current" ]]; then
+ read -p "Should I add the MongoDB Server? [y/N] "
+ if [[ $REPLY =~ ^[yY]$ ]]; then
+ echo "Installing MongoDB Server (version $MONGODB_VERSION)"
+ if [[ `uname -a` =~ "x86_64" ]] ; then
+ mongodb="mongodb-linux-x86_64-$MONGODB_VERSION"
+ echo "Installing 64-bit version"
+ else
+ mongodb="mongodb-linux-i686-$MONGODB_VERSION"
+ echo "Installing 32-bit version"
+ fi
+
+ pushd .
+ cd /tmp
+ wget http://fastdl.mongodb.org/linux/$mongodb.tgz
+ tar -zxvf $mongodb.tgz
+ cp $mongodb/bin/* /usr/bin
+ rm $mongodb.tgz
+ rm -fr $mongodb
+ popd
+ fi
+else
+ echo "MongoDB Server (version $MONGODB_VERSION) is current"
+fi
+
+echo -e "\n\nYou should be good to go!!\n\n"
+ruby -v
+
+echo -n "Gem version: "
+gem -v
+
+echo -e "\nGem List"
+gem list --local
+
+echo -e "\n\nBYE!\n\n"
+
+

No commit comments for this range

Something went wrong with that request. Please try again.