forked from sous-chefs/postgresql
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathVagrantfile.example
More file actions
95 lines (88 loc) · 2.92 KB
/
Vagrantfile.example
File metadata and controls
95 lines (88 loc) · 2.92 KB
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
# our settings
chef_json = {
postgresql: {
password: {
postgres: "howdy"
},
version: 9.5,
config: {
# this seems to be required off for now
ssl: false,
archive_mode: false
},
streaming: {
master: {
host: "192.168.7.10"
}
},
pg_hba: [
{type: 'local', db: 'all', user: 'postgres', addr: nil, method: 'ident'},
{type: 'local', db: 'all', user: 'all', addr: nil, method: 'ident'},
{type: 'host', db: 'all', user: 'all', addr: '127.0.0.1/32', method: 'md5'},
{type: 'host', db: 'all', user: 'all', addr: '::1/128', method: 'md5'},
{type: 'host', db: 'all', user: 'all', addr: '192.168.7.0/24', method: 'trust'},
]
wal_e: {
aws_access_key: 'ACCESS',
aws_secret_key: 'SECRET',
s3_bucket: 'BUCKET'
}
}
}
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64"
config.vm.network "public_network"
#config.berkshelf.enabled = true
# this is not really needed, but archiving locally is weird
config.vm.synced_folder "pgdata/", "/share/psql", mount_options: %w(dmode=777 fmode=666)
# define our psql master
config.vm.define :master do |conf|
conf.vm.host_name = "pgsql-master"
conf.vm.network 'private_network', ip: "192.168.7.10"
conf.vm.provider :virtualbox do |vb|
vb.memory= 2048
vb.cpus= 2
end
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "../my-recipes/cookbooks"
chef.roles_path = "../my-recipes/roles"
chef.add_recipe( "postgresql::server_streaming_master" )
chef.add_recipe( "postgresql::wal-e" )
json = chef_json.dup
json[:postgresql][:pg_hba] << {
type: 'host',
db: 'replication',
user: 'all',
addr: '192.168.7.31/30',
method: 'trust'
}
chef.json = json
end
end
# define our slaves, two for now
# more requires a larger netmask in the section above,
# plus more senders on the master
{ slave0: 30, slave1: 31 }.each do |slave,ip|
config.vm.define slave do |conf|
conf.vm.host_name = "pgsql-#{slave}"
conf.vm.network 'private_network', ip: "192.168.7.#{ip}"
conf.vm.provider :virtualbox do |vb|
vb.memory= 1024
end
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "../my-recipes/cookbooks"
chef.roles_path = "../my-recipes/roles"
chef.add_recipe( "postgresql::server_streaming_slave" )
chef.json = chef_json
end
end
end
end