Does A rails application runs on any webserver or some particular servers are required to run a rails application.
Thanks for help!
Rails application runs only on Rack based servers like Webrick, Puma, Passenger, Unicorn etc.
Checkout https://www.digitalocean.com/community/tutorials/a-comparison-of-rack-web-servers-for-ruby-web-applications
Related
I am trying to run specs on a Rails 5 app. However, I am seeing the following LoadError:
Failure/Error: raise LoadError, 'Capybara is unable to load puma for
its server, please add puma to your project or specify a different
server via something like Capybara.server = :webrick.'
I am using the passenger gem for the production server. Is there a way in which I can use passenger for the Capybara tests as well?
Thanks in advance
If you really want to use passenger to run your app while testing you will need to startup your app separately with passenger using the rails test environment (so it uses the test DB, etc) and then set
Capybara.run_server = false
Capybara.app_host = "http://<wherever the app is accessible>"
for your tests. This tells Capybara not to bother with running the app itself and to just connect to the app you're already running. You will also need to use something like database_cleaner to handle database resetting between tests, and be very careful to make sure you don't have any leftover requests running at the end of each test.
When running the tests with puma or webrick none of that is required (database_cleaner is generally required for rails < 5.1 but not 5.1+), because the web server is run in the same process (different threads) as the tests which allows Capybara to know when requests are still being processed and for Rails to share the DB connection with the tests. Overall you're just going to have a much smoother experience if you stick with puma or webrick for your tests.
I don't think you can do this:
The capybara documentation:
This block takes a rack app and a port and returns a
rack server listening on that port
From the passenger repo:
This is fundamentally incompatible with Phusion Passenger's model.
Such a Rack handler implies a single application and a single process.
Phusion Passenger runs multiple processes which can even serve multiple
applications.
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.
I'm in the process of setting up my VPS (linode) to host a few rails websites. What are some good options for setting up one server that will be hosting rails websites that are on different versions of rails and ruby. For example
foo.com - ruby 1.9.2, rails 3.0
bar.com - ruby 1.9.3, rails 3.2.3
I've seen only one blog post (using passenger) regarding a setup like this but I'm interested in finding out what some other solutions look like. Or if this is a BAD idea and I should be using different VPS's for each I'd like to know othat too.
You can use for example standalone Passenger or Unicorn instances per application, and reversproxy them via Apache or Nginx so it will respond on default port 80
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.
I just installed a new rails 3 application on ruby 1.9.2 for the first time using Refinery CMS.
Everything went well using refinerycms to install the application, but passenger is having issues with the application.
Passenger says Rack can not start gives me error:
"No such middleware to insert after: ActionDispatch::Static"
I am running several other rails applications on my server using passenger without trouble; although none of those applications are using refinerycms.
Help much appreciated as this is a project in a class I'm taking and have very limited time to complete the scope of this project, would be awesome to get started.
In your config/environments/production.rb file you have to specify:
config.serve_static_assets = true
This enables ActionDispatch::Static and is a requirement of Refinery CMS.