Commit f6a3f449 by Edward Zarecor

Merge pull request #2605 from edx/e0d/update-python-ppa

Add our PPA in bootstrap script
parents ae3f451e aeafe417
...@@ -13,23 +13,23 @@ ...@@ -13,23 +13,23 @@
set -xe set -xe
if [[ -z "$ANSIBLE_REPO" ]]; then if [[ -z "${ANSIBLE_REPO}" ]]; then
ANSIBLE_REPO="https://github.com/edx/ansible.git" ANSIBLE_REPO="https://github.com/edx/ansible.git"
fi fi
if [[ -z "$ANSIBLE_VERSION" ]]; then if [[ -z "${ANSIBLE_VERSION}" ]]; then
ANSIBLE_VERSION="master" ANSIBLE_VERSION="master"
fi fi
if [[ -z "$CONFIGURATION_REPO" ]]; then if [[ -z "${CONFIGURATION_REPO}" ]]; then
CONFIGURATION_REPO="https://github.com/edx/configuration.git" CONFIGURATION_REPO="https://github.com/edx/configuration.git"
fi fi
if [[ -z "$CONFIGURATION_VERSION" ]]; then if [[ -z "${CONFIGURATION_VERSION}" ]]; then
CONFIGURATION_VERSION="master" CONFIGURATION_VERSION="master"
fi fi
if [[ -z "UPGRADE_OS" ]]; then if [[ -z "${UPGRADE_OS}" ]]; then
UPGRADE_OS=false UPGRADE_OS=false
fi fi
...@@ -41,6 +41,9 @@ VIRTUAL_ENV="/tmp/bootstrap" ...@@ -41,6 +41,9 @@ VIRTUAL_ENV="/tmp/bootstrap"
PYTHON_BIN="${VIRTUAL_ENV}/bin" PYTHON_BIN="${VIRTUAL_ENV}/bin"
ANSIBLE_DIR="/tmp/ansible" ANSIBLE_DIR="/tmp/ansible"
CONFIGURATION_DIR="/tmp/configuration" CONFIGURATION_DIR="/tmp/configuration"
EDX_PPA="deb http://ppa.edx.org precise main"
EDX_PPA_KEY_SERVER="pgp.mit.edu"
EDX_PPA_KEY_ID="69464050"
cat << EOF cat << EOF
****************************************************************************** ******************************************************************************
...@@ -56,12 +59,18 @@ CONFIGURATION_VERSION="${CONFIGURATION_VERSION}" ...@@ -56,12 +59,18 @@ CONFIGURATION_VERSION="${CONFIGURATION_VERSION}"
EOF EOF
if [[ $(id -u) -ne 0 ]] ; then if [[ $(id -u) -ne 0 ]] ;then
echo "Please run as root"; echo "Please run as root";
exit 1; exit 1;
fi fi
if ! grep -q -e 'Precise Pangolin' -e 'Trusty Tahr' /etc/os-release; then if grep -q 'Precise Pangolin' /etc/os-release
then
SHORT_DIST="precise"
elif grep -q 'Trusty Tahr' /etc/os-release
then
SHORT_DIST="trusty"
else
cat << EOF cat << EOF
This script is only known to work on Ubuntu Precise and Trusty, This script is only known to work on Ubuntu Precise and Trusty,
...@@ -72,11 +81,13 @@ EOF ...@@ -72,11 +81,13 @@ EOF
exit 1; exit 1;
fi fi
EDX_PPA="deb http://ppa.edx.org ${SHORT_DIST} main"
# Upgrade the OS # Upgrade the OS
apt-get update -y apt-get update -y
apt-key update -y apt-key update -y
if [ "$UPGRADE_OS" = true ]; then if [ "${UPGRADE_OS}" = true ]; then
echo "Upgrading the OS..." echo "Upgrading the OS..."
apt-get upgrade -y apt-get upgrade -y
fi fi
...@@ -88,7 +99,8 @@ apt-get install -y software-properties-common python-software-properties ...@@ -88,7 +99,8 @@ apt-get install -y software-properties-common python-software-properties
add-apt-repository -y ppa:git-core/ppa add-apt-repository -y ppa:git-core/ppa
# Add python PPA # Add python PPA
add-apt-repository -y ppa:fkrull/deadsnakes-python2.7 apt-key adv --keyserver "${EDX_PPA_KEY_SERVER}" --recv-keys "${EDX_PPA_KEY_ID}"
add-apt-repository -y "${EDX_PPA}"
# Install python 2.7 latest, git and other common requirements # Install python 2.7 latest, git and other common requirements
# NOTE: This will install the latest version of python 2.7 and # NOTE: This will install the latest version of python 2.7 and
...@@ -100,12 +112,12 @@ pip install --upgrade pip setuptools ...@@ -100,12 +112,12 @@ pip install --upgrade pip setuptools
# pip moves to /usr/local/bin when upgraded # pip moves to /usr/local/bin when upgraded
PATH=/usr/local/bin:${PATH} PATH=/usr/local/bin:${PATH}
pip install virtualenv==${VIRTUAL_ENV_VERSION} pip install virtualenv=="${VIRTUAL_ENV_VERSION}"
# create a new virtual env # create a new virtual env
/usr/local/bin/virtualenv ${VIRTUAL_ENV} /usr/local/bin/virtualenv "${VIRTUAL_ENV}"
PATH=${PYTHON_BIN}:${PATH} PATH="${PYTHON_BIN}":${PATH}
# Install the configuration repository to install # Install the configuration repository to install
# edx_ansible role # edx_ansible role
...@@ -114,13 +126,13 @@ cd ${CONFIGURATION_DIR} ...@@ -114,13 +126,13 @@ cd ${CONFIGURATION_DIR}
git checkout ${CONFIGURATION_VERSION} git checkout ${CONFIGURATION_VERSION}
make requirements make requirements
cd ${CONFIGURATION_DIR}/playbooks/edx-east cd "${CONFIGURATION_DIR}"/playbooks/edx-east
${PYTHON_BIN}/ansible-playbook edx_ansible.yml -i '127.0.0.1,' -c local -e "configuration_version=${CONFIGURATION_VERSION}" "${PYTHON_BIN}"/ansible-playbook edx_ansible.yml -i '127.0.0.1,' -c local -e "configuration_version=${CONFIGURATION_VERSION}"
# cleanup # cleanup
rm -rf ${ANSIBLE_DIR} rm -rf "${ANSIBLE_DIR}"
rm -rf ${CONFIGURATION_DIR} rm -rf "${CONFIGURATION_DIR}"
rm -rf ${VIRTUAL_ENV} rm -rf "${VIRTUAL_ENV}"
cat << EOF cat << EOF
****************************************************************************** ******************************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment