I want to monitor my app with upstart. I'm exporting using
rvmsudo foreman export upstart /etc/init -a <my_app_name> -u ubuntu -l /var/<my_app_name>/log
It finishes successfully, but when i do
sudo start <my_app_name>
I get the following output and nothing happens
<my_app_name> start/running
my procfile
web: rvmsudo passenger start -p80 -e production
worker: rvmsudo bundle exec rake jobs:work RAILS_ENV=production
Its really frustrating because i can run the web and worker commands on different terminals individually. So I tried to just do a foreman start and this fails with the following error
*** ERROR ***
Please install daemon_controller first:
/usr/local/rvm/gems/ruby-2.0.0-p594/wrappers/gem install daemon_controller
The frustrating bit is that daemon controller is installed and i can see it when i do gem list
Maybe my whole approach to this is wrong can someone please point me in the right direction?
Here's the line in passenger that returns that error, so it looks as though it really can't find daemon_controller as it's rescuing a LoadError. Try updating your web process to run via bundle exec also:
web: rvmsudo bundle exec passenger start -p80 -e production
Related
I am using monit at production server. I have installed rbenv and bundler in a user which is in sudo group. Monit is unable to start unicorn server because it uses sudo by default and bundle command is not present in sudo.
`$ /etc/init.d/unicorn_demo_app start`
is working fine. When I say
`$ sudo /etc/init.d/unicorn_demo_app start`
Giving error as su: bundle command not found.
So monit using sudo to start the unicorn server. How can I make Monit NOT TO use sudo.?
Have you tried to reinstall rbenv and bundler with standard user?
binstubs will solve your problem. the rbenv docs go into it pretty well https://github.com/sstephenson/rbenv/wiki/Understanding-binstubs
I recently added the dokku-shoreman plugin and a Procfile so that my app runs both a worker and web process when I deploy. It looks like this:
web: bundle exec rails server -p $PORT
worker: bundle exec rake jobs:work
However, now I when I use dokku run <app> <cmd> such as ...rake db:migrate a server and worker start running instead.
Currently the only way I know how to run the worker is with the Procfile. It's not a big issue to start it manually after I deploy - only I don't know how.
Though the ideal would still be to have the both the Procfile and dokku run working.
Update 2 Dokku now supports this http://dokku.viewdocs.io/dokku/deployment/process-management/
Update: checkout dokku-alt (no longer maintained) first - it's what I've switched to instead.
This is a known issue with dokku.
This was a temporary solution detailed in the issue discussion that worked for me:
rename actualProcfile to Procfile.real
create a new Procfile with the following content:
web: bundle exec foreman start -f Procfile.real
add gem 'foreman' as a dep in Gemfile
run bundle install
commit Procfile* and Gemfile*
push
I am receiving the following error when trying to run "foreman start" to execute my rails file.
dyld: Symbol not found: _rb_ary_new_from_values
Referenced from: /Users/paulbattisson/.rvm/gems/ruby-2.1.1/gems/psych-2.0.5/lib/psych.bundle
Expected in: flat namespace
If I run rails s then the app starts fine however I am wanting to use the following Procfile:
web: bundle exec rackup config.ru -p $PORT
resque: env TERM_CHILD=1 bundle exec rake resque:work
So that I can utilise resque. Any help is much ppreciated. I have tried bundle install to see if that resolves the issue but it seems not. I am managed rvm via JewelryBox and using Rails 4.1.1 with Ruby 2.1.1
The solution seems to have been reinstalling foreman using
gem install foreman
I am making a chatting application using Ruby on Rails with Faye gem.
The app works on localhost after I inserted "localhost:9292/faye.js" in the index.html and I run the following script on command line:
rackup faye.ru -s thin -E production
ruby faye.rb
However, the app doesn't work on Heroku even if I changed the source url to "http://myappname.herokuapp.com/faye.js" and makes these errors.
http://myappname.herokuapp.com/faye.js 404 (Not Found)
ReferenceError: Faye is not defined
I've tried these commands but no luck so far.
heroku bundle exec rackup faye.ru -s thin
heroku bundle exec ruby faye.rb
It would be great if you could figure this out.
I appreciate for your help in advance!
I changed the url to "http://myappname.herokuapp.com:9292/faye.js"
and run the following commands on the commandline
heroku run bundle exec rackup faye.ru
heroku run bundle exec ruby faye.rb
Now I am getting this error
http://myappname.herokuapp.com:9292/faye.js net::ERR_CONNECTION_REFUSED
I tested the app with "foreman start" on localhost and everything worked.
However, it still does not work on Heroku.
Here's what my Procfile looks like:
web: bundle exec rails server thin -p $PORT -e $RACK_ENV
worker: bundle exec rake jobs:work
I intend to add a worker process because I wish to run some background jobs. I'm following these instructions
This is what I noticed:
No problems encountered if the worker is started separately.
When I keep the second line in the Procfile and don't not change anything else, the rails server serves a couple of requests and hangs after that
As mentioned here , I've added STDOUT.sync = true to config/environments/development.rb and verified the same in the rails console. Did not work.
Tailed log/development.log and compared it against the stuff that foreman outputted to the shell and noticed that both matched for a couple of requests and then foreman stopped printing out stuff to the shell - the next request would then hang
I updated foreman using foreman.pkg as mentioned here and verified the same with [6]
It was mentioned here that this might be caused due to a stray debug statement. I'm not using the debugger and I do not have the pry gem or the ruby-debug gem in my Gemfile.lock
I believe the symptoms are similar to this related unanswered question
Please help!
[6]:
which foreman
/usr/bin/foreman
ls -lah /usr/bin/foreman # checked the updated date
Tracked and resolved here:
https://github.com/ddollar/foreman/issues/244
TL;DR: Install the gem, don't use foreman.pkg
I'll add than if you're using Heroku, the foreman version included with the heroku toolbelt has the same issue.
Use the one you can get with gem install foreman instead.