Deploy Spring War locally - spring

How can I deploy my Spring Boot microservice on my ubuntu server, so that only the localhost can access it.
For example I got a user-service : localhost:8888.
I dont want to this to be accessible globaly. Only the localhost should be able to do that.
Thanks for your help

If you set server.address to localhost then your app is not accessible from outside.
Set the following in the application.properties
server.address=127.0.0.1

Related

Pivotal Cloud Foundry - Deployed Spring Boot App failed to run because of java netsocket(port) permission denied

so, i tried to deploy spring boot app to a PCF Server. When i deployed it, the logs showed that my application was shut down because it failed to open a tomcat server because there is a java.netsocketexception where it says that permission denied. The tomcat server was fine for a moment (it successfully use the port) but the next moment, it was shut down because there is the permission denied netsocketexception.
the port i tried to use is port 443. i tried to look up to several kinds of problems. one of it said that i need to have root access to be able to use port lower than 1000. the problem is, my other apps, which is eureka server run perfectly even when i use port 443.
the configuration, build-pack, and everything is the same. and it is even deployed on a same pcf platform. so, why can this app failed but the other (eureka server) can use the 443 port.
can anyone tell me for the things i need to check to make sure of the problem?
Remove server.port configuration from Spring Boot yml / properties configuration. It will by default expose the service to 443 on PCF

App deployed on PCF trying to find config at localhost:8888 even when the cloud foundry provided config server is binded with app

How do we make use of Spring Cloud Services like Config Services/ Hystrix at PCF? I have one app deployed on PCF and i am trying to bind a Config server service from CF marketplace to it. But when i start the app it tries to connect localhost:8888. Any Idea what can be done?
manifest.yml
---
applications:
- name: demo
memory: 4096M
host: demo
domain: apps.pcf.devfg.***.com
services:
- ps-config-server-pcf
Ensure that you have these two Libraries in your build.gradle and the bind your App to the Marketplace service
io.pivotal.spring.cloud:spring-cloud-services-starter-config-client
org.springframework.cloud:spring-cloud-config-server
Also, remove all your local configurations from your bootstrap.yml (however PCF will over ride your values, this is a good practice to do)

Eureka client not able to register with eureka server when deployed on external tomcat

Tried to deploy spring boot eureka server as war on external tomcat and tried to register eureka client to server but getting registration status 404. Hope someone might be success with this approach. Please share your thoughts on this.
seems like it's because of the context path tomcat gives to your eureka server app. are you sure you deploy your war file on context root of tomcat?

Modify spring cloud config server in the client

I have a spring boot powered spring cloud application with a configuration server running seperately on port say 8001 on localhost.
Meanwhile, location has been specified in the config client applications/micro services as below in the bootstrap.yml file of the client project.
spring:
cloud:
config:
uri: http://localhost:8001
This works absolutely fine.
However when i want to deploy the whole application on different setups, i would need to run the config server on different IPs and Ports.
In that case i can not go and change the IP:Port information of the config server in all the projects, rebuild the jar and deploy them. In fact in most scenarios, Jenkins build the Jars by itself on different environment.
How can we handle such situation? Can we specify an environment variable in the bootstrap.yml, if yes how to do it?
Any suggestion?
Br,
AJ
You can definitely use environment variables in your bootstrap.yml file:
spring:
cloud:
config:
uri: http://${configServerHost}:${configServerPort}
When you launch your application you only have to add -DconfigServerHost=localhost -DconfigServerPort=8001

How to access spring application deployed in openshift's tomcat?

I have created a simple spring boot application and deployed it to openshift redhat (as Tomcat 7 application) through my OpenShift explorer from my Eclipse SDE.
When I tried to access from my openshift domain url, It showing status 404 but same application is working fine in my local.
My local url:
http://localhost:8082/TestApp/testme.do
My openshift url:
http://test-{mydomain}.rhcloud.com/TestApp/testme.do
Is there any specific way to access the openshift application url?
Thanks in advance for those giving assistance, Please let me know if you need additional details.
Regards,
Dhana.

Resources