Skip to content
Snippets Groups Projects
Commit d342d94e authored by Marin Jankovski's avatar Marin Jankovski
Browse files

Merge branch 'postgresql' into 'master'

Postgresql database setup fixes
parents 675ab8de 86a81ea4
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -5,3 +5,5 @@ metadata
cookbook 'yum', tag: 'v2.4.4'
cookbook 'magic_shell', git: 'git://github.com/customink-webops/magic_shell.git', ref: '447b4b67420d3a7a749d2dd3b13a7f9aceb54c36'
cookbook 'monit', git: 'git://github.com/phlipper/chef-monit.git', tag: '1.4.0'
# Using a fork of the postgresql due to a bug in the original cookbook that prevented non-Debian installations
cookbook 'postgresql', git: 'git://github.com/maxlazio/postgresql.git'
Loading
Loading
@@ -16,6 +16,11 @@
"git": "git://github.com/phlipper/chef-monit.git",
"ref": "276c99ba08869ebd5117267d91a2ff6aa0d9fc6b"
},
"postgresql": {
"locked_version": "3.3.4",
"git": "git://github.com/maxlazio/postgresql.git",
"ref": "000ffed11710e8d307ea5b18c13213e53e66e289"
},
"redisio": {
"locked_version": "1.7.0"
},
Loading
Loading
@@ -25,20 +30,14 @@
"ruby_build": {
"locked_version": "0.8.0"
},
"postgresql": {
"locked_version": "3.3.4"
},
"apt": {
"locked_version": "2.3.0"
},
"build-essential": {
"locked_version": "1.4.2"
"mysql": {
"locked_version": "4.0.6"
},
"openssl": {
"locked_version": "1.1.0"
},
"mysql": {
"locked_version": "4.0.6"
"build-essential": {
"locked_version": "1.4.2"
},
"database": {
"locked_version": "1.5.2"
Loading
Loading
@@ -66,6 +65,9 @@
},
"chef_handler": {
"locked_version": "1.1.4"
},
"apt": {
"locked_version": "2.3.0"
}
}
}
Loading
Loading
@@ -55,10 +55,38 @@ default['mysql']['server_root_password'] = "rootpass"
default['mysql']['server_repl_password'] = "replpass"
default['mysql']['server_debian_password'] = "debianpass"
 
# PostgreSQL attributes
include_attribute 'postgresql'
default['postgresql']['version'] = "9.3"
case node["platform_family"]
when "debian"
default['postgresql']['enable_pgdg_apt'] = true
default['postgresql']['client']['packages'] = %w{postgresql-client-9.3 libpq-dev}
default['postgresql']['server']['packages'] = %w{postgresql-9.3}
# due to the way attributes are organized we have to override the default paths too
default['postgresql']['dir'] = "/etc/postgresql/#{node['postgresql']['version']}/main"
default['postgresql']['config']['data_directory'] = "/var/lib/postgresql/#{node['postgresql']['version']}/main"
default['postgresql']['config']['hba_file'] = "/etc/postgresql/#{node['postgresql']['version']}/main/pg_hba.conf"
default['postgresql']['config']['ident_file'] = "/etc/postgresql/#{node['postgresql']['version']}/main/pg_ident.conf"
default['postgresql']['config']['external_pid_file'] = "/var/run/postgresql/#{node['postgresql']['version']}-main.pid"
default['postgresql']['config']['ssl'] = false
default['postgresql']['config']['unix_socket_directory'] = nil
default['postgresql']['config']['unix_socket_directories'] = '/var/run/postgresql'
default['gitlab']['postgresql']['configuration_dir'] = nil
when "rhel"
default['postgresql']['enable_pgdg_yum'] = true
default['postgresql']['client']['packages'] = ["postgresql#{node['postgresql']['version'].split('.').join}-devel"]
default['postgresql']['server']['packages'] = ["postgresql#{node['postgresql']['version'].split('.').join}-server"]
default['postgresql']['contrib']['packages'] = ["postgresql#{node['postgresql']['version'].split('.').join}-contrib"]
default['postgresql']['dir'] = "/var/lib/pgsql/data"
default['postgresql']['server']['service_name'] = "postgresql-#{node['postgresql']['version']}"
default['gitlab']['postgresql']['configuration_dir'] = "/usr/pgsql-#{node['postgresql']['version']}/bin"
end
default['postgresql']['password']['postgres'] = "psqlpass"
default['postgresql']['server_host'] = "localhost"
 
# Postfix
default['postfix']['mail_type'] = "client"
default['postfix']['myhostname'] = "mail.localhost"
default['postfix']['mydomain'] = "localhost"
Loading
Loading
Loading
Loading
@@ -42,6 +42,7 @@ when 'mysql'
bundle_without << 'postgres'
when 'postgresql'
bundle_without << 'mysql'
end
bundle_without << 'aws' unless gitlab['aws']['enabled']
 
