当前位置: 动力学知识库 > 问答 > 编程问答 >

ibm bluemix - Create private instance on Cloud Foundry

问题描述:

I'm currently deploying on cloud foundry, Now I have a frontend server and a backend server.

Both deployed as micro services with the Cloud Foundry nodejs build pack.

I would like to hide the backend server from the outside world, that only my frontend server can access it. How do I do that?

If I remove the route to the backend server the server is hidden from the outside but then I do not know how to access it from my frontend.

I'm new to Cloud Foundry maybe there is an easy way.

Thanks

Andreas

Thanks for the information so far.

I do however not understand how I could now hide my backend instance from being accessed from the outside, but allow for access of the frontrontend?

Basically what roule would I need to set in my space in order to allow only port 80 to be accessed of my frontend instance (lets say the frontend ip is 168.192.0.5).

could you make an example?

网友答案:

If you are using OSS Cloud Foundry, you can put the backend services into their own space, and then set the security group rules for that space so that they will not respond to outside IP addresses: https://docs.pivotal.io/pivotalcf/adminguide/app-sec-groups.html

If you are using Pivotal Cloud Foundry, you can use Spring Cloud Service Discovery, as Amit said.

网友答案:

What about using "cf push myjavaapp --no-route"? The no-route option tell Bluemix that your backend is not a web application.

网友答案:

Another solution to hide the back-end microservice from the public is to use containers (also available on Bluemix, based on Docker, see https://www.ng.bluemix.net/docs/containers/container_gettingstarted.html). Containers have a private IP by default and can access other containers in the same space. You can assign the front-end microservice a public IP using e.g. following command

cf ic ip bind {public_ip} {container_name}

but don't assign a public address to your back-end microservices.

(A few weeks ago I've created a simple example for a microservice in a container, you can find the code at https://hub.jazz.net/project/matthiashub/bluemix-unistuttgart-container/overview I admit that this was done in Java and not in nodejs but I think you get the idea.)

分享给朋友:
您可能感兴趣的文章:
随机阅读: