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.
Related
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.
I'm deploying a Rails 4.2.1 app to an Apache / Passenger server with Capistrano 3.4.0.
The trouble is, when I do cap production deploy, no changes appear until I restart Apache.
Why is that? Does this have to do with my not having a tmp/restart.txt file in my app directory? (I seem to remember that was required for previous Rails versions)
Everything else works fine, as in cap production deploy updates the current directory of the app on the server. There are no errors in the capistrano deploy log.
You have to notify passenger to reload (redeploy) application. One way of doing it is by touching tmp/restart.txt file.
You can also use capistrano-passanger GEM capistrano can take care of that for you. It is also doing it more effectively by using passenger-config restart-app command for passanger >= 5.
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.
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.