diff --git a/files/gitlab-cookbooks/gitlab/recipes/redis.rb b/files/gitlab-cookbooks/gitlab/recipes/redis.rb index f70b3dd..10f0879 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/redis.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/redis.rb @@ -17,7 +17,6 @@ postgresql_dir = node['gitlab']['postgresql']['dir'] postgresql_data_dir = node['gitlab']['postgresql']['data_dir'] -postgresql_data_dir_symlink = File.join(postgresql_dir, "data") postgresql_log_dir = node['gitlab']['postgresql']['log_directory'] user node['gitlab']['postgresql']['username'] do @@ -42,55 +41,6 @@ directory postgresql_data_dir do recursive true end -link postgresql_data_dir_symlink do - to postgresql_data_dir - not_if { postgresql_data_dir == postgresql_data_dir_symlink } -end - -file File.join(node['gitlab']['postgresql']['home'], ".profile") do - owner node['gitlab']['postgresql']['username'] - mode "0644" - content <<-EOH -PATH=#{node['gitlab']['postgresql']['user_path']} -EOH -end - -if File.directory?("/etc/sysctl.d") && File.exists?("/etc/init.d/procps") - # smells like ubuntu... - service "procps" do - action :nothing - end - - template "/etc/sysctl.d/90-postgresql.conf" do - source "90-postgresql.conf.sysctl.erb" - owner "root" - mode "0644" - variables(node['gitlab']['postgresql'].to_hash) - notifies :start, 'service[procps]', :immediately - end -else - # hope this works... - execute "sysctl" do - command "/sbin/sysctl -p /etc/sysctl.conf" - action :nothing - end - - bash "add shm settings" do - user "root" - code <<-EOF - echo 'kernel.shmmax = #{node['gitlab']['postgresql']['shmmax']}' >> /etc/sysctl.conf - echo 'kernel.shmall = #{node['gitlab']['postgresql']['shmall']}' >> /etc/sysctl.conf - EOF - notifies :run, 'execute[sysctl]', :immediately - not_if "egrep '^kernel.shmmax = ' /etc/sysctl.conf" - end -end - -execute "/opt/gitlab/embedded/bin/initdb -D #{postgresql_data_dir} -E UTF8" do - user node['gitlab']['postgresql']['username'] - not_if { File.exists?(File.join(postgresql_data_dir, "PG_VERSION")) } -end - postgresql_config = File.join(postgresql_data_dir, "postgresql.conf") template postgresql_config do @@ -101,18 +51,6 @@ template postgresql_config do notifies :restart, 'service[postgresql]' if OmnibusHelper.should_notify?("postgresql") end -pg_hba_config = File.join(postgresql_data_dir, "pg_hba.conf") - -template pg_hba_config do - source "pg_hba.conf.erb" - owner node['gitlab']['postgresql']['username'] - mode "0644" - variables(node['gitlab']['postgresql'].to_hash) - notifies :restart, 'service[postgresql]' if OmnibusHelper.should_notify?("postgresql") -end - -should_notify = OmnibusHelper.should_notify?("postgresql") - runit_service "postgresql" do down node['gitlab']['postgresql']['ha'] control(['t']) @@ -128,29 +66,3 @@ if node['gitlab']['bootstrap']['enable'] retries 20 end end - -### -# Create the database, migrate it, and create the users we need, and grant them -# privileges. -### -pg_helper = PgHelper.new(node) -pg_port = node['gitlab']['postgresql']['port'] -pg_user = node['gitlab']['postgresql']['username'] -bin_dir = "/opt/gitlab/embedded/bin" -db_name = "gitlabhq_production" - -sql_user = node['gitlab']['postgresql']['sql_user'] -sql_user_passwd = node['gitlab']['postgresql']['sql_password'] - -execute "#{bin_dir}/psql --port #{pg_port} -d template1 -c \"CREATE USER #{sql_user} WITH ENCRYPTED PASSWORD '#{sql_user_passwd}'\"" do - user pg_user - not_if { !pg_helper.is_running? || pg_helper.sql_user_exists? } -end - -execute "create #{db_name} database" do - command "#{bin_dir}/createdb --port #{pg_port} -O #{sql_user} #{db_name}" - user pg_user - not_if { !pg_helper.is_running? || pg_helper.database_exists?(db_name) } - retries 30 - # notifies :run, "execute[migrate_database]", :immediately -end -- libgit2 0.21.2