Commit c7d6beba authored by Marin Jankovski's avatar Marin Jankovski

Move redis to sockets.

parent 54811e77
......@@ -36,12 +36,28 @@ default['gitlab']['shell_repository'] = "https://github.com/gitlabhq/gitlab-shel
default['gitlab']['repos_path'] = "#{node['gitlab']['home']}/repositories"
default['gitlab']['shell_path'] = "#{node['gitlab']['home']}/gitlab-shell"
default['gitlab']['redis_path'] = "/usr/local/bin/redis-cli"
default['gitlab']['redis_unixsocket'] = "/var/lib/redis/redis.sock" # To disable redis using Unix sockets set this value to nil
if node['gitlab']['redis_unixsocket']
default['gitlab']['redis_port'] = "0"
default['gitlab']['redis_unixsocketperms'] = "0770"
else
default['gitlab']['redis_port'] = "6379"
default['gitlab']['redis_unixsocketperms'] = nil
end
default['gitlab']['redis_host'] = "127.0.0.1"
default['gitlab']['redis_port'] = "6379"
default['gitlab']['redis_database'] = nil # Default value is 0
default['gitlab']['namespace'] = "resque:gitlab"
default['gitlab']['self_signed_cert'] = false
# Redis
include_attribute 'redisio'
default['gitlab']['redis']['configure'] = true
if node['gitlab']['redis']['configure']
default['redisio']['servers'] = [{'port' => node['gitlab']['redis_port'], 'address' => node['gitlab']['redis_host']}]
default['redisio']['default_settings']['unixsocket'] = node['gitlab']['redis_unixsocket']
default['redisio']['default_settings']['unixsocketperm'] = node['gitlab']['redis_unixsocketperms']
end
# GitLab
default['gitlab']['repository'] = "https://github.com/gitlabhq/gitlabhq.git"
default['gitlab']['deploy_key'] = "" # Optional. Private key used to connect to private GitLab repository.
......
......@@ -18,6 +18,7 @@ template File.join(gitlab['shell_path'], "config.yml") do
:redis_path => gitlab['redis_path'],
:redis_host => gitlab['redis_host'],
:redis_port => gitlab['redis_port'],
:redis_unixsocket => gitlab['redis_unixsocket'],
:redis_database => gitlab['redis_database'],
:namespace => gitlab['namespace'],
:self_signed_cert => gitlab['self_signed_cert']
......
......@@ -140,6 +140,12 @@ template File.join(gitlab['path'], "config", "database.yml") do
notifies :reload, "service[gitlab]"
end
file File.join(gitlab['path'], "config", "resque.yml") do
content "#{gitlab['env']}: unix:#{gitlab['redis_unixsocket']}"
user gitlab['user']
group gitlab['group']
end
### Load db schema
execute "rake db:schema:load" do
command <<-EOS
......
......@@ -15,6 +15,15 @@ include_recipe "apt" if platform?("ubuntu", "debian")
include_recipe "yum-epel" if platform_family?("rhel")
include_recipe "gitlab::git"
include_recipe "redisio::install"
file "#{gitlab['redis_unixsocket']}" do
owner node['redisio']['default_settings']['user']
group node['redisio']['default_settings']['group']
mode gitlab['redis_unixsocketperms']
action :create_if_missing
not_if gitlab['redis_unixsocket'].nil?
end
include_recipe "redisio::enable"
## Install the required packages.
......
......@@ -31,3 +31,10 @@ user gitlab['user'] do
action :lock
only_if { gitlab['env'] == 'production' }
end
group node['redisio']['default_settings']['group'] do
action :modify
members gitlab['user']
append true
not_if gitlab['redis_unixsocket'].nil?
end
......@@ -29,10 +29,12 @@ redis:
bin: <%= @redis_path %>
host: <%= @redis_host %>
port: <%= @redis_port %>
<% if @redis_unixsocket %>
socket: <%= @redis_unixsocket %>
<% end %>
<% if @redis_database %>
database: <%= @redis_database %>
<% end %>
# socket: /tmp/redis.socket # Only define this if you want to use sockets
namespace: <%= @namespace %>
# Log file.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment