Sign inSign up

freakmaxi/locking-center

By freakmaxi

•Updated about 1 month ago

Image
0

2.6K

freakmaxi/locking-center repository overview

⁠Locking-Center

A small distributed lock server. Take a named lock, do the work, release it — blocking and FIFO-fair, from a single binary, with client libraries for nine languages.

Source and full documentation: https://github.com/freakmaxi/locking-center⁠

⁠Supported tags

  • latest — the most recent release
  • <version> — a specific release, tagged <major>.2.<build>

Multi-arch images are published for linux/amd64 and linux/arm64.

⁠Quick start

docker run -d --name locking-center \
  -p 22119:22119 -p 22120:22120 -p 22121:22121 \
  freakmaxi/locking-center:latest

The image runs as a non-root user, carries both lcd (the server) and lc-cli (management + lock CLI), and has a HEALTHCHECK on the metrics endpoint. docker stop sends SIGTERM, which goes through the graceful shutdown path.

Inspect the lock table from the running container:

docker exec locking-center lc-cli --manager-address 127.0.0.1:22120 keys -d

⁠Ports

PortProtocolPurpose
22119Binary TCPMutex — locking and unlocking, used by your services
22120Binary TCPManager — management commands, used by lc-cli
22121HTTPPrometheus /metrics endpoint (also the container healthcheck)

Only the mutex port needs to be reachable by your applications. Keep the manager port restricted — it can release every lock in the system.

⁠Environment

VariableDefaultDescription
BIND_ADDRESS:22119Mutex bind address; the manager and metrics ports follow it at +1 and +2
DATA_PATH(unset)Path to a write-ahead log file; set it to keep held locks across restarts

⁠Keeping locks across restarts

By default the lock table lives in memory and a restart drops every key. Mount a volume on /data and point DATA_PATH at it:

docker run -d --name locking-center \
  -p 22119:22119 -p 22120:22120 -p 22121:22121 \
  -v locking-center-data:/data -e DATA_PATH=/data/locks.json \
  freakmaxi/locking-center:latest

The service runs as uid and gid 22119. A named volume inherits /data's ownership from the image; a bind mount does not, so chown 22119:22119 <directory> the host directory first — otherwise the process cannot create the file and exits with code 4.

⁠Client libraries

One tiny TCP protocol, clients for nine languages — Go, Rust, Python, Java, C#, JavaScript, C, C++ and Zig. See the client list⁠.

⁠License

GPL-3.0. The full documentation — wire protocol, Kubernetes manifest, Prometheus alert and design notes — lives in the GitHub repository⁠.

Tag summary

Content type

Image

Digest

sha256:dfe87b776…

Size

8 MB

Last updated

about 1 month ago

docker pull freakmaxi/locking-center