A project for learning about microservices observability.
- Centralized Logging
- Distributed Tracing
- Docker Compose v1.23.2
- OSX or GNU/Linux
-
Clone this repo and open the root folder in an IDE like Visual Studio Code.
-
For each microservice, rename
example.env
to.env
and supply the needed secrets.TODO: Eliminate this friction.
-
Start all microservices in development mode.
docker-compose -f docker-compose.dev.yml \ up -d --build
In Development Mode
- You can attach a remote debugger to a running service Docker for seemless debugging like placing breakpoints and watching variables.
- Changes to source files will automatically restart the corresponding docker service.
-
Optionally, attach the IDE's debugger to a service as follows in Visual Studio Code: shift+cmd+D > Select a debug configuration > F5.
All vscode debug configurations are stored in .vscode/launch.json. You can modify configs as you see fit.
-
Visit http://localhost:16686 to view traces.
# list all running services
docker-compose -f docker-compose.dev.yml ps
# stop all services
docker-compose -f docker-compose.dev.yml down
# restart all [or specific] service
docker-compose -f docker-compose.dev.yml \
up -d --no-deps --build [service-name]
# tail logs from all [or specific] service
docker-compose -f docker-compose.dev.yml \
logs -f [service-name]
# see how an image was built
docker history <image-name>
Read this article for more details.
Read this article for more details.
-
Research jaeger-operator
-
Name Duplication: The value of the
API_SERVER_ADDRESS
variable in user-simulator/.env depends on the service nameapi-server
specified in docker-compose.yml. If we rename the service, we must also change the variable. Is there a way to make this DRY? -
In the log-shipper container, I had to install a logz.io-specific plugin. Can't this step be eliminated since fluentd is capable of connecting to https endpoints without plugins?
-
Use sub-second precision for fluentd timestamps (probably best to use nanoseconds.)
- You can pass secrets for a microservice using the
env_file
attribute in docker-compose.yml. - Microservices can communicate using their service names if they are in the same docker network.
By default each containerized process runs in an isolated network namespace. For inter-container communication, place them in the same network namespace.