I'm running Puma in Windows Subsystem for Linux, installing it was a breeze and it worked right away but serving static files is horribly slow. It takes more than 8 seconds to serve them:
Any ideas what's going on or how to fix it? The app itself is running at a good speed.
I run puma by executing:
rails s Puma
Other than adding the gem to my Gemfile, I haven't made any particular configuration for Puma.
According to WSL I/O performance issue , it seem to be the root cause is WSL itself at the moment. Hope Microsoft will improve WSL asap.
Webrick work fine in WSL, when in develop environment, you can run rails s webrick to start quick webrick server
I found that rails was slow startup because i was running it on ntfs drive /mnt/c etc.
When running rails in WSL which you can get to with cd ~ in wsl. My speed problems were resolved.
Related
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.
Is there a way to run Ruby on Rails app on Apache HTTPD (CentOS)?
Is this just a matter of setting up httpd.conf with VirtualHost?
Passenger is probably the easiest way to get that running. Here's a tutorial on installing Passenger on CentOS6, and here are prebuilt rpms.
http://rubyonrails.org/deploy
Check Rails site, I think you have to use a Proxy, unless I'm misunderstanding what you mean by HTTPD. Seems like you want a simple Apache setup, Rails should be able to help.
EDIT: James answer looks perfect. Same as mine, but he has real CENTOS tutorials... I've never used CENTOS, just done this through Ubuntu.
You can run mod_rails aka Passenger or a Mongrel Cluster or Thin Cluster.
I find passenger the easiest, you can download it Here
The Steps are quite easy
sudo gem install passenger
sudo passenger-install-apache2-module
Follow instructions on screen.
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 have been using Mongrel successfully with rails 2.* and 3.0* development, with ruby 1.8.7.
I recently started working with Rails 3.1 and ruby 1.9.2. I got my test app running with WEBrick. I don't like WEBrick. If I forget and simply close the WEBrick terminal window instead of going into the window and issuing a Control-C to WEBrick, the server port (3000) stays in use, and I can't run 'rails server' again until I log out everything and get WEBrick cleared out of the port table. Mongrel never had that problem.
I do have a build problem with Mongrel and ruby-1.9.2. I get multiple header files in the build, some referring to ruby-1.9.1 and some ruby-1.9.2. What a mess.
What is the recommended development web server for my config, which is 32-bit Ubuntu Natty with Rails 3.1 and ruby 1.9.2?
Webrick works well for me. The only problem I had is that it did not work well with https secure. The solution was to only run https on staging and production, not on development machine.
I use the dev machine only as the server, and develop on Windows machine with Notepad++. I think it works well, after using a horrible Rails IDE. (I used to use Visual Studio and love it.) Access the web page through local IP and port. It's a cheap, fast easy solution for Windows users.
I am running Ubuntu 11.04, Rails 3.07, Ruby 1.92 with RVM, and PostgreSQL. RVM is supposed to make life easy for Ubuntu users, because Ubuntu uses a different version of Ruby.
To kill the server process running on port 3000: xxxx is the value returned from the first line.
$ lsof | grep 3000
$ kill -9 xxxx
This could easily be combined into one line or an alias killserver or similar.
Thanks for the various port listener kill commands, I will construct something simple to clear the WEBrick's irritating habit, and continue to use it. Chasing a development web server issue is low on my priority list; they should just work.
You can see from my questions that my Linux skills don't go very deep into the kernel.
Is it possible to run ror on apache under windows environment? I am having so much trouble with webrick server lately.
You should be able to do so with Passenger / mod_rails.
Here's a relevant Stack Overflow answer:
How to install Ruby on Rails alongside WampServer?