Project

slimer

0.0
No release in over 3 years
Slimer is an app that allows you to consume any data with ease
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 2.0
~> 13.0
>= 5.40
>= 6.1
 Project Readme

Slimer

build status

A minimalist consumer with an endless appetite.

Slimer

Slimer character created by Anthony Mungioli

Pre-Build Deployment Options

WTF

Working with IoT, I constantly find a need for a single place to dump generic data that I want to keep track of. If this were a physical place, there would be different bins I could throw this data into. Basically what I was looking for was an organized dumpster. Enter: Slimer!

Slimer exists with a sole purpose: consuming substances. Currently, these substances are molded in a data object with the following attributes:

attribute description
uid A unique identifier (UUID by default)
payload JSON representation of the data to be stored
metadata JSON representation of any meta-data that describes the contents of the above payload
group The name for a collection of similar Substance(s)

With the Slimer app running on http://localhost:6660 (local and Docker default), and an API key generated (rake slimer:api_keys:generate["your-name"]) you can give it any arbitrary JSON data you want to store either via GET:

http://localhost:6660/:api_key/consume?zipCode=19101&weather=sunny

Or via POST

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"zipCode":"19101","weather":{"cloudCover":0,description:"sunny"}}' \
  http://localhost:6660/:api_key/consume

Installation

Add this line to your application's Gemfile:

gem 'slimer'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install slimer

Usage

Slimer uses Sidekiq to line up it's meals. While it is recommended to deploy Slimer (locally via Docker or on Heroku), Slimer::Web is a simple mountable Rack app. All that is needed is a config.ru file:

# ./config.ru

require "slimer/web"

run Slimer::Web

Configuration

By default, Slimer uses SQLite for storing it's Substances, and the WEBrick web server.

Slimer uses the sequel gem to interact with the database. You can use whatever database it supports. Slimer will look for the DATABASE_URL environment variable and use it if one exists. Alternatively, you can configure the server explicitly:

# ./config.ru

require "pg"
require "slimer/web"

Slimer.configure do |config|
  config.database_url = "postgres://slimer-database/?pool=8"
end

run Slimer::Web

Slimer accepts many configurable options:

# By default, Slimer stores everything in the "general" group.
# Adding more groups here will make them available for consumption at:
#   /:api_key/:group/consume
Slimer.configure do |config|
  # Top-level group
  config.group :bookmarks
  # Nested group
  config.group "bookmarks/ruby"
  # Alternative nested group
  config.group :bookmarks do
    config.group :ruby
    config.group :rails
  end

  config.database_url = "postgres://slimer-database/?pool=8"
  config.sidekiq_queue = "slimed"
  config.configure_sidekiq_client do |sidekiq_config|
    sidekiq_config.redis = { url: 'redis://redis.example.com:7372/0' }
  end
  config.configure_sidekiq_server do |sidekiq_config|
    sidekiq_config.redis = { url: 'redis://redis.example.com:7372/0' }
  end
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/codenamev/slimer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Slimer project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.