-
Notifications
You must be signed in to change notification settings - Fork 1
Setup Script
#!/bin/bash
OS=uname
AWSOS=''
HOME=~
if [ whoami != "root" ]; then
echo "ERROR: This script must be run as root or with sudo."
exit 2
fi
apt-get install git-core python2.7
apt-get install python-pip python-dev build-essential libmysqlclient-dev libxslt1.1 libxslt1-dev python-pyopenssl
AWS_OS="linux"
else
echo "ERROR: Operating system, ${OS}, not supported."
exit 1
fi
if [ ! -d "$HOME/.ssh/" ]; then
# User needs an ssh key
echo "Enter your email address: "
read emailaddr
ssh-keygen -t rsa -C "$emailaddr"
fi
export WORKON_HOME="$HOME/Envs" export PROJECT_NAME="SecondFunnel" mkdir -p $WORKON_HOME
cd $WORKON_HOME git clone --recursive http://github.com/Willet/SecondFunnel.git $PROJECT_NAME
sudo pip install virtualenv sudo pip install virtualenvwrapper
source /usr/local/bin/virtualenvwrapper.sh
mkvirtualenv
echo ' ' >> ~/.bash_profile
echo '# Workon is virtualenv-wrapper specific, so we source it to allow the current user' >> ~/.bash_profile
echo '# to use it.' >> ~/.bash_profile
echo 'source /usr/local/bin/virtualenvwrapper.sh' >> /.bash_profile
echo 'export WORKON_HOME=/Envs' >> ~/.bash_profile
USER=$(whoami | awk '{print $1}') sudo chown -R $USER $WORKON_HOME/$PROJECT_NAME
#add postactivates echo 'export GEM_HOME="$VIRTUAL_ENV/gems"' >> $WORKON_HOME/postactivate echo 'export GEM_PATH=""' >> $WORKON_HOME/postactivate echo 'export PATH=$PATH:$GEM_HOME/bin' >> $WORKON_HOME/postactivate
cd $WORKON_HOME source $WORKON_HOME/$PROJECT_NAME/bin/activate
sudo pip install -r $WORKON_HOME/$PROJECT_NAME/requirements/dev.txt
#ruby sudo gem install bundler sudo bundle install
if [ ${OS} = "Linux" ]; then
URL='http://www.rabbitmq.com/releases/rabbitmq-server/v3.1.1/rabbitmq-server_3.1.1-1_all.deb'
FILE=mktemp ;
wget "$URL" -qO $FILE && dpkg -i $FILE
rm $FILE
fi
mkdir AWS-ElasticBeanstalk-CLI cd AWS-ElasticBeanstalk-CLI curl "https://s3.amazonaws.com/elasticbeanstalk/cli/AWS-ElasticBeanstalk-CLI-2.4.0.zip" -o AWS-CLI.zip unzip AWS-CLI.zip > /dev/null rm AWS-CLI.zip cp -r AWS-ElasticBeanstalk-CLI-2.4.0/* . echo "export PATH=$PATH:$WORKON_HOME/AWS-ElasticBeanstalk-CLI/eb/$AWS_OS/python2.7/" >> $WORKON_HOME/postactivate export PATH=$PATH:"$WORKON_HOME/AWS-ElasticBeanstalk-CLI/eb/$AWS_OS/python2.7/" cd $WORKON_HOME/$PROJECT_NAME sh $WORKON_HOME/AWS-ElasticBeanstalk-CLI/AWSDevTools/Linux/AWSDevTools-RepositorySetup.sh cat ~/.ssh/id_rsa.pub >> ssh_keys
sudo chown -R $USER $WORKON_HOME/AWS-ElasticBeanstalk-CLI sudo chown -R $USER $WORKON_HOME/$PROJECT_NAME
echo "Enter your AWS(Amazon Web Services) username: " read $AWS_USERNAME echo "Enter your AWS(Amazon Web Services) password: " read -s $AWS_PASSWORD echo "AWSAccessKeyId = $AWS_USERNAME" >> aws_credential_file echo "AWSSecretKey = $AWS_PASSWORD" >> aws_credential_file echo 'secondfunnel-dev_RdsMasterPassword = gfhjkmlkzHLC' >> aws_credential_file sudo chown $USER aws_credential_file git aws.config
eb status python manage.py syncdb && python manage.py migrate
cd $WORKON_HOME git clone http://github.com/Willet/SecondFunnel-Themes.git sudo chown -R $USER $WORKON_HOME/SecondFunnel-Themes cd $WORKON_HOME/$PROJECT_NAME
fixtures=( "./apps/assets/fixtures/init_dev.json" "./apps/pinpoint/fixtures/init_dev.json" "./secondfunnel/fixtures/init_dev.json" "apps/analytics/fixtures/data.json" ) for fixture in "${fixtures[@]}" do python manage.py loaddata $fixture done
cp scripts/runserver.sh runserver chmod a+x runserver ./runserver start echo "Setup complete."