Skip to content

Commit

Permalink
[FIX] Changed, that Chef doesn't change the owner of pid_path to th…
Browse files Browse the repository at this point in the history
…e Elasticsearch user

Since a95a3f7, the default `pid_path` attribute is "/usr/local/var/run".

However, the default recipe define this as directory resource and
specify that user/group owners are `elasticsearch`, which clashes with
other services running potentially on the system.

This directory should belongs to root and allow elasticsearch to write its pid.

A `chown` call is added into the init script.

Closes #193
Closes #194

Related: #108
  • Loading branch information
kamaradclimber authored and karmi committed May 7, 2014
1 parent e5ebce0 commit 76d918d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,19 @@

# Create ES directories
#
[ node.elasticsearch[:path][:conf], node.elasticsearch[:path][:logs], node.elasticsearch[:pid_path] ].each do |path|
[ node.elasticsearch[:path][:conf], node.elasticsearch[:path][:logs] ].each do |path|
directory path do
owner node.elasticsearch[:user] and group node.elasticsearch[:user] and mode 0755
recursive true
action :create
end
end

directory node.elasticsearch[:pid_path] do
mode '0755'
recursive true
end

# Create data path directories
#
data_paths = node.elasticsearch[:path][:data].is_a?(Array) ? node.elasticsearch[:path][:data] : node.elasticsearch[:path][:data].split(',')
Expand Down
1 change: 1 addition & 0 deletions templates/default/elasticsearch.init.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ start() {
fi

echo -e "\033[1mStarting elasticsearch...\033[0m"
touch $PIDFILE && chown <%= node[:elasticsearch][:user] %> $PIDFILE
<% if node.platform_family == 'debian' %>
ES_INCLUDE=$ES_INCLUDE start-stop-daemon --background --start --quiet --pidfile $PIDFILE --chuid <%= node[:elasticsearch][:user] %> --exec /usr/local/bin/elasticsearch -- -p $PIDFILE
<% else %>
Expand Down

0 comments on commit 76d918d

Please sign in to comment.