diff --git a/dev/Vagrantfile b/dev/Vagrantfile index 7d0fe0398e..9a12497b2f 100644 --- a/dev/Vagrantfile +++ b/dev/Vagrantfile @@ -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}\"", @@ -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) diff --git a/dev/scripts/provision-postgres.sh b/dev/scripts/provision-postgres.sh index c2a0beced3..7c9502f0ed 100755 --- a/dev/scripts/provision-postgres.sh +++ b/dev/scripts/provision-postgres.sh @@ -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';" diff --git a/omnibus/files/private-chef-cookbooks/private-chef/libraries/ec_postgres.rb b/omnibus/files/private-chef-cookbooks/private-chef/libraries/ec_postgres.rb index 9f7ea28f26..1ca8f82fad 100644 --- a/omnibus/files/private-chef-cookbooks/private-chef/libraries/ec_postgres.rb +++ b/omnibus/files/private-chef-cookbooks/private-chef/libraries/ec_postgres.rb @@ -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'],