I have two spring boot applications with shared database. Locally everything works perfect, I can run war files (tomcat is embedded) on ports 8080 and 8081.
Question is, how I can run it on AWS?
I know, there are a lot of possibilities, but I am really a beginner and have no experience. I just tried to run it on AWS as it is (as .war files) and open ports... this is working of course. But this is not secure for PROD. Another issue, I cannot serve it as HTTPS.
My imagine is described in the picture. Probably there should be some splitter (marked as ???X1) in the front and some container for the applications (???Y1).
Please, could somebody help me here? What is the best/simplest/the most secure/best performance solution.
Q2: I am not sure, whether I should use embedded tomcats for war applications.
Thank you in advance
picture of architecture
Launch your both apps on one Ec2 Instance( WebServer Instance) , use different ports (80,81), Launch this Ec2 instance in Public Subnet.
Launch another Instance for your Database and keep that instance in Private Subnet.
this Database instance will be accessed by only Public subnet's Instance ( WebServer Instance)..
keeping Database Instance in Private Subnet will make it secure as no one can access it other than your own webserver.
OR
Use Amazon RDS for your Database, which is managed service and secure one.
The "splitter" thing in your image would be an Application Load Balancer on AWS. And you can create free SSL certificates in AWS ACM that can be attached to the Application Load Balancer.
Related
I have two separate spring boot projects that share one database (MySQL).
Is there a way I can host these two applications on a VPS and make them share the same database the way I make them share it on a local server?
Thank you
MySQL supports multiple client connections. Assuming your 2 apps and MySQL are running ok locally, they should all work the same if deployed to the same VPS. If you are deploying across multiple VPS instances then you would need to consider configuring network routes between the instances and firewall rules to allow traffic to flow between them.
I have coded a Spring MVC Hibernate application with RabbitMQ as a messaging server & a MySQL DB. I have also used Hazelcast an in-memory distributed cache to centralize the state of the application, moving the local tomcat session to a centralized session & implementing distributed locks.
The app right now is hosted on a single tomcat server in my local system.
I want to test my application on a multiple JVM node environment i'e app running on multiple tomcat servers.
What would be the best approach to test the app.
Few things that come to my mind
A. Install & configure a load balancer & set up a tomcat cluster in my local system. This I believe is a tedious task & requires much effort.
B. Host the application on a PAAS like OpenShift, cloudfoundry but I am not sure if I will be able to test my application on several nodes.
C. Any other way to simulate a clustered environment on my local windows system?
I would suggest first you should understand your application requirement. For the real production/live environment, are you going to use Infrastructure as a service or PAAS.
If Infrastructure as a service then
I would suggest create local cluster environment and use the tomcat and spring application sticky session concept. Persist the session in Hazelcast or redis server installed on different node. Configure load balancer for multiple nodes having tomcat server. 2-3 VMs for testing purpose would be suitable.
If requirement is PAAS then
Don't think about local environment. Test directly on OpenShift or AWS free account and trust me you would be able to test on PAAS if all setup is fine.
I am developing a spring boot application.
Since spring boot created a .jar file for an application.
I want to cluster this particular application on different server. Lets say I build a jar file and ran a project then it should run in cluster mode from number of defined servers and should be able to serve end user needs.
My jar will reside on only one server but it will be clustered across number of servers. When end user calls a web service from my spring boot app he never know from where it is getting called.
The reason behind clustering is suppose any of the server goes down in future, end user will still be able to access web services from another server. But I don't know how to make it clustered.
Can any one please give me insight on this ?
If you want to have it clustered, you just run your Spring Boot application on multiple servers (of course, the JAR must be present on those servers, otherwise you can't run it). You would then place a loadbalancer in front of the application servers to distribute the load.
If all services you are going to expose are stateless so you only need to use load balancer in front of your nodes for ex. apache or nginx, if your services are stateful "store any state [session, store data in db]" so you have to use distributed cache or in memory data grid:
for session you can use spring-session project which could used rails to store sessions.
for store data in DB you need to cluster DB it self and can use distributed cache above your DB layer like Hazelcast.
Look into spring cloud, they have used some netflix open software along with amazons to create 12 factor apps for micro services.
Ideally you would need a load balancer, service registry that can help you achieve multiple instances of spring boot. I believe you have to add a dependency called eureka.
Check the below link
Spring cloud
You can deploy it in cloud foundry and use autoscale function to increase your application instances.
I am sure this question has been asked and answered before multiple times. But unfortunately, I am still not clear. Here is my issue.
I have a JSP, Servlet application which uses MySQL as the database. I have built the WAR file as well. Now I am in need of deploying this so it can be accessed online by anyone.
I looked into lot of areas including normal web hosting. However even though the services like DailyReazor are highly secured, they provide little for MySQL, around 250 MB for the package I selected.
Now I am looking into Amazon AWS. In AWS I am expecting to deploy my aplication and make it available online.The MySQL server should not contain limits like 250MB.
But I have never ever used this service AWS before. By reading various posts, I know that Elastic Beanstalk is the easiest way to go, but still not convinced about how to deploy it properly with database access and all. And in the other hand, will they give me a web address like "www.example.com" or will they simply provide an IP address?? I am also familiar with tomcat so I need to use it.
We will not upload files (images etc) at the moment, so I believe we can manage with around 20$ per month?
I really appreciate if someone can provide a clear guidance on deploying java web applications in Amazon, with the requirements I mentioned about MySQL, Global access and so on.
Amazon RDS for MySQL is a Database-as-a-service offerring from AWS. It is scaleable up to 3TB, and has scaleable IO as well. Of course it also depends on how much you prepared to pay. they manage the DB for you (backup etc). You get a URL to connect, credentials and you are set to go.
Amazon Elastic Beanstalk uses Tomcat. So you should be familiar with that. You upload your WAR file and specify what EC2 flavor you want (CPU/MEM etc). They launch a VM that is configured with Jva and Tomcat and deploy the WAR for you. You get an IP address.
Amazon Route 53 is the DNS service, where you can assign the IP address to your domain (assuming you have one)
I'm currently having 2 Weblogic admin servers in 2 different domains created on the same machine.
I want to convert one of the admin server to a managed server and then use them together to deploy a Java application. Is this feasible? If yes, how?
I'm currently using Weblogic Server 10.3.
PS: I'm quite new to Weblogic domain creation and administration. Please revert for any more details needed.
The simple answer is no, however, adding a managed server to a domain is extremely simple. See the documentation here. When deploying your application you'll need to target both servers or create a cluster (also very easy), add both machines to it and give the cluster name as the target.
Note, it is generally not concidered best practice to target applications to the Admin server (although it's fine when you're developing on your local machine). If you have the resources available on your environment, you could create two managed servers and put them in a cluster. Depending on the configuration of your Admin server, you may be able to reduce it's size if memory is tight.