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

Update gitlab and postgresql cookbooks.

parent b8f97f48
No related branches found
No related tags found
No related merge requests found
Showing
with 607 additions and 84 deletions
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
@@ -43,7 +43,7 @@ default['gitlab']['bundle_install'] = "SSL_CERT_FILE=/opt/local/etc/certs/cacert
# Assumed defaults
# database: mysql (option: postgresql)
# environment: production (option: development)
default['gitlab']['external_database'] = false
default['gitlab']['database_adapter'] = "mysql"
default['gitlab']['database_password'] = "datapass"
default['gitlab']['database_user'] = "git"
Loading
Loading
@@ -51,14 +51,44 @@ default['gitlab']['env'] = "production"
 
default['mysql']['server_host'] = "localhost" # Host of the server that hosts the database.
default['mysql']['client_host'] = "localhost" # Host where user connections are allowed from.
default['mysql']['server_root_username'] = "root"
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']['username']['postgres'] = "postgres"
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
@@ -104,6 +104,47 @@ it contains sensitive information:
```bash
rm /tmp/solo.json
```
### Note about using the external database
By setting the attribute:
```json
{
"gitlab": {
"external_database": true
}
}
```
database won't be installed on the server.
If the external database doesn't have database table and database user created, superuser credentials would have to be supplied so database table and user can be created. For example, if using mysql you will need to supply:
```json
{
"gitlab": {
"external_database": true,
"database_adapter": "mysql",
"database_user": "git",
"database_password": "gitdbpass"
default['mysql']['server_host'] = "localhost"
},
"mysql": {
"server_host": "http://example.com",
"server_root_username": "root",
"server_root_password": "rootpass"
}
}
```
This will connect to the database located at `http://example.com` with user `root`. User `root` has the credentials to create the database so this cookbook will create database table `gitlabhq_production` and database user `git` with password `gitdbpass`.
*Note* If using an existing database and database user use the same credentials for `server_root_username` and `database_user` (passwords too).
There is a manual step involved after the run is complete to add admin user to the database.
You will need to create an initial user manually with:
`sudo -u git -H bundle exec rake db:seed_fu RAILS_ENV=production`
### Enabling HTTPS
 
In order to enable HTTPS you will need to provide the following custom attributes:
Loading
Loading
Loading
Loading
@@ -7,12 +7,14 @@ mysql = node['mysql']
gitlab = node['gitlab']
 
# 5.Database
include_recipe "mysql::server"
include_recipe "database::mysql"
unless gitlab['external_database']
include_recipe "mysql::server"
include_recipe "database::mysql"
end
 
mysql_connection = {
:host => mysql['server_host'],
:username => 'root',
:username => mysql['server_root_username'],
:password => mysql['server_root_password']
}
 
Loading
Loading
Loading
Loading
@@ -7,12 +7,15 @@ postgresql = node['postgresql']
gitlab = node['gitlab']
 
# 5.Database
include_recipe "postgresql::server"
include_recipe "database::postgresql"
unless gitlab['external_database']
include_recipe "postgresql::server"
include_recipe "database::postgresql"
end
include_recipe "gitlab::database_postgresql_pg_gem"
 
postgresql_connection = {
:host => postgresql['server_host'],
:username => 'postgres',
:username => postgresql['username']['postgres'],
:password => postgresql['password']['postgres']
}
 
