Preparing application backends
To create a load balanced application, we must first prepare the application where it is served by several replicas in our Docker Swarm service. In the following steps, we will deploy an application that is scaled in our Docker Swarm cluster:
- First, we will provision additional nodes in our Docker Swarm cluster. This is to make sure we have enough capacity in our cluster to scale out our application later. In the following output, we can see that we have four nodes available:
dockerhost$ docker node ls ID HOSTNAME STATUS AVAILA... MANAGER... ENGINE VERSION 9tcxzq45 * dockerhost Ready Active Leader 18.09.3 thxcn7ev node-5lfg Ready Active 18.09.0 7lyr93qf node-ftc0 Ready Active 18.09.0 oydrnufp node-hqvv Ready Active 18.09.0
- Next, we will prepare a simple Node.js application in a file called
app.js
. The following app logs additional information related on how our application is...