File tree Expand file tree Collapse file tree 4 files changed +32
-1
lines changed
spec/chef/cookbooks/gitlab/recipes Expand file tree Collapse file tree 4 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -759,6 +759,9 @@ external_url 'GENERATED_EXTERNAL_URL'
759
759
# gitlab_rails['db_application_name'] = nil
760
760
# gitlab_rails['db_database_tasks'] = true
761
761
762
+ ##! Command to generate extra database configuration
763
+ # gitlab_rails['db_extra_config_command'] = nil
764
+
762
765
### Gitlab decomposed database settings
763
766
###! Docs: https://docs.gitlab.com/omnibus/settings/database.html
764
767
# gitlab_rails['databases']['main']['db_database'] = 'gitlabhq_production'
Original file line number Diff line number Diff line change 425
425
default [ 'gitlab' ] [ 'gitlab_rails' ] [ 'db_keepalives_count' ] = nil
426
426
default [ 'gitlab' ] [ 'gitlab_rails' ] [ 'db_tcp_user_timeout' ] = nil
427
427
default [ 'gitlab' ] [ 'gitlab_rails' ] [ 'db_application_name' ] = nil
428
+ default [ 'gitlab' ] [ 'gitlab_rails' ] [ 'db_extra_config_command' ] = nil
428
429
429
430
default [ 'gitlab' ] [ 'gitlab_rails' ] [ 'databases' ] = { }
430
431
default [ 'gitlab' ] [ 'gitlab_rails' ] [ 'clickhouse_databases' ] = { }
Original file line number Diff line number Diff line change 3
3
# and run `sudo gitlab-ctl reconfigure`.
4
4
5
5
production:
6
+ <% if !@db_extra_config_command.nil? -%>
7
+ config_command: <%= quote(@db_extra_config_command) %>
8
+ <% end -%>
6
9
<% # database.yml must always have `main` first, sort it to the front %>
7
10
<% @databases.sort_by { |name, config| name == "main" ? 0 : 1 }.each do |database, attributes| %>
8
11
<%= database %> :
Original file line number Diff line number Diff line change 817
817
'db_sslcompression' => 0 ,
818
818
'db_sslcert' => nil ,
819
819
'db_sslkey' => nil ,
820
- 'db_application_name' => nil
820
+ 'db_application_name' => nil ,
821
+ 'db_extra_config_command' => nil
821
822
)
822
823
)
823
824
end
994
995
)
995
996
end
996
997
end
998
+
999
+ context 'when db_extra_config_command is specified' do
1000
+ cached ( :chef_run ) do
1001
+ ChefSpec ::SoloRunner . new ( step_into : %w( templatesymlink ) ) . converge ( 'gitlab::default' )
1002
+ end
1003
+
1004
+ before do
1005
+ stub_gitlab_rb (
1006
+ gitlab_rails : {
1007
+ db_extra_config_command : '/opt/database-config.sh'
1008
+ }
1009
+ )
1010
+ end
1011
+
1012
+ it 'uses specified value in database.yml' do
1013
+ expect ( chef_run ) . to create_templatesymlink ( 'Create a database.yml and create a symlink to Rails root' ) . with_variables (
1014
+ hash_including (
1015
+ 'db_extra_config_command' => '/opt/database-config.sh'
1016
+ )
1017
+ )
1018
+ expect ( generated_yml_content . dig ( 'production' , 'config_command' ) ) . to eq ( '/opt/database-config.sh' )
1019
+ end
1020
+ end
997
1021
end
998
1022
999
1023
describe 'client side statement_timeout' do
You can’t perform that action at this time.
0 commit comments