After several hours (as well as trying God and Bluepill), I decided to ask my question here, because I absolutely do not know how to solve this problem.
I have a Rails application. I want to use Thin as my application server. I want to use Monit to monitor my thin instances. I use RVM to manage my versions of Ruby as a local user.
I have the following monit file, which supposedly does what I want but does not:
check process thin-81 with pidfile /Users/Michael/Desktop/myapp/tmp/pids/thin.81.pid start program = "/Users/Michael/.rvm/gems/ruby-1.9.2-p180/bin/thin start -c /Users/Michael/Desktop/myapp -e production -p 81 -d -P tmp/pids/thin.81.pid" stop program = "/Users/Michael/.rvm/gems/ruby-1.9.2-p180/bin/thin stop -c /Users/Michael/Desktop/myapp -P tmp/pids/thin.81.pid" if totalmem is greater than 150.0 MB for 2 cycles then restart
If I just copy / paste the start program into the command line (outside of Monit), it works. The same thing happens for the stop program , then to stop the thin instance. However, running it through Monit does not seem to work.
Running in -v verbose mode results in the following:
monit: pidfile '/Users/Michael/Desktop/myapp/tmp/pids/thin.81.pid' does not exist
It makes me think that Thin never initializes. Does Monit work as root or something else? Because if this happens, he obviously will not have the correct gems installed, since I use RVM, not the Ruby βsystemβ. I am on OSX (but eventually deploying to Linux) - does anyone know what is the reason for this? And if Monit runs as root, how can I use RVM independently? Or can I say that Monit executed start / stop programs like Michael:staff (do I assume it will be on OSX?)
Any help is much appreciated!
Michael van Rooijen
source share