Skip to content

Commit 229fa19

Browse files
committed
Initial crack - beginning test builds before tagging stable
0 parents  commit 229fa19

File tree

527 files changed

+30033
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

527 files changed

+30033
-0
lines changed

Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# General Ruby Box

vagrant/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# if updating cookbooks w/ Librarian, ignore the build files
2+
.librarian
3+
/tmp
4+
5+
# make sure the .vagrant directory isn't tracked
6+
.vagrant

vagrant/Cheffile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# encoding: utf-8
2+
3+
site 'http://community.opscode.com/api/v1'
4+
5+
cookbook "apt"
6+
#cookbook "build-essential", {}
7+
cookbook "git", {}
8+
cookbook "openssl", {}
9+
cookbook "nginx", {}
10+
cookbook "apache2", {}
11+
cookbook "nodejs", {:github=>"mdxp/nodejs-cookbook"}
12+
cookbook "redis", {:github=>"ctrabold/chef-redis"}
13+
cookbook "postgresql", {:github=>"phlipper/chef-postgresql", :ref=>"0.13.1"}
14+
cookbook "ruby_build", {:github=>"fnichol/chef-ruby_build", :ref=>"v0.8.0"}
15+
cookbook "rbenv", {:github=>"fnichol/chef-rbenv", :ref=>"v0.7.2"}

vagrant/Cheffile.lock

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
SITE
2+
remote: http://community.opscode.com/api/v1
3+
specs:
4+
apache2 (1.8.14)
5+
apt (2.3.4)
6+
bluepill (2.3.1)
7+
rsyslog (>= 0.0.0)
8+
build-essential (1.4.2)
9+
chef_handler (1.1.4)
10+
dmg (2.1.4)
11+
git (2.9.0)
12+
build-essential (>= 0.0.0)
13+
dmg (>= 0.0.0)
14+
runit (>= 1.0.0)
15+
windows (>= 0.0.0)
16+
yum (~> 3.0)
17+
yum-epel (>= 0.0.0)
18+
nginx (2.2.2)
19+
apt (~> 2.2)
20+
bluepill (~> 2.3)
21+
build-essential (~> 1.4)
22+
ohai (~> 1.1)
23+
runit (~> 1.2)
24+
yum (~> 3.0)
25+
yum-epel (>= 0.0.0)
26+
ohai (1.1.12)
27+
openssl (1.1.0)
28+
rsyslog (1.10.2)
29+
runit (1.5.8)
30+
build-essential (>= 0.0.0)
31+
yum (~> 3.0)
32+
yum-epel (>= 0.0.0)
33+
windows (1.12.8)
34+
chef_handler (>= 0.0.0)
35+
yum (3.0.6)
36+
yum-epel (0.2.0)
37+
yum (~> 3.0)
38+
39+
GIT
40+
remote: https://github.com/ctrabold/chef-redis
41+
ref: master
42+
sha: e3a89f34d0f5b81867ae9e07a9404ac89e1ff61c
43+
specs:
44+
redis (0.0.4)
45+
46+
GIT
47+
remote: https://github.com/fnichol/chef-rbenv
48+
ref: v0.7.2
49+
sha: f2b53292e810dd2b43f6121f9958f5f29979dcb1
50+
specs:
51+
rbenv (0.7.2)
52+
53+
GIT
54+
remote: https://github.com/fnichol/chef-ruby_build
55+
ref: v0.8.0
56+
sha: ed2d3841784ecf60c1de808946307b588efe644f
57+
specs:
58+
ruby_build (0.8.0)
59+
60+
GIT
61+
remote: https://github.com/mdxp/nodejs-cookbook
62+
ref: master
63+
sha: 4c685529e7a8db0222b17407367e8b309afd3137
64+
specs:
65+
nodejs (1.3.0)
66+
apt (>= 0.0.0)
67+
build-essential (>= 0.0.0)
68+
yum (>= 0.0.0)
69+
70+
GIT
71+
remote: https://github.com/phlipper/chef-postgresql
72+
ref: 0.13.1
73+
sha: 517e5331ddaa08aabf81deed64d0387b1f5c7a31
74+
specs:
75+
postgresql (0.13.1)
76+
apt (>= 1.9.0)
77+
78+
DEPENDENCIES
79+
apache2 (>= 0)
80+
apt (>= 0)
81+
git (>= 0)
82+
nginx (>= 0)
83+
nodejs (>= 0)
84+
openssl (>= 0)
85+
postgresql (>= 0)
86+
rbenv (>= 0)
87+
redis (>= 0)
88+
ruby_build (>= 0)
89+

