sandbox.sh 2.1 KB
Newer Older
1
#!/bin/sh
e0d committed
2 3 4
##
## Installs the pre-requisites for running edX on a single Ubuntu 12.04
## instance.  This script is provided as a convenience and any of these
5 6 7
## steps could be executed manually.
##
## Note that this script requires that you have the ability to run
e0d committed
8 9
## commands as root via sudo.  Caveat Emptor!
##
e0d committed
10 11 12 13 14

##
## Sanity check
##
if [[ ! "$(lsb_release -d | cut -f2)" =~ $'Ubuntu 12.04' ]]; then
15
   echo "This script is only known to work on Ubuntu 12.04, exiting...";
e0d committed
16 17 18 19
   exit;
fi

##
20 21 22 23 24 25
## Set ppa repository source for gcc/g++ 4.8 in order to install insights properly
##
sudo apt-get install -y python-software-properties
sudo add-apt-repository ppa:ubuntu-toolchain-r/test

##
26 27 28 29 30 31
## Update and Upgrade apt packages
##
sudo apt-get update -y
sudo apt-get upgrade -y

##
e0d committed
32 33
## Install system pre-requisites
##
34
sudo apt-get install -y build-essential software-properties-common python-software-properties curl git-core libxml2-dev libxslt1-dev python-pip python-apt python-dev libxmlsec1-dev libfreetype6-dev swig gcc-4.8 g++-4.8
e0d committed
35
sudo pip install --upgrade pip
36
sudo -H pip install --upgrade virtualenv
e0d committed
37

38 39 40 41 42 43
##
## Update alternatives so that gcc/g++ 4.8 is the default compiler
##
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50

44 45 46 47 48 49
## Did we specify an openedx release?
if [ -n "$OPENEDX_RELEASE" ]; then
  EXTRA_VARS="-e edx_platform_version=$OPENEDX_RELEASE \
    -e certs_version=$OPENEDX_RELEASE \
    -e forum_version=$OPENEDX_RELEASE \
    -e xqueue_version=$OPENEDX_RELEASE \
50
    -e configuration_version=$OPENEDX_RELEASE \
51 52 53
  "
  CONFIG_VER=$OPENEDX_RELEASE
else
54
  CONFIG_VER="master"
55 56
fi

e0d committed
57 58 59 60
##
## Clone the configuration repository and run Ansible
##
cd /var/tmp
61 62 63
git clone https://github.com/edx/configuration
cd configuration
git checkout $CONFIG_VER
e0d committed
64 65 66 67 68

##
## Install the ansible requirements
##
cd /var/tmp/configuration
69
sudo -H pip install -r requirements.txt
e0d committed
70 71 72 73

##
## Run the edx_sandbox.yml playbook in the configuration/playbooks directory
##
74
cd /var/tmp/configuration/playbooks && sudo ansible-playbook -c local ./edx_sandbox.yml -i "localhost," $EXTRA_VARS