-
Notifications
You must be signed in to change notification settings - Fork 4
Setting up a Swag dev environment with Vagrant
Brad Smith edited this page May 27, 2015
·
10 revisions
Especially if you don't have access to a server you can configure to host it, the the easiest way to set up a Swag development environment is with a virtual machine. Tunapanda's provisioning system can automatically configure and deploy such a virtual machine.
- Install a recent version of Vagrant
- Clone the provisioning system
git clone https://github.com/tunapanda/provision/
cd provision
- Create a custom config file
cp localconfig.yml.defaults localconfig.yml
- Edit this file:
* set
platform
tovm
- Vagrant will do the right thing if you leave this set to
auto
, but explicitly specifying the platform means it will also run correctly if youvagrant ssh
in and run the provisioning script locally (see below). * setprofile
toswag_dev
- Vagrant will do the right thing if you leave this set to
- Bring up the virtual machine
vagrant up
- Wait. Provisioning starts automatically but can take anywhere from 5-20 minutes, depending on your host computer and network connection. Vagrant also tends to buffer big chunks of output from the provisioning script before printing them, so there can be long periods that may look like the script has frozen. Give it time. If you want to investigate more closely, you can open a shell on the vm by running
vagrant ssh
from inside theprovision
directory, and looking foransible
processes. - When provisioning is complete, it will print out a line you should add to your
/etc/hosts
file. This is required because Swag and Learning Locker each get their own name-based virtual hosts.
You should now be able to access either service by opening the corresponding hostname into your browser.
Some manual setup is currently required for Learning Locker:
- Open to the Learning Locker hostname printed at the end of the provisioning process in your web browser
- Log in as
vagrant@BASE_TLD
(for example, if the learninglocker hostname islearninglocker.swag.dev.tunapanda.org
, you would use[email protected]
) with the passwordTunapanda2
- Click
LRSs
in the sidebar - Click "Create an LRS" and create a new LRS called "Swag"
- On the LRS dashboard, click the name of your new LRS
- Click
Manage Clients
- Edit
/usr/local/tunapanda/provision/modules/swagportal/config.ini
and change thexapiUsername
andxapiPassword
settings to match what is displayed in your browser.
- Note: Learninglocker tends to display these values with newlines in the middle. Do not include the newlines when you put them into the config file.
The code for Swag and Learning Locker will be available in the a subdirectory of the repo called modules
or vm_data
. If you open a shell on the VM (vagrant ssh
), that directory will also be accessible at /usr/local/tunapanda/provision/
-
git pull
# in the provisioning/ dir on your host machine vagrant reload --provision
-
git pull
# in the provisioning/ dir on your host machine vagrant provision
-
git pull
# in the provisioning/ dir on your host machine - Ensure that you have set
platform
tovm
in yourlocalconfig.yml
vagrant ssh
sudo /usr/local/tunapanda/provision/scripts/provision.py