stronghold
is officially deprecated and unmaintained.
It is recommended that users transition to alternatives.
Stronghold is a global distributed key-value store for keeping application configuration. It's a bit like etcd, or the KV module of consul.
Stronghold is client-server.
The server is Apache ZooKeeper.
The main client is stronghold
, which provides an HTTP API to query ZooKeeper.
That is what this repository provides.
stronghold
is designed to run as a local daemon on all hosts in your system,
and should be the only way you interact with ZooKeeper.
For another layer of indirection,
see other client libraries which use the stronghold
daemon:
stronghold-ui
.
This queries the stronghold
HTTP server.stronghold-cli
.
This also queries the stronghold
HTTP server.Stronghold features:
Stronghold has an HTTP API with the following resources:
GET /head
Fetches the current version, returned in the body.
GET /versions?at=[ts]
Fetches the revision active at ts.
GET /versions?last=[last]&size=[size]
Fetches information on up to size changes before last (a revision). Returns a JSON array containing one object per change in chronological order. Each has at least the following keys:
Fetches information on changes that occur after first and ending at
either limit (a revision) or after size changes. The response is in the
same form as the previous method. size
is optional.
Returns a JSON list of paths in the hierarchy at version.
Fetches the materialized JSON for a particular path at version.
Blocks until the materialized JSON for a particular path changes and returns a JSON object containing:
Fetches the JSON peculiar to a particular path.
Fetches information on the change immediately before version. Returns a JSON object containing:
Method used to make an update. The body should contain a JSON object with the following keys:
NB: There is a development mode which is backed by sqlite. This is likely to be simpler. You must still install the zookeeper dependency in order for it to compile.
brew install zookeeper
export CPATH=$(brew --prefix zookeeper)/include:$CPATH
sudo apt-get install libzookeeper-mt-dev
stack build
Here is a basic local zk config: https://gist.github.com/DanielWaterworth/6ab8d009e6d8e7bfa600
To initialize the state in zookeeper.
stack exec wipe -- localhost:2181
stronghold <port> <zk address>
Running locally, you'll probably want:
stack exec stronghold -- 5040 localhost:2181
or
foreman start
There's also a development mode that uses SQLite for storage instead of zookeeper:
stack exec stronghold -- development 5040 ./data.db