From 66b0f87f650fbc16f8cafe1f5f773f838a1152df Mon Sep 17 00:00:00 2001 From: James Hsiao Date: Sun, 9 Mar 2014 20:25:00 -0400 Subject: [PATCH] added provisioning and removed need for direct DL --- VAGRANT.md | 40 ++++++++++++++++++++++++++++++---------- Vagrantfile | 3 +++ vagrant.sh | 20 ++++++++++++++++++++ 3 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 vagrant.sh diff --git a/VAGRANT.md b/VAGRANT.md index 92fe68792c..1ff66d8414 100644 --- a/VAGRANT.md +++ b/VAGRANT.md @@ -1,11 +1,10 @@ -Vagrant -=============== +## Vagrant ## Vagrant is a system to create reproducible and portable development environments. Because of the variety of systems used for HabitRPG development and the various issues developers may encounter setting up -HabitRPG on them, vagrant can provide a single development environment -no matter the developer's platform. +HabitRPG on them, vagrant provides a single development enviroment with +minimal dependencies on the developer's local platform. To use Vagrant, go to [their downloads page](http://www.vagrantup.com/downloads.html) and download and install @@ -14,11 +13,32 @@ the software appropriate for your system. Once Vagrant has been installed, issue the following commands to get the environment up and running: -1. Download the vagrant box: -`vagrant box add habitrpg http://dl.dropboxusercontent.com/u/4309797/devel/habitrpg/package.box` +1. Fork and Clone the HabitRPG git repository 2. Boot up the box: -`vagrant up` -3. Login to the environment: -`vagrant ssh` -The HabitRPG files will be located under `/vagrant' on the filesystem. + `vagrant up` + +3. Login to the environment: + + `vagrant ssh` + +4. Once you're on the vagrant machine, change to your working directory: + + `cd /vagrant` + + You should see all the files from the git repository here. + +5. Start the system: + + `npm start` + +## Automatic Startup ## + +You can opt to have the initial `vagrant up` command start the entire +system. If you choose to do so, edit the file Vagrantfile in your +HabitRPG directory, and remove the '#' in front of the + +> `#config.vm.provision :shell, :path => "vagrant.sh"` + +Once the system is up and running, you will need to open another shell to run +`vagrant ssh` diff --git a/Vagrantfile b/Vagrantfile index 4060eaecc5..ab0840f172 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -7,5 +7,8 @@ Vagrant.configure("2") do |config| config.vm.box = "habitrpg" + config.vm.box_url = "http://dl.dropboxusercontent.com/u/4309797/devel/habitrpg/habitrpg.box" + config.vm.hostname = "habitrpg" config.vm.network "forwarded_port", guest: 3000, host: 3000 + #config.vm.provision :shell, :path => "vagrant.sh" end diff --git a/vagrant.sh b/vagrant.sh new file mode 100644 index 0000000000..c54810b530 --- /dev/null +++ b/vagrant.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +update_config=$'Please update config.json with your values\nfor ADMIN_EMAIL, SMTP_USER, SMTP_PASS and SMTP_SERVICE,\nthen run "vagrant reload --provision"' + +cd /vagrant +# check if config.json exists, then check if the defaults are still in place +if [ -e config.json ]; +then + if grep -Fq 'ADMIN_EMAIL": "you@yours.com' config.json; + then + echo "$update_config"; + exit; + else + npm start + fi +else + cp config.json.example config.json; + echo "$update_config"; + exit; +fi