Commit 50a93e3ca788e0fcc6a3fb020d85136af0edecbc

Authored by Jacob Vosmaer
1 parent bc329ba6

Create database.yml for the built-in postgresql

files/gitlab-cookbooks/gitlab/recipes/gitlab-core.rb
... ... @@ -51,6 +51,21 @@ link "/opt/gitlab/embedded/service/gitlab-core/.secret" do
51 51 to secret_token_config
52 52 end
53 53  
  54 +database_yml = File.join(gitlab_core_etc_dir, "database.yml")
  55 +
  56 +template database_yml do
  57 + source "database.yml.postgresql.erb"
  58 + owner "root"
  59 + group "root"
  60 + mode "0644"
  61 + variables(node['gitlab']['postgresql'].to_hash)
  62 + notifies :restart, 'service[gitlab-core]' if should_notify
  63 +end
  64 +
  65 +link "/opt/gitlab/embedded/service/gitlab-core/config/database.yml" do
  66 + to database_yml
  67 +end
  68 +
54 69 unicorn_listen_tcp = node['gitlab']['gitlab-core']['listen']
55 70 unicorn_listen_tcp << ":#{node['gitlab']['gitlab-core']['port']}"
56 71 unicorn_listen_socket = node['gitlab']['gitlab-core']['unicorn_socket']
... ...
files/gitlab-cookbooks/gitlab/templates/default/database.yml.postgresql.erb
... ... @@ -6,11 +6,11 @@ production:
6 6 encoding: unicode
7 7 database: gitlabhq_production
8 8 pool: 10
9   - # username: git
10   - # password:
11   - # host: localhost
12   - # port: 5432
13   - # socket: /tmp/postgresql.sock
  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 14  
15 15 #
16 16 # Development specific
... ...