Auto-generated by the devscriber command-line tool.
This GitHub repo has code examples from the Distributed Services with Go O'Reilly book by Travis Jeffrey.
After cloning the repo, run the following:
make init
make gencert
make compile
To run the program's API, execute the command below from proglog/cmd/server:
$ go run main.go
POST new records to the log:
$ curl -X POST localhost:8080 -d '{"record": {"value": "TGV0J3MgR28gIzEK"}}'
$ curl -X POST localhost:8080 -d '{"record": {"value": "TGV0J3MgR28gIzIK"}}'
$ curl -X POST localhost:8080 -d '{"record": {"value": "TGV0J3MgR28gIzMK"}}'
GET records from the log:
curl -X GET localhost:8080 -d '{"offset": [RECORD_OFFSET_#]}'
make test
The project's features are as follows:
⭐ Chapter 1: JSON/HTTP commit log service that stores and retrieves records from an in-memory log.
⭐ Chapter 2: Protobuf fundamentals and using them to create a protocol buffer for the Record type.
⭐ Chapter 3: Writing a custom log package
⭐ Chapter 4: Serve Requests w/ gRPC
⭐ Chapter 5: Securing the Service w/ Mutual TLS Authentication
⭐ Chapter 6: Observing the System
⭐ Chapter 7: Adding Service Discovery
⭐ Chapter 8: Implementing Raft
⭐ Chapter 9: Discover Servers and Load Balance from the Client
- Chapter 5 uses
go get
to install the cfssl tools. If this doesn't work, I recommend usingsudo apt install golang-cfssl
andsudo apt install golang-cfssljson
. - Observability - a measure of how well we understand a system's behavior or state based on external outputs.
- Types of Telemetry
- Metrics - measure numeric data over time (counters, histograms, gauges).
- Google's 4 Golden Signals - latency, errors, traffic, saturation (L.E.T.S.).
- Structured logs - descriptions of events that have occurred in a system.
- Traces - details the request lifecycle as it flows through the system.
- Metrics - measure numeric data over time (counters, histograms, gauges).
- Chapter 9: Load balancing strategies
None