{"id":15501360,"url":"https://github.com/envek/sekitome","last_synced_at":"2026-05-01T14:34:12.663Z","repository":{"id":138469067,"uuid":"75557259","full_name":"Envek/sekitome","owner":"Envek","description":"A proud member of bicycle parade. Pure rack application that uses Redis expirable keys.","archived":false,"fork":false,"pushed_at":"2016-12-04T19:38:53.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-30T05:54:40.127Z","etag":null,"topics":["rack-application","redis","ruby","test-task"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Envek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-04T18:55:14.000Z","updated_at":"2017-04-09T15:18:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"923efee0-88fe-46f2-b982-94d464ad1fc5","html_url":"https://github.com/Envek/sekitome","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"2d44afc0cd14f559e86664818fdd947466bc006d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Envek/sekitome","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Envek%2Fsekitome","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Envek%2Fsekitome/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Envek%2Fsekitome/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Envek%2Fsekitome/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Envek","download_url":"https://codeload.github.com/Envek/sekitome/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Envek%2Fsekitome/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32501403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rack-application","redis","ruby","test-task"],"created_at":"2024-10-02T09:04:03.326Z","updated_at":"2026-05-01T14:34:12.645Z","avatar_url":"https://github.com/Envek.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sekitome\n\nA small pure Rack application to answer simple question: was this username seen in last X seconds or not (usually used for throttling).\n\n\n## Task\n\nThe service receives one case insensitive GET parameter: `username`. If this parameter wasn't received during the last minute, service returns JSON:\n\n```json\n{“result”: “OK”}\n```\n\nIf this username was received during the last minute, service returns JSON:\n\n```json\n{“result”: “\u003cusername\u003e throttled”}\n```\n\n## Solution\n\n### Service\n\nAPI is written on Ruby as Rack application. Pure Rack applications are very lightweight and fast, can be run in any compatible application server (I chose fast threaded [Puma]).\n\n### Database\n\nRedis is fast and battle-tested key-value in-memory database which persists data on disk. Also it has ability to expire keys and that's why it's chosen as database for this service.\n\n\n## Launch\n\n### Via Docker Compose\n\nYou will need to have installed:\n\n - Recent [Docker]\n - Recent [Docker Compose]\n\nThen just execute next command from this directory:\n\n    docker-compose up\n\nAccess Sekitome multiple times on URL like this: http://localhost:3000/?username=Envek\n\n### Manually\n\nYou will need to have installed:\n\n - Recent MRI [Ruby] version (recommended: 2.3)\n - Recent [Redis] (2.6+, recommended: 3.2)\n\nFollow these simple steps:\n\n 1. Launch [Redis] somewhere accessible from this machine and construct an URL to access it, like `redis://127.0.0.1:6379/0`\n\n 2. Install required gems by executing `bundle install` in this directory.\n\n 3. Launch service with command like:\n\n        env 'REDIS_URL=redis://localhost/0' rackup -s puma -p 3000 -O \"Threads=0:${MAX_THREADS:-16}\"\n\n 4. Access API endpoint on URL like this: http://localhost:3000/?username=Envek\n\n 5. Access one more time.\n\n 6. …\n\n 7. PROFIT!\n\n\n## Testing\n\n    env 'REDIS_URL=redis://localhost/0' bundle exec ruby test/integration.rb\n\n\n## Configuration\n\nNext environment variables will change behavior of this application:\n\n - `REDIS_URL` (required) — URL to connect to Redis.\n - `THROTTLE_TIMEOUT` — A number of seconds after which username will be forgot. Default is 60 (1 minute).\n - `MAX_THREADS` — maximum number of threads to be used by [Puma] application server, also affects size of connection pool to [Redis] accordingly. Default is 16.\n\n\n## Operations\n\n### Surviving restarts\n\n - For deploying new versions of code Puma Phased Restart usage should be considered: https://github.com/puma/puma#normal-vs-hot-vs-phased-restart\n\n - [Redis] should be configured to use Append-Only File (AOF), to avoid data loss after unexpected restarts. See the docs for details: https://redis.io/topics/persistence\n\n## About the name\n\nA word _sekitome_ is a verbal noun from japanese verb _sekitomeru_ (堰き止める) with direct meaning of _to dam (a river)_ and figurative meaning of _to impede, delay, slow down_. Close enough to meaning of _throttling_ I believe.\n\n\n## License\n\nCan be freely used, distributed, and modified under the terms of the [MIT License]. See the [LICENSE](LICENSE) file.\n\n\n[Ruby]: https://www.ruby-lang.org/ (A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.)\n[Rack]: https://rack.github.io/ (Rack: a Ruby Webserver Interface)\n[Puma]: http://puma.io/ (A modern, concurrent web server for Ruby)\n[Redis]: https://redis.io/ (Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker)\n[MIT License]: https://opensource.org/licenses/MIT (A short and simple permissive license with conditions only requiring preservation of copyright and license notices)\n[Docker]: https://www.docker.com/ (Docker is the world’s leading software containerization platform)\n[Docker Compose]: https://docs.docker.com/compose/ (Compose is a tool for defining and running multi-container Docker applications)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenvek%2Fsekitome","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenvek%2Fsekitome","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenvek%2Fsekitome/lists"}