vagrant/Vagrantfile

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
# encoding: utf-8
2+
3+
# -*- mode: ruby -*-
4+
# vi: set ft=ruby :
5+
6+
Vagrant.configure("2") do |config|
7+
8+
SERVER_NGINX = 'nginx'
9+
SERVER_APACHE = 'apache'
10+
SERVER_NONE = false
11+
12+
# COMMONLY USED SETTINGS : NORMALLY DON'T CUSTOMIZE BELOW THIS HASH
13+
box_settings = {
14+
# Memory available for the virtual machine
15+
:memory_cap => '384',
16+
# Port to forward on your local system (http://localhost:3000)
17+
:http_port => {:from => 80, :to => 8080},
18+
# Install NodeJS?
19+
:nodejs => true,
20+
# Install Redis?
21+
:redis => true,
22+
# Install Nginx, Apache, or no web server? options: "nginx", "apache", false
23+
:web_server => SERVER_NONE,
24+
# Ruby settings for this box (using rbenv, to install more rubies, modify per-project)
25+
:ruby_settings => {
26+
# Ruby version to install for the Vagrant user
27+
:version => "2.1.0",
28+
# Gems to install out of the gate
29+
:gems => [{:name => 'bundler'}]
30+
},
31+
# PostgreSQL settings
32+
:postgres => {
33+
# Install PostgreSQL?
34+
:install => false,
35+
# Password for login
36+
:password => "vagrant",
37+
# Port to forward on your local system (GUI client)
38+
:port => {:from => 5432, :to => 5432},
39+
# Install hstore extensions?
40+
:hstore => true,
41+
# Install GIS extensions?
42+
:gis => false
43+
}
44+
}
45+
46+
47+
##################################################################################
48+
### REMAINING VAGRANT STUFF : USUALLY DON'T NEED TO DO ANYTHING!
49+
##################################################################################
50+
config.vm.box = "precise64-pristine"
51+
# Box URL
52+
config.vm.box_url = "http://focus-43.com/files/1913/8670/0974/precise64-pristine.box"
53+
# Apache
54+
config.vm.network :forwarded_port, guest: box_settings[:http_port][:from], host: box_settings[:http_port][:to], auto_correct: true
55+
# PostgreSQL (if applicable)
56+
if( box_settings[:postgres][:install] )
57+
config.vm.network :forwarded_port, guest: box_settings[:postgres][:port][:from], host: box_settings[:postgres][:port][:to], auto_correct: true
58+
end
59+
# Mount shared folder
60+
config.vm.synced_folder "../", "/home/vagrant/app"
61+
# Vagrant port forwarding
62+
config.ssh.forward_agent = true
63+
# Make VirtualBox GUI display the VM name as root project folder
64+
begin
65+
config.vm.provider "virtualbox" do |v|
66+
v.name = File.basename(File.expand_path("../"))
67+
end
68+
rescue
69+
$stdout.puts "Unable to rename Concrete5 VM; VirtualBox will display a generic name..."
70+
end
71+
# Resource usage caps for VM
72+
begin
73+
config.vm.provider "virtualbox" do |v|
74+
v.customize ['modifyvm', :id, '--memory', box_settings[:memory_cap]]
75+
end
76+
rescue
77+
$stdout.puts "Unable to set resource usage for VirtualBox; proceeding with defaults..."
78+
end
79+
80+
# Ensure utf8 locales (for compiling postgres and GIS extensions specifically)
81+
config.vm.provision :shell, :path => "shell_scripts/configure_vm_locales.sh"
82+
83+
# Chef provisioner : things included optionally based on declarations
84+
# in the box_settings file
85+
config.vm.provision :chef_solo do |chef|
86+
# Default cookbooks
87+
chef.cookbooks_path = ['cookbooks', 'project_cookbooks']
88+
chef.add_recipe :apt
89+
chef.add_recipe 'openssl'
90+
chef.add_recipe 'git'
91+
chef.add_recipe 'ruby_build'
92+
chef.add_recipe 'rbenv::user'
93+
94+
# Default attributes
95+
_attributes = {
96+
:git => {
97+
:prefix => '/usr/local'
98+
},
99+
:rbenv => {
100+
:user_installs => [{
101+
:user => 'vagrant',
102+
:rubies => [ box_settings[:ruby_settings][:version] ],
103+
:global => box_settings[:ruby_settings][:version],
104+
:gems => {
105+
box_settings[:ruby_settings][:version] => box_settings[:ruby_settings][:gems]
106+
}
107+
}]
108+
}
109+
}
110+
111+
# Include NodeJS?
112+
if box_settings[:nodejs]
113+
chef.add_recipe 'nodejs'
114+
chef.add_recipe 'nodejs::npm'
115+
end
116+
117+
# Include Redis?
118+
if box_settings[:redis]
119+
chef.add_recipe 'redis'
120+
121+
_attributes[:redis] = {
122+
:bind => "127.0.0.1",
123+
:port => "6379",
124+
:config_path => "/etc/redis/redis.conf",
125+
:daemonize => "yes",
126+
:timeout => "300",
127+
:loglevel => "notice"
128+
}
129+
end
130+
131+
# Use Nginx as the web server?
132+
if box_settings[:web_server] == SERVER_NGINX
133+
chef.add_recipe 'nginx'
134+
135+
_attributes[:nginx] = {
136+
:dir => "/etc/nginx",
137+
:log_dir => "/var/log/nginx",
138+
:binary => "/usr/sbin/nginx",
139+
:user => "vagrant",
140+
:init_style => "runit",
141+
:pid => "/var/run/nginx.pid",
142+
:worker_connections => "1024",
143+
# customizations
144+
:default_site_enabled => false
145+
}
146+
end
147+
148+
# User Apache as the web server?
149+
if box_settings[:web_server] == SERVER_APACHE
150+
chef.add_recipe 'apache2'
151+
152+
_attributes[:apache] = {
153+
:default_site_enabled => "true",
154+
:dir => "/etc/apache2",
155+
:log_dir => "/var/log/apache2",
156+
:error_log => "error.log",
157+
:user => 'vagrant',
158+
:group => 'vagrant',
159+
:binary => "/usr/sbin/apache2",
160+
:cache_dir => "/var/cache/apache2",
161+
:pid_file => "/var/run/apache2.pid",
162+
:lib_dir => "/usr/lib/apache2",
163+
:listen_ports => ["80", "443"],
164+
:contact => "ops@example.com",
165+
:timeout => "300",
166+
:keepalive => "On",
167+
:keepaliverequests => "100",
168+
:keepalivetimeout => "5",
169+
:default_modules => [
170+
'mod_mime',
171+
'mod_expires',
172+
'mod_php5',
173+
'mod_rewrite',
174+
'mod_deflate',
175+
'mod_headers',
176+
'mod_ssl'
177+
]
178+
}
179+
end
180+
181+
# Install PostgreSQL?
182+
if box_settings[:postgres][:install]
183+
chef.add_recipe 'postgresql'
184+
# Include GIS extensions?
185+
if box_settings[:postgres][:gis]
186+
chef.add_recipe 'postgresql::postgis'
187+
end
188+
189+
_attributes[:postgresql] = {
190+
:port => box_settings[:postgres][:port][:from],
191+
:listen_addresses => '*',
192+
:users => [{
193+
:username => 'vagrant',
194+
:password => box_settings[:postgres][:password],
195+
:superuser => true,
196+
:createdb => false,
197+
:login => true
198+
}],
199+
:pg_hba => [
200+
{:type => 'local', :db => 'all', :user => 'postgres', :addr => '', :method => 'ident'},
201+
{:type => 'local', :db => 'all', :user => 'all', :addr => '', :method => 'trust'},
202+
{:type => 'host', :db => 'all', :user => 'all', :addr => '0.0.0.0/0', :method => 'trust'},
203+
{:type => 'host', :db => 'all', :user => 'all', :addr => '::1/0', :method => 'trust'}
204+
#{:type => "local", :db => "postgres", :user => "postgres", :addr => nil, :method => "trust"},
205+
#{:type => "host", :db => "all", :user => "all", :addr => "0.0.0.0/0", :method => "md5"},
206+
#{:type => "host", :db => "all", :user => "all", :addr => "::1/0", :method => "md5"}
207+
]
208+
}
209+
end
210+
211+
# *NOW* pass the attributes to chef.json
212+
chef.json = _attributes
213+
214+
end
215+
216+
end

0 commit comments

Comments
 (0)