Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Allow Pushy Server to optionally use SSL for establishing database connections #191

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
default['pushy']['postgresql']['sql_ro_user'] = "opscode_pushy_ro"
default['pushy']['postgresql']['vip'] = "127.0.0.1"
default['pushy']['postgresql']['port'] = 5432
default['pushy']['postgresql']['sslmode'] = 'disable'

####
# Chef Pedant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def self.with_connection(node, database = 'template1', opts = {})
'host' => postgres['vip'],
'password' => password,
'port' => postgres['port'],
'sslmode' => postgres['sslmode'],
'dbname' => database)
begin
yield connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def generate_config(node_name)
PushJobsServer['postgresql']['vip'] = node['private_chef']['postgresql']['vip']
PushJobsServer['postgresql']['port'] = node['private_chef']['postgresql']['port']
PushJobsServer['postgresql']['db_superuser'] = node['private_chef']['postgresql']['db_superuser']
PushJobsServer['postgresql']['sslmode'] = node['private_chef']['postgresql']['sslmode']

topology = node['private_chef']['topology']
case topology
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
license "Apache 2.0"
description "Installs/Configures opscode-pushy-server"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.1.0"
version "0.2.0"

depends 'enterprise' # grabbed via Berkshelf + Git
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def whyrun_supported?
deploy #{target} --verify
EOM
environment "PERL5LIB" => "", # force us to use omnibus perl
"PGPASSWORD" => new_resource.password
"PGPASSWORD" => new_resource.password,
"PGSSLMODE" => new_resource.sslmode

# Sqitch Return Codes
# 0 - when changes are applied
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@
username push_attrs['db_superuser']
password PushServer::Secrets.veil.get('postgresql', 'db_superuser_password')
database database_name
sslmode push_attrs['sslmode']
end
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
attribute :password, kind_of: String, required: false, default: ""
attribute :target_version, kind_of: String
attribute :hostname, kind_of: String, required: true
attribute :port, kind_of: Integer, required: true
attribute :port, kind_of: Integer, required: true
attribute :sslmode, kind_of: String, required: false, default: "prefer"
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
{db_port, <%= node['pushy']['postgresql']['port'] %>},
{db_user, "<%= node['pushy']['postgresql']['sql_user'] %>"},
{db_name, "opscode_pushy" },
{db_options, [{ssl, <%= { 'disable' => false, 'prefer' => true, 'require' => 'required' }[node['pushy']['postgresql']['sslmode']] %>}]},
{idle_check, 10000},
{prepared_statements, {pushy_sql, statements, []} },
{column_transforms, []}
Expand Down