added provisioning and removed need for direct DL

This commit is contained in:
James Hsiao 2014-03-09 20:25:00 -04:00
parent 4814f479a4
commit 66b0f87f65
3 changed files with 53 additions and 10 deletions

View file

@ -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`

3
Vagrantfile vendored
View file

@ -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

20
vagrant.sh Normal file
View file

@ -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