A brief example of running Slimer on Docker.
This is meant to be a turn-key solution to running Slimer on a local network. It is especially useful when you need a convenient place to dump data to that is not in the cloud.
This specific implementation will run three containers:
- slimer – The Slimer web server that receives requests; it is configured
to listen on port
6660. - slimer-workers – Used to broker storage requests with Redis.
- slimer-redis – The Redis server used in tandem with slimer-workers.
- slimer-database – A PostgreSQL database to store Slimer's substances.
- Clone this repository –
git clone https://github.com/codenamev/slimer.git cd slimer && docker-compose up -d- Visit http://localhost:6660/status and verify Slimer responds with
Ok. - Generate an API key:
docker-compose run slimer rake slimer:api_keys:generate, and enter a name for the key when it asks.
Using the API key you generated above, you can tell Slimer to consume any
substance in one of two ways. Replace any API_KEY in the URLs below with the
API key you generated in the Setup above.
Consume via GET request
curl http:/localhost:6660/API_KEY/consume?store_this=this&and_that=that
The above request will create a substance with a payload of:
{
"store_this": "this",
"and_that": "that"
}**Consume via POST request
The same request above can be made as a POST request:
curl -X POST -H "Content-Type: application/json" \
-d '{"store_this": "this", "and_that": "that"}' \
http:/localhost:6660/API_KEY/consume** Metadata **
Substances can be stored with metadata to describe the data being stored.
Simply provide a metadata parameter in your payload and this will be stored
separately.
The upgrade process is as simple as:
- Stop any running Slimer containers – from the directory you cloned this
example app into, run:
docker-compose down - Upgrade Slimer:
bundle update - Re-build your Docker containers:
docker-compose build - Re-start Slimer:
docker-compose up -d