How can I open my custom URL-s? - ruby-on-rails

I'm trying to get my homework done in Ruby on Rails, but I have already faced dozens of problems because of my lack of UBUNTU (16.04.1) knowledge.
I have installed all the required gems and other clients like MySQL2, Apache2 and Puma. Puma is running, I have two standard tables in MySQL, but there is some issue with my Apache2 connection. I can access localhost:3000 (it says: Yay! You are on rails now!), but I just cannot reach my custom URL-s, that are located in the 'hosts' file.
Could any of you help me with getting started? I could blow my top because I have a lot of work to do and I cannot get through the basic steps of installing the environment...
Thanks in advance!

Related

Error using Passenger with RVM: "Passenger RequestHandler warning: someone tried to connect with an invalid connect password"

As we (finally) port our apps away from Ruby 1.8.7, I am trying to set up Phusion Passenger and Apache, with RVM, to serve apps using both Ruby 1.87/Rails 2.3.x and Ruby 1.9.3/Rails 3.2.x. This is all on my development machine; in production we us separate VMs to serve the two different platforms--but needless to say, that would be inconvenient in development.
The Good: I've got Passenger 3.0.7 installed using Ruby 1.8.7 (and RVM), and 1.8.7/Rails 2.3.x apps work great as they have in the past (the only thing changed from my past setup is having (re)installed Passenger via RVM).
The Bad: I also have installed Passenger 4.0.20 as a gem using Ruby 1.9.3 (and RVM), and if I configure Apache to use them, it is able to serve up a 1.9.3/Rails 3.2.x app just fine. But Passenger can't serve the Ruby 1.8.7/Rails 2.3.x app.
Another developer here has essentially the same setup working but we are unable to see any clear differences between her installation and mine. But her success tells me it is possible.
The Ugly: When I try to run the 1.8.7/2.3.x app with Passenger 4.0.20, Passenger logs a bunch of output to the Apache error.log, including these lines:
[ 2013-10-22 13:12:30.1770 21240/7fe89ad0e700 Pool2/SmartSpawner.h:301 ]: Preloader for /home/username/workspace/app started on PID 21284, listening on unix:/tmp/passenger.1.0.21232/generation-0/backends/preloader.21284
[ 2013-10-22 13:12:30.2547 21240/7fe89ac8c700 Pool2/Implementation.cpp:1274 ]: [App 21284 stderr] [ 2013-10-22 13:12:30.2547 21385/0x7f9bf1fd0b80(Worker 1) request_handler/thread_handler.rb:197 ]: *** Passenger RequestHandler warning: someone tried to connect with an invalid connect password.
It's the last bit (scroll to the right!) that seems the most bizarre.
Some online searching reveals that Passenger supports some sort of 'connect password' but we are using no such thing. There are few Passenger-related references to 'someone tried to connect with an invalid connect password' outside of the Passenger source code.
I actually have solved this problem, but due to the dearth of references on the web, and my failure to find any mention of the 'invalid connect password' error here on SO, I am posting this to help the next person. I haven't included lots of other log snippets, configuration file contents and the like, because I have already mentioned all the relevant information.
If you think you know the answer, here's your chance to get some more 'reputation'. Otherwise, I'll post my answer in a couple days.
Phusion Passenger author here. The connect password is a security mechanism in Phusion Passenger to prevent unauthorized processes on the local system to connect to the spawned application processes. The connect password is only known to the HelperAgent, the app process and admin tools like passenger-status.
I'm not sure what went wrong in your case. I'd like to analyze your problem more deeply. Could set PassengerLogLevel to 3, trigger the problem, and post the contents of your Apache error log file to the community discussion forum?
I found my answer in a passing remark on the Passenger forum.
Quoting my question, here is the real problem: "I also have installed Passenger 4.0.20 as a gem using Ruby 1.9.3 (and RVM)..."
I was able to solve it by re-installing Passenger 4.0.20 as a gem using Ruby 1.8.7 (and RVM). With this configuration, Passenger is able to serve up both Ruby 1.8.7 and Ruby 1.9.3 applications.
I have read that in addition to its mainly-native code, Passenger uses a bit of Ruby internally, interpreted by whatever version of Ruby it was installed with. Apparently (and wonderfully) this Ruby code is compatible with Rubies as ancient as 1.8.7. Equally wonderful, it will serve up applications with whatever Ruby their PassengerRuby directives specify... but apparently this isn't the case if Passenger is installed using a newer Ruby than the one needed by the application.
Big thanks to the Passenger and RVM teams, and also to Maximilian Herold for solving my mystery.

