Skip to content

Instantly share code, notes, and snippets.

@jimneath
Forked from benmoss/deploy.rb
Created July 7, 2013 06:55

Revisions

  1. @benmoss benmoss created this gist Apr 19, 2011.
    16 changes: 16 additions & 0 deletions deploy.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    # deploy.rb

    namespace :ts_remote do
    task :conf do
    run <<-CMD
    cd #{current_release}
    &&
    RAILS_ENV=#{rails_env} rake ts:conf
    &&
    rsync --progress #{current_release}/config/#{rails_env}.sphinx.conf sphinxsearch@db-server:/home/sphinxsearch/
    &&
    ssh sphinxsearch@db-server "searchd -c /home/sphinxsearch/#{rails_env}.sphinx.conf --stop
    ; searchd -c /home/sphinxsearch/#{rails_env}.sphinx.conf"
    CMD
    end
    end
    8 changes: 8 additions & 0 deletions sphinx.rake
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    # sphinx.rake

    namespace :ts_remote do
    desc 'Update indexes on the remote sphinx server'
    task :reindex do
    system "ssh sphinxsearch@db-server indexer --config ./#{ENV['RAILS_ENV']}.sphinx.conf --all --rotate"
    end
    end
    23 changes: 23 additions & 0 deletions sphinx.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    # sphinx.yml

    development:
    port: 9312
    test:
    port: 9312
    staging:
    port: 9312
    address: db-server
    sql_host: localhost
    pid_file: /home/sphinxsearch/searchd.staging.pid
    searchd_file_path: /home/sphinxsearch/searchd-staging
    sql_sock: /var/run/mysqld/mysqld.sock
    searchd_log_file: "/home/sphinxsearch/log/staging.searchd.log"
    query_log_file: "/home/sphinxsearch/log/staging.query.log"
    production:
    port: 9313
    address: db-server
    pid_file: /home/sphinxsearch/searchd.production.pid
    searchd_file_path: /home/sphinxsearch/searchd-production
    sql_sock: /var/run/mysqld/mysqld.sock
    searchd_log_file: "/home/sphinxsearch/log/production.searchd.log"
    query_log_file: "/home/sphinxsearch/log/production.query.log"