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.
Related
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)
I have created a spring boot application which i want to deploy with digital ocean servers, please can anyone guide me.
Any help will be appreciated.
The easiest way to run java application in the cloud using Digital Ocean:
First, create executable jar/war file.
Second, move generated file (jar/war) file to remote server (droplet).
Third, make sure the right version of java is installed (which java). If not install it.
Fourth, run your jar as a detached process.
The better way is to package your application inside of docker container and deploy it in the orchestrated environment.
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.
I create maven project with dependencies. Than write simple jetty server which return html page on request. Simple "Hello World" application. Now i want relocate it on jelastic cloud, but can't understand how.
When creating cloud on jelastic you can add jetty server, but i need run my own. Maybe i need connect my servlets or another things. Or maybe i can run server.jar file which assembled by maven.
My google traveling failed. I even not imagine what i must search. Pls help me.
Indeed, you can't up your own servers on the native containers. Moreover, such containers don't provide the root access for a customer.
If you want to run your own server you can use either VPS or Docker solution in Jelastic Cloud.
I'm trying to create a web project that is able to communicate with Amazon RDS. I know how to make a localhost project connect to a RDS with JDBC.
However, the problem is that I never tried to deploy my project (so that, for example someone can type somePage.com, and go to my webpage).
I have an Amazon EC2 instance, and I've already written a simple hello world jsp page. I am able to compile it and run the Eclipse Web Dynamic Project using the installed Apache Tomcat Server, and then typing localhost:8080/somePage then I can see my hello world popping up.
However, how do I deploy my project on this EC2 instance? I'm using Windows Server 2012 edition.
My whole idea is that once I have one AMI image all setup, then I can just use autoscale to scale my webpage with that AMI image.
Can anyone point me to the right direction?
Follow the steps below:
Setup Apache Tomcat on your Amazon EC2 instance.
Usually all you have to do is download the current version, unzip it, and start it by running apache-tomcat-folder\bin\startup.bat. (You can also donwload an installer and set it up as windows service. Check this link for more details).
Make sure you test it before continuing (open its address on a browser, something like http://yourinstaceaddress.com:8080/).
Export your web application .war file
In Eclipse, right click on a Web project and select Export. Then select WAR file in the Export window and then select Next. Choose the project, the .war file name and folder to export. More detailed explanation can be found here and here (with pictures).
Deploy the .war file to your Tomcat Server
The, by far, simplest way to do this is to place your .war (say myapp.war) file in your apache-tomcat-folder\webapps\ folder.
There are other ways, like via Tomcat Manager. But they can be tricky and, as a new user, you should avoid them. (Don't worry: the simple method is ok for production deployment).
Test your web app
Visit the url: say your .war's name was myapp.war. You should visit http://yourinstaceaddress.com:8080/myapp
That's it. If you ever edit the app, repeat steps 2-4 (but delete the webapps\myapp\ folder created before executing step 3).
Boxfuse does exactly what you want.
For you Java web application you literally only have to execute:
boxfuse create my-tomcat-app -apptype=load-balanced
boxfuse scale my-tomcat-app -capacity=1-16:t2-micro:cpu25-75
boxfuse run my-tomcat-app-1.0.war -env=prod
This will
Configure your application to use an ELB
Set it to autoscale between 1 and 16 t2.micro instances based on CPU usage (scale in at 25% and below, scale out at 75% and above)
Create AMI containg Tomcat and your application ready to boot
Create an ELB
Create a security group with the correct ports
Create an auto-scaling group
Launch your instance(s)
Any subsequent update will be done as a zero downtime blue/green deployment.
For your domain, you can simply map your samepage.com DNS record to the CNAME of the ELB.
More info: https://boxfuse.com/blog/auto-scaling