Ruby on Rails => Server is sleeping before some time - ruby-on-rails

I have installed Redmine on my computer, i can run it with the command:
bundle exec rails server webrick -e production
And that's working good
But it's just for work with localhost.
I need to access to Redmine from another station. For this, i have found this command:
rails s -p 3000 -b 0.0.0.0
And that's working good, but in this case, after some time without query, the rail server turn in sleep.
And if i clic in redmine, the server don't response. I have to enter in console and press a key for wake up it.

That's working with
bundle exec rails server webrick -p3000 -b 0.0.0.0 -e production
Thanks to MAX for telling me that WebRick was a webserver

Related

How to start a Rails server forever on Ubuntu

I have uploaded my Rails app on my Ubuntu server, where I want to keep my Rails server running so that any one can access it at any time.
I tried the command below to run my app:
rails server --binding=oditek.in -p 8888
Please help me to make this possible.
You can try following option to run the server in background.
rails s -d ## With default Port.
rails s -p 8888 -d ## With Custom port.
Or
nohup rails s &
Or
You can also configure your project with Nginx + Passenger

passenger start standalone with RAILS_ENV=production

I'm trying to run multiple rails apps (different versions) on my server. I followed this post
Phusion Passenger & running multiple Ruby versions
I ran one app outside the pattern with passenger standalone:
passenger start -a 127.0.0.1 -p 3000 -d
But I got this error:
database configuration does not specify adapter
(ActiveRecord::AdapterNotSpecified)
So, this app is on the development environment and I want to run as production mode.
How can I do it?
Solved! I passed now this command:
passenger start -a 127.0.0.1 -p 3000 -d --environment production

Unicorn rails server running always

I am using unicorn server for locomotive cms installed on digital ocean in ubuntu 12.04. I am wondering how I keep the server running so when I log out of the ssh session the site stays up and running.
This is currently the command I use to get it running
bundle exec unicorn_rails -p 80
Thanks! in advance
you need to set up unicorn with apache or nginx. here is a guide for apache + unicorn. with that setup you can start and stop server by starting and stopping apache service.
This is a guide on how to setup Unicorn with nginX which I have followed and used numerous times.
https://gist.github.com/billie66/3696537
Run Unicorn via bundler:
bundle exec unicorn -c config/unicorn.rb -E production -D -p 8089
Stop Unicron (if you have followed the guide from above)
kill -9 'cat /path/to/your/app/tmp/pids/unicorn.pid'

Rails deployment from foreman to supervisord

I would like to deploy my rails app, which locally runs with foreman to a server, where supervisord handles the restarts.
Unfortunatley the app throws this error and I have no idea where $PORT comes from, nor from where this part gets started. Locally everything runs nice.
My app uses redis (which is the second part in the procfile) and puma as a webserver
.../.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/uri/generic.rb:213:in 'initialize': the scheme tcp does not accept registry part: 0.0.0.0:$PORT
Check your supervisor config.
bundle exec puma -p $PORT
won't use the environment variable PORT. It should work setting the port manually.
For example:
bundle exec puma -p 3000

Upgraded to Ruby 1.9.3-p374, now default Rails port is 5000. How to change back?

I just upgraded to Ruby 1.9.3-p374 on my development machine. Now, when I start Rails with foreman start, it uses port 5000.
Here is my Procfile:
web: bundle exec rails server thin -p $PORT -e $RACK_ENV
My .env:
RACK_ENV=development
PORT=3000
Why is it giving me port 5000, and how can I change it back?
It was using the version installed under my old ruby directory- I hadn't installed it again since upgrading, I'd forgotten it wasn't in my gemfile. Installing it again worked.

Resources