Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 513042f951
Fetching contributors…

Cannot retrieve contributors at this time

executable file 130 lines (103 sloc) 3.993 kb
#!/bin/bash
# Allow VCAP_REPO to be overriden for testing
VCAP_REPO=${VCAP_REPO:-https://github.com/cloudfoundry/vcap.git}
export rvm_trust_rvmrcs_flag=1 # Trust all rmvrcs we find
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) One Click Installer for VMware's Cloud Application Platform!"
echo '-----------------------------------------------------------'
echo ""
echo "Hopefully this will be the last time you type your password"
sudo ls > /dev/null
read -p "Enter the password you want to use for root mysql user: " MYSQL_PASS
read -p "Enter the password you want to use for root postgresql user: " POSTGRESQL_PASS
echo "Installing dependencies"
if [[ $PLATFORM == 'Linux' ]]; then
sudo apt-get update
sudo apt-get -qqy install coreutils autoconf libtool curl git-core ruby bison build-essential zlib1g-dev libssl-dev libreadline5-dev
else
echo "Sorry, we can't install dependencies for your system yet."
fi
# Overide user-supplied mysql & postgresql passwords with random ones
# if we know how to do it on this platform
if [[ $PLATFORM == 'Linux' ]]; then
MYSQL_PASS="$(cat /dev/urandom | tr -dc _A-Z-a-z-0-9 | head -c10)"
POSTGRESQL_PASS="$(cat /dev/urandom | tr -dc _A-Z-a-z-0-9 | head -c10)"
elif [[ $PLATFORM == 'MacOSX' ]]; then
MYSQL_PASS="$(md5 -qs "$(date)")"
sleep 1
POSTGRESQL_PASS="$(md5 -qs "$(date)")"
fi
echo "Patch around .bash_profile issue with RMV"
if [ -f ~/.bashrc ]; then
if [ ! -f ~/.bash_profile ]; then
# rvm install is going to write into .bash_profile in this
# case and short circuit loading of .bashrc so we need to
# create a proper .bash_profile if its missing
echo "# This file is sourced by bash for login shells. The following line" >> ~/.bash_profile
echo "# runs your .bashrc and is recommended by the bash info pages." >> ~/.bash_profile
echo "[[ -f ~/.bashrc ]] && . ~/.bashrc" >> ~/.bash_profile
fi
fi
echo "Installing rvm"
curl -s -k -B https://rvm.beginrescueend.com/install/rvm > /tmp/install_rvm
bash /tmp/install_rvm
rm /tmp/install_rvm
echo "Activate rvm"
if [ "$(id -u)" != "0" ]; then
rvm_path="$HOME/.rvm"
else
rvm_path="/usr/local/rvm"
fi
[[ -s "$rvm_path/scripts/rvm" ]] && source "$rvm_path/scripts/rvm"
type rvm | head -1
# remove rake from default and global gems and instead install manually
rm $rvm_path/gemsets/default.gems
rm $rvm_path/gemsets/global.gems
echo "Installing various rubies"
rvm install 1.9.2-p180
rvm --default 1.9.2-p180
rvm install 1.8.7-p352
# install only rake 0.8.7
rvm use 1.8.7-p352
gem install rake --version '0.8.7' --no-rdoc --no-ri
rvm use 1.9.2-p180
gem install rake --version '0.8.7' --no-rdoc --no-ri
echo "Getting vcap"
[ -d ~/cloudfoundry ] || mkdir ~/cloudfoundry
cd ~/cloudfoundry
[ -d vcap ] || git clone $VCAP_REPO
cd vcap
git submodule update --init
gem install vmc --no-rdoc --no-ri
echo "Setting up vcap."
cd ~/cloudfoundry/vcap
sudo setup/vcap_setup -a -s -p "$MYSQL_PASS" -q "$POSTGRESQL_PASS"
cd ~/cloudfoundry/vcap/services/mysql/config
sed -i.bkup -e "s/pass: root/pass: $MYSQL_PASS/" mysql_node.yml
if [ -d ~/cloudfoundry/vcap/services/postgresql ]; then
cd ~/cloudfoundry/vcap/services/postgresql/config
sed -i.bkup -e "s/9.0/8.4/g" postgresql_gateway.yml
sed -i.bkup -e "s/user: vcap/user: postgres/" -e "s/pass: vcap/pass: $POSTGRESQL_PASS/" postgresql_node.yml
fi
echo "Restarting nginx"
cd ~/cloudfoundry/vcap
sudo cp setup/simple.nginx.conf /etc/nginx/nginx.conf
sudo /etc/init.d/nginx restart
echo "Installing bundler"
cd ~/cloudfoundry/vcap
gem install bundler --no-rdoc --no-ri
rake bundler:install
# don't start up vcap in this shell
# its best to exit the shell and then
# come back in so that the .rvmrc in cloudfoundry/vcap activates correctly
echo 'Success!'
Jump to Line
Something went wrong with that request. Please try again.