Search code examples
pythonruby-on-railsthincircusd

Get Thin (bundle exec thin) to work with Circus


I'm using Circus as my supervisor for a Rails project, but I'm having some weird problem to make it work with Thin, the Ruby Server I chose. This is my circus.ini:

[circus]
check_delay = 5

[socket:server]
host = 127.0.0.1
port = 8080

[watcher:server]
working_dir = /home/myuser/myproject/myproject
cmd = bundle exec thin start -C /home/myuser/myproject/etc/thin.yml -S $(circus.sockets.server)
use_sockets = True
numprocesses = 3

stdout_stream.class = FileStream
stdout_stream.filename = /home/myuser/myproject/log/circus_server.log
stdout_stream.time_format = %Y-%m-%d %H:%M:%S

[env:server]
RAILS_ENV=production

But when I start circus (sudo service circus start), this is what I find on logs:

$ cat log/circus.log 2014-06-03 10:42:27 circus[30987] [INFO] Starting master on pid 30987 2014-06-03 10:42:27 circus[30987] [INFO] sockets started 2014-06-03 10:42:27 circus[30987] [WARNING] error in 'server': [Errno 2] No such file or directory 2014-06-03 10:42:27 circus[30987] [WARNING] error in 'server': [Errno 2] No such file or directory 2014-06-03 10:42:27 circus[30987] [WARNING] error in 'server': [Errno 2] No such file or directory 2014-06-03 10:42:27 circus[30987] [WARNING] error in 'server': [Errno 2] No such file or directory 2014-06-03 10:42:27 circus[30987] [WARNING] error in 'server': [Errno 2] No such file or directory 2014-06-03 10:42:27 circus[30987] [INFO] server stopped 2014-06-03 10:42:27 circus[30987] [INFO] Arbiter now waiting for commands

For a matter of fact, I changed cmd to any other command like python -m SimpleHTTPServer and it worked. What's happening here?

EDIT: Here's what happens when I run circusd with --log-level debug... I still get the same output regardless of copy_env = True in my circus.ini.


Solution

  • The [Errno 2] No such file or directory you're getting probably means that Circus isn't finding bundle. You could try to add your RVM bin directory to your path, like that :

    [env:server]
    PATH=$PATH:/path/to/your/rvm/bin
    

    The most likely folder you'll need is "wrappers", because it contains both ruby and gems scripts, so try it:

    PATH=$PATH:/path/to/your/.rvm/wrappers/<your ruby version>