{"id":16068114,"url":"https://github.com/ged/strelka","last_synced_at":"2025-04-05T10:14:22.146Z","repository":{"id":28009007,"uuid":"31503561","full_name":"ged/strelka","owner":"ged","description":"A Ruby web framework for Mongrel2 (mirror)","archived":false,"fork":false,"pushed_at":"2020-02-12T22:40:51.000Z","size":4869,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-10T20:57:12.947Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ged.png","metadata":{"files":{"readme":"README.rdoc","changelog":"History.rdoc","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-01T17:11:02.000Z","updated_at":"2021-11-28T23:37:29.000Z","dependencies_parsed_at":"2022-09-14T14:10:51.599Z","dependency_job_id":null,"html_url":"https://github.com/ged/strelka","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Fstrelka","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Fstrelka/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Fstrelka/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Fstrelka/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ged","download_url":"https://codeload.github.com/ged/strelka/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247318746,"owners_count":20919483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-09T06:08:36.355Z","updated_at":"2025-04-05T10:14:22.126Z","avatar_url":"https://github.com/ged.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Strelka (Стрелка)\n\nhome:: https://hg.sr.ht/~ged/Strelka\ncode:: https://hg.sr.ht/~ged/Strelka/browse\ngithub:: https://github.com/ged/strelka\ndocs:: http://deveiate.org/code/strelka\n\n\n== Description\n\nStrelka is a framework for creating and deploying\nMongrel2[http://mongrel2.org/] web applications in Ruby.\n\nIt's named after a lesser known {Russian\ncosmonaut}[http://en.wikipedia.org/wiki/Strelka_(dog)#Belka_and_Strelka] who was\none of the first canine space travelers to orbit the Earth and return alive.\nHer name means \"little arrow\".\n\n\n== Prerequisites\n\n* Mongrel2[http://mongrel2.org/] 1.8.0 or better\n* Ruby 2.2 or better\n\n\n== Installation\n\n    $ gem install strelka\n\n\n== Getting Started\n\nWe're going to assume you've already built and installed the Mongrel2 daemon.\nIf not, please refer to the  {Mongrel2\ndocumentation}[http://mongrel2.org/wiki/quick_start.html] and get that  ready.\n\nMongrel2 loads its configuration from a SQLite database. You can create the \nthis database in any fashion you like, but the Mongrel2 ruby module includes a\ncommand-line tool called \u003ctt\u003em2sh.rb\u003c/tt\u003e that'll let you quickstart a server\nif you just want to experiment. If you've already installed the *strelka* gem,\nthen it will already have been installed as a dependency.\n\nTo bootstrap a basic server, configure it, and run it:\n\n    $ mkdir strelka-tryout\n    $ cd !$\n    $ m2sh.rb quickstart\n\nThis will generate a Ruby DSL config, then invoke an editor on it.\n\nMake sure the config has a line like:\n\n    route '/hello', handler( 'tcp://127.0.0.1:9999',  'helloworld' )\n\nin the 'host' section; that's the part of the Mongrel2 server we'll be talking\nto.\n\nThe quickstart will generate a SQLite configuration database for use with\nMongrel2 in your current working directory, with the default required directory\nstructure. Mongrel2 will listen on port 8113 (unless you changed it), and send\nall requests starting at the URI \u003ctt\u003e/hello\u003c/tt\u003e to a handler called\n\u003ctt\u003ehelloworld\u003c/tt\u003e.\n\nIf you stop the server (Ctrl-C will do so), you can restart it like so:\n\n    $ m2sh.rb start\n\nNow that the Mongrel2 daemon is up and running, we can move forward and create\nour first application!\n\n\n\n=== A Minimal Application\n\nStrelka applications are subclasses of the Strelka::App class. Strelka::App is\npretty minimal by itself; it inherits most of its behavior from the basic\nMongrel2::Handler[http://deveiate.org/code/mongrel2/Mongrel2/Handler.html]\nclass, only adding a few convenience methods for common HTTP tasks.\n\nA minimal application would look something like:\n\n    #!/usr/bin/env ruby\n\n    require 'strelka'\n\n    class HelloWorldApp \u003c Strelka::App\n\n        def handle_request( request )\n            response = request.response\n            response.content_type = 'text/plain'\n            response.puts( \"Hello, World!\" )\n            return response\n        end\n\n    end # class HelloWorldApp\n\n    # Run the app\n    HelloWorldApp.run if __FILE__ == $0\n\nWhile functional, this application is pretty dumb, and making it do anything\nmore intelligent on your own would require a bunch of additional code and\naccompanying tests.  Fortunately, Strelka already has done the heavy lifting.\nIt knows how to read the Mongrel2 configuration and hook your app up with the\nright sockets to talk to the Mongrel2 front end (providing you follow one of\nseveral simple conventions), provides hooks into the lifecycle of an HTTP\nrequest, and includes a plugin system that uses these hooks to handle common\napplication tasks. This allows you to mix in the specific framework parts you\nneed, so you get exactly what you want and nothing more.\n\n\n=== Talking to Mongrel2\n\nMongrel2 associates handlers with itself via an identifier, which is described\nin the Mongrel2 manual as a UUID, but can actually be any string consisting of\ndashes and alphanumeric characters. Strelka reads the Mongrel2 config database,\nand can automatically configure its apps to talk to the right socket with the\nright \u003ctt\u003esend_ident\u003c/tt\u003e if it can find them. It gives you a couple of\ndifferent ways of doing this. It will default to a string derived from the name\nof the class, or you can set it yourself by declaring an \u003ctt\u003eID\u003c/tt\u003e constant\nin your application class. If you need more control, you can also override the\n\u003ctt\u003e::run\u003c/tt\u003e class method and \u003ctt\u003esuper\u003c/tt\u003e with the right \u003ctt\u003eappid\u003c/tt\u003e:\n\n    class HelloWorldApp\n        # Run as a tester if not running in the production environment\n        def self::run\n            appid = if Socket.gethostname.include?( 'test' )\n                    'helloworld-test'\n                else\n                    'helloworld'\n                end\n\n            super( appid )\n        end\n    end\n\nBecause our \u003ctt\u003econfig.sqlite\u003c/tt\u003e configuration directs requests to \u003ctt\u003e/\u003c/tt\u003e\nto be sent to the \u003ctt\u003ehelloworldapp\u003c/tt\u003e handler, Strelka will automatically\nfind and pair this route to Mongrel2 when run.\n\nRun this handler, then point a browser to \u003ctt\u003ehttp://localhost:8080/\u003c/tt\u003e.  If\nyou see the text \"Hello, World!\", congrats!  We'll build off of this in the\nnext section, the {Strelka Tutorial}[rdoc-ref:Tutorial.rdoc].\n\n\n=== Packaging\n\nIf you want your app to be launchable via the \u003ctt\u003estrelka\u003c/tt\u003e command, you can\ndo so by registering it with the Strelka::Discovery module. For instance, if\nyour app is defined in a file called \u003ctt\u003elib/acme/store.rb\u003c/tt\u003e and you want to\nstart it with the command\n\n    strelka start acme-store\n\nthen you'd do something like:\n\n    require 'strelka/discovery'\n    Strelka::Discovery.register_app( 'acme-store', 'acme/store.rb' )\n\nIf you want the app to be launchable directory from the gem, you can put the\nabove discovery code in a file named \u003ccode\u003elib/strelka/apps.rb\u003c/code\u003e to your\ngem. The `strelka` command will load all of those files from any installed gems\nbefore running \u003ctt\u003estart\u003c/tt\u003e. You can test to see which apps are discoverable\nthis way using the \u003ctt\u003estrelka discover\u003c/tt\u003e command.\n\nSee Strelka::Discovery for more info.\n\n\n== Further Reading\n\nYou'll likely want to start with {the Tutorial}[rdoc-ref:Tutorial.rdoc].\n\n\n== Roadmap\n\nGoing forward, we're going to be extracting useful stuff out of our own\napplications as plugins, and finishing up the packaging and deployment\nstories once we've ironed out the details in own environment.\n\nHere's a tentative list of what kinds of stuff we have planned:\n\n=== More Plugins\n\n* CORS -- manage {Cross-Origin Resource Sharing}[http://www.html5rocks.com/en/tutorials/cors/]\n  headers, especially for service applications\n* caching -- utilities for easy HTTP caching\n\n=== New Application Styles\n\nCreate some new handler classes for different application styles, similar to\nthose in the Tir[http://tir.mongrel2.org/] framework.\n\n=== Chunked Encoding\n\nSupport for sending partial responses via the Chunked encoding.\n\n\n== Contributing\n\nYou can check out the current development source with Mercurial via its\n{project page}[http://bitbucket.org/ged/Strelka]. Or if you prefer Git, via\n{its Github mirror}[https://github.com/ged/strelka].\n\nAfter checking out the source, run:\n\n    $ rake newb\n\nThis task will install any missing dependencies, run the tests/specs,\nand generate the API documentation.\n\n\n== Authors\n\n- Mahlon E. Smith \u003cmahlon@martini.nu\u003e\n- Michael Granger \u003cged@faeriemud.org\u003e\n\n\n== License\n\nCopyright (c) 2011-2020, Michael Granger and Mahlon E. Smith\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice,\n  this list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* Neither the name of the author/s, nor the names of the project's\n  contributors may be used to endorse or promote products derived from this\n  software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fged%2Fstrelka","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fged%2Fstrelka","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fged%2Fstrelka/lists"}