Results 1 to 2 of 2

Thread: Upstart, Sphinx and Rails

  1. #1
    Join Date
    Aug 2006
    Location
    Katowice, Poland
    Beans
    54
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Upstart, Sphinx and Rails

    Hey,

    I've got Ruby on Rails application running on Ubuntu 10.04. My app requires Sphinx server to run and currently it's not started automatically after server reboot. I wanted to use upstart to handle it, but I can't make it work at all.

    Here's the upstart script I got:

    Code:
    description "Sphinx"
    
    start on startup
    stop on shutdown
    
    exec /bin/su - deploy -c "cd /var/www/apps/my_app/current && RAILS_ENV=production bundle exec rake thinking_sphinx:start"
    It calls rake task which in turn starts searchd with proper config file.

    After running "sudo start my_service" it just hangs. If I change path in the command above to some fake one, it still hangs - no difference. If I press CTRL+C while it hangs and try to start it again, it says that my_service is already running, but searchd daemon is actually not running. I tried adding "expect fork", but it doesn't change anything.

    If I manually run the command upstart is supposed to run with sudo - it works.

    Any ideas?

    [EDIT] I got it working with init.d script using exactly the same command, but upstart looks so much nicer
    Last edited by g0nzo; January 14th, 2011 at 03:12 PM.

  2. #2
    Join Date
    Jul 2010
    Location
    Michigan, USA
    Beans
    2,132
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Upstart, Sphinx and Rails

    And that's why I still use init.d for all my homemade init scripts. I'll try to transition them to upstart at some point though. I haven't done any Rails development in a while other than maintaining old applications. I'm going to have to tryout Thinking Sphinx.
    Last edited by rubylaser; January 14th, 2011 at 05:02 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •