Skip to content

Instantly share code, notes, and snippets.

@misteral
Last active April 9, 2016 16:40
Show Gist options
  • Save misteral/b6669a08f5daa63fe56e61798fe9a9f0 to your computer and use it in GitHub Desktop.
Save misteral/b6669a08f5daa63fe56e61798fe9a9f0 to your computer and use it in GitHub Desktop.
Sphinx in dokku
web: bundle exec rails server -p $PORT
sphinxstart: rake ts:run_in_foreground
web=1
sphinxstart=1
namespace :ts do
desc 'sphinx'
task run_in_foreground: ['ts:stop', 'ts:configure', 'ts:index'] do
controller = ThinkingSphinx::Configuration.instance.controller
# Workaround to make Sphinx die nicely:
# - PTY.spawn invokes bash -c under the covers
# - Which turns SIGTERM into SIGHUP (not sure exactly why, can't seem to find a reason)
# - Which sphinx interprets as a reload instead of a quit
# - So, we need to remap HUP to KILL for the purposes of this script.
unless pid = fork
exec "#{controller.bin_path}#{controller.searchd_binary_name} --pidfile --config #{controller.path} --nodetach"
end
trap('SIGHUP') { Process.kill(:TERM, pid) }
Process.wait
end
end
default: &default
mem_limit: 256M
morphology: stem_ru
min_infix_len: 2
min_word_len: 3
development:
<<: *default
mysql41: 9312
stage:
<<: *default
mysql41: 9312
test:
<<: *default
mysql41: 9307
production:
<<: *default
mysql41: 9312
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment