Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#562 added vagrant support #565

Merged
merged 1 commit into from
Jul 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ config/development.yml
config/development.json
config/certs/goo.pem

npm-shrinkwrap.json
npm-shrinkwrap.json

.vagrant
39 changes: 39 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
[submodule "wiki"]
path = wiki
url = https://github.com/joola/joola.io.wiki.git
[submodule "build/cookbooks/nodejs"]
path = build/cookbooks/nodejs
url = https://github.com/mdxp/nodejs-cookbook.git
[submodule "build/cookbooks/apt"]
path = build/cookbooks/apt
url = https://github.com/opscode-cookbooks/apt.git
[submodule "build/cookbooks/build-essential"]
path = build/cookbooks/build-essential
url = https://github.com/opscode-cookbooks/build-essential.git
[submodule "build/cookbooks/yum-epel"]
path = build/cookbooks/yum-epel
url = https://github.com/opscode-cookbooks/yum-epel.git
[submodule "build/cookbooks/yum"]
path = build/cookbooks/yum
url = https://github.com/opscode-cookbooks/yum.git
[submodule "build/cookbooks/redisio"]
path = build/cookbooks/redisio
url = https://github.com/brianbianco/redisio.git
[submodule "build/cookbooks/mongodb"]
path = build/cookbooks/mongodb
url = https://github.com/edelight/chef-mongodb.git
[submodule "build/cookbooks/rabbitmq"]
path = build/cookbooks/rabbitmq
url = https://github.com/kennonkwok/rabbitmq
[submodule "build/cookbooks/ulimit"]
path = build/cookbooks/ulimit
url = https://github.com/bmhatfield/chef-ulimit.git
[submodule "build/cookbooks/python"]
path = build/cookbooks/python
url = https://github.com/poise/python.git
[submodule "build/cookbooks/runit"]
path = build/cookbooks/runit
url = https://github.com/hw-cookbooks/runit.git
[submodule "build/cookbooks/erlang"]
path = build/cookbooks/erlang
url = https://github.com/opscode-cookbooks/erlang.git
[submodule "build/cookbooks/yum-erlang_solutions"]
path = build/cookbooks/yum-erlang_solutions
url = https://github.com/opscode-cookbooks/yum-erlang_solutions.git
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ apiary.out.html
config/oo.yml
config/development.yml
config/development.json
config/certs/goo.pem
config/certs/goo.pem

.vagrant
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ test-api:
publish:
npm shrinkwrap
npm publish
rm npm-shrinkwrap.json

.PHONY: test

26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,37 @@ joola.io uses several leading open-source software for its operation. Before get
For the example below to work out-of-the-box, it's required to have both joola.io and its dependencies installed on localhost.
For more details on the installation process, please refer to [this guide](http://github.com/joola/joola.io/wiki/install-joola.io).

#### Using Vagrant
We have included a [Vagrant](http://www.vagrantup.com) file to support easy playing around and testing. Running `vagrant up` will install all needed dependencies and run joola.io for you in a sand boxed virtual environment.

```bash
# Clone this repository
$ git clone https://github.com/joola/joola.io
$ cd joola.io

$ vagrant up
# wait for the box to come online
$ vagrant ssh

# once in the box
$ cd /opt/joola/node_modules/joola.io
$ node joola.io.js
```

We have configured the VM to use 2 CPUs with 2048MB of memory, but these can be configured from `Vagrantfile` if you prefer different settings.

#### Install via NPM

```bash
$ mkdir /opt/joola.io
$ cd /opt/joola.io
$ npm install joola.io
$ node ./node_modules/joola.io/joola.io.js
```

# Access REST API using cURL (-k switch due to default localhost SSL certificate)
Access REST API using cURL (-k switch due to default localhost SSL certificate)

```bash
$ curl -i -k https://localhost:8081/system/version?APIToken=apitoken-demo

HTTP/1.1 200 OK
Expand Down
29 changes: 29 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# 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 = "ubuntu/trusty32"
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.network "forwarded_port", guest: 8081, host: 8081

config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
end

config.vm.provision "chef_solo" do |chef|
chef.log_level = :debug
chef.verbose_logging = true
chef.cookbooks_path = "./build/cookbooks"
chef.custom_config_path = "./build/cookbooks/VagrantConfig.chef"
chef.add_recipe "nodejs"
chef.add_recipe "redisio::install"
chef.add_recipe "redisio::enable"
chef.add_recipe "mongodb"
chef.add_recipe "rabbitmq"
chef.add_recipe "joola"
end
end
1 change: 1 addition & 0 deletions build/cookbooks/VagrantConfig.chef
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Chef::Config.ssl_verify_mode = :verify_peer
1 change: 1 addition & 0 deletions build/cookbooks/apt
Submodule apt added at ac1917
1 change: 1 addition & 0 deletions build/cookbooks/build-essential
Submodule build-essential added at 400968
1 change: 1 addition & 0 deletions build/cookbooks/erlang
Submodule erlang added at 1ec78f
39 changes: 39 additions & 0 deletions build/cookbooks/joola/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
rabbitmq_plugin "rabbitmq_management" do
action :enable
end

rabbitmq_plugin "rabbitmq_stomp" do
action :enable
end

bash "install joola" do
user "root"
code <<-EOH
mkdir /opt/joola
mkdir /var/log/joola.io
cd /opt/joola

sudo chown -R root /root/.npm

npm install /vagrant --production
chown -R vagrant /opt/joola
chown -R vagrant /var/log/joola.io
EOH
end

#bash "install pm2" do
# user "root"
# code <<-EOH
# npm install -g pm2 --production
# pm2 kill
# EOH
#end

#bash "run joola (using pm2)" do
# user "vagrant"
# code <<-EOH
# cd /opt/joola/node_modules/joola.io
#
# pm2 start joola.io.js
# EOH
#end
1 change: 1 addition & 0 deletions build/cookbooks/mongodb
Submodule mongodb added at 17ab1f
1 change: 1 addition & 0 deletions build/cookbooks/nodejs
Submodule nodejs added at e2415c
1 change: 1 addition & 0 deletions build/cookbooks/python
Submodule python added at 56424a
1 change: 1 addition & 0 deletions build/cookbooks/rabbitmq
Submodule rabbitmq added at bc6b3c
1 change: 1 addition & 0 deletions build/cookbooks/redisio
Submodule redisio added at 2b7fc0
1 change: 1 addition & 0 deletions build/cookbooks/runit
Submodule runit added at d54b9a
1 change: 1 addition & 0 deletions build/cookbooks/ulimit
Submodule ulimit added at 965ca2
1 change: 1 addition & 0 deletions build/cookbooks/yum
Submodule yum added at e09d96
1 change: 1 addition & 0 deletions build/cookbooks/yum-epel
Submodule yum-epel added at 6ef99e
1 change: 1 addition & 0 deletions build/cookbooks/yum-erlang_solutions
Submodule yum-erlang_solutions added at 553756