Loading
Loading
#
# Cookbook Name:: gitlab
# Recipe:: database_postgresql_pg_gem
#
begin
chef_gem "pg"
rescue Gem::Installer::ExtensionBuildError => e
# Are we an omnibus install?
raise if RbConfig.ruby.scan(%r{(chef|opscode)}).empty?
# Still here, must be omnibus. Lets make this thing install!
Chef::Log.warn 'Failed to properly build pg gem. Forcing properly linking and retrying (omnibus fix)'
gem_dir = e.message.scan(%r{will remain installed in ([^ ]+)}).flatten.first
raise unless gem_dir
gem_name = File.basename(gem_dir)
ext_dir = File.join(gem_dir, 'ext')
gem_exec = File.join(File.dirname(RbConfig.ruby), 'gem')
new_content = <<-EOS
require 'rbconfig'
%w(
configure_args
LIBRUBYARG_SHARED
LIBRUBYARG_STATIC
LIBRUBYARG
LDFLAGS
).each do |key|
RbConfig::CONFIG[key].gsub!(/-Wl[^ ]+( ?\\/[^ ]+)?/, '')
RbConfig::MAKEFILE_CONFIG[key].gsub!(/-Wl[^ ]+( ?\\/[^ ]+)?/, '')
end
RbConfig::CONFIG['RPATHFLAG'] = ''
RbConfig::MAKEFILE_CONFIG['RPATHFLAG'] = ''
EOS
new_content << File.read(extconf_path = File.join(ext_dir, 'extconf.rb'))
File.open(extconf_path, 'w') do |file|
file.write(new_content)
end
lib_builder = execute 'generate pg gem Makefile' do
# [COOK-3490] pg gem install requires full path on RHEL
if node['platform_family'] == 'rhel'
command "#{RbConfig.ruby} extconf.rb --with-pg-config=/usr/pgsql-#{node['postgresql']['version']}/bin/pg_config"
else
command "#{RbConfig.ruby} extconf.rb"
end
cwd ext_dir
action :nothing
end
lib_builder.run_action(:run)
lib_maker = execute 'make pg gem lib' do
command 'make'
cwd ext_dir
action :nothing
end
lib_maker.run_action(:run)
lib_installer = execute 'install pg gem lib' do
command 'make install'
cwd ext_dir
action :nothing
end
lib_installer.run_action(:run)
spec_installer = execute 'install pg spec' do
command "#{gem_exec} spec ./cache/#{gem_name}.gem --ruby > ./specifications/#{gem_name}.gemspec"
cwd File.join(gem_dir, '..', '..')
action :nothing
end
spec_installer.run_action(:run)
Chef::Log.warn 'Installation of pg gem successful!'
end
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
@@ -20,17 +20,27 @@ template File.join(gitlab['shell_path'], "config.yml") do
:redis_port => gitlab['redis_port'],
:namespace => gitlab['namespace']
})
notifies :run, "execute[gitlab-shell install]", :immediately
end
 
## Do setup
execute "gitlab-shell install" do
command <<-EOS
PATH="/usr/local/bin:$PATH"
./bin/install
EOS
cwd gitlab['shell_path']
user gitlab['user']
directory "Repositories path" do
path gitlab['repos_path']
owner gitlab['user']
group gitlab['group']
mode 02770
end
directory "SSH key directory" do
path File.join(gitlab['home'], "/", ".ssh")
owner gitlab['user']
group gitlab['group']
mode 0700
end
file "authorized keys file" do
path File.join(gitlab['home'], "/", ".ssh", "/", "authorized_keys")
owner gitlab['user']
group gitlab['group']
action :nothing
mode 0600
action :create_if_missing
end
Loading
Loading
@@ -123,18 +123,18 @@ template File.join(gitlab['path'], "config", "database.yml") do
notifies :reload, "service[gitlab]"
end
 
### db:setup
execute "rake db:setup" do
### Load db schema
execute "rake db:schema:load" do
command <<-EOS
PATH="/usr/local/bin:$PATH"
bundle exec rake db:setup RAILS_ENV=#{gitlab['env']}
bundle exec rake db:schema:load RAILS_ENV=#{gitlab['env']}
EOS
cwd gitlab['path']
user gitlab['user']
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
@@ -148,7 +148,7 @@ execute "rake db:migrate" do
group gitlab['group']
action :nothing
subscribes :run, "git[clone gitlabhq source]"
subscribes :run, "execute[rake db:setup]"
subscribes :run, "execute[rake db:schema:load]"
end
 
