mirror of
https://github.com/tiennm99/docker-images.git
synced 2026-10-20 02:17:24 +00:00
refactor(scribe): normalize ASCII formatting
Remove decorative Unicode banner comments, replace em-dashes with hyphens across Dockerfile, configs, docs, and one Go log string, alphabetize the builder-stage yum package list, and drop the non-standard description/version LABELs from the runtime stage.
This commit is contained in:
1 parent
ff5e5f6a42
commit
afaa631c94
7 files changed
+35
-57
No files matched your search
@@ -7,7 +7,7 @@ A one-command demo that proves the Scribe config actually writes logs.
|
||||
Thrift, pushes a few messages, and exits. The resulting log files appear on your host under
|
||||
[`./logs`](./logs).
|
||||
|
||||
> Scribe is receive-only — it writes **nothing** until a client sends it messages. The Go
|
||||
> Scribe is receive-only - it writes **nothing** until a client sends it messages. The Go
|
||||
> sender is what makes this example produce log files.
|
||||
|
||||
---
|
||||
@@ -38,7 +38,7 @@ ls logs/example/
|
||||
cat logs/example/example-*_00000
|
||||
```
|
||||
|
||||
You should see the five `Hello from Go sender — message N/5` lines.
|
||||
You should see the five `Hello from Go sender - message N/5` lines.
|
||||
|
||||
---
|
||||
|
||||
@@ -48,17 +48,17 @@ Adjust the sender via environment variables in [`docker-compose.yml`](./docker-c
|
||||
|
||||
| Env | Default | Purpose |
|
||||
|-----|---------|---------|
|
||||
| `SCRIBE_CATEGORY` | `example` | Message category → log subdirectory name |
|
||||
| `SCRIBE_CATEGORY` | `example` | Message category to log subdirectory name |
|
||||
| `SCRIBE_COUNT` | `5` | Number of messages to send |
|
||||
| `SCRIBE_HOST` | `scribe` | Daemon hostname (compose service name) |
|
||||
| `SCRIBE_PORT` | `1463` | Thrift port |
|
||||
|
||||
To change *where/how* Scribe stores logs (rotation, store type, per-category routing), edit
|
||||
[`config/scribe.conf`](../config/scribe.conf) — see the
|
||||
[`config/scribe.conf`](../config/scribe.conf) - see the
|
||||
[Configuration Reference](../README.md#configuration-reference).
|
||||
|
||||
The sender ([`sender/main.go`](./sender/main.go)) hand-encodes the Thrift framed binary
|
||||
`Log()` call using only the Go standard library — no Apache Thrift dependency, no generated
|
||||
`Log()` call using only the Go standard library - no Apache Thrift dependency, no generated
|
||||
bindings. For the higher-level client API, see the Python snippet in the
|
||||
[main README](../README.md#sending-log-messages).
|
||||
|
||||
@@ -66,9 +66,9 @@ bindings. For the higher-level client API, see the Python snippet in the
|
||||
|
||||
## Troubleshoot
|
||||
|
||||
- **`logs/` stays empty** — no messages were written yet. Check the `sender` output in the
|
||||
- **`logs/` stays empty** - no messages were written yet. Check the `sender` output in the
|
||||
compose logs; it exits non-zero and logs the cause if the send failed.
|
||||
- **Permission denied writing logs (native Linux hosts)** — Scribe runs as a non-root user
|
||||
- **Permission denied writing logs (native Linux hosts)** - Scribe runs as a non-root user
|
||||
inside the container, which may not be able to write to the bind-mounted host directory.
|
||||
Fix by loosening the local dir before running:
|
||||
|
||||
@@ -77,7 +77,7 @@ bindings. For the higher-level client API, see the Python snippet in the
|
||||
```
|
||||
|
||||
On Docker Desktop (Windows/macOS) this is normally not needed.
|
||||
- **Sender can't connect** — it retries for ~10s on startup. If Scribe takes longer to boot,
|
||||
- **Sender can't connect** - it retries for ~10s on startup. If Scribe takes longer to boot,
|
||||
re-run `docker compose up` or increase the retry window in `sender/main.go`.
|
||||
|
||||
---
|
||||
|
||||
@@ -9,7 +9,7 @@ services:
|
||||
volumes:
|
||||
# Reuse the repo's default config (read-only).
|
||||
- ../config/scribe.conf:/etc/scribe/scribe.conf:ro
|
||||
# Host-visible log output — files land here after the sender runs.
|
||||
# Host-visible log output: files land here after the sender runs.
|
||||
- ./logs:/var/log/scribe
|
||||
restart: unless-stopped
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// daemon to demonstrate that the example writes real log files.
|
||||
//
|
||||
// It speaks Scribe's Thrift RPC by hand-encoding the framed binary `Log()` call
|
||||
// using only the Go standard library — no Apache Thrift dependency and no
|
||||
// using only the Go standard library - no Apache Thrift dependency and no
|
||||
// generated bindings. The Scribe Thrift contract:
|
||||
//
|
||||
// enum ResultCode { OK = 0, TRY_LATER = 1 }
|
||||
@@ -122,7 +122,7 @@ func readResultCode(r io.Reader) (int32, error) {
|
||||
}
|
||||
br := bytes.NewReader(frame)
|
||||
|
||||
// messageBegin — detect strict vs non-strict from the first i32.
|
||||
// messageBegin: detect strict vs non-strict from the first i32.
|
||||
var i32buf [4]byte
|
||||
if _, err := io.ReadFull(br, i32buf[:]); err != nil {
|
||||
return -1, fmt.Errorf("read message header: %w", err)
|
||||
@@ -158,7 +158,7 @@ func readResultCode(r io.Reader) (int32, error) {
|
||||
return -1, err
|
||||
}
|
||||
if typeID == tSTOP {
|
||||
return 0, nil // no return field present → treat as OK
|
||||
return 0, nil // no return field present; treat as OK
|
||||
}
|
||||
var idBuf [2]byte
|
||||
if _, err := io.ReadFull(br, idBuf[:]); err != nil {
|
||||
@@ -208,7 +208,7 @@ func main() {
|
||||
|
||||
messages := make([]string, 0, count)
|
||||
for i := 1; i <= count; i++ {
|
||||
messages = append(messages, fmt.Sprintf("Hello from Go sender — message %d/%d", i, count))
|
||||
messages = append(messages, fmt.Sprintf("Hello from Go sender - message %d/%d", i, count))
|
||||
}
|
||||
|
||||
if _, err := conn.Write(buildLogFrame(category, messages)); err != nil {
|
||||
|
||||
Reference in new issue
Block a user