I have an application in Clojure which I'd like to deploy to CloudFoundry. The application is doing a background job, and needs to run periodically/always. It has no web interface. How can I deploy it to CloudFoundry?
I've found several resources which seem to indicate that it might not be difficult, but I'm not sure how to do it, I don't have yet too deep knowledge with CloudFoundry.
Thank you for help.
When you push the application, either add the --no-route argument to cf push or set no-route: true in your manifest.yml file. This bypasses the health check on CF which requires your app to be listening for incoming web requests.
Just be careful that your app continues to run. If the process exits, then CF will interpret that as your app having crashed.
Related
I know that by sending a http post request to http://host:port/shutdown, we can shutdown a Springboot application. Is it possible to restart the whole springboot application by sending a http request in a production environment? So we don't need to login in the server to do that. Thank you.
I don't think such a thing exists, I'll be glad to be proven otherwise:
Spring boot doesn't do any assumptions about the environment it runs in. So when spring boot process gets shut down, re-starting it again is "out of competence" of spring boot infrastructure which is just a bunch of java classes running inside a JVM process.
You can find Here a list of endpoints exposed by the spring boot. There is a "shutdown" method that you've mentioned there, but there is no "restart" functionality exposed.
Now there are other techniques that probably can help:
If the application gets shut down because of some illegal state of some spring bean, maybe it makes sense to expose some endpoint that will "clean up" the state and make application operational again. If the application has to be restarted due to changes in configuration files or something, then you might want to consider using spring cloud's Refresh Scope for Beans. It's kind of hard to provide more information here, because you haven't mentioned the reason for shutting down the application, but I guess you've got the direction.
Having said that, there are probably some different ways to achieve what you want depending on the environment your application runs in:
If you're running in AWS for example, you can take advantage of their autoscaling policies, shut down the application remotely and AWS will run another instance for you. I'm not an expert in AWS, but I saw this working in ECS for example.
If you're running "java -jar" just on some server and want to make sure that when your process ends (by using 'shutdown') it should be started again, its possible to use some kind of wrapper that would wrap the process in service and track the service availability. There are even ready solutions for this, like Tanuki wrapper (I'm not affiliated with this product but used once its free version and it served us great)
If you're using Docker infrastructure you can change the policy and restart the container automatically when it gets shut down, I haven't used this by myself, but according to This excellent blog post is perfectly doable.
You should look at Spring boot jenkins You will also find a small article explaining how to configure the project on jenkins.
I am new to working with RAD for Websphere. After making some Java code changes I notice the server and the EAR deployed on it will say something like "Started, Publish". Today I started my server and it says "Started, Republish" (on both the server and EAR). Can someone give me a simple explanation of what is meant by "Publish", "Republish", and any other status(es) I may come across while working on a Java web app with RAD for Websphere? Also, what is the appropriate action to take for each status if I want my Java changes to be picked up? I tried bouncing the server without doing a new build and it doesnt appear to have made any difference.
Started is the state in which your server starts deploying applications.
Publish is the state in which your server publishes a new application that was not already deployed. So, new deployment is Publish
Republish is the state in which your server already has published the application but there are few changes which need publishing again. So, instead of Publish since application is already deployed, server Republish the application to make sure that changes are published as well.
I am trying to use Bluemix monitoring and analytics service bounded to a java application running on Liberty runtime. But the service always shows application as unavailable (even though I can see and verify its working). And none of the stats on CPU/memory utilization & response/throughput times work. The application is started by calling the Main class and its NOT web application. Is there specific entry in manifest.yml for M&A to start working with the application. I have used M&A with node.js application and it worked well.
I thought I will just get an answer by simple google search but alas not able to find anything on this. Appreciate the help
The Monitoring & Analytics service generally assumes a web application. The availability tab is based on doing an http GET of your application's route as defined in Bluemix. Since yours is not a web application it presumably either doesn't have a route or doesn't respond to the one that it has if it does have one; this will cause M&A to report it as down.
Likewise for Liberty apps the performance data is gathered via Websphere application server JMX MBeans. If your app is not a web app, it is likely that it is invisible to these interfaces.
There was a temporary outtage due to network issues, but things should be resolved now. Restage your app and try again...
I have a heavy java web application that has a module which needs to be run as soon as computer starts and 24X7. That module has a bat file to execute which fetches data from server.
I want to run that bat file as a windows service on my system (OS: Windows 7)
I created service with sc create command which successfully created. But when I try to start it, it always give error 1053 i.e. can't start service ; service does not respond correctly or in timely manner.
I followed all the related threads on stack overflow and others as well but no luck.For eg., I set servicesPipeTimeout also but it doesn't work.
Is there a way in java itself to create windows service?
I do not want to use any third party like wrapper, NSSM etc or Time Scheduler either.
Please provide me some clues if anybody faced this error and get it resolved.
Thanks in advance.The time you give means a lot to me. Thanks a lot
What you are trying will not work. While SC will not tell you otherwise, it should only be used to install a binary executable that is already a "true" windows service. Because the batch file does not implement the windows services interface, it fails with error 1053 ("The service did not respond to the start or control request in timely fashion") when you try to start the service.
To start your batch file as a service, use a "service wrapper" -- an executable that implements the windows services interface and can launch your batch file when you start the service. Microsoft's SRVANY is free and basic, but there are also commercial applications more suitable for a professional environment.
Where does the application logic run in a Java Web Start deployment? I want to understand the intellectual property security risk of Java Web Start. On the client end does it merely start the application on a server and then proceed to process pixels (GUI objects) and mouse clicks at the client? or is my application logic executing at the client?
Implicit in my question is the assumption that I place no value on any aspects of the design that can be inferred by looking at the GUI buttons, text output and by being an experienced user of the application. The value is in the code and logic.
Java Web Start downloads code to the client, and executes it there. The application logic will execute at the client.
Basically JWS keeps local .jar in sync with that on a server to execute an application in local mode. Read about JNLP here.
So the risk for reverse engineering is the same as with any jar packet Java app.
Basically Java Web Start downloads the latest jars (Application Logic) from the server when u launch it with the help of JNLP. and then it installs this application in temporary internet files or cache.
Your whole application logic(cache) exists in cache at client side. and then your jnlp file use them (jars)