Skip to content
Brad Smith edited this page Jan 5, 2015 · 58 revisions

NOTE: Some of this describes how deployment should work in the future, not how it currently works. Many of the links do not go to the master branch/repo, since much of this work has not yet been checked in. Once everything is in place the links will be updated and these instructions will probably go to the main README

Deployment

Overview

There are four ways in which the provisioning system might be used:

  • Deploying to a vagrant-based VM
  • Deploying to a cubietruck
  • Deploying to a commodity PC
  • Refreshing/reloading the config after deployment

Deploying to a vagrant VM:

  1. git clone --recursive -b lng https://github.com/usernamenumber/provision
  2. cd provision
  3. vagrant up
  4. To access the system, either:
  • vagrant ssh (CLI only, no password required)
  • A new VirtualBox window should appear during deployment. You can log in there with username teacher and password Tunapanda2. If you installed the GUI (see 'customization' below), you will have full desktop access here.

An important note about vagrant deployments: Normally, the deployment process clones the provision git repo into /usr/local/tunapanda/provision. In this case, you've already cloned the repo on your host system, so we can just use that. The Vagrantfile that controls the VM's behavior mounts the directory where you cloned the repo on your host as /usr/local/tunapanda/provision on the VM. This is why VM-based deployments can be very convenient for development. Just modify stuff in the repo and run vagrant provision to apply your changes.

Deploying to a cubietruck

edX requires several modifications to work on ARM. Thanks mainly to the hard work of Arturo Samanez, we have a prebuilt image of Lubuntu 13 with edX pre-installed. You will need to begin by using it to create an SD card from which to boot the cubie.

Note: these instructions require a Linux machine with a micro SD reader.

  1. Determine the device name of your SD card (e.g. /dev/sdb). Try fdisk -l as root.
  2. git clone -b edx_Lubuntu-13 https://github.com/iLearner/x2go.git x2go-arm
  3. cd x2go-arm
  4. python execute sd /dev/DEVICE_FROM_STEP_1
  • This will destroy any data on the SD card
  1. Boot the cubie from the SD
  • sshd is not installed by default in this image (yes, we should fix that), so you will need to connect it to a keyboard and monitor the first time you use it.
  • It should boot directly to a root prompt
  1. apt-get install -y openssh-server
  2. Follow the "commodity PC" instructions below...

Deploying to a commodity PC

Log in as root (or log in as another user and run sudo -i). Just using sudo isn't enough, because the ssh keys Ansible needs are stored in root's homedir. This should be fixed, but it's what we have for now.

export PROVISION_CORE_REPO="https://github.com/usernamenumber/provision"
export PROVISION_CORE_VERSION="lng"
cd /tmp
wget -O - https://raw.githubusercontent.com/usernamenumber/provision/lng/scripts/bootstrap.sh
bash bootstrap.sh  # add -x if troubleshooting

Customizing

First, a very brief overview of Ansible, the system we use to configure systems during deployment. You will need to understand at least three concepts: roles, playbooks, and profiles (roles and playbooks are ansible terms, profiles are specific to this provisioning system).

  • A role describes how to deploy a specific service or machine type. Most of the roles we use can be found in playbooks/roles/. Well-written roles use variables instead of hard-coded values so their behavior can be customized without re-writing the role. Variables can be overridden in...
  • A playbook describes a set of roles to load and (optionally) custom values for variables that control what they do.
  • A profile is a playbook that describes the default configuration of a particular server type (e.g. a cubietruck). You can all the available profiles in playbooks/profiles/

Normally, the best profile is automatically chosen based on hardware architecture, etc, but if you want to (and you know what you're doing!), you can fine-tune things with a special profile called custom.

Almost every role has a variable called role_name__enabled (note the double-underscore), which is usually set to false. You can customize your deployment by modifying these settings and more while using the custom profile.

The command below will create a config file with all available settings set to their default values, which might be helpful.

(echo "---" ; echo "roles = [ custom ]"; echo "vars:" ; for r in $(ls playbooks/roles/) ; do echo "" ; echo "  ## $r role" ; cat playbooks/roles/$r/defaults/main.yml | grep -v '^---' | grep -v '^[[:space:]]*$' | sed 's,^,  ,'; done) > localconfig.yml

When you've made your changes, simply run vagrant provision if you are using vagrant, or run /usr/local/tunapanda/provision/scripts/bootstrap.sh on other systems.

Clone this wiki locally