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

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.

Related

How to deploy an application [Looking for advice]

First, I don't know anything about deployment.
Here is my application :
I got a rest API backend using Spring Boot with a MongoDB using MongoLab. My frontend is built using React (webpack, cypress).
I have this full application on gitlab in the same repo, with different folders (ie backend, frontend).
Where can I deploy this application? I guess I need to deploy separately those services. If you guys have any advice and give me some tutorials I could follow. What URL can I use like api.example.xx for back and example.xx for the front ?
Any advice is appreciated.
Thank you
Your question is too broad to get a summarised answer. I will give you a few hints that you can expand on.
For starters, since you do not know so much about deployment, I will recommend that you learn with a single machine than with multiple IP addresses. (no Docker, Kubernetes etc. just your applications on different ports)
NOTE: below are the tools you will need to familiarise your self with before this attempt.
linux terminal / GitBash for windows
SSH (communication with your server)
Git (repository managament and versioning)
Github / Bitbucket
Hosting services
Below are a few providers you can use to get you up and running although there are a turn other providers.
Linode hosting services - paid
Amazon Web services - paid/free
Netlify - paid/free
Heroku - free
All these provide you with either a terminal or GUI to deploy/maintain your applications.
Deployment
First, you will need to install all your application dependencies on the server of your choice. i.e. Databases (Mongo for your case) and other applications that support your app. (The same way you did on your local machine)
making sure that your project has the right configurations(passwords, reference URLs, etc.)
See here on How to deploy your spring-boot application
In the meantime, you can try hosting your ReactApp on Netlify and see how it works
As you said you already have it in Gitlab right,And if you want an easy solution and a way out of deploying world then you might want to consider using netlify
it makes deploying as easy as eating a piece of cake, just
Signup
Click on "New site from Git" Button
Select Gitlab in your case
Select the project you want to deploy and for netlify to install
It automatically detects build command and that's all, waits for your permission to build.
Once build is completed you can preview your application(there is a button for that in right corner) and then confirm your deployment.
*Plus it automatically deploys the changes in your git i.e pull requests,
you can choose whatever name you want your website to be(but should be available)

How to deploy spring boot application into it self

I have a spring boot application that running on embedded tomcat with java -jar app.jar on a server away from my work office, and I haven't any ssh or other access to that server.
So when I want to install and run newer version of application, I should go to the server place, physically connect to server and then install and run newer version.
Is there a way to run newer version of application without going to the server place? for example, upload newer jar file into my running application, and itself update it.
NOTE
I don't have any access to server and cannot use and run any continous delivery tools like jenkins or other, because of IP and port restrictions.
I did something like this a while back which worked out pretty well.
So you could create a super small app on the server(so small that it "never" needs to be updated) and have that monitor the versions and when a new version is available it could stop the real process and restart it with the new jar file.
I unfortunately don't have the code for that starter app, but it shouldn't take that long to write one that suits your needs
Why don't you install a Tomcat to the server and use it's management GUI to deploy the newer version of the app? It is a very old fashion but works well.
The only thing you will need to modify in your source code is to replace the packaging from jar to war in the pom.xml, so you can deploy it via Tomcat Manager.
This how the manager GUI looks like:
You can learn more about the Tomcat Manager here.

How to ship java based web application in AWS cloud using docker

We have build java web application which provides various REST API.. I would like to have painless deployment progress.. Here is desired scene..
Users -> Load Balancer -> AS1, AS2, AS3 ...
Here AS = Application Server (Tomcat on EC2) OR Docker instances (I will prefer docker instances)
First time Desired Flow:
Developer fires maven and builds .war file
We may develop script which will generate docker image using this .war file..
Executes steps which will float this dockers behind ELB
Redeployment:
Developer fires maven and builds .war file
We may develop script which will generate docker image using this .war file..
Executes steps which will float this dockers behind ELB and destroy previous one..
I am kind of new to DevOps and may be doing some mistake in above steps. So please feel free to correct me and provide guidance to achieve this goal.
(If this is duplicate please provide link to related question)
Thanks in advance.

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

Running netty application in Amazon Elasticbeanstalk

I have a regular netty application server that runs on port 44080 and is built as a .jar file. I would like to use elastic beanstalk to manage the lifecycle of the application. Is there a way I can deploy the jar or something similar using elastic beanstalk?
It seems netty is currently not supported by elastic beanstalk. If your application can also run on Tomcat, you could do that - with Tomcat, you just need to enter some basic settings in the webinterface and you´ll get a fully working environment where you can upload jar files to.
If you need netty as a platform, you could try using Amazon OpsWorks. I never worked with it myself, but I know you can create your own "environment configurations" there. You´d basically create a few scripts to setup your server and deploy your application and OpsWorks lets you execute those through the web ui and also provides capabilites for auto-scaling, failover, etc. in OpsWorks environments.
There's nothing wrong about using Netty. In fact, one of our archetypes for AWS Elastic Beanstalk contains support for Dropwizard (by using Docker as its stack), thus not being dependent on a Java Web Container.
$ mvn archetype:generate -Dfilter=elasticbeanstalk-docker-dropwizard
It might need a few tweaks, but the overall idea is to package all your dependencies into a zip file and deploy it. Also, make sure your Dockerfile EXPOSEs port 44080.

Categories

Resources