### db:seed_fu
Loading
Loading
@@ -161,7 +161,7 @@ execute "rake db:seed_fu" do
user gitlab['user']
group gitlab['group']
action :nothing
subscribes :run, "execute[rake db:setup]"
subscribes :run, "execute[rake db:schema:load]"
end
 
## Setup Init Script
Loading
Loading
Loading
Loading
@@ -32,6 +32,20 @@ describe "gitlab::database_mysql" do
expect(chef_run).to include_recipe("mysql::server")
expect(chef_run).to include_recipe("gitlab::database_mysql")
end
describe "with external database" do
let(:chef_run) do
runner = ChefSpec::Runner.new(platform: "ubuntu", version: version)
runner.node.set['gitlab']['env'] = "production"
runner.node.set['gitlab']['external_database'] = true
runner.converge("gitlab::database_mysql")
end
it "skips database setup recipe" do
expect(chef_run).to_not include_recipe("mysql::server")
expect(chef_run).to_not include_recipe("database::mysql")
end
end
end
end
 
Loading
Loading
@@ -57,6 +71,20 @@ describe "gitlab::database_mysql" do
expect(chef_run).to include_recipe("mysql::server")
expect(chef_run).to include_recipe("gitlab::database_mysql")
end
describe "with external database" do
let(:chef_run) do
runner = ChefSpec::Runner.new(platform: "centos", version: version)
runner.node.set['gitlab']['env'] = "production"
runner.node.set['gitlab']['external_database'] = true
runner.converge("gitlab::database_mysql")
end
it "skips database setup recipe" do
expect(chef_run).to_not include_recipe("mysql::server")
expect(chef_run).to_not include_recipe("database::mysql")
end
end
end
end
end
Loading
Loading
@@ -25,6 +25,20 @@ describe "gitlab::database_postgresql" do
expect(chef_run).to include_recipe("postgresql::server")
expect(chef_run).to include_recipe("database::postgresql")
end
describe "with external database" do
let(:chef_run) do
runner = ChefSpec::Runner.new(platform: "ubuntu", version: version)
runner.node.set['gitlab']['env'] = "production"
runner.node.set['gitlab']['external_database'] = true
runner.converge("gitlab::database_postgresql")
end
it "skips database setup recipe" do
expect(chef_run).to_not include_recipe("postgresql::server")
expect(chef_run).to_not include_recipe("database::postgresql")
end
end
end
end
 
Loading
Loading
@@ -43,6 +57,20 @@ describe "gitlab::database_postgresql" do
expect(chef_run).to include_recipe("postgresql::server")
expect(chef_run).to include_recipe("database::postgresql")
end
describe "with external database" do
let(:chef_run) do
runner = ChefSpec::Runner.new(platform: "centos", version: version)
runner.node.set['gitlab']['env'] = "production"
runner.node.set['gitlab']['external_database'] = true
runner.converge("gitlab::database_postgresql")
end
it "skips database setup recipe" do
expect(chef_run).to_not include_recipe("postgresql::server")
expect(chef_run).to_not include_recipe("database::postgresql")
end
end
end
end
end
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
Loading
Loading
@@ -28,20 +28,28 @@ describe "gitlab::gitlab_shell_install" do
)
end
 
describe "creating gitlab-shell config" do
let(:template) { chef_run.template('/home/git/gitlab-shell/config.yml') }
it 'creates repository directory in the gitlab user home directory' do
expect(chef_run).to create_directory("/home/git/repositories").with(
user: 'git',
group: 'git',
mode: 02770
)
end
 
it 'triggers install' do
expect(template).to notify('execute[gitlab-shell install]').to(:run).immediately
end
it 'creates .ssh directory in the gitlab user home directory' do
expect(chef_run).to create_directory("/home/git/.ssh").with(
user: 'git',
group: 'git',
mode: 0700
)
end
 
