Spring Boot scheduled application updates - java

I want to automate instalation/update process for my app. It's web application in spring boot. Users run this application on their own servers which usually isn't accessible from my build servers.
Requirements
installation is simple
update can be scheduled and is done automatically
fewest dependencies possible
runs on both windows server and linux
reliability & security
Current prototype
Our current prototype is based on docker. There are actually 6 docker images (our app is 2 dockers, watchtower, monitoring agent, zuul + eureka, certbot).
Installation:
download and install docker
download & run a script (it's very thin wrapper around docker compose)
Upgrade:
user checks release notes and schedules an upgrade
app sends to our build server request for new version
image for new version is built & published to repository
watchtower automatically downloads & updates it
This prototype works but it's not very reliable and it feels like overengineering.
Do you have experience with something similar? I will be very happy for opinions how to make it simpler.
Thank you

Have you looked into Spring Batch? It's got a scheduling API that you can run within the spring boot application.

Related

Java spring boot as a windows service alternative

I have multiple spring boot projects that a running on windows server. For now I am deploying each project as a windows service because we cant use docker.
Now I was thinking about to reduce the amount of windows services that I have but not change the microservice architecure.
One alternative is OSGi which seems to be very nice but as I have seen it is not recommend to use spring boot apps with OSGi.
The next alternative I was thinking about was to create my own java "controller app" that then can start/stop the other microservices. So only the "controller app" has to be deployed as a windows service.
Is there a better alternative instead of creating a own "controller app"? Docker would be nice but unfortunately we canĀ“t use it. Or should we maybe try to run our spring boot services with OSGi?

Can i deploy my Java Spring-Boot Application in my Synology NAS?

I have a Spring-Boot Application with REST API (Maven build and MongoDB Database). I will also make a UI with Angular 2 on top of that (npm build).
What i would like to do is, to host this site, with its backend & database on a server. Can i do that on my Synology NAS (DS216j)? Or should i better buy a small computer like Raspberry Pi 3?
I have heard somewhere that we can deploy our apps in Docker, and Synology has a docker app or sth? Will this help me reaching my goal? I would like to have a step by step guide from your similar setups.
As far as I understand, you only want to get your app running on your NAS, so using Docker would be an option, but no requirement.
According to the model-specific download page, your DS216j supports Java8.
So what you have to do:
Install Java on your NAS
Package your application as standalone jar-file: If not yet done, you can do that in your pom.xml (see Spring Boot documentation for details; btw, this standalone mode is one of the best features of Spring Boot)
Now you can upload the jar-file
Run it via the command line with java -jar <jar-file-name>.jar
Just make sure that the port of your app does not conflict with the ports used by your NAS.
You could also create a Docker image from your app and run it on your NAS, it seems like your model supports Docker: https://www.synology.com/en-us/dsm/packages/Docker. But that would create some extra effort, but no added value, from my point of view.

Spring Boot on Android?

Is it possible to run Spring Boot on an Android device?
Right now I am successfully running a web service on localhost using Spring Boot which I've got building in IntelliJ IDEA. I need to get the same web service code running on an Android device. Is it possible to build the web service app into a JAR file that I can get running on an Android phone? I have a Google Nexus 6P running Android Nougat. I've done some limited research, and have found an application called JBED. So far I haven't been able to get this working.
I've started from scratch and built the example JAR:
gs-spring-boot-0.1.0.jar
and hopefully I can find a way to run this JAR. I'm guessing it probably won't work so if anyone has a better idea that would be great!
You can use i-jetty to host servlet based apps in android. or embed i-jetty (replacing tomcat or netty) in your spring boot app
Short answer is you're not gonna be able to directly run your spring boot application on your android phone. Spring boot is meant as a wrapper to quickly bootstrap Spring applications and is going to best serve you when building web based applications. As I see it you have two options.
Deploy your jar on the cloud somewhere(ec2,digitalocean, heroku, cloud foundry, etc.) and just access your Spring MVC app from the android browser. If you have some really complex logic in your boot app that you don't think you can port to android, you can still deploy your boot app in the cloud, and create a really "dumb" front end android application that consumes all of it's data from the spring boot app running externally.
Port you current spring boot application to a true Spring for Android project. http://projects.spring.io/spring-android/. The tools are out there to help you port it over all you have to do is put the work in.
There's an AnLinux app in play store that helps install a Linux distro inside termux.
I was able to install open jdk, spring cli and then run an spring boot project in that.
Here's a video I recorded demoing the same - https://m.youtube.com/watch?v=n9CY2wZPWJ0&t=1s

How do I deploy my Java Application to Azure Cloud Service(not VM or App Service) using a WAR file?

I need to deploy my Java application on Azure Cloud Service. I don't want the extra overhead that comes with managing my own machines using Azure VM, which is an IaaS, nor do I want to use App Service, since the max cores per machine is 4- My application is very compute intensive and I would like to use at least 16 cores per instance, which Azure Cloud Services provides(D5v2 instances).
My build system is Maven and I would like to use something like Codeship to build my .war and deploy it to Azure Cloud services(rather than using the Azure Eclipse SDK to manually Publish to Azure Cloud Services). I've spent hours on the Azure documentation, but haven't found any way of doing this.(Azure App Service has a simple 'upload a war to deploy' model. I dont know why the same isn't there for cloud services: https://azure.microsoft.com/en-in/documentation/articles/web-sites-java-get-started/).
Remember that Cloud Services are the original deployment mechanism for Azure, dating back to 2010 (ok, 2009 if you want to count pre-production days). The .cspkg format is pretty much the same as it ever has been. The Web Apps deployment mechanism is completely different.
Eclipse (on Windows) has a specific plugin available for constructing .cspkg which you can then automate deploying, via PowerShell or CLI.
Alternatively, you can bundle your .war files within a .cspkg generated by Visual Studio, and then get things started within `OnStart(). Again, you can automate deployment from scripts - no need to ever publish directly from within an IDE.
Also: There's nothing stopping you from your automation process pushing .war files to blob storage (or somewhere else) and then sending your app some type of message letting it know to update itself. At that point, there's no redeployment of a .cspkg - rather, it's just downloading a new .war to running web/worker instances and restarting the java process.
#DylanColaco, As #DavidMakogon said, you can install the plugins named azure-tools-for-java for Eclipse or IntelliJ IDEA to deploy your war file as web/worker role instance into cloud service.
And there is an offical tutorial which shows how to getstarted.
As references, you can refer to the article lists and a very helpful vedio at Channel 9 below.
For Eclipse, https://azure.microsoft.com/en-us/documentation/articles/azure-toolkit-for-eclipse/
For IntelliJ, https://azure.microsoft.com/en-us/documentation/articles/azure-toolkit-for-intellij/
Java Applications in Windows Azure Cloud Services using Eclipse

Deploying an Angular app to a Weblogic server

I'm trying to figure out how to deploy an Angular.js app to a Weblogic server and am getting stuck. The goal is to have a Java Servlet running a REST API to communicate with the weblogic server while the Angular app serves up the front-end.
Typically, I used a gulpfile to build my Angular application and bower to manage the dependencies. I can't figure out how to fit the Java Servlet into the build though, and what to do about deploying the app to the weblogic server.
I read that grunt and bower can be used to generate Maven files which would then be installed as artifacts on the local repository, but it isn't making much sense to me. Has anyone done something similar to this before and have advice?
Oops. all right!?
I'm currently having to develop applications in AngularJS to be used in an application server. Specific tasks that the Gulp can provide, I will be flawed if i try to say something as use Grunt (grunt-contrib-war), but on the issues architecture're, i created e install 2 aplications to the weblogic, usually with CrossOrigin defined between them. therefore its development is separated, Service layers and consumption layer.
In a larger scope could consider using:
Service-web
Service-oauth
Service-rs
ApplicationA
ApplicationB
P.S .: Searching in npm to found: https://www.npmjs.com/package/gulp-war

Categories

Resources