Linking Tomcat to MYSQL on Openshift - java

I've a java web application running on openshift 3 online.
I'm rather new to this platform and not familiar to the usage of service and pods.
So currently i have 2 containers running.
A. Web app
B. MYSQL
I've created environment variables to supply the MYSQL username,password,port and ip-address to the container A running the web application. However, it seem like when openshift creates a new pod, the ip-address changes. Is there any other way i could link the two container so that i don't have to rely on the ip-address?

Each service has a name/domain name. You should use their name to specify their location, rather than the IP address. Internally, the name will be resolved to the IP address.
You can find the name in the service details in the web console.

Related

How to change the localhost:8080 to www.myWebApp.com?

Every time I access my spring boot application I type localhost:8080.
I want to access the application by typing www.MyApp.com. It is an in-house application so it is not going to be live on the Web. The application is using spring boot embedded. Is there a way to change it?
This is more related to operating system's host configurations.
https://www.webhosting.uk.com/kb/how-to-update-hosts-file-entry-on-windows-ubuntu-and-mac/
About the adding port number in host file
refer: Using port number in Windows host file

Multiple databases connection in one web application - java

I'm hosting a web application on Amazon web services on two different elastic beanstalk environments (i.e. two different RDS instances) one for test and another for production. each time I deploy the application I need to change the connection URL according to the environment.
Is there anything I can do to automate this process? a condition for checking the environment and connecting using the right URL or something?
You should be using Elastic Beanstalk environment variables to store the database connection URL, and any other environment specific settings. Your code would simply pull the value out of the environment variable, instead of having to do some sort of check.

How to have Azure App Service Tomcat to forward all 80/443 traffic to JBoss running on the same App Service

First of all, my Azure subscription is through a Cloud Service Provider, so I don't have access to certain features (i.e. cannot install a marketplace tomcat, only the native one; with the native Tomcat I do not have access to server.xml, which I need for some traffic rerouting solutions - modifying Connectors).
The basic need is to have IBM's B2B Client app running and sending files back and forth. It comes with its own JBoss, and all you do is put the app in a directory on Azure App Service and run the executable. This is already not a problem, and I have it starting with the app service using a WebJob.
Problem:
App Service only has two inbound ports open - 80 and 443, and they are both being used by Tomcat.
So I need to either:
1) Disable Tomcat, and only have JBoss running and listening on those ports without conflicts;
or
2) Have native Tomcat forward traffic to JBoss.
How can I do either of those in this environment, and are there better solutions for this problem?
According to the subsection Network endpoint listening of the wiki page Azure Web App sandbox of Kudu for Azure App Services, you couldn't use the other ports on Azure App Service besides 80 & 443 to access the application server from the internet. So if you can't create a JBoss AS instance from Azure Marketplace, per my experience, I think the only way is that creating an Azure VM instance to install a JBoss AS instance to deploy your specified Java Application.
Hope it helps. Any concern, please feel free to let me know.

Setup web service using Amazon AWS and tomcat

I am pretty new to Amazon AWS technologies, and I have been going through all their documentation. My goal is to create a new web service for a use case (preferably REST) using Tomcat.
I want to use this service in multiple clients like Android, Iphone, Tablet, Web etc.
Some of the examples I want to support are like -
GET http://myservice.com/user/{userid}
PUT http://myservice.com/user/{user-data}
Does AWS or any other cloud service providers provide anything out of the box for deploying such services with minimal code changes?
With AWS, you create a virtual server, customize it, and then use it. When you create a server, you pick your operating system and the size of the server you need. Once it is running, you can login and customize it.
For example, you might start a linux server using the Amazon Linux AMI (amazon machine image). You can use yum to install tomcat. You can drop your war file into the tomcat webapps directory.
Set up access in the security group (firewall) to allow your clients to access the relevant port(s).
Bottom line is that the process is basically the same as if you are doing this on a new server of your own.

WildFly/JBoss server group deployment understanding

According to JBoss documentation:
In managed domain deployments are associated with a server group.
Deployments will be provided to any server that belongs to a
particular group.
...the multiple servers in common server group become the single one virtually.
But how does JBoss choose the target actual server for deployment?
For example, i have two different vps servers with JBoss running, which are combined to the single main-server-group. Then which vps server will actually host the application by following command?
[domain#localhost:9999 /] deploy ~/Desktop/test-application.war --server-group=main-server-group
'test-application.war' deployed successfully
The application will be deployed to both servers.
If you were to go to http://server1:8080/MyApp you should see the same as if you went to http://server2:8080/MyApp
The reason for this is that you would normally have a web server or proxy to load balance between the two servers. If you want to have two separate servers which don't have the apps deployed to each, then put them in different server groups or, a better solution would be to run JBoss in standalone mode, rather than domain mode.

Categories

Resources