Beyond the Twelve-Factor App
beyond_the_12-factor_app_pivotal
beyond_the_12-factor_app_pivotal
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
CHAPTER 11<br />
Port Binding<br />
<strong>Factor</strong> 7 states that cloud-native applications export services via port<br />
binding.<br />
Avoiding Container-Determined Ports<br />
Web applications, especially those already running within an enterprise,<br />
are often executed within some kind of server container. The<br />
Java world is full of containers like Tomcat, JBoss, Liberty, and Web‐<br />
Sphere. O<strong>the</strong>r web applications might run inside o<strong>the</strong>r containers,<br />
like Microsoft Internet Information Server (IIS).<br />
In a noncloud environment, web applications are deployed to <strong>the</strong>se<br />
containers, and <strong>the</strong> container is <strong>the</strong>n responsible for assigning ports<br />
for applications when <strong>the</strong>y start up.<br />
One extremely common pattern in an enterprise that manages its<br />
own web servers is to host a number of applications in <strong>the</strong> same<br />
container, separating applications by port number (or URL hierarchy)<br />
and <strong>the</strong>n using DNS to provide a user-friendly facade around<br />
that server. For example, you might have a (virtual or physical) host<br />
called appserver, and a number of apps that have been assigned<br />
ports 8080 through 8090. Ra<strong>the</strong>r than making users remember port<br />
numbers, DNS is used to associate a host name like app1 with app<br />
server:8080, app2 with appserver:8081, and so on.<br />
37