The application server

Copy the old application server folder from Chapter 3Service Decomposition, to a new folder and we will change our main handler code ( index.js )  since we have to accommodate the fact that we will not be the only instance reading from and writing to the database anymore.

As always, all code can also be found at https://github.com/sgnn7/deploying_with_docker. This particular implementation can be found in chapter_4/clustered_application.
Warning! As you start thinking about similar containers running in parallel, you have to start being extra careful about data changes that can and will occur outside of the container's realm of control. For this reason, keeping or caching the state in any form in a running container is usually a recipe for disaster and data inconsistencies. To avoid this issue, in general, you should try to make sure that you re-read the information from your upstream sources (that is, the database) before doing any transformation or passing of the data like we do here.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset