stormlock
simple centralized lock with lease expiration
TLDR
SYNOPSIS
stormlock subcommand [options] resource [lease-id]
DESCRIPTION
stormlock is a simple centralized lock manager aimed at human operators and scripts that need occasional coordination (deployments, migrations, cron runs). Each lock is associated with a principal (who holds it) and a lease with a TTL that auto-expires, so a crashed holder cannot deadlock the resource.Typical flow: `stormlock acquire <resource>` prints a lease id; run the protected work; `stormlock release <resource> <lease-id>` when done. For long-running work, periodically call `stormlock renew` to extend the lease.
PARAMETERS
acquire RESOURCE [--ttl DUR]
Attempt to acquire a lease. On success prints the lease id.release RESOURCE LEASEID_
Release the given lease on the given resource.renew RESOURCE LEASEID [**--ttl** DUR_]
Extend the lease duration.current RESOURCE [--id-only]
Show the current lease holder and id. `--id-only` prints only the id.is-held RESOURCE LEASEID_
Exit with status 0 if the given lease is still active, non-zero otherwise.-c, --config FILE
Path to the configuration file. Overrides `STORMLOCK_CONFIG`.--ttl DURATION
Time-to-live for the lease (e.g. `30s`, `5m`, `1h`). Defaults come from the config file.--help
Show help.
CONFIGURATION
~/.config/stormlock/config.toml
Default configuration location. Uses INI/TOML syntax with `[default]`, per-resource, and `[backend.<name>]` sections. Common keys: `ttl`, `principal`, `backend`.STORMLOCK_CONFIG
Overrides the configuration file path.
BACKENDS
Supported storage backends:- etcd — uses etcd leases.- redis — uses Redis keys with TTL.- dynamodb — AWS DynamoDB table with conditional writes.- postgresql — PostgreSQL row with expiry column.Custom backends can be added by implementing the `stormlock.Backend` interface and registering it via Python entry points.
CAVEATS
Requires a reachable backend. Locks are advisory — cooperating clients must all check the lock before acting. TTL must be tuned to be longer than the worst-case work unit (or renewed during it). The tool is written in Python; install via `pip install stormlock[etcd,redis,...]` with the backend extras you need.
HISTORY
stormlock is maintained by Thayne McCombs (tmccombs) on GitHub. It is released under the Apache 2.0 license.
