Chapter 5. Writing Applications to Run on DC/OS
In this chapter, we look at important things that you need to know before you begin to design and write applications to run on DC/OS. In particular, I will address two questions:
How do your applications communicate with one another and with services provided by packages? (Service Discovery)
Where and how is data stored in DC/OS? (Persistence)
The answers to these two questions allow you to create applications from interdependent services running on DC/OS. In the final part of this chapter, I describe the structure of an example system consisting of multiple applications and services running on DC/OS.
Service Discovery in DC/OS
Service discovery is a mechanism that applications can use to dynamically discover the location and address of services that they want to communicate with at runtime. Service discovery replaces static configuration, which is a typical part of many multicomponent systems. In this situation, we are principally concerned with service discovery for applications running within DC/OS.
What Is Service Discovery?
An example of a service discovery mechanism that most people are familiar with is DNS (specifically DNS A Records). DNS is a mechanism for looking up the specific IP address of a machine that provides a particular service for accomplishing the following:
Identifying the specific address of the server, because the service might change over time.
It is useful to reference the desired service (i.e., the ...