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'
Related
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
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
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
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
For start application i use Foreman.
Foreman start process from Procfile
web: bundle exec rails server thin -p $PORT
worker: bundle exec rake environment resque:work QUEUE=send_mail
api: bundle exec rails server thin -p $PORT
If i press control+C in console where i run foreman, foreman is ended but ran process is not killed. Is it possible to kill process that foreman ran when foreman killed.
Example below assumes port used is 4567, then do:
lsof -i :4567
This gives you the pid of the process, say 34564, then kill it with
kill -9 34564
If you are on windows, install cygwin to get lsof and kill commands.
Thin doesn't terminate as long as there are open connections.
Faye uses long-polling or WebSockets (long lasting connections).
So the end result is that Thin is waiting for your Faye connections to close.
Try to turn of the signal handlers installed by Thin and you should be fine.
I've assembled a little one-liner which finds the process ids and kills the processes
kill -9 `lsof -P -i :5000 | sed -n 's/python *\([0-9]*\).*\:5000.*/\1/p'`
In this case, I'm running python processes on port 5000, but you may be running some other type of processes on other ports, so you'll need to customize this one-liner accordingly.