it 'executes with correct info' do
resource = chef_run.find_resource(:execute, 'gitlab-shell install')
expect(resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n ./bin/install\n")
expect(resource.user).to eq("git")
expect(resource.group).to eq("git")
expect(resource.cwd).to eq("/home/git/gitlab-shell")
end
it 'creates authorized hosts file in .ssh directory' do
expect(chef_run).to create_file_if_missing("/home/git/.ssh/authorized_keys").with(
user: 'git',
group: 'git',
mode: 0600
)
end
 
it 'does not run a execute to install gitlab shell on its own' do
Loading
Loading
@@ -74,20 +82,28 @@ describe "gitlab::gitlab_shell_install" do
)
end
 
describe "creating gitlab-shell config" do
let(:template) { chef_run.template('/home/git/gitlab-shell/config.yml') }
it 'creates repository directory in the gitlab user home directory' do
expect(chef_run).to create_directory("/home/git/repositories").with(
user: 'git',
group: 'git',
mode: 02770
)
end
 
it 'triggers install' do
expect(template).to notify('execute[gitlab-shell install]').to(:run).immediately
end
it 'creates .ssh directory in the gitlab user home directory' do
expect(chef_run).to create_directory("/home/git/.ssh").with(
user: 'git',
group: 'git',
mode: 0700
)
end
 
