Sign inSign up

dimahkiin/egts_gateway

By dimahkiin

•Updated 10 days ago

TCP server for EGTS telematics packets with delivery to stdout, files, EGTS, RabbitMQ and Valkey

Image
Integration & delivery
Message queues
Internet of things
0

87

dimahkiin/egts_gateway repository overview

⁠dimahkiin/egts_gateway

egts_gateway is a TCP server for the EGTS (Era Glonass Telematics Standard) protocol. It accepts connections from telematics terminals, decodes EGTS packets and delivers them to one or more destinations: stdout, rotating NDJSON files, other EGTS servers, RabbitMQ queues and Valkey/Redis Streams. Incoming authentication is optional, delivery is buffered in an in-memory queue, and undelivered packets are dumped to disk on shutdown and restored on the next start.

Sources: github.com/LdDl/go-egts⁠

⁠Configuration

The image ships no configuration file. There are two mutually exclusive ways to configure it, and exactly one CLI flag: -conf.

  • TOML - pass -conf <path> after the image name and bind-mount the file. Environment variables and .env are then ignored.
  • Environment - without -conf, the gateway reads EGTS_* variables. If /app/.env exists (the working directory is /app), its values override the process environment.

Without either, the built-in defaults apply: listen on 0.0.0.0:8081, no authentication, packets to stdout, application logs to stderr.

Minimal working TOML:

[server_cfg]
host = "0.0.0.0"
port = 8081

[destinations_cfg]
stdout = true

Unset keys fall back to the defaults, but unknown keys are rejected at startup. The full annotated example is egts_gateway.toml⁠; the full variable list is .env.example⁠.

Non-obvious startup conditions:

  • Listen on 0.0.0.0 inside the container. 127.0.0.1 in server_cfg.host / EGTS_SERVER_HOST makes the published port unreachable.
  • At least one packet destination must be enabled, otherwise the process exits with an error.
  • Application logs and packets may not share an output: logs_cfg.output = "stdout" together with destinations_cfg.stdout = true is rejected, as are overlapping log, packet and dump directories.
  • Relative paths such as ./data/queue resolve against the working directory /app, so mount a volume at /app/data to keep packet files, file logs and queue dumps.
  • Use --stop-timeout 30 (or stop_grace_period: 30s) so the gateway can dump its pending queue on SIGTERM.
  • The image is built FROM scratch - there is no shell, so docker exec ... sh does not work.

⁠Usage

Defaults, packets printed to the container log:

docker run --rm --name egts_gateway --stop-timeout 30 \
  -p 8081:8081 \
  -v egts_gateway_data:/app/data \
  docker.io/dimahkiin/egts_gateway:latest

Authentication is disabled by default; use -p 127.0.0.1:8081:8081 instead if the port should not be reachable from other hosts, or set auth_cfg.enabled = true with auth_cfg.password.

With a TOML file:

curl -fsSL https://raw.githubusercontent.com/LdDl/go-egts/master/egts_gateway.toml -o egts_gateway.toml
docker run --rm --name egts_gateway --stop-timeout 30 \
  -p 8081:8081 \
  --mount type=bind,source="$(pwd)/egts_gateway.toml",target=/app/egts_gateway.toml,readonly \
  -v egts_gateway_data:/app/data \
  docker.io/dimahkiin/egts_gateway:latest -conf /app/egts_gateway.toml

With an .env file (note: no -conf, and the target path must be /app/.env):

docker run --rm --name egts_gateway --stop-timeout 30 \
  -p 8081:8081 \
  --mount type=bind,source="$(pwd)/.env",target=/app/.env,readonly \
  -v egts_gateway_data:/app/data \
  docker.io/dimahkiin/egts_gateway:latest

⁠Ports

PortProtocolPurpose
8081TCPEGTS ingress from telematics terminals (EXPOSEd; server_cfg.port / EGTS_SERVER_PORT)

This is the only listening port. Outbound destinations - EGTS relays, RabbitMQ, Valkey/Redis - are dialed by the container and need no published ports.

⁠Paths

PathPurpose
/appWorking directory; ENTRYPOINT is ./egts_gateway
/app/egts_gateway.tomlConventional mount point for the TOML file passed via -conf
/app/.envENV file, loaded automatically when -conf is absent
/app/dataMount a volume here; parent of the three directories below
/app/data/queueQueue dumps queue.dump (delivery_cfg.dump_directory)
/app/data/logsapplication.log and rotated archives, when logs_cfg.output = "file"
/app/data/packetspackets.ndjson and rotated archives, when destinations_cfg.file.enabled = true

⁠Environment

Read only when -conf is not passed. Selected variables; see .env.example⁠ for all of them.

VariableDefaultPurpose
EGTS_SERVER_HOST0.0.0.0Listen address
EGTS_SERVER_PORT8081Listen port
EGTS_AUTH_ENABLEDfalseRequire terminal authentication
EGTS_AUTH_PASSWORDemptyPassword, required when auth is enabled (max 32 bytes)
EGTS_ACK_MODEqueuedqueued or delivered acknowledgement
EGTS_QUEUE_CAPACITY1024In-memory queue size
EGTS_DUMP_AFTER_SECONDS60Dump the queue and exit after this long failing
EGTS_DUMP_DIRECTORY./data/queueQueue dump directory
EGTS_LOG_OUTPUTstderrstdout, stderr or file
EGTS_LOG_DIRECTORY./data/logsApplication log directory for file output
EGTS_PACKETS_STDOUTtrueOne JSON packet envelope per line on stdout
EGTS_PACKETS_FILE_ENABLEDfalseWrite packets as NDJSON
EGTS_PACKETS_FILE_DIRECTORY./data/packetsNDJSON directory
EGTS_RELAY_IDSunsetComma-separated EGTS relay IDs; per-destination keys use the ID as an uppercase suffix, e.g. EGTS_RELAY_HOST_MONITORING
EGTS_RABBITMQ_IDSunsetComma-separated RabbitMQ destination IDs, same suffix convention
EGTS_VALKEY_IDSunsetComma-separated Valkey/Redis destination IDs, same suffix convention

The gateway exposes no HTTP or management endpoints.

⁠Image

Built FROM scratch with a static CGO_ENABLED=0 Go binary compiled in golang:1.25.9-alpine3.23. No shell, no package manager, no CA bundle. Size is about 6 MB.

⁠License

MIT - LICENSE.md⁠

Tag summary

Content type

Image

Digest

sha256:69a6fc4e8…

Size

2.5 MB

Last updated

10 days ago

docker pull dimahkiin/egts_gateway