Deploy compiled Rails app to Java server on Heroku - java

What are the steps I need to take to deploy my compiled jruby rails application(with warbler gem) to heroku Java servers?
I don't know Java so I hope you can help with the actions I need to take. For example, how I deal with the database connection? What configuration I need?

for deploying your Rails application as a war archive you should follow the Java web-app runner guide ... although it does require some Java domain knowledge - mostly around Maven.
probably the easiest thing is deployment using the toolbelt plugin heroku deploy:war --war <path_to_war_file> since it assumes you have packaged the .war on your own locally ...
NOTE: be advised that if you'd follow the migrating to JRuby guide than you'll end up deploying without any .war packaging being involved in the process (similar to how you deploy with MRI)

Related

Why using Tomcat and not "java -jar"?

I'm creating a job in jenkins to deploy a springboot application to Tomcat.
I'm trying to understand why should I deploy an application to Tomcat? Why not just run the application on the server by "java -jar" command?
In my previous workplace we deployed the springboot application by creating a war file and "java -jar" command. We used "kill" to shut down the application and "java -jar" again to deploy a new version...
I understand that Tomcat has a big advantage here and I would like to understand what is it?
Google says me how to work with tomcat but I couldn't find a real explanation why need it except this that says:
It provides a management dashboard from which you can deploy a new web application, or undeploy an existing one without having to restart the container. This is especially useful in production environments.
But what do I have to manage here?

deploy a java EE application on a live server

I've just finished developing a java ee application with tomcat and spring boot and angularjs and mysql on localhost, please can any body help how to deploy this app to run on live server and what are the changes must be done before generate the war ( i meant the porte 8080 and mysql porte) because finally i want tu run my app on http://myserver.com/myapp/ instead of http://myserver.com:8080/myapp/
If you're using Spring Boot, don't use the war option. Build a fat jar instead. That's the more common way of deploying Sprint Boot and it will save you an incredible amount of pain like this. For example, your complaint about ports is (going on memory) solved liked this:
java -Dserver.port=80 -jar some-service.jar
or
export SERVER_PORT=80
java -jar some-service.jar
FWIW, Spring Boot bundles Tomcat with the fat jar.

New to J2EE - Hosting a Spring MVC based project using Tomcat 7 server on local dev machine (no Eclipse)

I am familiar with Java as a language but not JSP and Spring framework. I am trying to load an existing project and using vim as my IDE.
Originally, when working on it using eclipse, I installed openjdk7-jdk, downloaded the tomcat7 server from its website and extracted to a location, imported project in current workspace, set up the tomcat for server environment. I was able to see the application in browser.
I am looking for a way to use vim, installing tomcat from official repos and then either set up a new host for this application or adding a context for the same. I have tried both the ways but still not able to make it work. I get the tomcat standard 404 error page.
This answer here says that this may work if I create a .war file and place it in the webapps folder. Is this the only way to run a spring based application?
After working in ASP.Net, ROR, Django, I am assuming Java also has similar deployment structure.
One thing is that Tomcat is not required for spring based applications. But if you are implementing J2EE application on Tomcat, make sure you have Spring context defined in your webapps web.xml (inside WEB-INF directory).
The Spring Application context must be initialized through your ServletContextListener implementation.
Oups, seems there a long way to heaven ... More seriously you must pass by several steps (that a nice IDE like Eclipse or Netbeans can hide from you) :
create the source files for the application - you spoke of vim it can be used for that step
compile and build the application to a .war - this step is almost mandatory but i would not dare avoid it as I explain below - you can use low level tools like javac but you really should use ant or maven here ; if you are lucky, there is already a pom.xml (maven) or build.xml (ant) in the sources
deploy the war to a tomcat
In theory, it should be possible to individually compile the java file into .class, build a full hierarchy by hand and put that manually in webapps folder of tomcat. But never do that - or at least never say that I adviced you to do it :-)

How to deploy Workflow engine on jBOSS AS 7

I have running jBOSS AS 7 and I want to deploy my Workflow engine on this server. How can I do it? I have files .bpmn and .java. In .bpmn file I have scenario and in .java file I have class with functions which I'm using in my .bpmn file.
Please help me.
Greetings
rizon
You basically have two options:
(1) write your own web application that embeds the jBPM jars and calls the process at some point in time, this requires you to write a web app, embed all the jbpm jars and create a war from this to deploy
(2) take advantage of the jBPM console to deploy and execute your process on the jBPM execution server, you should install the jbpm-console and use the authoring environment to build and deploy your process and the management UI to start and manage your process instances. You can use git to sync your process in Eclipse with the jbpm-console. Consider using the jbpm-installer to install and start the jbpm-console on as7
Note that for (1) you need to have sufficient web development capabilities before you can get started with this. In this case, it seems going for (2) seems to be recommended.

What happens behind the scenes of deploying a Spring MVC application to tomcat outside of eclipse?

I guess a drawback of using such an awesome IDE like eclipse is that you miss the point for what happens behind the scenes of an application. I'm a ruby developer so not a java veteran. So I've been coding a project in java and using the spring framework for IOC and MVC. Can someone explain to me what is going on when I select run on server in eclipse? Because eventually I will be deploying this masterpiece of an application to a Linux server. Here is my setup. I am using Spring MVC 3 and the maven plugin in eclipse. In the pom.xml file, I have stuff like latest spring release version, log4j, spring mvc, spring context etc.
I have been testing my application on localhost using the handy option of run on server in the eclipse IDE. The server configuration in eclipse is pointing to the tomcat directory location for where I have installed tomcat 7. Please demystify what happens behind the scenes and what I will need to do if I want to deploy this application on a production server. The more detail the better. Thanks a ton in advance.
Deploying a web application to Tomcat is as simple as this (assuming Tomcat is installed)
Bundle your application in a .war with the correct format.
Move the generated .war file to the /webapps directory of your Tomcat installation folder.
Run the /bin/startup.[sh|bat] script in the Tomcat installation folder.
Note that there are intermediate steps you can do to configure the deployment, like changing your context path. Go through the Tomcat documentation for details.
In step 3, Tomcat will extract the .war contents to a directory in the /webapps folder with the same name as your .war file. It will use this as the context path. The script itself launches a java process by putting the WEB-INF/[class|lib|...] onto the classpath along with some Tomcat libraries.
So Eclipse basically does all the steps above for you.
Ultimately you are deploying an web application that means you are deploying a war file to the server. Regardless of using frameworks like spring, struts anything.
SO a web application request starts from web.xml file. SO for spring mvc application, you are mapping all request coming from browser to DispatcherServlet and then this guy is responsible to manage whole life cycle of your application.
For more details of how MVC works please see
http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/mvc.html
So in order to deploy your application (a war) on server first of all you have to create a war from your source code. You can go to traditional approach to use java given utility like using jar from command prompt or you can use ANT, GRADLE, MAVEN and such build tool that creates war for you in automated way.
Spring is not doing anything extra for you. I believe you to research a bit more on how these tools works.
Once a war is ready for you, you can simply go to tomcat UI and there you will find options to deploy your war.
I hope it helps you.
All the majic happens in two places.
The first is your 'Servers' directory in the root of your Eclipse Package Explorer. These are your server configuration files that Eclipse will use (mostly) when it creates a new server instance.
The second is in the ./metadata/.plugins/org.eclipse.wst.server.core/ file system directory in your Eclipse workspace. This is where the tomcat application is actually deployed by eclipse.
The Tomcat Documentation is pretty good actually and helps explain how to do deployments. FYI, I do not know many people that use the Manager, from my experience most people deploy their applications by hand.

Categories