blob: 8fc78dd67ecc4666c7778e13b738159c2b05e338 (
plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
execute "apt-get update -y"
execute "apt-get upgrade -y"
packages = %w{
bison
build-essential
curl
exuberant-ctags
flex
g++
git-core
gperf
libcurl4-openssl-dev
libffi-dev
libfontconfig1-dev
libfreetype6
libicu-dev
libjpeg-dev
libpcap-dev
libpng-dev
libreadline-dev
libsqlite3-dev
libssl-dev
libx11-dev
libxext-dev
libxml2-dev
libxslt1-dev
libyaml-dev
memcached
perl
python
python-software-properties
rabbitmq-server
software-properties-common
sqlite3
unzip
zlib1g-dev
}
package packages
phantomjs = "phantomjs-1.9.8-linux-x86_64"
remote_file "/tmp/#{phantomjs}.tar.bz2" do
source "https://bitbucket.org/ariya/phantomjs/downloads/#{phantomjs}.tar.bz2"
action :create
end
bash "install_phantomjs" do
cwd "/tmp"
not_if { ::Dir.exist?("/usr/local/share/#{phantomjs}") }
code <<-SCRIPT
tar xvjf #{phantomjs}.tar.bz2
mv #{phantomjs} /usr/local/share
SCRIPT
end
link "/usr/local/bin/phantomjs" do
to "/usr/local/share/#{phantomjs}/bin/phantomjs"
end
bash "install postgres" do
user "root"
not_if { ::File.exist?("/etc/apt/sources.list.d/pgdg.list") }
code <<-SCRIPT
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc \
| apt-key add -
apt-get update -y
apt-get install -y postgresql-9.4 libpq-dev \
postgresql-contrib-9.4 postgresql-client-common
SCRIPT
end
execute "curl -sL https://deb.nodesource.com/setup | bash -"
package "nodejs"
sql = "SELECT 1 FROM pg_roles WHERE rolname='vagrant'"
create_user = "createuser -s -e -w vagrant"
execute "psql postgres -tAc \"#{sql}\" | grep -q 1 || #{create_user}" do
user "postgres"
end
sql = "SELECT 1 FROM pg_roles WHERE rolname='vagrant'"
execute "createdb" do
user "vagrant"
not_if { "psql postgres -tAc \"#{sql}\" | grep -q 1" }
end
git "/usr/local/rbenv" do
repository "https://github.com/sstephenson/rbenv.git"
end
file "/etc/profile.d/rbenv.sh" do
content <<-CONTENT
export RBENV_ROOT="/usr/local/rbenv"
export PATH="/usr/local/rbenv/bin:$PATH"
eval "$(rbenv init -)"
CONTENT
end
directory "/usr/local/rbenv/plugins"
git "/usr/local/rbenv/plugins/ruby-build" do
repository "https://github.com/sstephenson/ruby-build.git"
end
bash "install_ruby" do
user "root"
not_if { ::File.exist?("/usr/local/rbenv/shims/ruby") }
code <<-EOH
source /etc/profile.d/rbenv.sh
rbenv install 2.2.3
rbenv global 2.2.3
EOH
end
bash "install_bundler" do
user "root"
code <<-EOH
source /etc/profile.d/rbenv.sh
gem install bundler --no-ri --no-rdoc
EOH
end
execute "cp .env.example .env.local" do
user "vagrant"
cwd "/vagrant"
not_if { ::File.exist?("/vagrant/.env.local") }
end
["rabbitmq-server", "postgresql"].each do |service_name|
service service_name do
action [:enable, :start]
end
end
|