From 85ebed84e3636dc4756b389c5a27aaabcc50f973 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Thu, 17 May 2018 12:41:12 -0500 Subject: [PATCH 01/13] updated skip_auto_migrations to skip_auto_reconfigure --- manifests/config.pp | 18 ++++++------------ manifests/init.pp | 9 +++++---- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 44630396..000c375f 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -61,7 +61,7 @@ $shell = $::gitlab::shell $sidekiq = $::gitlab::sidekiq $sidekiq_cluster = $::gitlab::sidekiq_cluster - $skip_auto_migrations = $::gitlab::skip_auto_migrations + $skip_auto_reconfigure = $::gitlab::skip_auto_migrations $store_git_keys_in_db = $::gitlab::store_git_keys_in_db $source_config_file = $::gitlab::source_config_file $unicorn = $::gitlab::unicorn @@ -142,17 +142,11 @@ } } - if $skip_auto_migrations != undef { - $_skip_auto_migrations_ensure = $skip_auto_migrations ? { - true => 'present', - default => 'absent', - } - file { '/etc/gitlab/skip-auto-migrations': - ensure => $_skip_auto_migrations_ensure, - owner => 'root', - group => 'root', - mode => '0644', - } + file { '/etc/gitlab/skip-auto-reconfigure': + ensure => $skip_auto_reconfigure, + owner => 'root', + group => 'root', + mode => '0644', } if $store_git_keys_in_db != undef { diff --git a/manifests/init.pp b/manifests/init.pp index 0cbb1bd2..8aa7de96 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -281,9 +281,10 @@ # Default: undef # Hash of 'sidekiq_cluster' config parameters. # -# [*skip_auto_migrations*] -# Default: undef -# Enable or disable auto migrations. undef keeps the current state on the system. +# [*skip_auto_reconfigure*] +# Default: 'absent' +# String containing either 'present' or 'absent' +# Utilized for Zero Downtime Updates, See: https://docs.gitlab.com/omnibus/update/README.html#zero-downtime-updates # # [*store_git_keys_in_db*] # Default: false @@ -422,7 +423,7 @@ Optional[Hash] $shell = undef, Optional[Hash] $sidekiq = undef, Optional[Hash] $sidekiq_cluster = undef, - Optional[Boolean] $skip_auto_migrations = undef, + Enum['present', 'absent'] $skip_auto_reconfigure = 'absent', Optional[Stdlib::Absolutepath] $source_config_file = undef, Boolean $store_git_keys_in_db = false, Optional[Hash] $unicorn = undef, From 4a67395d1d305600079e3b377cc3e8fc7fdae9c5 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Thu, 17 May 2018 12:54:12 -0500 Subject: [PATCH 02/13] add tests for skip-auto-reconfigure --- spec/classes/init_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 78f78886..93d2653a 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -83,6 +83,20 @@ with_content(%r{^\s*letsencrypt\['contact_emails'\] = \["test@example.com"\]$}) } end + describe 'skip_auto_reconfigure' do + let(:params) do + { { skip_auto_reconfigure: 'present' } } + + it { + is_expected.to contain_file('/etc/gitlab/skip-auto-reconfigure').with({ + 'ensure' => 'present', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + }) + } + end + end describe 'secrets' do let(:params) do { secrets: { From 870875460b315d3e5e14e5df02c3c63265b51eea Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Thu, 17 May 2018 12:54:30 -0500 Subject: [PATCH 03/13] fix param name skip_auto_reconfigure --- manifests/config.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/config.pp b/manifests/config.pp index 000c375f..56177643 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -61,7 +61,7 @@ $shell = $::gitlab::shell $sidekiq = $::gitlab::sidekiq $sidekiq_cluster = $::gitlab::sidekiq_cluster - $skip_auto_reconfigure = $::gitlab::skip_auto_migrations + $skip_auto_reconfigure = $::gitlab::skip_auto_reconfigure $store_git_keys_in_db = $::gitlab::store_git_keys_in_db $source_config_file = $::gitlab::source_config_file $unicorn = $::gitlab::unicorn From dbf7254489e2a24c938d0809f4dab1f5ef8037e3 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Thu, 17 May 2018 12:56:03 -0500 Subject: [PATCH 04/13] update rc version --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index efc373af..0269bd8b 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-gitlab", - "version": "2.0.1-rc0", + "version": "3.0.0-rc0", "author": "Vox Pupuli", "summary": "Installation and configuration of Gitlab Omnibus", "license": "BSD-3-Clause", From 790eb2db95200a36ae1c9796d0bb8da6c72b743c Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Thu, 17 May 2018 14:44:59 -0500 Subject: [PATCH 05/13] fix spec syntax --- spec/classes/init_spec.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 93d2653a..3a4b3116 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -84,10 +84,9 @@ } end describe 'skip_auto_reconfigure' do - let(:params) do - { { skip_auto_reconfigure: 'present' } } + let(:params) { { skip_auto_reconfigure => 'present' } } - it { + it { is_expected.to contain_file('/etc/gitlab/skip-auto-reconfigure').with({ 'ensure' => 'present', 'owner' => 'root', @@ -95,7 +94,6 @@ 'mode' => '0644', }) } - end end describe 'secrets' do let(:params) do From 02114d08589385f093540fed31f76297a31a75c0 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Mon, 21 May 2018 08:39:18 -0500 Subject: [PATCH 06/13] use hash syntax in spec --- spec/classes/init_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 3a4b3116..17bfb9f5 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -84,7 +84,7 @@ } end describe 'skip_auto_reconfigure' do - let(:params) { { skip_auto_reconfigure => 'present' } } + let(:params) { { skip_auto_reconfigure: 'present' } } it { is_expected.to contain_file('/etc/gitlab/skip-auto-reconfigure').with({ From 7d7bb85aba4fba1970acf928a76919ff2b1bf9d4 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Mon, 21 May 2018 09:15:35 -0500 Subject: [PATCH 07/13] correcting linting errors --- spec/classes/init_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 17bfb9f5..33e851e8 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -87,13 +87,13 @@ let(:params) { { skip_auto_reconfigure: 'present' } } it { - is_expected.to contain_file('/etc/gitlab/skip-auto-reconfigure').with({ + is_expected.to contain_file('/etc/gitlab/skip-auto-reconfigure').with( 'ensure' => 'present', 'owner' => 'root', 'group' => 'root', - 'mode' => '0644', - }) - } + 'mode' => '0644' + ) + } end describe 'secrets' do let(:params) do From 8ddeef87ed14f16fefff55b2437ddca163bddf88 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Mon, 21 May 2018 10:00:08 -0500 Subject: [PATCH 08/13] linting fixes --- spec/classes/init_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 33e851e8..7f00cd56 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -87,12 +87,12 @@ let(:params) { { skip_auto_reconfigure: 'present' } } it { - is_expected.to contain_file('/etc/gitlab/skip-auto-reconfigure').with( - 'ensure' => 'present', - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644' - ) + is_expected.to contain_file('/etc/gitlab/skip-auto-reconfigure').with( + 'ensure' => 'present', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644' + ) } end describe 'secrets' do From 274787ef77a1db6176991032848f8fdfa1569b1b Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Fri, 25 May 2018 08:35:23 -0500 Subject: [PATCH 09/13] deprecate skip_auto_migrations --- manifests/config.pp | 8 -------- manifests/init.pp | 19 ++++++++++--------- manifests/preinstall.pp | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 17 deletions(-) create mode 100644 manifests/preinstall.pp diff --git a/manifests/config.pp b/manifests/config.pp index 56177643..0ba646bc 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -61,7 +61,6 @@ $shell = $::gitlab::shell $sidekiq = $::gitlab::sidekiq $sidekiq_cluster = $::gitlab::sidekiq_cluster - $skip_auto_reconfigure = $::gitlab::skip_auto_reconfigure $store_git_keys_in_db = $::gitlab::store_git_keys_in_db $source_config_file = $::gitlab::source_config_file $unicorn = $::gitlab::unicorn @@ -142,13 +141,6 @@ } } - file { '/etc/gitlab/skip-auto-reconfigure': - ensure => $skip_auto_reconfigure, - owner => 'root', - group => 'root', - mode => '0644', - } - if $store_git_keys_in_db != undef { $_store_git_keys_in_db = $store_git_keys_in_db ? { true => 'file', diff --git a/manifests/init.pp b/manifests/init.pp index 8aa7de96..dddd71b9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -281,9 +281,13 @@ # Default: undef # Hash of 'sidekiq_cluster' config parameters. # +# [*skip_auto_migrations*] +# Default: undef +# Deprecated if using Gitlab > 10.6.4 and < 11.0.0, unsupported by gitlab omnibus using gitlab 11+ +# Use skip_auto_reconfigure +# # [*skip_auto_reconfigure*] -# Default: 'absent' -# String containing either 'present' or 'absent' +# Default: undef # Utilized for Zero Downtime Updates, See: https://docs.gitlab.com/omnibus/update/README.html#zero-downtime-updates # # [*store_git_keys_in_db*] @@ -333,8 +337,8 @@ # === Examples # # class { 'gitlab': -# edition => 'ee', -# external_url => 'https://gitlab.mydomain.tld', +# edition => 'ee', +# external_url => 'https://gitlab.mydomain.tld', # nginx => { redirect_http_to_https => true }, # } # @@ -424,6 +428,7 @@ Optional[Hash] $sidekiq = undef, Optional[Hash] $sidekiq_cluster = undef, Enum['present', 'absent'] $skip_auto_reconfigure = 'absent', + Optional $skip_auto_migrations = undef, Optional[Stdlib::Absolutepath] $source_config_file = undef, Boolean $store_git_keys_in_db = false, Optional[Hash] $unicorn = undef, @@ -438,11 +443,7 @@ Hash $global_hooks = {}, ) inherits gitlab::params { - class { '::gitlab::install': } - -> class { '::gitlab::config': } - ~> class { '::gitlab::service': } - -> class { '::gitlab::backup': } - + contain gitlab::preinstall contain gitlab::install contain gitlab::config contain gitlab::service diff --git a/manifests/preinstall.pp b/manifests/preinstall.pp new file mode 100644 index 00000000..96e6b595 --- /dev/null +++ b/manifests/preinstall.pp @@ -0,0 +1,34 @@ +class gitlab::preinstall ( + $skip_auto_migrations = $gitlab::skip_auto_migrations, + $skip_auto_reconfigure = $gitlab::skip_auto_reconfigure +) { + + #### + # Deprecation notice: + # skip_auto_migrations is deprecated and will be removed at some point after + # GitLab 11.0 is released + $skip_auto_migrations_deprecation_msg = "DEPRECTATION: 'skip_auto_migrations' is deprecated if using GitLab 10.6 or greater. Set skip_auto_reconfigure instead" + + if $skip_auto_migrations != undef { + + notify { $skip_auto_migrations_deprecation_msg: } + + $_skip_auto_migrations_ensure = $skip_auto_migrations ? { + true => 'present', + default => 'absent', + } + file { '/etc/gitlab/skip-auto-migrations': + ensure => $_skip_auto_migrations_ensure, + owner => 'root', + group => 'root', + mode => '0644', + } + } + + file { '/etc/gitlab/skip-auto-reconfigure': + ensure => $skip_auto_reconfigure, + owner => 'root', + group => 'root', + mode => '0644', + } +} From c696df3c0a920a406104c243ea789b24d16828d1 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Fri, 25 May 2018 08:37:01 -0500 Subject: [PATCH 10/13] document preinstall class --- manifests/preinstall.pp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/manifests/preinstall.pp b/manifests/preinstall.pp index 96e6b595..7b1a4018 100644 --- a/manifests/preinstall.pp +++ b/manifests/preinstall.pp @@ -1,3 +1,7 @@ +# == Class gitlab::config +# +# This class is for setting pre-install configurations +# class gitlab::preinstall ( $skip_auto_migrations = $gitlab::skip_auto_migrations, $skip_auto_reconfigure = $gitlab::skip_auto_reconfigure From 80d356cdfd93efb3921858eedbfecfe3f95947d4 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Fri, 25 May 2018 08:45:15 -0500 Subject: [PATCH 11/13] add documentaiton for auto-reconfigure and auto-migrations --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 28ca188d..ba5cf864 100644 --- a/README.md +++ b/README.md @@ -222,6 +222,29 @@ class { 'gitlab': } ``` +### Skip Auto Reconfigure (formerly Skip Auto Migrations) + +In order to achieve [Zero Downtime Upgrades](https://docs.gitlab.com/omnibus/update/README.html#zero-downtime-updates) +of your GitLab instance, GitLab will need to skip the post-install step of the omnibus package that automatically calls +`gitlab-ctl reconfigure` for you. In GitLab < 10.5, GitLab check for the presence of a file at `/etc/gitlab/skip-auto-migrations`. +As of GitLab `10.6`, this is deprecated, and you are warned to use `/etc/gitlab/skip-auto-reconfigure` going forward. + +Both of these are currently supported in this module, and you should be aware of which option is right for you +based on the version of GitLab Omnibus you are running. You will be presented with a deprecation notice in you +puppet client if using the deprecated form. + +```puppet +# use 'absent' or 'present' for the skip_auto_reconfigure param +class { 'gitlab': + skip_auto_reconfigure => 'present' +} + +# use true/false for the skip_auto_migrations param +class { 'gitlab': + skip_auto_migrations => true +} +``` + ### Gitlab Custom Hooks Manage custom hook files within a GitLab project. Custom hooks can be created From f64d27a3550ed9406397fd424904f57232807764 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Fri, 25 May 2018 09:00:00 -0500 Subject: [PATCH 12/13] update class ordering and anchoring --- manifests/init.pp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index dddd71b9..4bf15a87 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -449,6 +449,8 @@ contain gitlab::service contain gitlab::backup + Class['gitlab::preinstall'] -> Class['gitlab::install'] -> Class['gitlab::config'] ~> Class['gitlab::service'] -> Class['gitlab::backup'] + $custom_hooks.each |$name, $options| { gitlab::custom_hook { $name: * => $options, From de0ba9d039c3888778533a269281de2c64ef7837 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Fri, 25 May 2018 09:48:26 -0500 Subject: [PATCH 13/13] formatting fixes --- manifests/preinstall.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/manifests/preinstall.pp b/manifests/preinstall.pp index 7b1a4018..f98cce37 100644 --- a/manifests/preinstall.pp +++ b/manifests/preinstall.pp @@ -11,16 +11,17 @@ # Deprecation notice: # skip_auto_migrations is deprecated and will be removed at some point after # GitLab 11.0 is released - $skip_auto_migrations_deprecation_msg = "DEPRECTATION: 'skip_auto_migrations' is deprecated if using GitLab 10.6 or greater. Set skip_auto_reconfigure instead" + $skip_auto_migrations_deprecation_msg = "DEPRECTATION: 'skip_auto_migrations' is deprecated if using GitLab 10.6 or greater. Set skip_auto_reconfigure instead" if $skip_auto_migrations != undef { - notify { $skip_auto_migrations_deprecation_msg: } + notify { $skip_auto_migrations_deprecation_msg: } $_skip_auto_migrations_ensure = $skip_auto_migrations ? { true => 'present', default => 'absent', } + file { '/etc/gitlab/skip-auto-migrations': ensure => $_skip_auto_migrations_ensure, owner => 'root',