Passenger thinks I'm on the wrong ruby version?

weird issue. I have passenger installed on an Apache 2 server, and trying to get a Rails application running. First time deploying a rails application, so not really sure what's going on.
Passenger gives me this error:
But the problem is that 1.9.2-p136 isn't even installed on my system. I removed all ruby versions and completely reinstalled ruby with 1.9.3-p448. (I also have 2.0.0 but I default to 1.9.3)
Not seeing how passenger is even recognizing that I am running a build of ruby that doesnt exist on my system.
I'm hoping this is my last obstacle to getting this started. I have dealt with about every issue that I could have trying to get this damn rails app up. I'll tell you, they make up for how easy it is to develop with by making it impossible to deploy.
Thanks all!
1.9.2 is probably the system ruby (or was, at some point). Now, how in the heck Passenger is running on that while simultaneously using gems from an rvm install of 1.9.3...
Anyway, check your Passenger config. Make sure the PassengerDefaultRuby (if present) and PassengerRuby directives are pointing to the correct version; Passenger often gets confused by varying PATHs, and this is especially true with rvm where you may be running a different version in your user shell session than system tools will find on their own.
There's a reason people like solutions like Unicorn, Puma, and Rainbows. ;) Passenger, once you get it compiled and configured, is pretty much fire and forget, but getting to that point can be painful.

Requirements to run Ruby on Rails on Server

I want to develop a website using Ruby on Rails.
What is the requirements for the Server, i.e. what do I have to tell the admin what I need. I believe the server will be running on a machine that is already hosting some websites which use PHP. I dont know more about that so far, and it will probably be depending on my requirements.
As far as I understood from documentation and other questions the server needs to have ruby, rails installed. It also said that I could use cgi.
My problem is that I need a concrete list of things that my admin should provide.
Another question suggests that the only thing is to intall Phusion Passenger if I can use an Apache Werbserver. This would seem like an option maybe.
So what do I really need?
Phusion Passenger is the easiest way to go in a mixed environment.
A Rails app needs these things:
ruby (ruby enterprise edition or MRI 1.9.2)
rubygems
sort of gems handled with bundler
You should try it with Passenger on Your local computer. Then you will see the list for the installation.

Curl::Err::HostResolutionError (Couldn't resolve host name)

I'm running Rails 3.0 with a custom Devise authentication strategy that makes an SSL call using Curb. I get an "Curl::Err::HostResolutionError (Couldn't resolve host name)" error. Works fine manually from the command line.
The production environment is Apache running Passenger standalone with rvm 1.9.2#rails3, because the main Passenger is running ruby 1.8.7 and rails 2.3.4. I don't get this error with the my other app running the earlier versions of ruby and rails. Same code, but the difference seems to be Devise.
I've read elsewhere that this might have something to do with DNS and Apache, but I can't for the life of me figure this out and I'm really grasping at straws here. Any ideas would be greatly appreciated! Thanks in advance!
The issue actually turned out to be related to user permissions. When I ssh in with my user account and start Passenger standalone, no problem. When I start it remotely from Capistrano with the deploy user I get the error.

How to configure ruby on rails with Apache

i have strugle in connection between J2me and ruby on rails under Webrick server...
dats why i need configure with apache..i saw some tutorials about configuring..but it's not working..
You need to install Phusion Passenger: http://www.modrails.com/
Also, for performance improvement, do install REE: http://www.rubyenterpriseedition.com/
What environment are you coming from? Unix, Mac, Windows? Let's assume you're using some Unix variant, as you should, and Apache2 is already properly installed:
1 - install phusion passenger:
$ gem install passenger
2 - install passenger-apache2-module:
$ passenger-install-apache2-module
Be sure to read what the passenger-install-apache2-module command output is telling you, in the end it will give you some lines you have to put in some apache configuration files, if you miss that, it won't work. At all.
3 - Edit your vhosts.conf file (under /etc/apache2/) to define a hostname for your application, point to your application's public folder, etc.
VirtualHost examples
4 - Profit.
Commands listed under 1. and 2. might need admin privileges, it all depends on how your environment is set.
WebRick is not for production environments at all, in fact, it's not really good for development either, if you intend on doing some slightly more complex stuff with your rails applications. Other than that, you didn't really give enough detail about your problem, so I hope this answer at least points you in the right direction.

Resources