Skip to content

Commit 091cdcc

Browse files
committed
add database.yml and install missing dependencies.
1 parent 7f3c7a7 commit 091cdcc

File tree

1 file changed

+50
-19
lines changed

1 file changed

+50
-19
lines changed

scripts/shell/provision.rb

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,43 @@
22
execute "apt-get upgrade -y"
33

44
package [
5+
"autoconf",
6+
"bison",
57
"build-essential",
68
"curl",
79
"git-core",
10+
"libapr1",
11+
"libaprutil1",
812
"libcurl4-openssl-dev",
913
"libffi-dev",
14+
"libgmp3-dev",
15+
"libpcap-dev",
16+
"libpq-dev",
1017
"libreadline-dev",
18+
"libreadline6-dev",
1119
"libsqlite3-dev",
1220
"libssl-dev",
21+
"libsvn1",
22+
"libtool",
23+
"libxml2",
1324
"libxml2-dev",
25+
"libxslt-dev",
1426
"libxslt1-dev",
1527
"libyaml-dev",
28+
"locate",
29+
"ncurses-dev",
30+
"openssl",
31+
"postgresql",
32+
"postgresql-contrib",
1633
"python-software-properties",
1734
"sqlite3",
35+
"vim",
36+
"wget",
37+
"xsel",
38+
"zlib1g",
1839
"zlib1g-dev",
1940
]
2041

21-
bash "install postgres" do
22-
user "root"
23-
not_if { ::File.exist?("/etc/apt/sources.list.d/pgdg.list") }
24-
code <<-SCRIPT
25-
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
26-
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc \
27-
| apt-key add -
28-
apt-get update -y
29-
apt-get install -y postgresql-9.4 libpq-dev \
30-
postgresql-contrib-9.4 postgresql-client-common
31-
SCRIPT
32-
end
33-
3442
sql = "SELECT 1 FROM pg_roles WHERE rolname='vagrant'"
3543
create_user = "createuser -s -e -w vagrant"
3644
execute "psql postgres -tAc \"#{sql}\" | grep -q 1 || #{create_user}" do
@@ -43,6 +51,35 @@
4351
not_if { "psql postgres -tAc \"#{sql}\" | grep -q 1" }
4452
end
4553

54+
file "/vagrant/.msf4/database.yml" do
55+
content <<-EOH
56+
# Development Database
57+
development: &pgsql
58+
adapter: postgresql
59+
database: msf_dev_db
60+
username: vagrant
61+
host: localhost
62+
port: 5432
63+
pool: 5
64+
timeout: 5
65+
66+
# Production database -- same as dev
67+
production: &production
68+
<<: *pgsql
69+
70+
# Test database -- not the same, since it gets dropped all the time
71+
test:
72+
<<: *pgsql
73+
database: msf_test_db
74+
EOH
75+
end
76+
77+
["postgresql"].each do |service_name|
78+
service service_name do
79+
action [:enable, :start]
80+
end
81+
end
82+
4683
git "/usr/local/rbenv" do
4784
repository "https://github.com/sstephenson/rbenv.git"
4885
end
@@ -78,9 +115,3 @@
78115
gem install bundler --no-ri --no-rdoc
79116
EOH
80117
end
81-
82-
["postgresql"].each do |service_name|
83-
service service_name do
84-
action [:enable, :start]
85-
end
86-
end

0 commit comments

Comments
 (0)