From ab525fa3c3f053d835c8fe39ea6d453cc63b54bf Mon Sep 17 00:00:00 2001 From: chexxor Date: Wed, 22 Mar 2017 13:13:45 -0500 Subject: [PATCH] Apply changes requested by review. --- src/applications/inter-app-communication.md | 43 +-------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/src/applications/inter-app-communication.md b/src/applications/inter-app-communication.md index 299da4a7..b5af7ed5 100644 --- a/src/applications/inter-app-communication.md +++ b/src/applications/inter-app-communication.md @@ -1,46 +1,7 @@ ## Inter-app Communication +A common architecture pattern of multi-process applications is to have one process serve public requests while having multiple other processes supporting the public one to, for example, perform actions on a schedule or process work items from a queue. To implement this system of apps in Deis Workflow, set up the apps to communicate using DNS resolution, as shown above, and hide the supporting processes from public view by removing them from the Deis Workflow router. See [Deis Blog: Private Applications on Workflow](https://deis.com/blog/2016/private-applications-on-deis-workflow/) for more details, which walks through an example of removing an app from the router. + ### DNS Service Discovery Deis Workflow supports deploying a single app composed of a system of processes. Each Deis Workflow app communicates on a single port, so communicating with another Workflow app means finding that app's address and port. All Workflow apps are mapped to port 80 externally, so finding its IP address is the only challenge. Workflow creates a [Kubernetes Service](https://kubernetes.io/docs/user-guide/services/) for each app, which effectively assigns a name and one cluster-internal IP address to an app. The DNS service running in the cluster adds and removes DNS records which point from the app name to its IP address as services are added and removed. Deis Workflow apps, then, can simply send requests to the domain name given to the service, which is "app-name.app-namespace". - -For example, if you deployed a Deis Workflow app like this: - - $ deis create http-server --no-remote - $ deis pull deis/example-dockerfile-python:latest -a http-server - -You can deploy a second app and communicate with the first one: - - $ deis create http-client --no-remote - $ # Need to set a port because the docker image doesn't use one. - $ deis config:set PORT=8080 -a http-client - $ deis config:set HOSTNAME=http-server.http-server - $ deis pull -a http-client willfarrell/ping:latest - $ deis logs -a http-client - ... - --- http-server.http-server ping statistics --- - 1 packets transmitted, 0 packets received, 100% packet loss - ping http-server.http-server every 300 sec - PING http-server.http-server (10.71.241.103): 56 data bytes - - $ # While the ping failed, it successfully resolved - $ # "http-server.http-server" to "10.71.241.103" - -Clean up: - - $ deis destroy -a http-server --confirm=http-server - $ deis destroy -a http-client --confirm=http-client - - -### Environment Variable Service Discovery - -It's useful to note that Kubernetes also supports [environment variable service discovery](https://kubernetes.io/docs/user-guide/services/#environment-variables), which works by adding environment variables to an app's environment to provide a reference to other services in the app's namespace. This method is currently not supported by Deis Workflow because Workflow creates a separate namespace for each app it deploys. - -### Related Topics - -A common architecture pattern of multi-process applications is to have one process serve public requests while having multiple other processes supporting the public one to, for example, perform actions on a schedule or process work items from a queue. To implement this system of apps in Deis Workflow, set up the apps to communicate using DNS resolution, as shown above, and hide the supporting processes from public view by removing them from the Deis Workflow router. - - deis routing:disable -a supporting-scheduled-app - deis routing:disable -a supporting-queue-worker-app - -The [Deis Blog: Private Applications on Workflow](https://deis.com/blog/2016/private-applications-on-deis-workflow/) provides more details by walking through an example of this.