Commit 6d3c62b2 by Han Su Kim

Merge pull request #2766 from edx/han/Vagrantfile

Removing Vagrantfile, no longer used, please see configuration repo
parents a1dc347c 9bccb3e4
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.network :forwarded_port, guest: 8000, host: 9000
config.vm.network :forwarded_port, guest: 8001, host: 9001
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network :private_network, ip: "192.168.20.40"
nfs_setting = RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/
config.vm.synced_folder ".", "/opt/edx/edx-platform", id: "vagrant-root", :nfs => nfs_setting
# Make it so that network access from the vagrant guest is able to
# use SSH private keys that are present on the host without copying
# them into the VM.
config.ssh.forward_agent = true
config.vm.provider :virtualbox do |vb|
# Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "2048"]
# This setting makes it so that network access from inside the vagrant guest
# is able to resolve DNS using the hosts VPN connection.
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
config.vm.provision :shell, :path => "scripts/install-acceptance-req.sh"
config.vm.provision :shell, :path => "scripts/vagrant-provisioning.sh"
end
#!/usr/bin/env bash
# Install all the requirements for running the
# acceptance test suite and the JavaScript
# unit test suite.
#
# Requires 32-bit Ubuntu
# Exit if any commands return a non-zero status
set -e
sudo apt-get update
sudo apt-get install unzip
# Install xvfb
if [ -z `command -v xvfb` ]; then
echo "Installing Xvfb..."
sudo apt-get install -y xvfb
# Install the xvfb upstart script
sudo cat > /etc/init/xvfb.conf <<END
description "Xvfb X Server"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
exec /usr/bin/Xvfb :99 -screen 0 1024x768x24
END
cat >> .bashrc <<END
# Set the display to the virtual frame buffer (Xvfb)
export DISPLAY=:99
END
else
echo "Already installed; skipping."
fi
# Ensure that xvfb is running
sudo start xvfb 2> /dev/null || sudo restart xvfb 2> /dev/null || echo "Cannot start xvfb"
# Move to a temp directory so we can download things
cd /var/tmp
# Install Chrome
echo "Downloading Google Chrome..."
if [ -z `command -v google-chrome` ]; then
wget --quiet https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb
sudo dpkg -i google-chrome*.deb 2> /dev/null || true
sudo apt-get -f -y install
else
echo "Already installed; skipping."
fi
# Install ChromeDriver
echo "Installing ChromeDriver..."
if [ -z `command -v chromedriver` ]; then
wget --quiet https://chromedriver.googlecode.com/files/chromedriver_linux32_2.3.zip
unzip chromedriver_linux32_2.3.zip
sudo mv chromedriver /usr/local/bin/chromedriver
sudo chmod go+rx /usr/local/bin/chromedriver
else
echo "Already installed; skipping."
fi
# Install Firefox
echo "Installing Firefox..."
sudo apt-get -y install firefox
# Install dbus (required for FF)
sudo apt-get -y install dbus-x11
# Install PhantomJS
echo "Installing PhantomJS..."
if [ -z `command -v phantomjs` ]; then
wget --quiet "https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-i686.tar.bz2"
tar -xjf phantomjs-1.9.1-linux-i686.tar.bz2
sudo mv phantomjs-1.9.1-linux-i686/bin/phantomjs /usr/local/bin/phantomjs
else
echo "Already installed; skipping."
fi
exit 0
#!/bin/bash -e
#
# Copyright (C) 2013 edX <info@edx.org>
#
# Authors: Xavier Antoviaque <xavier@antoviaque.org>
# David Baumgold <david@davidbaumgold.com>
# Yarko Tymciurak <yarkot1@gmail.com>
#
# This software's license gives you freedom; you can copy, convey,
# propagate, redistribute and/or modify this program under the terms of
# the GNU Affero General Public License (AGPL) as published by the Free
# Software Foundation (FSF), either version 3 of the License, or (at your
# option) any later version of the AGPL published by the FSF.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
# General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program in a file in the toplevel directory called
# "AGPLv3". If not, see <http://www.gnu.org/licenses/>.
###############################################################################
# vagrant-provisioning.sh:
#
# Script to setup base environment on Vagrant, based on `precise32` image
# Runs ./scripts/create-dev-env.sh for the actual setup
#
# This script is ran by `$ vagrant up`, see the README for more explanations
on_create()
{
# APT - Packages ##############################################################
apt-get update
apt-get install -y python-software-properties vim
# Curl - No progress bar ######################################################
[[ -f ~vagrant/.curlrc ]] || echo "silent show-error" > ~vagrant/.curlrc
chown vagrant.vagrant ~vagrant/.curlrc
# SSH - Known hosts ###########################################################
# Github
([[ -f ~vagrant/.ssh/known_hosts ]] && grep "zBX7bKA= ssh" ~vagrant/.ssh/known_hosts) || {
echo "|1|4DtBcMsTM4zgl/jTS7h3ZkmS/Vc=|XkRnn2xEhr8ixOxeskJAzBX7bKA= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> ~vagrant/.ssh/known_hosts
}
([[ -f ~vagrant/.ssh/known_hosts ]] && grep "jO3J5bvw= ssh" ~vagrant/.ssh/known_hosts) || {
echo "|1|9rANf/qOAPgKH/TXpGuZCAgGxMs=|x9VYWEDI8kiotbhhNXqjO3J5bvw= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> ~vagrant/.ssh/known_hosts
}
chown vagrant.vagrant ~vagrant/.ssh/known_hosts
# edX - Development environment ###############################################
# Node modules require a filesystem with symlinks (Windows support)
mkdir -p /opt/edx/node_modules /opt/edx/edx-platform/node_modules
([[ -f /etc/fstab ]] && grep '/opt/edx/node_modules' /etc/fstab) || {
echo '/opt/edx/node_modules /opt/edx/edx-platform/node_modules none bind,noauto 0 0' >> /etc/fstab
mount /opt/edx/node_modules
}
# Must be mounted *after* the NFS mount, made manually by Vagrant
([[ -f /etc/cron.d/nodemodules ]] && grep '/opt/edx/node_modules' /etc/cron.d/nodemodules) || {
echo '@reboot root until [ -n "`mount |grep "/opt/edx/edx-platform type"`" ]; do sleep 1; done; mount /opt/edx/node_modules' > /etc/cron.d/nodemodules
}
# Force rechecking all prerequisites (could have been fetched outside of the VM)
rm -rf /opt/edx/edx-platform/.prereqs_cache
# Permissions
chown vagrant.vagrant /opt/edx /opt/edx/node_modules /opt/edx/edx-platform/node_modules
# For convenience with `vagrant ssh`, the `edx-platform` virtualenv is always
# loaded after the first run, so we need to deactivate that behavior to run
# `create-dev-env.sh`.
[[ -f ~vagrant/.bash_profile ]] && {
mv ~vagrant/.bash_profile ~vagrant/.bash_profile.bak
}
sudo -u vagrant -i bash -c "cd /opt/edx/edx-platform && PROJECT_HOME=/opt/edx ./scripts/create-dev-env.sh -ynq"
# Load .bashrc ################################################################
([[ -f ~vagrant/.bash_profile ]] && grep ".bashrc" ~vagrant/.bash_profile) || {
echo ". /home/vagrant/.bashrc" >> ~vagrant/.bash_profile
}
# Virtualenv - Always load ####################################################
([[ -f ~vagrant/.bash_profile ]] && grep "edx-platform/bin/activate" ~vagrant/.bash_profile) || {
echo ". /home/vagrant/.virtualenvs/edx-platform/bin/activate" >> ~vagrant/.bash_profile
}
# Directory ###################################################################
grep "cd /opt/edx/edx-platform" ~vagrant/.bash_profile || {
echo "cd /opt/edx/edx-platform" >> ~vagrant/.bash_profile
}
# Permissions
chown vagrant.vagrant ~vagrant/.bash_profile
# Install completed entirely & successfully - set flag to skip in future runs
touch /opt/edx/.install_succeeded
cat << EOF
==============================================================================
Success - Created your development environment!
==============================================================================
EOF
} # End on_create() ########################################################
## only initialize / setup the development environment once:
[[ -f /opt/edx/.install_succeeded ]] || on_create
# grab what the Vagrantfile spec'd our IP to be:
# expecting:
# - relevant ip on eth1;
# - line of interest to look like:
# inet 192.168.20.40/24 brd 192.168.20.255 scope global eth1
MY_IP=$(ip addr show dev eth1 | sed -n '/inet /{s/.*[ ]\(.*\)\/.*/\1/;p}')
cat << EOF
Connect to your virtual machine with "vagrant ssh".
Some examples you can use from your virtual machine:
- Start Learning management system (LMS):
$ rake lms[cms.dev,0.0.0.0:8000]
=> http://${MY_IP}:8000/
- Start Studio:
$ rake cms[dev,0.0.0.0:8001]
=> http://${MY_IP}:8001/
See the README for more.
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