-
Notifications
You must be signed in to change notification settings - Fork 8
/
provision.rb
71 lines (57 loc) · 1.74 KB
/
provision.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
%w[ build-essential wget libpcre3-dev luarocks git-core cpanminus curl ].each do |p|
package p
end
execute "install basho key" do
command "curl http://apt.basho.com/gpg/basho.apt.key | apt-key add -"
action :nothing
notifies :run, "execute[apt-get update]", :immediately
end
execute "apt-get update" do
action :nothing
end
file "/etc/apt/sources.list.d/basho.list" do
content "deb http://apt.basho.com #{node['lsb']['codename']} main\n"
notifies :run, "execute[install basho key]", :immediately
end
package "riak" do
version "1.4.9-1"
end
file "/etc/default/riak" do
content "ulimit -n 16384\n"
notifies :restart, "service[riak]"
end
template "/etc/riak/app.config" do
source "/vagrant/app.config"
local true
notifies :restart, "service[riak]"
end
service "riak" do
action [ :enable, :start]
end
execute "luarocks install https://raw.github.com/Neopallium/lua-pb/master/lua-pb-scm-0.rockspec" do
not_if "luarocks show lua-pb"
end
execute "luarocks install lpack" do
not_if "luarocks show lpack"
end
execute "cpanm install Test::Nginx" do
not_if "perl -mTest::Nginx -e'1'"
end
openresty_version = "1.7.2.1"
check_nginx_version = "/usr/local/sbin/nginx -v 2>&1 | grep 'openresty/#{openresty_version}'"
remote_file "/home/vagrant/ngx_openresty-#{openresty_version}.tar.gz" do
source "http://openresty.org/download/ngx_openresty-#{openresty_version}.tar.gz"
notifies :run, "execute[install openresty]"
not_if check_nginx_version
end
execute "install openresty" do
cwd "/home/vagrant"
command <<EOF
tar -zxvf ngx_openresty-#{openresty_version}.tar.gz
cd ngx_openresty-#{openresty_version}
./configure --with-luajit --prefix=/usr/local --sbin-path=/usr/local/sbin/nginx
make
make install
EOF
not_if check_nginx_version
end