Commit 46d9a171f7f8993bce119c3ca04719489facd997
1 parent
2bf889e8
Exists in
master
and in
17 other branches
Use GitLab DB setup procedure
Showing
1 changed file
with
5 additions
and
12 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/recipes/postgresql.rb
@@ -140,26 +140,19 @@ pg_user = node['gitlab']['postgresql']['username'] | @@ -140,26 +140,19 @@ pg_user = node['gitlab']['postgresql']['username'] | ||
140 | bin_dir = "/opt/gitlab/embedded/bin" | 140 | bin_dir = "/opt/gitlab/embedded/bin" |
141 | db_name = "gitlabhq_production" | 141 | db_name = "gitlabhq_production" |
142 | 142 | ||
143 | -execute "create #{db_name} database" do | ||
144 | - command "#{bin_dir}/createdb -T template0 --port #{pg_port} -E UTF-8 #{db_name}" | ||
145 | - user pg_user | ||
146 | - not_if { !pg_helper.is_running? || pg_helper.database_exists?(db_name) } | ||
147 | - retries 30 | ||
148 | - # notifies :run, "execute[migrate_database]", :immediately | ||
149 | -end | ||
150 | - | ||
151 | sql_user = node['gitlab']['postgresql']['sql_user'] | 143 | sql_user = node['gitlab']['postgresql']['sql_user'] |
152 | sql_user_passwd = node['gitlab']['postgresql']['sql_password'] | 144 | sql_user_passwd = node['gitlab']['postgresql']['sql_password'] |
153 | 145 | ||
154 | execute "#{bin_dir}/psql --port #{pg_port} -d '#{db_name}' -c \"CREATE USER #{sql_user} WITH ENCRYPTED PASSWORD '#{sql_user_passwd}'\"" do | 146 | execute "#{bin_dir}/psql --port #{pg_port} -d '#{db_name}' -c \"CREATE USER #{sql_user} WITH ENCRYPTED PASSWORD '#{sql_user_passwd}'\"" do |
155 | cwd chef_db_dir | 147 | cwd chef_db_dir |
156 | user pg_user | 148 | user pg_user |
157 | - notifies :run, "execute[grant #{db_name} privileges]", :immediately | ||
158 | not_if { !pg_helper.is_running? || pg_helper.sql_user_exists? } | 149 | not_if { !pg_helper.is_running? || pg_helper.sql_user_exists? } |
159 | end | 150 | end |
160 | 151 | ||
161 | -execute "grant #{db_name} privileges" do | ||
162 | - command "#{bin_dir}/psql --port #{pg_port} -d '#{db_name}' -c \"GRANT ALL PRIVILEGES ON DATABASE #{db_name} TO #{sql_user}\"" | 152 | +execute "create #{db_name} database" do |
153 | + command "#{bin_dir}/createdb -T template0 --port #{pg_port} -E UTF-8 -O #{sql_user} #{db_name}" | ||
163 | user pg_user | 154 | user pg_user |
164 | - action :nothing | 155 | + not_if { !pg_helper.is_running? || pg_helper.database_exists?(db_name) } |
156 | + retries 30 | ||
157 | + # notifies :run, "execute[migrate_database]", :immediately | ||
165 | end | 158 | end |