Common Tasks - RepoCamp/ohsu2018 GitHub Wiki
-
Stop the VM if it's running
- Find the terminal window where you started vagrant
- Exit the VM if needed (i.e. if you have a
*vagrant@camperprompt:exit - Type
vagrant halt
-
Start the VM if it's not running
- Open a new terminal window on your host system
- Change directory to the directory with
Vagrantfilein it - Type
vagrant up
-
Connect to the VM
- From the directory with
Vagrantfilein it on your host system, type
vagrant ssh - For the tutorials here, you'll always want to run from the same directory.
Change your working directory:
cd /vagrant/ohsu2018
- From the directory with
-
Start Solr, Fedora, and web servers hydra:server
- Open a separate terminal and connect to a new ssh session where you can leave the servers running (see the steps above)
- Type
cd /vagrant/ohsu2018to change directory to the root of your Rails application - Type
rails hydra:serverto start Solr, Fedora, and the Web server
-
Start Solr, Fedora servers for you test environment hydra:test_server
- Open a separate terminal and connect to a new ssh session where you can leave the servers running (see the steps above)
- Type
cd /vagrant/ohsu2018to change directory to the root of your Rails application - Type
rails hydra:test_serverto start Solr, Fedora, and the Web serverALTERNATE Instead of leaving your test servers running using the command in 3. You can start your servers each time using
rails ciand Solr and Fedora will start before running the tests and then shut down automatically after the test suite has run
-
Editing files
- This tutorial assumes that you run the examples within your virtual machine from the
/vagrant/ohsu2018directory - The entire
/vagrantdirectory in your virtual machine (guest) is shared to your laptop (host), so you can use your favorite editor or IDE to edit files easily atpath-you-copied-to-on-your-host-system/vagrant/ohsu2018 - Inside the guest machine, you can also use common Linux editors like
vimandnanoto edit files.
- This tutorial assumes that you run the examples within your virtual machine from the
-
Start a Rails console
- Make sure you're connected to the VM
- Type
cd /vagrant/ohsu2018to change directory to the root of your Rails application - Type
rails consoleto enter the console (orrails cfor shorthand) - Type
exitwhen you're done to return to the command line
-
Fix Solr if you get an error like
ERROR: Core 'hydra-test' already exists!- Clear the test solr instance using
rm -rf tmp/solr-test/server/solr/hydra-test - ALTERNATE Try
solr_wrapper --config config/solr_wrapper_test.yml clean - Try
rails ciagain and things should work; if not, ask for help!
- Clear the test solr instance using
-
Wipe out everything and start over
- On your host system, open a terminal window and switch to your vagrant directory
cd [path-on-your-local-system]/vagrant - Kill the Vagrant virtual machine
vagrant destroy- answer 'y' when prompted - OPTIONAL WITH FIRE
Remove the base virtual machine
vagrant box remove --all camper - Follow the Initial Vagrant Setup instructions again
- On your host system, open a terminal window and switch to your vagrant directory