Deploying Java war and Rails app to Apache in Amazon EC2 - ruby-on-rails

is it possible to deploy java app and rails app to same EC2 sever. I have a rails app that communicates a java app via AJAX so I need to deploy both to same server. Is there any way to do that or any resource to see how to?
I guess it is possible by using apache2 with tomcat and passenger. Is it true?

You can install two servers in diferent ports i.e. Apache HTTP on 80 and Apache Tomcat (or other) on 8080. Also you can use mod_jk if you want attend all your clients through Apache HTTP. MOD_JK enables to you to integrate Apache Tomcat and Apache HTTP.

Related

How to Deploy rails application using apache2 and apache tomcat server

Hi I am new to ruby on rails and I want to deploy my rails app using web server apache2 and application server tomcat and jruby.I have installed tomcat 8.0.36 and apache2.My application runs on tomcat server IP_ADDRESS:8080.
apache2 folders:
apache2.conf conf-enabled magic mods-enabled sites-available
conf-available envvars mods-available ports.conf sites-enabled
Please suggest me how to connect both these server and deploy.If my idea is wrong then suggest me what are the best way to deploy rails app.
You could deploy using this link
https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-apache-on-ubuntu-14-04

Spring boot remote address in standalone Apache Tomcat instance

I have a spring boot 1.2 web application is deployed on standalone tomcat.
I need to authorize an url based on remote IP.
In case of embedded tomcat , we can use
server.tomcat.remote_ip_header= x-forwarded-for
How do we configure, when deployed in standalone tomcat.
Note :
I did try RemoteIpValve of tomcat by setting remoteIpHeader="x-forwarded-for" and it did not work and My tomcat is behind a web Application firewall.
without changing tomcat settings etc, can we tell spring security to look for remote ip in x-forwarded-for(in stand alone tomcat deployement)
You can use Remote IP Filter available with Tomcat. There are many such filters available.
Please see (Tomcat Documentation](http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#Remote_IP_Filter)
You can configure these filters in $CATALINA_BASE/conf/web.xml which will be available for all web application or you can do it in web applications web.xml.

Deploying Apache Solr

I've been experimenting with Apache SOLR and I'm ready to integrate it with a rails application. However, I'd like to make sure I know how to deploy solr. I currently have the rails application deployed using passenger+nginx. Is it possible to deploy SOLR using nginx as well? If so, how would I do that? Otherwise, what is the preferred method of deployment? Thanks!
Solr needs to run in a Java EE application server. You can use Jetty or Tomcat. Nginx will act as a proxy via AJP or something simliar to forward all RESTless request to Solr. I haven't used my ajp with nginx but I have read about this. Essentially you will have a Java EE application server, Rails server, nginx, passenger and ajp proxy running all at the same time.
You can also setup a proxy pass and there is a tutorial here. Explore different options to see which one is bet for you.

Rails framework & Nginx web server

As we install rails it uses its own web server WEBrick. If i want to run ths application in Nginx server, then how to configure or set the Nginx web werver?
You should run your rails application in a production server such as mongrel_cluster or thin (I have used the former, and am currently switching to the latter). To put nginx in front of it, I would use the upstream and proxy_pass directives. I found a nice blog post comparing ways of running rails applications that shows their config for mongrel_cluster + nginx.
Passenger is also available for nginx, I've used that with Apache and it was very easy to set up.

Apache Tomcat and Ruby

We have Ruby Rails and Apache tomcat servers running on the samw windows server. When the App on Apache Tomcat is installed alone its working fine, but when the ruby app is installed, the Apace Tomcat App stops working. We need to have both the apps running on the same server. Please help. The application running on Tomcat is displaying the login screens and allowing the users the login. And then rest of the things are failing. The application running on Ruby is just fine as expected. Also, we installed Apace Tomcat and then Ruby on to this server. so there are a lot of chances that the Ruby took Tomcat's port. But how to figure out the overlap?
You probably have both trying to bind to port 80. Whatever server you're using for rails (passenger via nginx/apache http server, nginx+thin/mongrel, etc) is bound to port 80, then tomcat tries to do the same and can't.
If you're using nginx, I would configure tomcat to run on 8080 and reverse proxy http requests to tomcat based on the hostname of part of the url.
You can do this too with apache http server with mod_proxy.

Resources