it 'executes with correct info' do
resource = chef_run.find_resource(:execute, 'gitlab-shell install')
expect(resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n ./bin/install\n")
expect(resource.user).to eq("git")
expect(resource.group).to eq("git")
expect(resource.cwd).to eq("/home/git/gitlab-shell")
end
it 'creates authorized hosts file in .ssh directory' do
expect(chef_run).to create_file_if_missing("/home/git/.ssh/authorized_keys").with(
user: 'git',
group: 'git',
mode: 0600
)
end
 
it 'does not run a execute to install gitlab shell on its own' do
Loading
Loading
Loading
Loading
@@ -157,13 +157,13 @@ describe "gitlab::install" do
end
 
describe "running database setup, migrations and seed when production" do
it 'runs an execute to rake db:setup' do
expect(chef_run).not_to run_execute('rake db:setup')
it 'runs an execute to rake db:schema:load' do
expect(chef_run).not_to run_execute('rake db:schema:load')
end
 
it 'runs db setup' do
resource = chef_run.find_resource(:execute, 'rake db:setup')
expect(resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n bundle exec rake db:setup RAILS_ENV=production\n")
resource = chef_run.find_resource(:execute, 'rake db:schema:load')
expect(resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n bundle exec rake db:schema:load RAILS_ENV=production\n")
expect(resource.user).to eq("git")
expect(resource.group).to eq("git")
expect(resource.cwd).to eq("/home/git/gitlab")
Loading
Loading
@@ -201,15 +201,15 @@ describe "gitlab::install" do
runner.converge("gitlab::start","gitlab::install")
end
 
it 'runs an execute to rake db:setup' do
expect(chef_run).not_to run_execute('rake db:setup')
it 'runs an execute to rake db:schema:load' do
expect(chef_run).not_to run_execute('rake db:schema:load')
end
 
it 'runs db setup for all environments' do
resources = chef_run.find_resources(:execute).select {|n| n.name == "rake db:setup"}
resources = chef_run.find_resources(:execute).select {|n| n.name == "rake db:schema:load"}
dev_resource = resources.first
 
expect(dev_resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n bundle exec rake db:setup RAILS_ENV=development\n")
expect(dev_resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n bundle exec rake db:schema:load RAILS_ENV=development\n")
expect(dev_resource.user).to eq("git")
expect(dev_resource.group).to eq("git")
expect(dev_resource.cwd).to eq("/home/git/gitlab")
Loading
Loading
@@ -431,13 +431,13 @@ describe "gitlab::install" do
end
 
describe "running database setup, migrations and seed when production" do
it 'does not run an execute to rake db:setup' do
expect(chef_run).not_to run_execute('rake db:setup')
it 'does not run an execute to rake db:schema:load' do
expect(chef_run).not_to run_execute('rake db:schema:load')
end
 
it 'runs db setup' do
resource = chef_run.find_resource(:execute, 'rake db:setup')
expect(resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n bundle exec rake db:setup RAILS_ENV=production\n")
resource = chef_run.find_resource(:execute, 'rake db:schema:load')
expect(resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n bundle exec rake db:schema:load RAILS_ENV=production\n")
expect(resource.user).to eq("git")
expect(resource.group).to eq("git")
expect(resource.cwd).to eq("/home/git/gitlab")
Loading
Loading
@@ -476,15 +476,15 @@ describe "gitlab::install" do
runner.converge("gitlab::start","gitlab::install")
end
 
it 'runs an execute to rake db:setup' do
expect(chef_run).not_to run_execute('rake db:setup')
it 'runs an execute to rake db:schema:load' do
expect(chef_run).not_to run_execute('rake db:schema:load')
end
 
it 'runs db setup for all environments' do
resources = chef_run.find_resources(:execute).select {|n| n.name == "rake db:setup"}
resources = chef_run.find_resources(:execute).select {|n| n.name == "rake db:schema:load"}
dev_resource = resources.first
 
expect(dev_resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n bundle exec rake db:setup RAILS_ENV=development\n")
expect(dev_resource.command).to eq(" PATH=\"/usr/local/bin:$PATH\"\n bundle exec rake db:schema:load RAILS_ENV=development\n")
expect(dev_resource.user).to eq("git")
expect(dev_resource.group).to eq("git")
expect(dev_resource.cwd).to eq("/home/git/gitlab")
Loading
Loading
Loading
Loading
@@ -38,4 +38,4 @@ test: &test
username: "<%= @user %>"
password: "<%= @password %>"
host: <%= @host %>
# socket: /tmp/mysql.sock
\ No newline at end of file
# socket: /tmp/mysql.sock
Loading
Loading
@@ -49,4 +49,4 @@ test: &test
username: "<%= @user %>"
password: "<%= @password %>"
host: <%= @host %>
# socket: /tmp/postgresql.sock
\ No newline at end of file
# socket: /tmp/postgresql.sock
site :opscode
metadata
group :integration do
cookbook 'minitest-handler'
end
Loading
Loading
@@ -3,6 +3,30 @@ postgresql Cookbook CHANGELOG
This file is used to list changes made in each version of the postgresql cookbook.
 
 
v3.3.4
------
Testing
v3.3.2
------
- Testing maintainer transfer to Heavywater with Opscode as collaborator
v3.3.0
------
### Bug
- **[COOK-3851](https://tickets.opscode.com/browse/COOK-3851)** - Postgresql: reload after config change does not pick up certain configuration changes
- **[COOK-3611](https://tickets.opscode.com/browse/COOK-3611)** - unix_socket_directory does not exists in 9.3
- **[COOK-2954](https://tickets.opscode.com/browse/COOK-2954)** - PostgreSQL installation ignores version attribute on CentOS >= 6
v3.2.0
------
- [COOK-3717] Pgdg repositories improvements
- [COOK-3756] Change postgresql.conf mode from 0600 to 0644
v3.1.0
------
### Improvement
Loading
Loading
# Contributing to Opscode Cookbooks
We are glad you want to contribute to Opscode Cookbooks! The first
step is the desire to improve the project.
You can find the answers to additional frequently asked questions
[on the wiki](http://wiki.opscode.com/display/chef/How+to+Contribute).
You can find additional information about
[contributing to cookbooks](http://wiki.opscode.com/display/chef/How+to+Contribute+to+Opscode+Cookbooks)
on the wiki as well.
## Quick-contribute
* Create an account on our [bug tracker](http://tickets.opscode.com)
* Sign our contributor agreement (CLA)
[ online](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L)
(keep reading if you're contributing on behalf of your employer)
* Create a ticket for your change on the
[bug tracker](http://tickets.opscode.com)
* Link to your patch as a rebased git branch or pull request from the
ticket
* Resolve the ticket as fixed
We regularly review contributions and will get back to you if we have
any suggestions or concerns.
## The Apache License and the CLA/CCLA
Licensing is very important to open source projects, it helps ensure
the software continues to be available under the terms that the author
desired. Chef uses the Apache 2.0 license to strike a balance between
open contribution and allowing you to use the software however you
would like to.
The license tells you what rights you have that are provided by the
copyright holder. It is important that the contributor fully
understands what rights they are licensing and agrees to them.
Sometimes the copyright holder isn't the contributor, most often when
the contributor is doing work for a company.
To make a good faith effort to ensure these criteria are met, Opscode
requires a Contributor License Agreement (CLA) or a Corporate
Contributor License Agreement (CCLA) for all contributions. This is
without exception due to some matters not being related to copyright
and to avoid having to continually check with our lawyers about small
patches.
It only takes a few minutes to complete a CLA, and you retain the
copyright to your contribution.
You can complete our contributor agreement (CLA)
[ online](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L).
If you're contributing on behalf of your employer, have your employer
fill out our
[Corporate CLA](https://secure.echosign.com/public/hostedForm?formid=PIE6C7AX856)
instead.
## Ticket Tracker (JIRA)
The [ticket tracker](http://tickets.opscode.com) is the most important
documentation for the code base. It provides significant historical
information, such as:
* Which release a bug fix is included in
* Discussion regarding the design and merits of features
* Error output to aid in finding similar bugs
Each ticket should aim to fix one bug or add one feature.
## Using git
You can get a quick copy of the repository for this cookbook by
running `git clone
git://github.com/opscode-coobkooks/COOKBOOKNAME.git`.
For collaboration purposes, it is best if you create a Github account
and fork the repository to your own account. Once you do this you will
be able to push your changes to your Github repository for others to
see and use.
If you have another repository in your GitHub account named the same
as the cookbook, we suggest you suffix the repository with -cookbook.
### Branches and Commits
You should submit your patch as a git branch named after the ticket,
such as COOK-1337. This is called a _topic branch_ and allows users to
associate a branch of code with the ticket.
It is a best practice to have your commit message have a _summary
line_ that includes the ticket number, followed by an empty line and
then a brief description of the commit. This also helps other
contributors understand the purpose of changes to the code.
[COOK-1757] - platform_family and style
* use platform_family for platform checking
* update notifies syntax to "resource_type[resource_name]" instead of
resources() lookup
* COOK-692 - delete config files dropped off by packages in conf.d
* dropped debian 4 support because all other platforms have the same
values, and it is older than "old stable" debian release
Remember that not all users use Chef in the same way or on the same
operating systems as you, so it is helpful to be clear about your use
case and change so they can understand it even when it doesn't apply
to them.
### Github and Pull Requests
All of Opscode's open source cookbook projects are available on
[Github](http://www.github.com/opscode-cookbooks).
We don't require you to use Github, and we will even take patch diffs
attached to tickets on the tracker. However Github has a lot of
convenient features, such as being able to see a diff of changes
between a pull request and the main repository quickly without
downloading the branch.
If you do choose to use a pull request, please provide a link to the
pull request from the ticket __and__ a link to the ticket from the
pull request. Because pull requests only have two states, open and
closed, we can't easily filter pull requests that are waiting for a
reply from the author for various reasons.
### More information
Additional help with git is available on the
[Working with Git](http://wiki.opscode.com/display/chef/Working+with+Git)
wiki page.
## Functional and Unit Tests
This cookbook is set up to run tests under
[Opscode's test-kitchen](https://github.com/opscode/test-kitchen). It
uses minitest-chef to run integration tests after the node has been
converged to verify that the state of the node.
Test kitchen should run completely without exception using the default
[baseboxes provided by Opscode](https://github.com/opscode/bento).
Because Test Kitchen creates VirtualBox machines and runs through
every configuration in the Kitchenfile, it may take some time for
these tests to complete.
If your changes are only for a specific recipe, run only its
configuration with Test Kitchen. If you are adding a new recipe, or
other functionality such as a LWRP or definition, please add
appropriate tests and ensure they run with Test Kitchen.
If any don't pass, investigate them before submitting your patch.
Any new feature should have unit tests included with the patch with
good code coverage to help protect it from future changes. Similarly,
patches that fix a bug or regression should have a _regression test_.
Simply put, this is a test that would fail without your patch but
passes with it. The goal is to ensure this bug doesn't regress in the
future. Consider a regular expression that doesn't match a certain
pattern that it should, so you provide a patch and a test to ensure
that the part of the code that uses this regular expression works as
expected. Later another contributor may modify this regular expression
in a way that breaks your use cases. The test you wrote will fail,
signalling to them to research your ticket and use case and accounting
for it.
If you need help writing tests, please ask on the Chef Developer's
mailing list, or the #chef-hacking IRC channel.
## Code Review
Opscode regularly reviews code contributions and provides suggestions
for improvement in the code itself or the implementation.
We find contributions by searching the ticket tracker for _resolved_
tickets with a status of _fixed_. If we have feedback we will reopen
the ticket and you should resolve it again when you've made the
changes or have a response to our feedback. When we believe the patch
is ready to be merged, we will tag the _Code Reviewed_ field with
_Reviewed_.
Depending on the project, these tickets are then merged within a week
or two, depending on the current release cycle.
## Release Cycle
The versioning for Opscode Cookbook projects is X.Y.Z.
* X is a major release, which may not be fully compatible with prior
major releases
* Y is a minor release, which adds both new features and bug fixes
* Z is a patch release, which adds just bug fixes
A released version of a cookbook will end in an even number, e.g.
"1.2.4" or "0.8.0". When development for the next version of the
cookbook begins, the "Z" patch number is incremented to the next odd
number, however the next release of the cookbook may be a major or
minor incrementing version.
Releases of Opscode's cookbooks are usually announced on the Chef user
mailing list. Releases of several cookbooks may be batched together
and announced on the [Opscode Blog](http://www.opscode.com/blog).
## Working with the community
These resources will help you learn more about Chef and connect to
other members of the Chef community:
* [chef](http://lists.opscode.com/sympa/info/chef) and
[chef-dev](http://lists.opscode.com/sympa/info/chef-dev) mailing
lists
* #chef and #chef-hacking IRC channels on irc.freenode.net
* [Community Cookbook site](http://community.opscode.com)
* [Chef wiki](http://wiki.opscode.com/display/chef)
* Opscode Chef [product page](http://www.opscode.com/chef)
## Cookbook Contribution Do's and Don't's
Please do include tests for your contribution. If you need help, ask
on the
[chef-dev mailing list](http://lists.opscode.com/sympa/info/chef-dev)
or the
[#chef-hacking IRC channel](http://community.opscode.com/chat/chef-hacking).
Not all platforms that a cookbook supports may be supported by Test
Kitchen. Please provide evidence of testing your contribution if it
isn't trivial so we don't have to duplicate effort in testing. Chef
10.14+ "doc" formatted output is sufficient.
Please do indicate new platform (families) or platform versions in the
commit message, and update the relevant ticket.
If a contribution adds new platforms or platform versions, indicate
such in the body of the commit message(s), and update the relevant
COOK ticket. When writing commit messages, it is helpful for others if
you indicate the COOK ticket. For example:
git commit -m '[COOK-1041] - Updated pool resource to correctly
delete.'
Please do use [foodcritic](http://acrmp.github.com/foodcritic) to
lint-check the cookbook. Except FC007, it should pass all correctness
rules. FC007 is okay as long as the dependent cookbooks are *required*
for the default behavior of the cookbook, such as to support an
uncommon platform, secondary recipe, etc.
Please do ensure that your changes do not break or modify behavior for
other platforms supported by the cookbook. For example if your changes
are for Debian, make sure that they do not break on CentOS.
Please do not modify the version number in the metadata.rb, Opscode
will select the appropriate version based on the release cycle
information above.
Please do not update the CHANGELOG.md for a new version. Not all
changes to a cookbook may be merged and released in the same versions.
Opscode will update the CHANGELOG.md when releasing a new version of
the cookbook.
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