Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to support thinking_sphinx v3 #109

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

update to support thinking_sphinx v3 #109

wants to merge 3 commits into from

Conversation

grumpit
Copy link

@grumpit grumpit commented Jun 4, 2013

One additional change would be that there would need to be a ts_searchd file in /engineyard/bin/searchd something like this:

#!/bin/sh
# This script starts and stops the searchd
# This script belongs in /engineyard/bin/searchd
###############################################################################
export PATH=/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.2
###############################################################################

usage() {
  echo "Usage: $0 <appname> {start, stop, configure, reindex} [environment]"
  exit 1
}

if [ $# -lt 2 ]; then usage; fi

if [ -z "$3" ]; then
  FRAMEWORK_ENV=production
else
  FRAMEWORK_ENV="$3"
fi

###############################################################################
LOGBASE=/var/log/engineyard/sphinx/$1
PIDFILE=/var/run/sphinx/$1.pid
CONFIGFILE=/data/$1/shared/config/sphinx.yml
GEMFILE=/data/$1/current/Gemfile
OUTPUT=$LOGBASE/searchd.log
USER=`stat -c"%U" /data/$1/current`
COMMAND=""
###############################################################################

export RAILS_ENV="$FRAMEWORK_ENV"
export RACK_ENV="$FRAMEWORK_ENV"
export HOME="/home/$USER"

if [ -f $GEMFILE ]; then
  COMMAND="bundle exec"
fi

if [ -d /data/$1/current ]; then

  cd /data/$1/current

  if [ ! -f $CONFIGFILE ]; then
          echo "$CONFIGFILE doesn't exist! Exiting" >> $OUTPUT 2>&1
  fi

  # handle the second param, don't start if already existing
  case "$2" in
    start)
      echo "Starting searchd"
      $COMMAND rake ts:start >> $OUTPUT 2>&1
      ;;
    stop)
      echo "Stopping searchd"
      $COMMAND rake ts:stop >> $OUTPUT 2>&1
      ;;
    configure)
      echo "Configuring your searchd indexes"
      $COMMAND rake ts:configure >> $OUTPUT 2>&1
      ;;
    reindex)
      echo "Reindexing your searchd indexes against the live server"
      $COMMAND rake ts:index >> $OUTPUT 2>&1
      ;;
    *)
      usage
      ;;
      esac
else
  echo "/data/$1/current doesn't exist."
  usage
fi

(thanks to Matt Jones at EYDC for that one)

@grumpit
Copy link
Author

grumpit commented Jun 13, 2013

Latest push adds the mentioned ts_searchd script as a file and a remote_file instruction that gets run when 'ts' is chosen as the flavor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant