I have an error in application deployment with "git push master heroku" while locally it works fine.
I want to use my persistence.xml for access to my data base of H2 (I will be use maybe PostgreSQL) all with my data source on WildFly 10.
I found no reference other than the Spring. (I can not use it)
Thank you!
I've deployed JavaEE web app (with jsf, javabean, ejb, di etc) on Heroku. Heroku will allow you to run shell script for starting your application like class with a main method or executable .jar file. Not on the pre installed fullstack application server. Also if you gonna run java app on Heroku your project should be maven.
To make it work from command line you can use cloud ready run anywhere tiny servers like payara-micro, wildfly-swarm, spring-boot. It turns your app and server into single executable jar (Uber JAR). Also tomcat and jetty have wrappers for build uberJar.
I use payara-micro and it's great that very little jar can run almost all of JavaEE features with session replication. Follow this link for instructions payara-micro how to (read also maven parts).
When you git push to Heroku(with heroku cli tool) it will automatically builds your project and run script from file called Procfile from your project root directory. Sample procfile:
web: java -jar target/myapp.jar --port $PORT
Consider $PORT part from above snippet. When Heroku runtime (dyno) starts it will open random port (I think so) and bind to $PORT environment variable. So here I'm passing that accessibe port to payara-micro server for listen. Other mentioned servers should work with similar procedures. You can find documentations at heroku devcenterr
For JPA and database connectivity Heroku provides JDBC_DATABASE_URL and DATABASE_URL environment variables that have connection information (url etc) for you to connect database. I couln't find the way to hook up those variables into persistence.xml. But you can create and configure EntityManagerFactory and EntityManager programmatically.
Hope it helps.
Related
I just downloaded jhipster-registry v3.0.0 and built it in Eclipse with the 'dev' profile. I'm running it with the 'dev' profile as a Spring Boot app using the STS Boot Dashboard. However, it is trying to use a Git URI. I thought it was supposed to use the "native" profile and use a directory on the filesystem.
It was failing due to proxy issues, first. I commented out the git.uri property in bootstrap.yml and it complains a uri is not defined. I left it empty, but it still tries to checkout from it.
bootstrap.yml says profiles.active = dev,native
I can launch the registry using Maven from the command-line. I've never had trouble launching jHipster generated projects from Eclipse, but this one is acting different. How can I launch it and not use a Git repo?
When using STS Boot Dashboard, make sure to include both native and dev in the profiles to use in the run target. Use native,dev
Without the native profile, the JHipster registry's cloud config server will use the git configuration instead of the local filesystem.
I have created an application on Play framework 2.5.6. I am trying to find out what is the best way to deploy the application on production. I have tomcat installed on my Ubuntu machine. How to create war file and How to deploy on tomcat? I am using Scala Eclipse IDE for development.
Have a look at this other thread which is very similar to what you're asking here (albeit directed at GAE).
In a nutshell, the disadvantages of deploying your app to Tomcat are:-
you have extra work to do to package your application as a WAR
extra work to deploy it
your application may not be fully asynchronous running in Tomcat
As that outdated documentation suggests - the simplest way of deploying your app in production is just using the version of Netty which is packaged as part of a Play application. See the relevant version of the docs to create a distribution. You only need a relevant version of a JVM on your prod server in this case.
The flow is generally:-
Run $ dist to build the binary (this is a zip by default, but you can also build a tar if you prefer using $ universal:packageZipTarball instead of dist).
Move it into your Linux production environment
Unpack it
Set permissions if you build a zip $ chmod +x /path/to/bin/<project-name> (not required if you created the tar)
Run the app start script (created by the dist task) eg. $ target/universal/stage/bin/<project-name>
My setup is as following:
Production web server with Glassfish 3.1.1 wrapped into a windows service.
Developing environment with Netbeans 7.1 with the included Glassfish server.
I thought a valid way to deploy updates to production server was to copy the content of the Netbeans /build directory and it worked well many times.
Unfortunately I experienced a major problem, described in the link below, where new roles were not recognized because glassfish had cached data somewhere else.
Glassfish: how to investigate roles/groups problems
I checked the Glassfish configuration a lot but couldn't find any parameters like 'rebuild cached data at the server start'. So my question is how can I deploy updates in my production server being sure that my changes will not be invalidated by pre-compiled cached data ?
Thanks
Filippo
In fact, I'm trying to see which would be the best approach to achieve play framework native support on openshift.
Play has it's own http server developed with netty. Right now you can deploy a play application to openshift, but you have to deploy it as a war, in which case play uses Servlet Container wrapper.
Being able to deploy it as a netty application would allow us to use some advanced features, like asynchronuos request.
Openshift uses jboss, so this question would also involve which would be the recommended approach to deploy a netty application on a jboss server, using netty instead of the servlet container provided by jboss.
Here is request for providing play framework native support on openshift There's more info there, and if you like it you can also add your vote ;-)
Start with creating 'raw-0.1' application.
SSH into the server and
cd $OPENSHIFT_DATA_DIR
download and install play into a directory here. $OPENSHIFT_DATA_DIR is supposed to survive redeploys of your application.
Now you can disconnect from SSH.
Clone the application repository. In the repository, there is a file .openshift/actions_hooks/start. It's task is to start the application using a framework of your choice. The file will need to contain at least (from what I know about Play)
cd $OPENSHIFT_REPO_DIR
$OPENSHIFT_DATA_DIR/play-directroy/play run --http.port=$OPENSHIFT_INTERNAL_PORT --some-other-parameters
Important
You have to bind to $OPENSHIFT_INTERNAL_IP:$OPENSHIFT_INTERNAL_PORT. Trying to bind to different interface is not allowed, also most of the ports are blocked.
To create some sort of template, save the installation steps into .openshift/action_hooks/build file. Check if play is installed, if it is do nothing, if it's not, execute the installation process.
What things have to taken care for deploy a web appl ( war ) in glassfish v3.1.1 ( glassfish-3.1.1-web-windows.exe installer ) , the appl. is developed using netbeans 7.0.1. I am using postgresql database . Developement machine and Production machine is different and is not connected to each other. Any detailed step by step instruction ?
It all depends on what resources your application would need to run successfully on the application server.
e.g. If your application uses container managed persistence then you have to make sure that you create the required JDBC connection pool and resource on the server before you can deploy your application server. If you check the persistence.xml file you will see if your application uses some jta-datasource (the value provided there is actually the JNDI name of the JDBC resource created on the server). Here you might also have to supply the required JDBC driver to the server if it is not package within the application.
What you can do is install the same application server on your local machine and deploy the application there and see if it fails. If it fails then you can check the stacktrace to find out the reason for failure.