Commit 1b77c292 by Ned Batchelder

Remove Vagrantfiles for Open edX installations

parent c2df5edf
- Removed Vagrantfiles for devstack and fullstack, and supporting files.
- Role: xqueue
- Added XQUEUE_SUBMISSION_PROCESSING_DELAY and XQUEUE_CONSUMER_DELAY to xqueue env so they can be passed along to the app.
- Role: edxapp
- Moved `PASSWORD_MIN_LENGTH`, `PASSWORD_MAX_LENGTH`, and `PASSWORD_COMPLEXITY` to generic_env_config to allow CMS and LMS to share these configurations
......
- name: Configure instance(s)
hosts: all
become: True
gather_facts: True
vars:
migrate_db: 'yes'
devstack: true
edx_django_service_is_devstack: true
disable_edx_services: true
mongo_enable_journal: false
EDXAPP_NO_PREREQ_INSTALL: 0
COMMON_SSH_PASSWORD_AUTH: "yes"
EDXAPP_LMS_BASE: 127.0.0.1:8000
EDXAPP_OAUTH_ENFORCE_SECURE: false
EDXAPP_LMS_BASE_SCHEME: http
ECOMMERCE_DJANGO_SETTINGS_MODULE: "ecommerce.settings.devstack"
# When provisioning your devstack, we apply security updates
COMMON_SECURITY_UPDATES: true
SECURITY_UPGRADE_ON_ANSIBLE: true
MONGO_AUTH: false
DISCOVERY_URL_ROOT: 'http://localhost:{{ DISCOVERY_NGINX_PORT }}'
vars_files:
- roles/edxapp/vars/devstack.yml
roles:
- common
- vhost
- edx_ansible
- mysql
- edxlocal
- memcache
- mongo_3_2
- role: rabbitmq
rabbitmq_ip: 127.0.0.1
- edxapp
- oraclejdk
- elasticsearch
- forum
- ecommerce
- role: ecomworker
ECOMMERCE_WORKER_BROKER_HOST: 127.0.0.1
- discovery
- role: notifier
NOTIFIER_DIGEST_TASK_INTERVAL: "5"
- browsers
- local_dev
- demo
- oauth_client_setup
[defaults]
jinja2_extensions=jinja2.ext.do
host_key_checking = False
library=../library
roles_path=../roles
callback_plugins=../callback_plugins
ansible_managed=This file is created and updated by ansible, edit at your peril
[ssh_connection]
ssh_args=-o ControlMaster=auto -o ControlPersist=60s -o ControlPath="~/.ansible/tmp/ansible-ssh-%h-%p-%r" -o ServerAliveInterval=30
- name: Update devstack to a specific intermediate revision
hosts: all
sudo: True
gather_facts: True
vars:
devstack: true
disable_edx_services: true
mongo_enable_journal: false
COMMON_SSH_PASSWORD_AUTH: "yes"
EDXAPP_LMS_BASE: 127.0.0.1:8000
EDXAPP_OAUTH_ENFORCE_SECURE: false
EDXAPP_LMS_BASE_SCHEME: http
roles:
- common
- vhost
- edxapp
- edxlocal
- name: Update fullstack to a specific intermediate revision
hosts: all
sudo: True
gather_facts: True
vars:
disable_edx_services: true
mongo_enable_journal: false
COMMON_SSH_PASSWORD_AUTH: "yes"
EDXAPP_LMS_BASE: 127.0.0.1:8000
EDXAPP_OAUTH_ENFORCE_SECURE: false
EDXAPP_LMS_BASE_SCHEME: http
roles:
- common
- vhost
- edxapp
- xqueue
- edxlocal
#!/usr/bin/env bash
# Setting OPENEDX_DEBUG makes this more verbose.
if [[ $OPENEDX_DEBUG ]]; then
set -x
fi
# Stop if any command fails.
set -e
# Logging: write all the output to a timestamped log file.
sudo mkdir -p /var/log/edx
exec > >(sudo tee /var/log/edx/upgrade-$(date +%Y%m%d-%H%M%S).log) 2>&1
# defaults
CONFIGURATION="none"
TARGET=${OPENEDX_RELEASE-none}
INTERACTIVE=true
OPENEDX_ROOT="/edx"
# Use this function to exit the script: it helps keep the output right with the
# exec-logging we started above.
exit_cleanly () {
sleep .25
echo
exit $@
}
# check_pip succeeds if its first argument is found in the output of pip freeze.
PIP_EDXAPP="sudo -u edxapp -H $OPENEDX_ROOT/bin/pip.edxapp --disable-pip-version-check"
check_pip () {
how_many=$($PIP_EDXAPP list 2>&- | grep -c "^$1 ")
if (( $how_many > 0 )); then
return 0
else
return 1
fi
}
show_help () {
cat << EOM
Upgrades your Open edX installation to a newer release.
-c CONFIGURATION
Use the given configuration. Either "devstack" or "fullstack". You
must specify this.
-t TARGET
Upgrade to the given git ref. Open edX releases are called
"open-release/eucalyptus.1", "open-release/eucalyptus.latest", and so on.
Defaults to \$OPENEDX_RELEASE if it is defined.
-y
Run in non-interactive mode (reply "yes" to all questions)
-r OPENEDX_ROOT
The root directory under which all Open edX applications are installed.
Defaults to "$OPENEDX_ROOT"
-h
Show this help and exit.
EOM
}
# override defaults with options
while getopts "hc:t:y" opt; do
case "$opt" in
h)
show_help
exit_cleanly 0
;;
c)
CONFIGURATION=$OPTARG
;;
t)
TARGET=$OPTARG
;;
y)
INTERACTIVE=false
;;
r)
OPENEDX_ROOT=$OPTARG
;;
esac
done
# Helper to ask to proceed.
confirm_proceed () {
echo "Do you wish to proceed?"
read input
if [[ "$input" != "yes" && "$input" != "y" ]]; then
echo "Quitting"
exit_cleanly 1
fi
}
# Check we are in the right place, and have the info we need.
if [[ ! -d ${OPENEDX_ROOT}/app/edxapp ]]; then
echo "Run this on your Open edX machine."
exit_cleanly 1
fi
if [[ $TARGET == none ]]; then
cat <<"EOM"
You must specify a target. This should be the next Open edX release after the
one you are currently running. This script can only move forward one release
at a time.
EOM
show_help
exit_cleanly 1
fi
if [[ $CONFIGURATION == none ]]; then
echo "You must specify a configuration, either fullstack or devstack."
exit_cleanly 1
fi
APPUSER=edxapp
if [[ $CONFIGURATION == fullstack ]] ; then
APPUSER=www-data
fi
# Birch details
if [[ $TARGET == *birch* && $INTERACTIVE == true ]] ; then
cat <<"EOM"
WARNING WARNING WARNING WARNING WARNING
The Birch release of Open edX depends on MySQL 5.6 and MongoDB 2.6.4.
The Aspen release of Open edX depended on MySQL 5.5 and MongoDB 2.4.7.
Please make sure that you have already upgraded MySQL and MongoDB
before continuing.
If MySQL or MongoDB are not at the correct version, this script will
attempt to automatically upgrade them for you. However, this process
can fail, and IT RUNS THE RISK OF CORRUPTING ALL YOUR DATA.
Here there be dragons.
.> )\;`a__
( _ _)/ /-." ~~
`( )_ )/
<_ <_
Once you have verified that your MySQL and MongoDB versions are correct,
or you have decided to risk the automatic upgrade process, type "yes"
followed by enter to continue. Otherwise, press ctrl-c to quit. You can
also run this script with the -y flag to skip this check.
EOM
confirm_proceed
fi
# Cypress details
if [[ $TARGET == *cypress* && $INTERACTIVE == true ]] ; then
cat <<"EOM"
WARNING WARNING WARNING WARNING WARNING
Due to the changes introduced between Birch and Cypress, you may encounter
some problems in this migration. If so, check this webpage for solutions:
https://openedx.atlassian.net/wiki/display/OpenOPS/Potential+Problems+Migrating+from+Birch+to+Cypress
EOM
confirm_proceed
fi
if [[ $TARGET == *cypress* ]] ; then
# Needed if transitioning to Cypress.
echo "Killing all celery worker processes."
sudo ${OPENEDX_ROOT}/bin/supervisorctl stop edxapp_worker:* &
sleep 3
# Supervisor restarts the process a couple of times so we have to kill it multiple times.
sudo pgrep -lf celery | grep worker | awk '{ print $1}' | sudo xargs -I {} kill -9 {}
sleep 3
sudo pgrep -lf celery | grep worker | awk '{ print $1}' | sudo xargs -I {} kill -9 {}
sleep 3
sudo pgrep -lf celery | grep worker | awk '{ print $1}' | sudo xargs -I {} kill -9 {}
sleep 3
sudo pgrep -lf celery | grep worker | awk '{ print $1}' | sudo xargs -I {} kill -9 {}
sudo -u forum git -C ${OPENEDX_ROOT}/app/forum/.rbenv reset --hard
fi
if [[ -f ${OPENEDX_ROOT}/app/edx_ansible/server-vars.yml ]]; then
SERVER_VARS="--extra-vars=\"@${OPENEDX_ROOT}/app/edx_ansible/server-vars.yml\""
fi
# When tee'ing to a log, ansible (like many programs) buffers its output. This
# makes it hard to tell what is actually happening during the upgrade.
# "stdbuf -oL" will run ansible with line-buffered stdout, which makes the
# messages scroll in the way people expect.
ANSIBLE_PLAYBOOK="sudo stdbuf -oL ansible-playbook --inventory-file=localhost, --connection=local "
make_config_venv () {
virtualenv venv
source venv/bin/activate
pip install -r configuration/pre-requirements.txt
pip install -r configuration/requirements.txt
}
TEMPDIR=`mktemp -d`
echo "Working in $TEMPDIR"
chmod 777 $TEMPDIR
cd $TEMPDIR
# Set the CONFIGURATION_TARGET environment variable to use a different branch
# in the configuration repo, defaults to $TARGET.
git clone https://github.com/edx/configuration.git \
--depth=1 --single-branch --branch=${CONFIGURATION_TARGET-$TARGET}
make_config_venv
# Dogwood details
if [[ $TARGET == *dogwood* ]] ; then
# Run the forum migrations.
cat > migrate-008-context.js <<"EOF"
// from: https://github.com/edx/cs_comments_service/blob/master/scripts/db/migrate-008-context.js
print ("Add the new indexes for the context field");
db.contents.ensureIndex({ _type: 1, course_id: 1, context: 1, pinned: -1, created_at: -1 }, {background: true})
db.contents.ensureIndex({ _type: 1, commentable_id: 1, context: 1, pinned: -1, created_at: -1 }, {background: true})
print ("Adding context to all comment threads where it does not yet exist\n");
var bulk = db.contents.initializeUnorderedBulkOp();
bulk.find( {_type: "CommentThread", context: {$exists: false}} ).update( {$set: {context: "course"}} );
bulk.execute();
printjson (db.runCommand({ getLastError: 1, w: "majority", wtimeout: 5000 } ));
EOF
mongo cs_comments_service migrate-008-context.js
# We are upgrading Python from 2.7.3 to 2.7.10, so remake the venvs.
sudo rm -rf ${OPENEDX_ROOT}/app/*/v*envs/*
echo "Upgrading to the end of Django 1.4"
cd configuration/playbooks/vagrant
$ANSIBLE_PLAYBOOK \
$SERVER_VARS \
--extra-vars="edx_platform_version=release-2015-11-09" \
--extra-vars="xqueue_version=named-release/cypress" \
--extra-vars="migrate_db=yes" \
--skip-tags="edxapp-sandbox" \
vagrant-$CONFIGURATION-delta.yml
cd ../../..
# Remake our own venv because of the Python 2.7.10 upgrade.
rm -rf venv
make_config_venv
# Need to get rid of South from edx-platform, or things won't work.
$PIP_EDXAPP uninstall -y South
echo "Upgrading to the beginning of Django 1.8"
cd configuration/playbooks/vagrant
$ANSIBLE_PLAYBOOK \
$SERVER_VARS \
--extra-vars="edx_platform_version=dogwood-first-18" \
--extra-vars="xqueue_version=dogwood-first-18" \
--extra-vars="migrate_db=no" \
--skip-tags="edxapp-sandbox" \
vagrant-$CONFIGURATION-delta.yml
cd ../../..
echo "Running the Django 1.8 faked migrations"
for item in lms cms; do
sudo -u $APPUSER -E ${OPENEDX_ROOT}/bin/python.edxapp \
${OPENEDX_ROOT}/bin/manage.edxapp $item migrate --settings=aws --noinput --fake-initial
done
if [[ $CONFIGURATION == fullstack ]] ; then
sudo -u xqueue \
SERVICE_VARIANT=xqueue \
${OPENEDX_ROOT}/app/xqueue/venvs/xqueue/bin/python \
${OPENEDX_ROOT}/app/xqueue/xqueue/manage.py migrate \
--settings=xqueue.aws_settings --noinput --fake-initial
fi
fi
# Eucalyptus details
if [[ $TARGET == *eucalyptus* ]] ; then
if check_pip edx-oauth2-provider ; then
echo "Uninstall edx-oauth2-provider"
$PIP_EDXAPP uninstall -y edx-oauth2-provider
fi
if check_pip django-oauth2-provider ; then
echo "Uninstall django-oauth2-provider"
$PIP_EDXAPP uninstall -y django-oauth2-provider
fi
# edx-milestones changed how it was installed, so it is possible to have it
# installed twice. Try to uninstall it twice.
if check_pip edx-milestones ; then
echo "Uninstall edx-milestones"
$PIP_EDXAPP uninstall -y edx-milestones
fi
if check_pip edx-milestones ; then
echo "Uninstall edx-milestones again"
$PIP_EDXAPP uninstall -y edx-milestones
fi
if [[ $CONFIGURATION == devstack ]] ; then
echo "Remove old Firefox"
sudo apt-get purge -y firefox
fi
echo "Upgrade the code"
cd configuration/playbooks/vagrant
$ANSIBLE_PLAYBOOK \
$SERVER_VARS \
--extra-vars="edx_platform_version=$TARGET" \
--extra-vars="xqueue_version=$TARGET" \
--extra-vars="migrate_db=no" \
--skip-tags="edxapp-sandbox,gather_static_assets" \
vagrant-$CONFIGURATION-delta.yml
cd ../../..
echo "Migrate to fix oauth2_provider"
${OPENEDX_ROOT}/bin/edxapp-migrate-lms --fake oauth2_provider zero
${OPENEDX_ROOT}/bin/edxapp-migrate-lms --fake-initial
echo "Clean up forums Ruby detritus"
sudo rm -rf ${OPENEDX_ROOT}/app/forum/.rbenv ${OPENEDX_ROOT}/app/forum/.gem
fi
# Update to target.
echo "Updating to final version of code"
cd configuration/playbooks
echo "edx_platform_version: $TARGET" > vars.yml
echo "certs_version: $TARGET" >> vars.yml
echo "forum_version: $TARGET" >> vars.yml
echo "xqueue_version: $TARGET" >> vars.yml
echo "demo_version: $TARGET" >> vars.yml
echo "NOTIFIER_VERSION: $TARGET" >> vars.yml
echo "ECOMMERCE_VERSION: $TARGET" >> vars.yml
echo "ECOMMERCE_WORKER_VERSION: $TARGET" >> vars.yml
$ANSIBLE_PLAYBOOK \
--extra-vars="@vars.yml" \
$SERVER_VARS \
vagrant-$CONFIGURATION.yml
cd ../..
# Post-upgrade work.
if [[ $TARGET == *dogwood* ]] ; then
echo "Running data fixup management commands"
sudo -u $APPUSER -E ${OPENEDX_ROOT}/bin/python.edxapp \
${OPENEDX_ROOT}/bin/manage.edxapp lms --settings=aws generate_course_overview --all
sudo -u $APPUSER -E ${OPENEDX_ROOT}/bin/python.edxapp \
${OPENEDX_ROOT}/bin/manage.edxapp lms --settings=aws post_cohort_membership_fix --commit
# Run the forums migrations again to catch things made while this script
# was running.
mongo cs_comments_service migrate-008-context.js
fi
cd /
sudo rm -rf $TEMPDIR
echo "Upgrade complete. Please reboot your machine."
Vagrant
=======
Vagrant instances for local development and testing of edX instances and Ansible playbooks/roles.
- Vagrant stacks in ``base`` create new base boxes from scratch.
- Vagrant stacks in ``release`` download a base box with most requirements already installed. The instances then update themselves with the latest versions of the application code.
If you are a developer or designer, you should use the ``release`` stacks.
For creating test edX instances, there are two versions of the stack:
- ``fullstack`` is a production-like configuration running all the services on a single server. https://openedx.atlassian.net/wiki/display/OpenOPS/Running+Fullstack
- ``devstack`` is designed for local development. It uses the same system requirements as in production, but simplifies certain settings to make development more convenient. https://openedx.atlassian.net/wiki/display/OpenOPS/Running+Devstack
For testing Ansible playbooks and roles, there are two directories under the ``base`` directory:
- ``test_playbook`` is used for testing the playbooks in the Ansible configuration scripts.
......
Vagrant.require_version ">= 1.8.7"
unless Vagrant.has_plugin?("vagrant-vbguest")
raise "Please install the vagrant-vbguest plugin by running `vagrant plugin install vagrant-vbguest`"
end
VAGRANTFILE_API_VERSION = "2"
MEMORY = 4096
CPU_COUNT = 2
vm_guest_ip = "192.168.33.10"
if ENV["VAGRANT_GUEST_IP"]
vm_guest_ip = ENV["VAGRANT_GUEST_IP"]
end
# These are versioning variables in the roles. Each can be overridden, first
# with OPENEDX_RELEASE, and then with a specific environment variable of the
# same name but upper-cased.
VERSION_VARS = [
'edx_platform_version',
'configuration_version',
'certs_version',
'forum_version',
'xqueue_version',
'demo_version',
'NOTIFIER_VERSION',
'ECOMMERCE_VERSION',
'ECOMMERCE_WORKER_VERSION',
'DISCOVERY_VERSION',
]
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Creates a devstack from a base Ubuntu 16.04 image for virtualbox
config.vm.box = "boxcutter/ubuntu1604"
config.vm.network :private_network, ip: vm_guest_ip, nic_type: "virtio"
# If you want to run the box but don't need network ports, set VAGRANT_NO_PORTS=1.
# This is useful if you want to run more than one box at once.
if not ENV['VAGRANT_NO_PORTS']
config.vm.network :forwarded_port, guest: 8000, host: 8000 # LMS
config.vm.network :forwarded_port, guest: 8001, host: 8001 # Studio
config.vm.network :forwarded_port, guest: 8002, host: 8002 # Ecommerce
config.vm.network :forwarded_port, guest: 8003, host: 8003 # LMS for Bok Choy
config.vm.network :forwarded_port, guest: 8031, host: 8031 # Studio for Bok Choy
config.vm.network :forwarded_port, guest: 8120, host: 8120 # edX Notes Service
config.vm.network :forwarded_port, guest: 8765, host: 8765
config.vm.network :forwarded_port, guest: 9200, host: 9200
config.vm.network :forwarded_port, guest: 18080, host: 18080
config.vm.network :forwarded_port, guest: 8100, host: 8100 # Analytics Data API
config.vm.network :forwarded_port, guest: 8110, host: 8110 # Insights
config.vm.network :forwarded_port, guest: 50070, host: 50070 # HDFS Admin UI
config.vm.network :forwarded_port, guest: 8088, host: 8088 # Hadoop Resource Manager
config.vm.network :forwarded_port, guest: 18381, host: 18381 # Course discovery
end
config.ssh.insert_key = true
# Enable X11 forwarding so we can interact with GUI applications
if ENV['VAGRANT_X11']
config.ssh.forward_x11 = true
end
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", MEMORY.to_s]
vb.customize ["modifyvm", :id, "--cpus", CPU_COUNT.to_s]
end
# Make LC_ALL default to en_US.UTF-8 instead of en_US.
# See: https://github.com/mitchellh/vagrant/issues/1188
config.vm.provision "shell", inline: 'echo \'LC_ALL="en_US.UTF-8"\' > /etc/default/locale'
# Get ready for ansible on this box.
config.vm.provision "shell", path: '../../../util/install/ansible-bootstrap.sh'
# Use vagrant-vbguest plugin to make sure Guest Additions are in sync
config.vbguest.auto_reboot = true
config.vbguest.auto_update = true
config.vm.provision :ansible do |ansible|
ansible.playbook = "../../../playbooks/vagrant-devstack.yml"
ansible.verbose = "vv"
ansible.extra_vars = {}
VERSION_VARS.each do |var|
if ENV['OPENEDX_RELEASE']
ansible.extra_vars[var] = ENV['OPENEDX_RELEASE']
end
env_var = var.upcase
if ENV[env_var]
ansible.extra_vars[var] = ENV[env_var]
end
end
end
end
../../../playbooks/ansible.cfg
\ No newline at end of file
Vagrant.require_version ">= 1.8.7"
VAGRANTFILE_API_VERSION = "2"
MEMORY = 6144
CPU_COUNT = 2
vm_guest_ip = "192.168.33.10"
if ENV["VAGRANT_GUEST_IP"]
vm_guest_ip = ENV["VAGRANT_GUEST_IP"]
end
# These are versioning variables in the roles. Each can be overridden, first
# with OPENEDX_RELEASE, and then with a specific environment variable of the
# same name but upper-cased.
VERSION_VARS = [
'edx_platform_version',
'configuration_version',
'certs_version',
'forum_version',
'xqueue_version',
'demo_version',
'NOTIFIER_VERSION',
'INSIGHTS_VERSION',
'ANALYTICS_API_VERSION',
'ECOMMERCE_VERSION',
'ECOMMERCE_WORKER_VERSION',
'DISCOVERY_VERSION',
]
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Creates a machine from a base Ubuntu 16.04 image for virtualbox
config.vm.box = "boxcutter/ubuntu1604"
config.vm.network :private_network, ip: vm_guest_ip, nic_type: "virtio"
config.ssh.insert_key = true
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", MEMORY.to_s]
vb.customize ["modifyvm", :id, "--cpus", CPU_COUNT.to_s]
end
# Make LC_ALL default to en_US.UTF-8 instead of en_US.
# See: https://github.com/mitchellh/vagrant/issues/1188
config.vm.provision "shell", inline: 'echo \'LC_ALL="en_US.UTF-8"\' > /etc/default/locale'
config.vm.provision :ansible do |ansible|
# point Vagrant at the location of your playbook you want to run
ansible.playbook = "../../../playbooks/edx_sandbox.yml"
ansible.verbose = "vv"
# Set extra-vars here instead of in the vagrant play so that
# they are written out to /edx/etc/server-vars.yml which can
# be used later when running ansible locally.
ansible.extra_vars = {}
VERSION_VARS.each do |var|
if ENV['OPENEDX_RELEASE']
ansible.extra_vars[var] = ENV['OPENEDX_RELEASE']
end
env_var = var.upcase
if ENV[env_var]
ansible.extra_vars[var] = ENV[env_var]
end
end
end
end
../../../playbooks/ansible.cfg
\ No newline at end of file
Vagrant.require_version ">= 1.8.7"
unless Vagrant.has_plugin?("vagrant-vbguest")
raise "Please install the vagrant-vbguest plugin by running `vagrant plugin install vagrant-vbguest`"
end
VAGRANTFILE_API_VERSION = "2"
MEMORY = 4096
CPU_COUNT = 2
# These are versioning variables in the roles. Each can be overridden, first
# with OPENEDX_RELEASE, and then with a specific environment variable of the
# same name but upper-cased.
VERSION_VARS = [
'edx_platform_version',
'configuration_version',
'certs_version',
'forum_version',
'xqueue_version',
'demo_version',
'NOTIFIER_VERSION',
'ECOMMERCE_VERSION',
'ECOMMERCE_WORKER_VERSION',
'DISCOVERY_VERSION',
]
MOUNT_DIRS = {
:edx_platform => {:repo => "edx-platform", :local => "/edx/app/edxapp/edx-platform", :owner => "edxapp"},
:themes => {:repo => "themes", :local => "/edx/app/edxapp/themes", :owner => "edxapp"},
:forum => {:repo => "cs_comments_service", :local => "/edx/app/forum/cs_comments_service", :owner => "forum"},
:ecommerce => {:repo => "ecommerce", :local => "/edx/app/ecommerce/ecommerce", :owner => "ecommerce"},
:ecommerce_worker => {:repo => "ecommerce-worker", :local => "/edx/app/ecommerce_worker/ecommerce_worker", :owner => "ecomworker"},
# This src directory won't have useful permissions. You can set them from the
# vagrant user in the guest OS. "sudo chmod 0777 /edx/src" is useful.
:src => {:repo => "src", :local => "/edx/src", :owner => "root"},
}
if ENV['VAGRANT_MOUNT_BASE']
MOUNT_DIRS.each { |k, v| MOUNT_DIRS[k][:repo] = ENV['VAGRANT_MOUNT_BASE'] + "/" + MOUNT_DIRS[k][:repo] }
end
# map the name of the git branch that we use for a release
# to a name and a file path, which are used for retrieving
# a Vagrant box from the internet.
openedx_releases = {
"open-release/ginkgo.master" => "ginkgo-devstack-2017-07-14",
"open-release/ginkgo.1rc1" => "ginkgo-devstack-2017-07-14",
"open-release/ginkgo.1" => "ginkgo-devstack-2017-07-14",
"open-release/ficus.master" => "ficus-devstack-2017-02-07",
"open-release/ficus.1rc1" => "ficus-devstack-2017-01-11",
"open-release/ficus.1rc3" => "ficus-devstack-2017-02-07",
"open-release/ficus.1rc4" => "ficus-devstack-2017-02-07",
"open-release/ficus.1" => "ficus-devstack-2017-02-07",
"open-release/ficus.2" => "ficus-devstack-2017-02-07",
"open-release/ficus.3" => "ficus-devstack-2017-02-07",
"open-release/eucalyptus.master" => "eucalyptus-devstack-2016-09-01",
"open-release/eucalyptus.1rc2" => "eucalyptus-devstack-2016-08-19",
"open-release/eucalyptus.1" => "eucalyptus-devstack-2016-08-19",
"open-release/eucalyptus.2" => "eucalyptus-devstack-2016-09-01",
"named-release/dogwood.rc" => "dogwood-devstack-2016-03-09",
"named-release/dogwood.1" => "dogwood-devstack-2016-03-09",
"named-release/dogwood.2" => "dogwood-devstack-2016-03-09",
"named-release/dogwood.3" => "dogwood-devstack-2016-03-09",
"named-release/dogwood" => {
:name => "dogwood-devstack-rc2", :file => "20151221-dogwood-devstack-rc2.box",
},
# Cypress is deprecated and unsupported
# Birch is deprecated and unsupported
}
openedx_releases.default = "master-devstack-2017-09-14"
openedx_release = ENV['OPENEDX_RELEASE']
boxname = ENV['OPENEDX_BOXNAME']
# Build -e override lines for each overridable variable.
extra_vars_lines = ""
VERSION_VARS.each do |var|
rel = ENV[var.upcase] || openedx_release
if rel
extra_vars_lines += "-e #{var}=#{rel} \\\n"
end
end
$script = <<SCRIPT
if [ ! -d /edx/app/edx_ansible ]; then
echo "Error: Base box is missing provisioning scripts." 1>&2
exit 1
fi
export PYTHONUNBUFFERED=1
source /edx/app/edx_ansible/venvs/edx_ansible/bin/activate
cd /edx/app/edx_ansible/edx_ansible/playbooks
EXTRA_VARS="#{extra_vars_lines}"
CONFIG_VER="#{ENV['CONFIGURATION_VERSION'] || openedx_release || 'master'}"
ansible-playbook -i localhost, -c local run_role.yml -e role=edx_ansible -e configuration_version=$CONFIG_VER $EXTRA_VARS
ansible-playbook -i localhost, -c local vagrant-devstack.yml -e configuration_version=$CONFIG_VER $EXTRA_VARS
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
boxfile = ""
if not boxname
reldata = openedx_releases[openedx_release]
if Hash == reldata.class
boxname = openedx_releases[openedx_release][:name]
boxfile = openedx_releases[openedx_release].fetch(:file, "")
else
boxname = reldata
end
end
if boxfile == ""
boxfile = "#{boxname}.box"
end
# Creates an edX devstack VM from an official release
config.vm.box = boxname
config.vm.box_url = "http://files.edx.org/vagrant-images/#{boxfile}"
config.vm.box_check_update = false
config.vm.network :private_network, ip: "192.168.33.10"
# If you want to run the box but don't need network ports, set VAGRANT_NO_PORTS=1.
# This is useful if you want to run more than one box at once.
if not ENV['VAGRANT_NO_PORTS']
config.vm.network :forwarded_port, guest: 8000, host: 8000 # LMS
config.vm.network :forwarded_port, guest: 8001, host: 8001 # Studio
config.vm.network :forwarded_port, guest: 8002, host: 8002 # Ecommerce
config.vm.network :forwarded_port, guest: 8003, host: 8003 # LMS for Bok Choy
config.vm.network :forwarded_port, guest: 8031, host: 8031 # Studio for Bok Choy
config.vm.network :forwarded_port, guest: 8120, host: 8120 # edX Notes Service
config.vm.network :forwarded_port, guest: 8765, host: 8765
config.vm.network :forwarded_port, guest: 9200, host: 9200 # Elasticsearch
config.vm.network :forwarded_port, guest: 18080, host: 18080 # Forums
config.vm.network :forwarded_port, guest: 8100, host: 8100 # Analytics Data API
config.vm.network :forwarded_port, guest: 8110, host: 8110 # Insights
config.vm.network :forwarded_port, guest: 9876, host: 9876 # ORA2 Karma tests
config.vm.network :forwarded_port, guest: 50070, host: 50070 # HDFS Admin UI
config.vm.network :forwarded_port, guest: 8088, host: 8088 # Hadoop Resource Manager
config.vm.network :forwarded_port, guest: 18381, host: 18381 # Course discovery
end
config.ssh.insert_key = true
config.vm.synced_folder ".", "/vagrant", disabled: true
# Enable X11 forwarding so we can interact with GUI applications
if ENV['VAGRANT_X11']
config.ssh.forward_x11 = true
end
if ENV['VAGRANT_USE_VBOXFS'] == 'true'
MOUNT_DIRS.each { |k, v|
config.vm.synced_folder v[:repo], v[:local], create: true, owner: v[:owner], group: "www-data"
}
else
MOUNT_DIRS.each { |k, v|
config.vm.synced_folder v[:repo], v[:local], create: true, nfs: true
}
end
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", MEMORY.to_s]
vb.customize ["modifyvm", :id, "--cpus", CPU_COUNT.to_s]
# Virtio is faster, but the box needs to have support for it. We didn't
# have support in the boxes before Ficus.
if !(boxname.include?("dogwood") || boxname.include?("eucalyptus"))
vb.customize ['modifyvm', :id, '--nictype1', 'virtio']
end
end
# Use vagrant-vbguest plugin to make sure Guest Additions are in sync
config.vbguest.auto_reboot = true
config.vbguest.auto_update = true
# Assume that the base box has the edx_ansible role installed
# We can then tell the Vagrant instance to update itself.
config.vm.provision "shell", inline: $script
end
Vagrant.require_version ">= 1.8.7"
unless Vagrant.has_plugin?("vagrant-hostsupdater")
raise "Please install the vagrant-hostsupdater plugin by running `vagrant plugin install vagrant-hostsupdater`"
end
VAGRANTFILE_API_VERSION = "2"
MEMORY = 6144
CPU_COUNT = 2
# map the name of the git branch that we use for a release
# to a name and a file path, which are used for retrieving
# a Vagrant box from the internet.
openedx_releases = {
"open-release/ginkgo.1rc1" => "ginkgo-fullstack-2017-07-14",
"open-release/ginkgo.1" => "ginkgo-fullstack-2017-08-14",
"open-release/ficus.1rc3" => "ficus-fullstack-2017-02-07",
"open-release/ficus.1rc4" => "ficus-fullstack-2017-02-15",
"open-release/ficus.1" => "ficus-fullstack-2017-02-15",
"open-release/ficus.2" => "ficus-fullstack-2017-03-28",
"open-release/ficus.3" => "ficus-fullstack-2017-04-20",
"open-release/eucalyptus/1rc1" => "eucalyptus-fullstack-1rc1",
"open-release/eucalyptus.1rc2" => "eucalyptus-fullstack-2016-08-19",
"open-release/eucalyptus.1" => "eucalyptus-fullstack-2016-08-25",
"open-release/eucalyptus.2" => "eucalyptus-fullstack-2016-09-01",
"named-release/dogwood" => {
:name => "dogwood-fullstack-rc2", :file => "20151221-dogwood-fullstack-rc2.box",
},
"named-release/dogwood.1" => {
:name => "dogwood-fullstack-rc2", :file => "20151221-dogwood-fullstack-rc2.box",
},
"named-release/dogwood.2" => {
:name => "dogwood-fullstack-rc2", :file => "20151221-dogwood-fullstack-rc2.box",
},
"named-release/dogwood.3" => {
:name => "dogwood-fullstack-rc2", :file => "20151221-dogwood-fullstack-rc2.box",
},
"named-release/dogwood.rc" => {
:name => "dogwood-fullstack-rc2", :file => "20151221-dogwood-fullstack-rc2.box",
},
# Cypress is deprecated and unsupported
# Birch is deprecated and unsupported
}
openedx_releases.default = "ginkgo-fullstack-2017-08-14"
openedx_release = ENV['OPENEDX_RELEASE']
boxname = ENV['OPENEDX_BOXNAME']
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
boxfile = ""
if not boxname
reldata = openedx_releases[openedx_release]
if Hash == reldata.class
boxname = openedx_releases[openedx_release][:name]
boxfile = openedx_releases[openedx_release].fetch(:file, "")
else
boxname = reldata
end
end
if boxfile == ""
boxfile = "#{boxname}.box"
end
# Creates an edX fullstack VM from an official release
config.vm.box = boxname
config.vm.box_url = "http://files.edx.org/vagrant-images/#{boxfile}"
config.vm.box_check_update = false
config.vm.network :private_network, ip: "192.168.33.10"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.ssh.insert_key = true
config.hostsupdater.aliases = ["preview.localhost"]
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", MEMORY.to_s]
vb.customize ["modifyvm", :id, "--cpus", CPU_COUNT.to_s]
# Virtio is faster, but the box needs to have support for it. We didn't
# have support in the boxes before Ficus.
if !(boxname.include?("dogwood") || boxname.include?("eucalyptus"))
vb.customize ['modifyvm', :id, '--nictype1', 'virtio']
end
end
end
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