Chapter 6. Web stack application example

 

This chapter covers

  • Deploying a multitier web application to a CoreOS cluster
  • Applying autodiscovery systems in application logic and service unit files
  • Testing failover of discrete layers

In this chapter, you’ll begin fleshing out a full application stack on CoreOS. This isn’t an application development book, so the example is a bit contrived, but it’s similar to any complex stack you might see that contains a number of different services with different purposes. This example will develop the information you’ve already learned about CoreOS into a more real-world scenario. The application you’ll build and deploy will be iterated on throughout the rest of the book, just as you’d expect in the real world.

6.1. Scope of the example

This example will cover the setup of a full-stack web application with the following components:

  • Node.js back end (app.js) running
  • Express HTTP server
  • Socket.IO WebSocket server
  • Node.js worker process for data acquisition (worker.js)
  • Memcached for the express-session store
  • Couchbase as the persistent database
  • React for front-end view composition

By the end of this chapter, your infrastructure on CoreOS will look like figure 6.1. You’ll have an instance of your web application (app.js) and a memcached service running on all three machines, as well as one Couchbase instance and one instance of your data-acquisition program (worker.js).

Figure 6.1. Infrastructure of the example

6.2. Setting up persistence layers

6.3. Application layer

6.4. Where to from here?

6.5. Summary