Loading
Loading
@@ -55,7 +56,7 @@ end
 
execute "bundle install" do
command <<-EOS
PATH="/usr/local/bin:$PATH"
PATH="#{gitlab['postgresql']['configuration_dir']}:/usr/local/bin:$PATH"
#{gitlab['bundle_install']} --without #{bundle_without.join(" ")}
EOS
cwd gitlab['path']
Loading
Loading
Loading
Loading
@@ -134,7 +134,7 @@ execute "rake db:setup" do
group gitlab['group']
action :nothing
subscribes :run, "mysql_database[gitlabhq_database]"
subscribes :run, "postgresql_database[gitlabhq_#{environment}]"
subscribes :run, "postgresql_database[gitlabhq_database]"
end
 
### db:migrate
Loading
Loading
Loading
Loading
@@ -33,7 +33,7 @@ describe "gitlab::gems" do
 
it 'executes bundle without development and test' do
resource = chef_run.find_resource(:execute, 'bundle install')
expect(resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without postgres aws development test\n")
expect(resource.command).to eq(" PATH=\":/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without postgres aws development test\n")
expect(resource.user).to eq("git")
expect(resource.group).to eq("git")
expect(resource.cwd).to eq("/home/git/gitlab")
Loading
Loading
@@ -48,7 +48,7 @@ describe "gitlab::gems" do
 
it 'executes bundle without production' do
resource = chef_run.find_resource(:execute, 'bundle install')
expect(resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without postgres aws production\n")
expect(resource.command).to eq(" PATH=\":/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without postgres aws production\n")
expect(resource.user).to eq("git")
expect(resource.group).to eq("git")
expect(resource.cwd).to eq("/home/git/gitlab")
Loading
Loading
@@ -69,7 +69,7 @@ describe "gitlab::gems" do
 
it 'executes bundle without postgres' do
resource = chef_run.find_resource(:execute, 'bundle install')
expect(resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without postgres aws development test\n")
expect(resource.command).to eq(" PATH=\":/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without postgres aws development test\n")
expect(resource.user).to eq("git")
expect(resource.group).to eq("git")
expect(resource.cwd).to eq("/home/git/gitlab")
Loading
Loading
@@ -88,7 +88,7 @@ describe "gitlab::gems" do
 
it 'executes bundle without mysql' do
resource = chef_run.find_resource(:execute, 'bundle install')
expect(resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without mysql aws development test\n")
expect(resource.command).to eq(" PATH=\":/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without mysql aws development test\n")
expect(resource.user).to eq("git")
expect(resource.group).to eq("git")
expect(resource.cwd).to eq("/home/git/gitlab")
Loading
Loading
@@ -127,7 +127,7 @@ describe "gitlab::gems" do
 
it 'executes bundle without development and test' do
resource = chef_run.find_resource(:execute, 'bundle install')
expect(resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without postgres aws development test\n")
expect(resource.command).to eq(" PATH=\"/usr/pgsql-9.3/bin:/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without postgres aws development test\n")
expect(resource.user).to eq("git")
expect(resource.group).to eq("git")
expect(resource.cwd).to eq("/home/git/gitlab")
Loading
Loading
@@ -142,7 +142,7 @@ describe "gitlab::gems" do
 
it 'executes bundle without production' do
resource = chef_run.find_resource(:execute, 'bundle install')
expect(resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without postgres aws production\n")
expect(resource.command).to eq(" PATH=\"/usr/pgsql-9.3/bin:/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without postgres aws production\n")
expect(resource.user).to eq("git")
expect(resource.group).to eq("git")
expect(resource.cwd).to eq("/home/git/gitlab")
Loading
Loading
@@ -163,7 +163,7 @@ describe "gitlab::gems" do
 
it 'executes bundle without postgres' do
resource = chef_run.find_resource(:execute, 'bundle install')
expect(resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without postgres aws development test\n")
expect(resource.command).to eq(" PATH=\"/usr/pgsql-9.3/bin:/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without postgres aws development test\n")
expect(resource.user).to eq("git")
expect(resource.group).to eq("git")
expect(resource.cwd).to eq("/home/git/gitlab")
Loading
Loading
@@ -182,7 +182,7 @@ describe "gitlab::gems" do
 
it 'executes bundle without mysql' do
resource = chef_run.find_resource(:execute, 'bundle install')
expect(resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without mysql aws development test\n")
expect(resource.command).to eq(" PATH=\"/usr/pgsql-9.3/bin:/usr/local/bin:$PATH\"\n SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem bundle install --path=.bundle --deployment --without mysql aws development test\n")
expect(resource.user).to eq("git")
expect(resource.group).to eq("git")
expect(resource.cwd).to eq("/home/git/gitlab")
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment