Skip to content
Closed
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
17 changes: 13 additions & 4 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
fixtures:
symlinks:
"gitlab": "#{source_dir}"
gitlab: "#{source_dir}"
repositories:
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
"vcsrepo": "git://github.com/puppetlabs/puppetlabs-vcsrepo.git"
"git": "git://github.com/puppetlabs/puppetlabs-git.git"
git:
repo: "git://github.com/puppetlabs/puppetlabs-git.git"
ref: "0.0.3"
rbenv:
repo: "git://github.com/alup/puppet-rbenv.git"
ref: "6628a24"
stdlib:
repo: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
ref: "4.2.1"
vcsrepo:
repo: "git://github.com/puppetlabs/puppetlabs-vcsrepo.git"
ref: "0.2.0"
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ rvm:
- 1.8.7
- 1.9.3
- 2.0.0
- 2.1.2
env:
matrix:
- PUPPET_GEM_VERSION="~> 2.7.0"
Expand All @@ -16,5 +17,10 @@ matrix:
env: PUPPET_GEM_VERSION="~> 2.7.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 2.7.0"
- rvm: 2.1.2
env: PUPPET_GEM_VERSION="~> 2.7.0"
- rvm: 2.1.2
env: PUPPET_GEM_VERSION="~> 3.3.0"

notifications:
email: false
1 change: 1 addition & 0 deletions Modulefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ summary 'Puppet GitLab Module'
description 'Module to install GitLab using puppet'
project_page 'https://github.com/sbadia/puppet-gitlab/'

dependency 'alup/rbenv', '>= 1.2.0'
dependency 'puppetlabs/stdlib', '>= 3.1.0'
dependency 'puppetlabs/vcsrepo', '>= 0.2.0'
dependency 'puppetlabs/git', '>= 0.0.3'
Expand Down
9 changes: 7 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,20 @@
#
# [*gitlab_unicorn_port*]
# Port that unicorn listens on 172.0.0.1 for HTTP traffic
# (default: 8080)
# default: 8080
#
# [*gitlab_bundler_flags*]
# Flags that should be passed to bundler when installing gems
# (default: --deployment)
# default: --deployment
#
# [*gitlab_bundler_jobs*]
# Number of jobs to use while installing gems. Should match number of
# procs on your system (default: 1)
#
# [*gitlab_ruby_version*]
# Ruby version to install with rbenv for Gitlab user
# default: 2.1.2
#
# [*gitlab_ensure_postfix*]
# Whether or not this module should ensure the postfix package is
# installed (used to manage conflicts with other modules)
Expand Down Expand Up @@ -304,6 +308,7 @@
$gitlab_unicorn_worker = $gitlab::params::gitlab_unicorn_worker,
$gitlab_bundler_flags = $gitlab::params::gitlab_bundler_flags,
$gitlab_bundler_jobs = $gitlab::params::gitlab_bundler_jobs,
$gitlab_ruby_version = $gitlab::params::gitlab_ruby_version,
$gitlab_ensure_postfix = $gitlab::params::gitlab_ensure_postfix,
$exec_path = $gitlab::params::exec_path,
$ldap_enabled = $gitlab::params::ldap_enabled,
Expand Down
3 changes: 2 additions & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
class gitlab::install inherits gitlab {

# note that this is *without*
$gitlab_without_gems = $gitlab_dbtype ? {
'mysql' => 'postgres',
'pgsql' => 'mysql',
Expand Down Expand Up @@ -58,7 +59,7 @@

file { "${git_home}/gitlab/config/initializers/rack_attack.rb":
ensure => file,
source => "${git_home}/gitlab/config/initializers/rack_attack.rb.example"
source => "${git_home}/gitlab/config/initializers/rack_attack.rb.example",
}

if $gitlab_relative_url_root or $use_exim {
Expand Down
4 changes: 2 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#
#
class gitlab::params {

$ensure = 'present'
$git_user = 'git'
$git_home = '/home/git'
Expand Down Expand Up @@ -43,8 +42,9 @@
$gitlab_unicorn_worker = '2'
$gitlab_bundler_flags = '--deployment'
$gitlab_bundler_jobs = 1
$gitlab_ruby_version = '2.1.2'
$gitlab_ensure_postfix = true
$exec_path = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
$exec_path = "${git_home}/.rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
$ldap_enabled = false
$ldap_host = 'ldap.domain.com'
$ldap_base = 'dc=domain,dc=com'
Expand Down
40 changes: 31 additions & 9 deletions manifests/setup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,40 @@
}
} # Case $::osfamily

# system packages
package { 'bundler':
ensure => installed,
provider => gem,
}

# dev. dependencies
ensure_packages($system_packages)

package { 'charlock_holmes':
ensure => '0.6.9.4',
provider => gem,
rbenv::install { $git_user:
group => $git_user,
home => $git_home,

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this space

}

# By default, puppet-rbenv sets ~/.profile to load rbenv, which is
# read when bash is invoked as an interactive login shell, but we
# also need ~/.bashrc to load rbenv (which is read by interactive
# but non-login shells). This works, but may not be the best
# solution, please see issue #114 if you have a better solution.
file { "${git_home}/.bashrc":
ensure => link,
target => "${git_home}/.profile",
require => Rbenv::Install[$git_user],
}

rbenv::compile { 'gitlab/ruby':
user => $git_user,
home => $git_home,
ruby => $gitlab_ruby_version,
global => true,
notify => [ Exec['install gitlab-shell'],
Exec['install gitlab'] ],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd write this as

notify => [
  Exec['install gitlab-shell'],
  Exec['install gitlab'],
],

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(There's no definite word on that in the puppet style guide so…

}

rbenv::gem { 'charlock_holmes':
ensure => '0.6.9.4',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should put this into a variable somewhere.

Another time.

user => $git_user,
home => $git_home,
ruby => $gitlab_ruby_version,
}

# other packages
Expand Down
8 changes: 4 additions & 4 deletions spec/classes/gitlab_install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
it { should contain_file('/home/git/gitlab-shell/config.yml').with_content(/^\s*port: 6379$/)}
it { should contain_exec('install gitlab-shell').with(
:user => 'git',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:path => '/home/git/.rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:command => 'ruby /home/git/gitlab-shell/bin/install',
:cwd => '/home/git',
:creates => '/home/git/repositories',
Expand Down Expand Up @@ -159,7 +159,7 @@
describe 'install gitlab' do
it { should contain_exec('install gitlab').with(
:user => 'git',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:path => '/home/git/.rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's with the spacing here?

:command => "bundle install --without development aws test postgres --deployment",
:unless => 'bundle check',
:cwd => '/home/git/gitlab',
Expand All @@ -180,7 +180,7 @@
let(:params) {{ :gitlab_dbtype => 'pgsql' }}
it { should contain_exec('install gitlab').with(
:user => 'git',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:path => '/home/git/.rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:command => "bundle install --without development aws test mysql --deployment",
:unless => 'bundle check',
:cwd => '/home/git/gitlab',
Expand All @@ -195,7 +195,7 @@
describe 'setup gitlab database' do
it { should contain_exec('setup gitlab database').with(
:user => 'git',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:path => '/home/git/.rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:command => '/usr/bin/yes yes | bundle exec rake gitlab:setup RAILS_ENV=production',
:cwd => '/home/git/gitlab',
:creates => '/home/git/.gitlab_setup_done',
Expand Down
66 changes: 52 additions & 14 deletions spec/classes/gitlab_setup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
# a non-default common parameter set
let :params_set do
{
:git_user => 'gitlab',
:git_home => '/srv/gitlab',
:git_comment => 'Labfooboozoo',
:git_email => '[email protected]',
:git_proxy => 'http://proxy.fooboozoo.fr:3128'
:git_user => 'gitlab',
:git_home => '/srv/gitlab',
:git_comment => 'Labfooboozoo',
:git_email => '[email protected]',
:git_proxy => 'http://proxy.fooboozoo.fr:3128',
:gitlab_ruby_version => '2.0.0'
}
end

Expand All @@ -41,7 +42,7 @@
it { should contain_file('/home/git').with(:ensure => 'directory', :mode => '0755')}
it { should contain_file('/home/git/gitlab-satellites').with(:ensure => 'directory', :mode => '0750')}
end
context 'with specifics params' do
context 'with specific params' do
let(:params) { params_set }
it { should contain_user(params_set[:git_user]).with(
:ensure => 'present',
Expand All @@ -59,8 +60,50 @@
end
end

### Ruby
describe 'rbenv' do
context 'with default params' do
it { should contain_rbenv__install('git').with(
:group => 'git',
:home => '/home/git'
)}
it { should contain_file('/home/git/.bashrc').with(
:ensure => 'link',
:target => '/home/git/.profile',
:require => 'Rbenv::Install[git]'
)}
it { should contain_rbenv__compile('gitlab/ruby').with(
:user => 'git',
:home => '/home/git',
:ruby => '2.1.2',
:global => true,
:notify => ['Exec[install gitlab-shell]', 'Exec[install gitlab]']
)}

end
context 'with specific params' do
let(:params) { params_set }
it { should contain_rbenv__install(params_set[:git_user]).with(
:group => params_set[:git_user],
:home => params_set[:git_home]
)}
it { should contain_file('/srv/gitlab/.bashrc').with(
:ensure => 'link',
:target => '/srv/gitlab/.profile',
:require => 'Rbenv::Install[gitlab]'
)}
it { should contain_rbenv__compile('gitlab/ruby').with(
:user => params_set[:git_user],
:home => params_set[:git_home],
:ruby => '2.0.0',
:global => true,
:notify => ['Exec[install gitlab-shell]', 'Exec[install gitlab]']
)}
end
end

### Sshkey
describe 'sshkey (hostfile)' do
describe 'sshkey (hostfile)' do
it { should contain_sshkey('localhost').with(
:ensure => 'present',
:host_aliases => 'gitlab.fooboozoo.fr',
Expand Down Expand Up @@ -118,13 +161,8 @@
end
#### Gems (all dist.)
describe 'commons gems' do
it { should contain_package('bundler').with(
:ensure => 'installed',
:provider => 'gem'
)}
it { should contain_package('charlock_holmes').with(
:ensure => '0.6.9.4',
:provider => 'gem'
it { should contain_rbenv__gem('charlock_holmes').with(
:ensure => '0.6.9.4'
)}
end
#### Commons packages (all dist.)
Expand Down