Merge branch 'disable_gitlab_should_not_break_the_package' into 'master'

Do not run recipes that are not needed when gitlab-rails is disabled.

Fixes #1137 

Should be finished after !682 is merged.

See merge request !683
This commit is contained in:
Marin Jankovski 2016-03-15 14:59:08 +00:00
commit 5e695aac6d
2 changed files with 10 additions and 14 deletions

View File

@ -118,4 +118,4 @@ runit_service "gitlab-git-http-server" do
action :disable
end
include_recipe "gitlab::database_migrations"
include_recipe "gitlab::database_migrations" if node['gitlab']['gitlab-rails']['enable']

View File

@ -139,6 +139,7 @@ pg_port = node['gitlab']['postgresql']['port']
bin_dir = "/opt/gitlab/embedded/bin"
database_name = node['gitlab']['gitlab-rails']['db_database']
gitlab_sql_user = node['gitlab']['postgresql']['sql_user']
sql_replication_user = node['gitlab']['postgresql']['sql_replication_user']
if node['gitlab']['gitlab-rails']['enable']
execute "create #{gitlab_sql_user} database user" do
@ -157,6 +158,14 @@ if node['gitlab']['gitlab-rails']['enable']
notifies :run, "execute[initialize gitlab-rails database]", :immediately
not_if { !pg_helper.is_running? || pg_helper.database_exists?(database_name) }
end
execute "create #{sql_replication_user} replication user" do
command "#{bin_dir}/psql --port #{pg_port} -h #{postgresql_socket_dir} -d template1 -c \"CREATE USER #{sql_replication_user} REPLICATION\""
user postgresql_user
# Added retries to give the service time to start on slower systems
retries 20
not_if { !pg_helper.is_running? || pg_helper.user_exists?(sql_replication_user) }
end
end
execute "enable pg_trgm extension" do
@ -166,16 +175,3 @@ execute "enable pg_trgm extension" do
action :nothing
not_if { !pg_helper.is_running? }
end
###
# Create replication user
###
sql_replication_user = node['gitlab']['postgresql']['sql_replication_user']
execute "create #{sql_replication_user} replication user" do
command "#{bin_dir}/psql --port #{pg_port} -h #{postgresql_socket_dir} -d template1 -c \"CREATE USER #{sql_replication_user} REPLICATION\""
user postgresql_user
# Added retries to give the service time to start on slower systems
retries 20
not_if { !pg_helper.is_running? || pg_helper.user_exists?(sql_replication_user) }
end