Commit 81c3ccfa1c20661739a88e02a813eadaa74383bc
1 parent
2ea536d8
Exists in
master
and in
17 other branches
Change postgresql to redis
Showing
2 changed files
with
35 additions
and
24 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/attributes/default.rb
| ... | ... | @@ -62,3 +62,14 @@ default['gitlab']['postgresql']['checkpoint_warning'] = "30s" |
| 62 | 62 | # Redis |
| 63 | 63 | ### |
| 64 | 64 | default['gitlab']['redis']['enable'] = true |
| 65 | +default['gitlab']['redis']['ha'] = false | |
| 66 | +default['gitlab']['redis']['dir'] = "/var/opt/gitlab/redis" | |
| 67 | +default['gitlab']['redis']['data_dir'] = "/var/opt/gitlab/redis/data" | |
| 68 | +default['gitlab']['redis']['log_directory'] = "/var/log/gitlab/redis" | |
| 69 | +default['gitlab']['redis']['svlogd_size'] = 1000000 | |
| 70 | +default['gitlab']['redis']['svlogd_num'] = 10 | |
| 71 | +default['gitlab']['redis']['username'] = "gitlab-psql" | |
| 72 | +default['gitlab']['redis']['shell'] = "/bin/nologin" | |
| 73 | +default['gitlab']['redis']['home'] = "/var/opt/gitlab/redis" | |
| 74 | +default['gitlab']['redis']['port'] = 6379 | |
| 75 | +default['gitlab']['redis']['listen_address'] = 'localhost' | ... | ... |
files/gitlab-cookbooks/gitlab/recipes/redis.rb
| ... | ... | @@ -15,54 +15,54 @@ |
| 15 | 15 | # limitations under the License. |
| 16 | 16 | # |
| 17 | 17 | |
| 18 | -postgresql_dir = node['gitlab']['postgresql']['dir'] | |
| 19 | -postgresql_data_dir = node['gitlab']['postgresql']['data_dir'] | |
| 20 | -postgresql_log_dir = node['gitlab']['postgresql']['log_directory'] | |
| 18 | +redis_dir = node['gitlab']['redis']['dir'] | |
| 19 | +redis_data_dir = node['gitlab']['redis']['data_dir'] | |
| 20 | +redis_log_dir = node['gitlab']['redis']['log_directory'] | |
| 21 | 21 | |
| 22 | -user node['gitlab']['postgresql']['username'] do | |
| 22 | +user node['gitlab']['redis']['username'] do | |
| 23 | 23 | system true |
| 24 | - shell node['gitlab']['postgresql']['shell'] | |
| 25 | - home node['gitlab']['postgresql']['home'] | |
| 24 | + shell node['gitlab']['redis']['shell'] | |
| 25 | + home node['gitlab']['redis']['home'] | |
| 26 | 26 | end |
| 27 | 27 | |
| 28 | -directory postgresql_log_dir do | |
| 29 | - owner node['gitlab']['postgresql']['username'] | |
| 28 | +directory redis_log_dir do | |
| 29 | + owner node['gitlab']['redis']['username'] | |
| 30 | 30 | recursive true |
| 31 | 31 | end |
| 32 | 32 | |
| 33 | -directory postgresql_dir do | |
| 34 | - owner node['gitlab']['postgresql']['username'] | |
| 33 | +directory redis_dir do | |
| 34 | + owner node['gitlab']['redis']['username'] | |
| 35 | 35 | mode "0700" |
| 36 | 36 | end |
| 37 | 37 | |
| 38 | -directory postgresql_data_dir do | |
| 39 | - owner node['gitlab']['postgresql']['username'] | |
| 38 | +directory redis_data_dir do | |
| 39 | + owner node['gitlab']['redis']['username'] | |
| 40 | 40 | mode "0700" |
| 41 | 41 | recursive true |
| 42 | 42 | end |
| 43 | 43 | |
| 44 | -postgresql_config = File.join(postgresql_data_dir, "postgresql.conf") | |
| 44 | +redis_config = File.join(redis_data_dir, "redis.conf") | |
| 45 | 45 | |
| 46 | -template postgresql_config do | |
| 47 | - source "postgresql.conf.erb" | |
| 48 | - owner node['gitlab']['postgresql']['username'] | |
| 46 | +template redis_config do | |
| 47 | + source "redis.conf.erb" | |
| 48 | + owner node['gitlab']['redis']['username'] | |
| 49 | 49 | mode "0644" |
| 50 | - variables(node['gitlab']['postgresql'].to_hash) | |
| 51 | - notifies :restart, 'service[postgresql]' if OmnibusHelper.should_notify?("postgresql") | |
| 50 | + variables(node['gitlab']['redis'].to_hash) | |
| 51 | + notifies :restart, 'service[redis]' if OmnibusHelper.should_notify?("redis") | |
| 52 | 52 | end |
| 53 | 53 | |
| 54 | -runit_service "postgresql" do | |
| 55 | - down node['gitlab']['postgresql']['ha'] | |
| 54 | +runit_service "redis" do | |
| 55 | + down node['gitlab']['redis']['ha'] | |
| 56 | 56 | control(['t']) |
| 57 | 57 | options({ |
| 58 | - :log_directory => postgresql_log_dir, | |
| 59 | - :svlogd_size => node['gitlab']['postgresql']['svlogd_size'], | |
| 60 | - :svlogd_num => node['gitlab']['postgresql']['svlogd_num'] | |
| 58 | + :log_directory => redis_log_dir, | |
| 59 | + :svlogd_size => node['gitlab']['redis']['svlogd_size'], | |
| 60 | + :svlogd_num => node['gitlab']['redis']['svlogd_num'] | |
| 61 | 61 | }.merge(params)) |
| 62 | 62 | end |
| 63 | 63 | |
| 64 | 64 | if node['gitlab']['bootstrap']['enable'] |
| 65 | - execute "/opt/gitlab/bin/gitlab-ctl start postgresql" do | |
| 65 | + execute "/opt/gitlab/bin/gitlab-ctl start redis" do | |
| 66 | 66 | retries 20 |
| 67 | 67 | end |
| 68 | 68 | end | ... | ... |