Commit 2ea536d8baed8cd55e89196907bb1320e7de6982
1 parent
060c9b82
Exists in
master
and in
17 other branches
Remove stuff we do not need for redis
Showing
1 changed file
with
0 additions
and
88 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/recipes/redis.rb
| @@ -17,7 +17,6 @@ | @@ -17,7 +17,6 @@ | ||
| 17 | 17 | ||
| 18 | postgresql_dir = node['gitlab']['postgresql']['dir'] | 18 | postgresql_dir = node['gitlab']['postgresql']['dir'] |
| 19 | postgresql_data_dir = node['gitlab']['postgresql']['data_dir'] | 19 | postgresql_data_dir = node['gitlab']['postgresql']['data_dir'] |
| 20 | -postgresql_data_dir_symlink = File.join(postgresql_dir, "data") | ||
| 21 | postgresql_log_dir = node['gitlab']['postgresql']['log_directory'] | 20 | postgresql_log_dir = node['gitlab']['postgresql']['log_directory'] |
| 22 | 21 | ||
| 23 | user node['gitlab']['postgresql']['username'] do | 22 | user node['gitlab']['postgresql']['username'] do |
| @@ -42,55 +41,6 @@ directory postgresql_data_dir do | @@ -42,55 +41,6 @@ directory postgresql_data_dir do | ||
| 42 | recursive true | 41 | recursive true |
| 43 | end | 42 | end |
| 44 | 43 | ||
| 45 | -link postgresql_data_dir_symlink do | ||
| 46 | - to postgresql_data_dir | ||
| 47 | - not_if { postgresql_data_dir == postgresql_data_dir_symlink } | ||
| 48 | -end | ||
| 49 | - | ||
| 50 | -file File.join(node['gitlab']['postgresql']['home'], ".profile") do | ||
| 51 | - owner node['gitlab']['postgresql']['username'] | ||
| 52 | - mode "0644" | ||
| 53 | - content <<-EOH | ||
| 54 | -PATH=#{node['gitlab']['postgresql']['user_path']} | ||
| 55 | -EOH | ||
| 56 | -end | ||
| 57 | - | ||
| 58 | -if File.directory?("/etc/sysctl.d") && File.exists?("/etc/init.d/procps") | ||
| 59 | - # smells like ubuntu... | ||
| 60 | - service "procps" do | ||
| 61 | - action :nothing | ||
| 62 | - end | ||
| 63 | - | ||
| 64 | - template "/etc/sysctl.d/90-postgresql.conf" do | ||
| 65 | - source "90-postgresql.conf.sysctl.erb" | ||
| 66 | - owner "root" | ||
| 67 | - mode "0644" | ||
| 68 | - variables(node['gitlab']['postgresql'].to_hash) | ||
| 69 | - notifies :start, 'service[procps]', :immediately | ||
| 70 | - end | ||
| 71 | -else | ||
| 72 | - # hope this works... | ||
| 73 | - execute "sysctl" do | ||
| 74 | - command "/sbin/sysctl -p /etc/sysctl.conf" | ||
| 75 | - action :nothing | ||
| 76 | - end | ||
| 77 | - | ||
| 78 | - bash "add shm settings" do | ||
| 79 | - user "root" | ||
| 80 | - code <<-EOF | ||
| 81 | - echo 'kernel.shmmax = #{node['gitlab']['postgresql']['shmmax']}' >> /etc/sysctl.conf | ||
| 82 | - echo 'kernel.shmall = #{node['gitlab']['postgresql']['shmall']}' >> /etc/sysctl.conf | ||
| 83 | - EOF | ||
| 84 | - notifies :run, 'execute[sysctl]', :immediately | ||
| 85 | - not_if "egrep '^kernel.shmmax = ' /etc/sysctl.conf" | ||
| 86 | - end | ||
| 87 | -end | ||
| 88 | - | ||
| 89 | -execute "/opt/gitlab/embedded/bin/initdb -D #{postgresql_data_dir} -E UTF8" do | ||
| 90 | - user node['gitlab']['postgresql']['username'] | ||
| 91 | - not_if { File.exists?(File.join(postgresql_data_dir, "PG_VERSION")) } | ||
| 92 | -end | ||
| 93 | - | ||
| 94 | postgresql_config = File.join(postgresql_data_dir, "postgresql.conf") | 44 | postgresql_config = File.join(postgresql_data_dir, "postgresql.conf") |
| 95 | 45 | ||
| 96 | template postgresql_config do | 46 | template postgresql_config do |
| @@ -101,18 +51,6 @@ template postgresql_config do | @@ -101,18 +51,6 @@ template postgresql_config do | ||
| 101 | notifies :restart, 'service[postgresql]' if OmnibusHelper.should_notify?("postgresql") | 51 | notifies :restart, 'service[postgresql]' if OmnibusHelper.should_notify?("postgresql") |
| 102 | end | 52 | end |
| 103 | 53 | ||
| 104 | -pg_hba_config = File.join(postgresql_data_dir, "pg_hba.conf") | ||
| 105 | - | ||
| 106 | -template pg_hba_config do | ||
| 107 | - source "pg_hba.conf.erb" | ||
| 108 | - owner node['gitlab']['postgresql']['username'] | ||
| 109 | - mode "0644" | ||
| 110 | - variables(node['gitlab']['postgresql'].to_hash) | ||
| 111 | - notifies :restart, 'service[postgresql]' if OmnibusHelper.should_notify?("postgresql") | ||
| 112 | -end | ||
| 113 | - | ||
| 114 | -should_notify = OmnibusHelper.should_notify?("postgresql") | ||
| 115 | - | ||
| 116 | runit_service "postgresql" do | 54 | runit_service "postgresql" do |
| 117 | down node['gitlab']['postgresql']['ha'] | 55 | down node['gitlab']['postgresql']['ha'] |
| 118 | control(['t']) | 56 | control(['t']) |
| @@ -128,29 +66,3 @@ if node['gitlab']['bootstrap']['enable'] | @@ -128,29 +66,3 @@ if node['gitlab']['bootstrap']['enable'] | ||
| 128 | retries 20 | 66 | retries 20 |
| 129 | end | 67 | end |
| 130 | end | 68 | end |
| 131 | - | ||
| 132 | -### | ||
| 133 | -# Create the database, migrate it, and create the users we need, and grant them | ||
| 134 | -# privileges. | ||
| 135 | -### | ||
| 136 | -pg_helper = PgHelper.new(node) | ||
| 137 | -pg_port = node['gitlab']['postgresql']['port'] | ||
| 138 | -pg_user = node['gitlab']['postgresql']['username'] | ||
| 139 | -bin_dir = "/opt/gitlab/embedded/bin" | ||
| 140 | -db_name = "gitlabhq_production" | ||
| 141 | - | ||
| 142 | -sql_user = node['gitlab']['postgresql']['sql_user'] | ||
| 143 | -sql_user_passwd = node['gitlab']['postgresql']['sql_password'] | ||
| 144 | - | ||
| 145 | -execute "#{bin_dir}/psql --port #{pg_port} -d template1 -c \"CREATE USER #{sql_user} WITH ENCRYPTED PASSWORD '#{sql_user_passwd}'\"" do | ||
| 146 | - user pg_user | ||
| 147 | - not_if { !pg_helper.is_running? || pg_helper.sql_user_exists? } | ||
| 148 | -end | ||
| 149 | - | ||
| 150 | -execute "create #{db_name} database" do | ||
| 151 | - command "#{bin_dir}/createdb --port #{pg_port} -O #{sql_user} #{db_name}" | ||
| 152 | - user pg_user | ||
| 153 | - not_if { !pg_helper.is_running? || pg_helper.database_exists?(db_name) } | ||
| 154 | - retries 30 | ||
| 155 | - # notifies :run, "execute[migrate_database]", :immediately | ||
| 156 | -end |