Commit 85a6fe3a0e76b0d8542276cb7a76b47816473f9f
1 parent
39127045
Exists in
master
and in
13 other branches
Create attributes for database.yml
Showing
4 changed files
with
30 additions
and
51 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/attributes/default.rb
| ... | ... | @@ -100,6 +100,14 @@ default['gitlab']['gitlab-rails']['git_bin_path'] = "/opt/gitlab/embedded/bin/gi |
| 100 | 100 | default['gitlab']['gitlab-rails']['git_max_size'] = 5242880 |
| 101 | 101 | default['gitlab']['gitlab-rails']['git_timeout'] = 10 |
| 102 | 102 | |
| 103 | +default['gitlab']['gitlab-rails']['db_adapter'] = "postgresql" | |
| 104 | +default['gitlab']['gitlab-rails']['db_encoding'] = "unicode" | |
| 105 | +default['gitlab']['gitlab-rails']['db_database'] = "gitlabhq_production" | |
| 106 | +default['gitlab']['gitlab-rails']['db_pool'] = 10 | |
| 107 | +default['gitlab']['gitlab-rails']['db_username'] = "gitlab" | |
| 108 | +default['gitlab']['gitlab-rails']['db_password'] = "password" | |
| 109 | +default['gitlab']['gitlab-rails']['db_host'] = "localhost" | |
| 110 | +default['gitlab']['gitlab-rails']['db_port'] = 6379 | |
| 103 | 111 | |
| 104 | 112 | #### |
| 105 | 113 | # Unicorn | ... | ... |
files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb
| ... | ... | @@ -53,13 +53,24 @@ template_symlink File.join(gitlab_rails_etc_dir, "secret") do |
| 53 | 53 | restarts dependent_services |
| 54 | 54 | end |
| 55 | 55 | |
| 56 | +database_attributes = node['gitlab']['gitlab-rails'].to_hash | |
| 57 | +if node['gitlab']['postgresql']['enable'] | |
| 58 | + database_attributes.merge!( | |
| 59 | + :db_adapter => "postgresql", | |
| 60 | + :db_username => node['gitlab']['postgresql']['sql_user'], | |
| 61 | + :db_password => node['gitlab']['postgresql']['sql_password'], | |
| 62 | + :db_host => node['gitlab']['postgresql']['listen_address'], | |
| 63 | + :db_port => node['gitlab']['postgresql']['port'] | |
| 64 | + ) | |
| 65 | +end | |
| 66 | + | |
| 56 | 67 | template_symlink File.join(gitlab_rails_etc_dir, "database.yml") do |
| 57 | 68 | link_from File.join(gitlab_rails_source_dir, "config/database.yml") |
| 58 | - source "database.yml.postgresql.erb" | |
| 69 | + source "database.yml.erb" | |
| 59 | 70 | owner "root" |
| 60 | 71 | group "root" |
| 61 | 72 | mode "0644" |
| 62 | - variables(node['gitlab']['postgresql'].to_hash) | |
| 73 | + variables database_attributes | |
| 63 | 74 | restarts dependent_services |
| 64 | 75 | end |
| 65 | 76 | ... | ... |
files/gitlab-cookbooks/gitlab/templates/default/database.yml.erb
0 → 100644
files/gitlab-cookbooks/gitlab/templates/default/database.yml.postgresql.erb
| ... | ... | @@ -1,49 +0,0 @@ |
| 1 | -# | |
| 2 | -# PRODUCTION | |
| 3 | -# | |
| 4 | -production: | |
| 5 | - adapter: postgresql | |
| 6 | - encoding: unicode | |
| 7 | - database: gitlabhq_production | |
| 8 | - pool: 10 | |
| 9 | - username: <%= node['gitlab']['postgresql']['sql_user'] %> | |
| 10 | - password: "<%= node['gitlab']['postgresql']['sql_password'] %>" | |
| 11 | - host: <%= node['gitlab']['postgresql']['listen_address'] %> | |
| 12 | - port: <%= node['gitlab']['postgresql']['port'] %> | |
| 13 | -# socket: /tmp/postgresql.sock | |
| 14 | - | |
| 15 | -# | |
| 16 | -# Development specific | |
| 17 | -# | |
| 18 | -development: | |
| 19 | - adapter: postgresql | |
| 20 | - encoding: unicode | |
| 21 | - database: gitlabhq_development | |
| 22 | - pool: 5 | |
| 23 | - username: postgres | |
| 24 | - password: | |
| 25 | - # socket: /tmp/postgresql.sock | |
| 26 | - | |
| 27 | -# | |
| 28 | -# Staging specific | |
| 29 | -# | |
| 30 | -staging: | |
| 31 | - adapter: postgresql | |
| 32 | - encoding: unicode | |
| 33 | - database: gitlabhq_staging | |
| 34 | - pool: 5 | |
| 35 | - username: postgres | |
| 36 | - password: | |
| 37 | - # socket: /tmp/postgresql.sock | |
| 38 | - | |
| 39 | -# Warning: The database defined as "test" will be erased and | |
| 40 | -# re-generated from your development database when you run "rake". | |
| 41 | -# Do not set this db to the same as development or production. | |
| 42 | -test: &test | |
| 43 | - adapter: postgresql | |
| 44 | - encoding: unicode | |
| 45 | - database: gitlabhq_test | |
| 46 | - pool: 5 | |
| 47 | - username: postgres | |
| 48 | - password: | |
| 49 | - # socket: /tmp/postgresql.sock |