{"id":18837287,"url":"https://github.com/clarenceb/sidekiq_sinatra_spike","last_synced_at":"2025-08-03T19:31:39.659Z","repository":{"id":13100361,"uuid":"15781818","full_name":"clarenceb/sidekiq_sinatra_spike","owner":"clarenceb","description":"Demo of Sidekiq with a Sinatra web app under MRI Ruby and JRuby","archived":false,"fork":false,"pushed_at":"2014-02-24T22:41:56.000Z","size":168,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-29T19:39:26.257Z","etag":null,"topics":["ruby","sidekiq","sinatra"],"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/clarenceb.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2014-01-09T22:40:54.000Z","updated_at":"2014-02-24T22:41:57.000Z","dependencies_parsed_at":"2022-08-23T18:10:26.086Z","dependency_job_id":null,"html_url":"https://github.com/clarenceb/sidekiq_sinatra_spike","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/clarenceb/sidekiq_sinatra_spike","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarenceb%2Fsidekiq_sinatra_spike","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarenceb%2Fsidekiq_sinatra_spike/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarenceb%2Fsidekiq_sinatra_spike/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarenceb%2Fsidekiq_sinatra_spike/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clarenceb","download_url":"https://codeload.github.com/clarenceb/sidekiq_sinatra_spike/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarenceb%2Fsidekiq_sinatra_spike/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268601052,"owners_count":24276677,"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","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"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":["ruby","sidekiq","sinatra"],"created_at":"2024-11-08T02:34:40.174Z","updated_at":"2025-08-03T19:31:39.608Z","avatar_url":"https://github.com/clarenceb.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Sidekiq use with a Sinatra App\n==============================\n\nThis demo tests Sidekiq for job processing with a Sinatra web app both under MRI Ruby and JRuby.\n\nIt also demonstrates how to build a WAR file from a Sinatra app that runs with an embedded Jetty server.\nThe Sidekiq worker(s) can also be run from the expanded WAR file without any dependency on having to\ninstall JRuby on the target environment - you only need Java JDK 1.7.0.\n\nTested on Mac OS X 10.8.5 with a Centos 6.3 64-bit VM.\n\nPrequisites:\n------------\n\n* VirtualBox [Tested with v4.3.6]\n* Vagrant    [Tested with v1.4.0]\n* Optional plugin: vagrant-cachier [Tested with v0.5.1]\n\nTesting Sidekiq on MRI 1.9.3\n----------------------------\n\nCreate and log onto the VM:\n\n    vagrant up\n    vagrant ssh\n\nOn the VM:\n\n    sudo su\n    source ~/.bash_profile\n    cd /vagrant\n\nVerify you are using MRI Ruby 1.9.3:\n\n    ruby -v\n    # ==\u003e ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]\n\nRun the Sinatra web app:\n\n    bundle exec rackup\n\nTest the web app is up by browsing to `http://localhost:49292` on your host machine.\n\nYou should see \"Sinatra Demo App is alive!\"\n\nTry out the Sidekiq monitoring dashboard by browing to `http://localhost:49292/sidekiq` on your host machine.\n\nStart a Sidekiq worker to process pending jobs in Redis:\n\n    # Run this command on the VM\n    ./process_jobs.sh\n\nGenerate some random numbers to be stored in a Redis list:\n    \n    # Run this command a few times on the VM (use port 49292 if running from your host machine)\n    curl -X POST http://localhost:9292/numbers -d ''\n    # ==\u003e Your request to make a number is pending.\n    curl -X POST http://localhost:9292/numbers -d ''\n    # ==\u003e Your request to make a number is pending.\n    curl -X POST http://localhost:9292/numbers -d ''\n    # ==\u003e Your request to make a number is pending.\n\nGet back the list of random numbers:\n\n    # Run this command on the VM (use port 49292 if running from your host)\n    curl http://localhost:9292/numbers\n    # ==\u003e Random numbers: 70, 42, 54\n\nHave a look in Redis to see what's going on:\n\n    # First stop the Sidekiq worker using CTRL-C.\n    # Run this command on the VM to enter the Redis CLI:\n    redis-cli\n\n    # Type \"keys *\" to see all the available keys in Redis\n    redis 127.0.0.1:6379\u003e keys *\n    1) \"sidekiq_demo:stat:processed:2014-01-09\"\n    2) \"sidekiq_demo:queue:default\"\n    3) \"sidekiq_demo:stat:processed\"\n    4) \"sidekiq_demo:queues\"\n    5) \"random-numbers\"\n\n    # Let's see our currently queued job(s) without removing them\n    # (requires stopping the Sidekiq workers then generating a new random number).\n    \u003e LRANGE sidekiq_demo:queue:default 0 -1\n    1) \"{\\\"retry\\\":true,\\\"queue\\\":\\\"default\\\",\\\"class\\\":\\\"RandomNumberWorker\\\",\\\"args\\\":[100],\\\"jid\\\":\\\"c70f3d594444040469538556\\\",\\\"enqueued_at\\\":1389305919.2538064}\"\n\n    # And let's see our current list of random numbers.\n    redis 127.0.0.1:6379\u003e LRANGE random-numbers 0 -1\n    1) \"54\"    \n    2) \"42\"\n    3) \"70\"\n\n    # Exit redis-cli with CTRL-D\n\nTesting Sidekiq on JRuby 1.7.9\n------------------------------\n\nOn the VM:\n\n    sudo su\n    source ~/.bash_profile\n    cd /vagrant\n    rbenv local jruby-1.7.9\n    gem install bundler --no-ri --no-rdoc\n    rbenv rehash\n    bundle install\n    rbenv rehash\n\nNow we are using JRuby 1.7.9.\n\nFollow the steps in `Testing Sidekiq on MRI 1.9.3` above to test out Sidekiq with Sinatra.\n\nBuilding an executable WAR file (JRuby)\n---------------------------------------\n\nOn the VM:\n\n    sudo su\n    source ~/.bash_profile\n    cd /vagrant\n    rbenv local jruby-1.7.9\n\n    # Build the WAR file (see config/warble.rb for configuration)\n    warble executable war\n    # --\u003e creates 'sidekiq-demo.war'\n\n    # Run the web app\n    java -jar sidekiq.war\n\nAccess the running web server on port 8080:\n\n    curl -X POST http://localhost:8080/numbers -d ''\n\nStarting Sidekiq workers from the expanded WAR.  This is need since Sidekiq needs to require a file to load the worker environment:\n\n    ./process_jobs_war.sh\n    curl http://localhost:8080/numbers\n\n\nFurther Info\n------------\n\nSee the [SideKiq](http://sidekiq.org/) website for documentation and examples.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclarenceb%2Fsidekiq_sinatra_spike","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclarenceb%2Fsidekiq_sinatra_spike","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclarenceb%2Fsidekiq_sinatra_spike/lists"}