This patch adds a Dockerfile for building and running our backend application. Additionally, it refactors our command line flags so that we specify a set of cluster members when starting our backend service. In the future, this will likely be handled by a service discovery server, which will be able to more appropriately accommodate scenarios in which a cluster member fails and re-joins.
changes to command line interface
To start a cluster member, first define a cluster configuration file:
where the keys of the JSON object are the node IDs of the cluster members.
When starting a service, specify the path to that file as well as the node id of the server we're
starting like so:
./server -config foo.json -nodeid 1
building
The Dockerfile (Dockerfile.server) leverages a multi-stage builder pattern that builds our deps, our service, and then copies our final binaries into a runtime image. To build (from the main folder), run:
docker build . -f Dockerfile.server -t owlplace
running
At this point, we have an image that will run our service packaged with its dependencies. To run several of them at one time, we'll use docker compose to define a few services. See docker-compose.yml for an example, and run docker-compose up to start 3 services.
This patch adds a Dockerfile for building and running our backend application. Additionally, it refactors our command line flags so that we specify a set of cluster members when starting our backend service. In the future, this will likely be handled by a service discovery server, which will be able to more appropriately accommodate scenarios in which a cluster member fails and re-joins.
changes to command line interface
To start a cluster member, first define a cluster configuration file:
where the keys of the JSON object are the node IDs of the cluster members.
When starting a service, specify the path to that file as well as the node id of the server we're starting like so:
building
The Dockerfile (
Dockerfile.server
) leverages a multi-stage builder pattern that builds our deps, our service, and then copies our final binaries into a runtime image. To build (from the main folder), run:running
At this point, we have an image that will run our service packaged with its dependencies. To run several of them at one time, we'll use docker compose to define a few services. See
docker-compose.yml
for an example, and rundocker-compose up
to start 3 services.