Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dvm changes to get external postgres working. #1708

Merged
merged 1 commit into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dev/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def define_chef_server(config, attributes)
if vmattr["postgresql"]["start"] and vmattr["postgresql"]["use-external"]
# TODO make this stuff common - we have these values in 2-3 places now...
pg = { "postgresql['external']" => true,
"postgresql['vip']" => "\"#{IPS[:database]}\"",
"postgresql['vip']" => "\"#{IPS[:db]}\"",
"postgresql['port']" => 5432,
"postgresql['db_superuser']" => "\"#{DB_SUPERUSER}\"",
"postgresql['db_superuser_password']" => "\"#{DB_SUPERPASS}\"",
Expand Down Expand Up @@ -276,13 +276,13 @@ def define_ldap_server(config, attributes)
end

def define_db_server(config, attributes)
config.vm.hostname = "database.#{VMName}.dev"
config.vm.network "private_network", ip: IPS[:database]
config.vm.hostname = "db.#{VMName}.dev"
config.vm.network "private_network", ip: IPS[:db]
customize_vm(config, name: "database#{Variant}", memory: 512, cpus: 1)
set_chef_zero_provisioning(config,
recipes: ["provisioning::hosts"],
json: { 'provisioning' => { 'hosts' => ips_to_fqdns } })
config.vm.provision "shell", path: "scripts/configure-postgres.sh"
config.vm.provision "shell", path: "scripts/provision-postgres.sh", args: "#{IPS[:cs]}"
end

def define_custom_server(config, attributes)
Expand Down
10 changes: 5 additions & 5 deletions dev/scripts/provision-postgres.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" > /etc/apt/sources.list.d/pgdg.list
echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" > /etc/apt/sources.list.d/pgdg.list
wget --quiet https://www.postgresql.org/media/keys/ACCC4CF8.asc
apt-key add ACCC4CF8.asc
apt-get update
apt-get install postgresql-9.2 -y
echo "host all all #{IPS[:cs]}/32 md5" >> /etc/postgresql/9.2/main/pg_hba.conf
echo "listen_addresses='*'" >> /etc/postgresql/9.2/main/postgresql.conf
apt-get install postgresql-9.6 -y
echo "host all all $1/32 md5" >> /etc/postgresql/9.6/main/pg_hba.conf
echo "listen_addresses='*'" >> /etc/postgresql/9.6/main/postgresql.conf
service postgresql restart
export PATH=/usr/lib/postgresql/9.2/bin:$PATH
export PATH=/usr/lib/postgresql/9.6/bin:$PATH
sudo -u postgres psql -c "CREATE USER bofh SUPERUSER ENCRYPTED PASSWORD 'i1uvd3v0ps';"
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def self.with_connection(node, database = 'template1', opts = {})
end
max_retries = retries
begin
connection = ::PGconn.open('user' => postgres['db_superuser'],
connection = PG::Connection.open('user' => postgres['db_superuser'],
'host' => postgres['vip'],
'password' => postgres['db_superuser_password'],
'port' => postgres['port'],
Expand Down