Vagrant is designed to run on multiple platforms, including Mac OS X, Microsoft Windows, Debian, Ubuntu, CentOS, RedHat and Fedora. In this document we describe how to configure and run an OpenDSA project virtual development environment through Vagrant.
-
Install Vagrant
-
Install VirtualBox
-
Clone this repository
-
$ cd OpenDSA-DevStack
-
$ vagrant up
(This will take a long time to install everything the first time!) -
$ vagrant ssh
-
$ cd /vagrant
-
$ ./runservers.sh
-
After the provisioning script is complete you can go to:
- http://192.168.33.10:8080 for OpenDSA content server
- https://192.168.33.10:9292 for OpenDSA-LTI server
- https://192.168.33.10:9200 for code-workout server
After you finish your work, you need to turn the virtual machine off.
- Exit the virtual machine terminal by typing
exit
- Change directory to
OpenDSA-DevStack
$ vagrant halt
If you decided to shut down the virtual machine using vagrant halt
, you have to re-run the servers again after you do vagrant up
.
- Change directory to
OpenDSA-DevStack
$ vagrant up
$ vagrant ssh
$ cd /vagrant
$ ./runservers.sh
If anything went wrong or you want to reprovision your virtual machine for any reason, follow these steps.
- Change directory to
OpenDSA-DevStack
$ git pull
$ vagrant destroy
$ vagrant up
The sudo password is vagrant
(in case you need to execute any commands that require sudo).
The provisioning script will clone the OpenDSA, OpenDSA-LTI, and code-workout repositories inside the OpenDSA-DevStack directory. The OpenDSA-DevStack directory is shared between your host machine and the virtual machine, so you can do your development to any of these repositories on your host machine using your preferred tools or IDEs (from "outside" the virtual machine). All changes that you make will take effect immediately, and you can test them through the virtual machine server URLs provided earlier. You can commit and push your changes from your host machine. However, if you want to compile books in OpenDSA, you have to do that from within the virtual machine. Do so as follows:
- Open a new terminal within your virtual machine
$ cd OpenDSA-DevStack
$ vagrant ssh
(you don't need to dovagrant up
if the VM is already up and running)$ cd /vagrant/OpenDSA
make <<CONFIG_FILE_NAME>>
Other developers might make changes to any of the repositories cloned by the OpenDSA-DevStack. To keep your local version up to date with the latest version do the following:
- Open a new terminal
- Change directory to
OpenDSA-DevStack
$ vagrant reload
$ vagrant ssh
$ cd /vagrant
$ ./get_latest.sh
The initial database population is defined by lib/tasks/sample_data.rake. It uses the factories defined in spec/factories/* to generate entities. If you add new model classes and want to generate test data in the database, please add to the sample_data.rake file so that this population will happen automatically for everyone. The sample_data.rake contains only "sample/try out" data for use during development, and it won't appear on the production server. Initial database contents provided for all new installs, including the production server, is described in db/seeds.rb instead.
-
opendsa
database includes the following admin account:- admin@opendsa.org (pass: adminadmin)
-
codeworkout
database includes the following admin account:- admin@codeworkout.org (pass: adminadmin)
-
Both
opendsa
andcodeworkout
databases include the following accounts:- example-1@railstutorial.org (pass: hokiehokie), has instructor access
- example-*@railstutorial.org (pass: hokiehokie) 50 students
It also includes the following other objects:
- Five terms (Spring, Summer I, Summer II, Fall, and Winter 2016),
- one organization (VT)
- one course (CS 1114)
- two offerings of 1114 (one each term)
- one course offering is set up with the admin and instructor as instructors, and all other sample accounts as students
- Make sure OpenDSA-DevStack is up to date by following the instructions here.
- After you are done you should have OpenDSA-LTI server running. Go to https://192.168.33.10:9292 to make sure your application is up and running.
- Follow the instructions on the instructor's guide page to set up your Canvas course. Note: skip the first step in this guide since you can use the admin account (admin@opendsa.org, pass: adminadmin) to cerate the course.
If you are responsible for maintaining an OpenDSA-LTI production server, follow the instructions in this section to perform deployment to the production server.
Deployment to the production server is initiated from the development environment. It starts with changes you make to OpenDSA-LTI or OpenDSA repositories in OpenDSA-DevStack. First, test these changes locally using OpenDSA-DevStack development servers. Second, commit and push any OpenDSA-LTI and OpenDSA changes. Finally, initiate the production deployment command from within OpenDSA-DevStack. It is important to push your changes before the deployment. Every time you deploy your code, Capistrano will clone the latest version of OpenDSA-LTI, then perform the deployment tasks. One of the tasks gets the latest version of OpenDSA from GitHub as well.
The following steps need to be done only once to generate a pair
of authentication keys.
Note: Do not enter a passphrase, and replace prod_server with
your domain name.
Some installations use both a staging and a production server.
If yours has both, then you will need to do the cat
line for each
one.
Change directory to OpenDSA-DevStack
$ vagrant up
$ vagrant ssh
$ ssh-keygen -t rsa
$ cat .ssh/id_rsa.pub | ssh deploy@prod_server 'cat >> .ssh/authorized_keys'
Enter deploy user password for the last time
Here are the steps that you need to follow every time you want to perform a production deployment:
Change directory to OpenDSA-DevStack
$ vagrant up
$ vagrant ssh
$ cd /vagrant/OpenDSA-LTI
$ git pull any new code
$ commit and push any changes
Execute the following command to deploy to the staging server:
$ bundle exec cap staging deploy
Execute the following command to deploy to the production server:
$ bundle exec cap production deploy
...
$ Please enter a branch (<current_branch>): <Branch to deploy. Leave blank to deploy current_branch>
During development, it is convenient to connect to opendsa
and codeworkout
databases from your host machine using MySQL Workbench. Once you installed MySQL Workbench create a new connection to Vagrant VM Database using the following setup:
- Connection Name: OpenDSA-Devstack
- Connection Method: Standard TCP/IP over SSH
- SSH Hostname: 192.168.33.10
- SSH Username: vagrant
- SSH Password: vagrant
- MySQL Hostname: 127.0.0.1
- MySQL Server Port: 3306
- Username: opendsa
- Password: opendsa
- On the page with the untrusted certificate (
https://
is crossed out in red), click the lock > Certificate Information. - Click the
Details tab > Export
. ChoosePKCS #7, single certificate
as the file format. - Then follow my original instructions to get to the Manage Certificates page. Click the `Authorities tab > Import and choose the file to which you exported the certificate.
- If prompted certification store, choose Trusted Root Certificate Authorities
- Check all boxes and click OK. Restart Chrome.