Skip to content

Commit

Permalink
Adding ultrasphinx cookbook
Browse files Browse the repository at this point in the history
  • Loading branch information
demonbane committed Sep 19, 2009
1 parent a7f14fd commit 2897fc8
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 2 deletions.
66 changes: 65 additions & 1 deletion cookbooks/ultrasphinx/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1 +1,65 @@
# recipes go here.
require 'pp'
#
# Cookbook Name:: ultrasphinx
# Recipe:: default
#
#if_app_needs_recipe("ultrasphinx") do |app,data,index|

# Make sure that we only run this on an app instance and not on a database server.
# The "node" information will be provided by the server, that's why you won't see
# it defined anywhere in this repository.
if ['solo', 'app', 'app_master'].include?(node[:instance_role])

# This is the name of your application as Flex/Solo knows it.
run_for_app("<app_name>") do |app_name, data|

directory "/var/run/sphinx" do
owner node[:owner_name]
group node[:owner_name]
mode 0755
end

directory "/var/log/engineyard/sphinx/#{app_name}" do
recursive true
owner node[:owner_name]
group node[:owner_name]
mode 0755
end

# This will create a remote file by copying a local file from ./files
remote_file "/etc/logrotate.d/sphinx" do
owner "root"
group "root"
mode 0755
source "sphinx.logrotate"
action :create
end

# This will create a remote file using a local template. See the file in
# ./templates to get a feel for what's going on here.
template "/etc/monit.d/sphinx.#{app_name}.monitrc" do
source "sphinx.monitrc.erb"
owner node[:owner_name]
group node[:owner_name]
mode 0644
variables({
:app_name => app_name,
:user => node[:owner_name]
})
end

template "/data/#{app_name}/shared/config/sphinx.yml" do
owner node[:owner_name]
group node[:owner_name]
mode 0644
source "sphinx.yml.erb"
variables({
:app_name => app_name,
:user => node[:owner_name]
})
end

end

end

5 changes: 5 additions & 0 deletions cookbooks/ultrasphinx/templates/default/sphinx.monitrc.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
check process sphinx_<%= @app_name %>_3312
with pidfile /var/run/sphinx/<%= @app_name %>.pid
start program = "/engineyard/bin/ultrasphinx_searchd <%= @app_name %> start" as uid <%= @user %> and gid <%= @user %>
stop program = "/engineyard/bin/ultrasphinx_searchd <%= @app_name %> stop" as uid <%= @user %> and gid <%= @user %>
group sphinx_<%= @app_name %>
10 changes: 9 additions & 1 deletion cookbooks/ultrasphinx/templates/default/sphinx.yml.erb
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# stuff goes here.
<%= @node[:environment][:framework_env] %>:
searchd_log_file: /var/log/engineyard/sphinx/<%= @app_name %>/searchd.log
query_log_file: /var/log/engineyard/sphinx/<%= @app_name %>/query.log
pid_file: /var/run/sphinx/<%= @app_name %>.pid
address: localhost
port: 3312
mem_limit: 32
config_file: /data/<%= @app_name %>/current/config/ultrasphinx/<%= @node[:environment][:framework_env] %>.sphinx.conf
searchd_file_path: /var/log/engineyard/sphinx/<%= @app_name %>/indexes

0 comments on commit 2897fc8

Please sign in to comment.