Passenger & Rails refuse to start up in production environment - ruby-on-rails

I have a production server that refuses to start up in the 'production' environment. it recently ran Rails 2.x and Passenger 1 (or 2 can't remember) just fine. Upgraded Rails & Passenger and now it starts up in the development environment even though Passenger docs say it should default to production. We haven't changed anything in its default setup.
Though I just tried adding RailsEnv production to the Virtual Hosts file...to no effect.
How can I troubleshoot this? The only output I see in the console is:
server:current elvis$ rails c
Loading development environment (Rails 3.0.3)
and trying to hit app with a web browser presents this dialog after a long delay (30+ secs)
Mac OS X Server 10.5.8
Rails 3.0.3
Passenger 3.0.0
MySQL: 5.0.82

Did you install Passenger to Nginx or Apache? You start the Rails app by running the webserver, not rails c. Nginx, for example, will then load the Passenger module which will run your Rails app as needed. So, startup Nginx or Apache and you should be good to go.

Related

Is it possible to run puma and passenger in a same nginx server

We have a production machine runs on Nginx + phusion passenger. Passenger is pointing to ruby verions 2.3. Want to deploy another application into the same server in which we require, ruby version 2.4+.
I believe, we cannot use that with the passenger any more as it is already pointing to a ruby version. So thinking to use puma for the other app with ruby version 2.4.
Is it possible to run puma and passenger in a same nginx server ?

Unable to restart production rails server when started as daemon

I am running a rails server on an Ubuntu EC2 instance and have run into an issue when it comes to deploying (and restarting) my server. The odd thing is; everything seems to work fine when I start a vanilla server (rails server), but when I start the server as a daemon it does not reset (rails server -d).
I use Capistrano to do deployment. As far as I can tell there is no issue; it pulls down my latest branch, runs migrations and does a touch tmp/restart.txt. I had tried making my tmp/restart.txt a shared file, but that does not seem to be the issue (although it is a configuration I think I'll keep). After discovering Capistrano is likely working as expected I tried sshing into the server and running touch tmp/restart.txt myself. It works for the vanilla server but not the daemon.
Has anyone seen this issue before? If there is more info I could provide please let me know!
Env:
ruby 2.6.3p62 #/home/deploy/.rvm/rubies/ruby-2.6.3/bin/ruby
Rails 5.2.3 #/home/deploy/.rvm/gems/ruby-2.6.3/bin/rails
Bundler version 2.1.2 #/home/deploy/.rvm/gems/ruby-2.6.3/bin/bundle
Node v13.8.0 #/home/deploy/.nvm/versions/node/v13.8.0/bin/node
My logs, tmp, and config/master.key are shared as part of my Capistrano setup.
are you using puma or unicorn or passenger? apache or nginx? restarting the process depends more on that than anything.
personally, I like using Passenger with apache and when I restart apache, the passenger process restarts automatically.

Deploying Rails App on Elastic Beanstalk - Is WEBrick automatically replaced by passenger?

Quick Question:
I develop a ruby on rails application on my laptop. Rails has WEBrick installed as an out of the box APPLICATION server.
I deploy my app on amazon web services elastic beanstalk.
I choose The configuration: Ruby 2.2 with Passenger version 2.0.8, which contains:
64bit Amazon Linux 2015.09 v2.0.8 running Ruby 2.2 (Passenger Standalone)
Ruby 2.2.3
RubyGems 2.4.5.1
Passenger 4.0.59 - Application server
nginx 1.8.0 - Web server.
When I deploy my app, does elastic beanstalk automatically replace WEBrick with passenger??? Or-- do I need to install the passenger gem myself?
Thanks!
Figured it out. I used the AWS GUI console online to download the virtual server's instance logs. I checked the ed-activity.log file and saw that the server was started with passenger.
So, yes, Amazon Elastic Beanstalk automatically runs passenger even without the passenger gem in the gemfile.
Side note, when I tried to deploy the rails app with the passenger gem, I ran into a lot of problems. AWS EB runs passenger standalone 4.0.59 while HomeBrew installs passenger 5.0~something or other... This conflict will take down your entire server instance.

Running nginx in rails automatically

I am using rails 2.3.9, rubygems 1.8.24, ruby 1.9.3 and Windows 7 ultimate 64-bit
I just installed nginx as my web server through passenger. Now I want to run nginx as my default server such that when i run ruby script/server, it runs instead of the default WeBrick. Is there any way to do this? Thanks a million.
Nginx doesn't work the way you described. Once it is started, you won't need to run script/server, the rails app will be run at the same time when the Nginx/Apache started.
So, just deploy your rails app following the 'Passenger' manual( in development mode), and you will get your app always running.
so, as conclusion, we can tell that, when deploying a Rails app, Nginx and Apache is in the same group( work together with Passenger), and Mongrel/Webrick/Thin is another group(script/server approach).
You may want to take a look at Foreman.

How to deploy Rails project in Nginx server using passenger?

In my local, I am using werbrick application server for my localhost.
I have Ruby version 1.9.2 .and Rails version 3.1.
How to deploy On live,with Rails Project On Nginx Server?
And What will be the application server (like passenger module with apache) can be used with Nginx server for Rails 3.1 application?
This blog post should give you a good starting point. This one here goes a little deeper in detail. Note: I used these to get nginx running on my local development machine (OSX 10.7) and to host different rails apps locally without using Webrick. Probably there is more to take care of on a live / production system.

Resources