mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-17 11:18:52 +00:00
Updated base vagrant box. added full provisioning of HRPG env.
This commit is contained in:
parent
c1a219380b
commit
326b65a8e0
3 changed files with 101 additions and 36 deletions
57
VAGRANT.md
57
VAGRANT.md
|
|
@ -1,4 +1,4 @@
|
|||
## Vagrant ##
|
||||
# Vagrant #
|
||||
|
||||
Vagrant is a system to create reproducible and portable development
|
||||
environments. Because of the variety of systems used for HabitRPG
|
||||
|
|
@ -8,37 +8,64 @@ 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
|
||||
the software appropriate for your system.
|
||||
the software appropriate for your system. Using HabitRPG's vagrant image
|
||||
requires a minimum of Vagrant version 1.5.
|
||||
|
||||
Once Vagrant has been installed, issue the following commands to get the
|
||||
environment up and running:
|
||||
|
||||
1. Fork and Clone the HabitRPG git repository
|
||||
2. Boot up the box:
|
||||
2. Create a config file from the sample config:
|
||||
|
||||
`cp config.json.example config.json`
|
||||
|
||||
3. Edit the `ADMIN_EMAIL`, `SMTP_USER`, `SMTP_PASS`, and `SMTP_SERVICE` values in config.json.
|
||||
|
||||
4. Boot up the box:
|
||||
|
||||
`vagrant up`
|
||||
|
||||
3. Login to the environment:
|
||||
This step may take a while, and you may see various warnings scroll up
|
||||
your screen. If you encounter failures at step 6 or 7, make a note of
|
||||
any failures, and submit them as a bug (see below)
|
||||
|
||||
5. 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:
|
||||
6. Once you're on the vagrant machine, start the system:
|
||||
|
||||
`npm start`
|
||||
|
||||
7. Open a browser to `http://localhost:3000`
|
||||
|
||||
If you encounter any difficulties getting your Vagrant environment up
|
||||
and running, [file a bug on
|
||||
Github](https://github.com/HabitRPG/habitrpg/issues/new) and mention
|
||||
'@thepeopleseason' in the body of your bug report.
|
||||
|
||||
## 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
|
||||
HabitRPG directory, and remove the '#' in front of the line
|
||||
|
||||
> `#config.vm.provision :shell, :path => "vagrant.sh"`
|
||||
> # autostart_habitrpg
|
||||
|
||||
Once the system is up and running, you will need to open another shell to run
|
||||
`vagrant ssh`
|
||||
Once the system is up and running, you will need to open another shell
|
||||
to run `vagrant ssh`, and you won't be able to interactively reload the
|
||||
server. Because of these deficiencies, you should only autostart the
|
||||
server if you know what you're doing.
|
||||
|
||||
## Notes ##
|
||||
|
||||
By default, running the HabitRPG server will show up on your local
|
||||
machine on port 3000. If you already have port 3000 mapped to another
|
||||
service, however, vagrant will use another port between 3000 and 3050 to
|
||||
forward traffic to the virtual machine.
|
||||
|
||||
In creating the vagrant environment, a configuration option
|
||||
automatically changes the working directory to /vagrant (the location of
|
||||
the HabitRPG source) on login. If you do not wish to login to vagrant
|
||||
with that default directory, edit /home/vagrant/.bashrc to remove the
|
||||
final line ('cd /vagrant').
|
||||
|
|
|
|||
17
Vagrantfile
vendored
17
Vagrantfile
vendored
|
|
@ -1,14 +1,15 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# The vagrant config for HabitRPG. Requires vagrant on your local machine.
|
||||
# The box fetched will be precise64 located:
|
||||
# http://files.vagrantup.com/precise64.box
|
||||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
config.vm.box = "thepeopleseason/habitrpg"
|
||||
config.ssh.forward_agent = true
|
||||
|
||||
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"
|
||||
config.vm.network "forwarded_port", guest: 3000, host: 3000, auto_correct: true
|
||||
config.vm.usable_port_range = (3000..3050)
|
||||
config.vm.provision :shell, :path => "vagrant.sh"
|
||||
end
|
||||
|
|
|
|||
63
vagrant.sh
63
vagrant.sh
|
|
@ -1,20 +1,57 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# HabitRPG provisioning script
|
||||
|
||||
update_config=$'Please update config.json with your values\nfor ADMIN_EMAIL, SMTP_USER, SMTP_PASS and SMTP_SERVICE,\nthen run "vagrant reload --provision"'
|
||||
# function for autostart
|
||||
function autostart_habitrpg {
|
||||
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;
|
||||
# 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;
|
||||
else
|
||||
npm start
|
||||
fi
|
||||
else
|
||||
cp config.json.example config.json;
|
||||
echo "$update_config";
|
||||
exit;
|
||||
fi
|
||||
}
|
||||
|
||||
# Main provisioning
|
||||
echo Setting up HabitRPG...
|
||||
echo cd /vagrant >> /home/vagrant/.bashrc
|
||||
|
||||
apt-get update -qq
|
||||
|
||||
echo Installing Mongodb...
|
||||
apt-get install -qq mongodb
|
||||
|
||||
echo Installing Git...
|
||||
apt-get install -qq git
|
||||
|
||||
echo Installing npm...
|
||||
apt-get install -qq python-software-properties
|
||||
apt-add-repository -y ppa:chris-lea/node.js
|
||||
apt-get update -qq
|
||||
apt-get install -qq nodejs
|
||||
|
||||
cd /vagrant
|
||||
|
||||
echo Installing grunt/bower...
|
||||
npm install -g grunt-cli bower
|
||||
|
||||
echo Installing HabitRPG
|
||||
npm install
|
||||
|
||||
echo Seeding Mongodb...
|
||||
node ./src/seed.js
|
||||
|
||||
# Uncomment this line to autostart the habitrpg server when provisioning
|
||||
# autostart_habitrpg
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue