rack

Heroku Cedar pure rack static site

百般思念 提交于 2019-12-04 17:42:52
I've been trying to consolidate two tutorials for hosting static sites: Deploying Rack-based Apps for the cedar stack Static Sites with Ruby on Heroku/Bamboo Basically I want to be able to do what you do in the old bamboo tutorial on the cedar stack. I can get the cedar tutorial to work, but when I try modify it to serve files I get an error. I have had a look at the following post , but the github repo doesn't seem to be up any longer and I can't quite figure out where I've gone wrong. When I try run the site locally as per the first tutorial, I get the following error: martin@crunchbang:~

How to read POST data in rack request

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 16:38:00
问题 When I run the curl command curl -v -H "Content-type: application/json" -X POST -d '{"name":"abc", "id":"12", "subject":"my subject"}' http://localhost:9292 to send a POST request with data to my Rack application, my code prints out {} . That is coming from puts req.POST() in the code below. Why does it print out {} instead of the POST data? And how do I correctly access the POST data in my Rack application? require 'json' class Greeter def call(env) req = Rack::Request.new(env) if req.post?

Rack Web Server and https: tutorial?

一个人想着一个人 提交于 2019-12-04 16:32:36
Can anyone provide a link to a description or tutorial dealing with the setup of https and installint certs etc using the Ruby RACK webserver? Thanks Rack isn't a webserver, it's an interface between webservers (like Apache, nginx) and applications middleware. If you're wanting to deploy a Rails application behind SSL, it's as easy as setting up SSL in your web server software. There are special things you can do in your app (such as forcing login pages to always use SSL), but they're outside of the scope of the deployment itself. For example, to set up SSL with Apache and passenger, you would

Are Rack-based web servers represent FastCGI protocol?

吃可爱长大的小学妹 提交于 2019-12-04 13:41:12
I've read that CGI/FastCGI is a protocol for interfacing external applications to web servers. so the web server (like Apache or NginX) sends environment information and the page request itself to a FastCGI process over a socket and responses are returned by FastCGI to the web server over the same connection, and the web server subsequently delivers that response to the end-user. Now I'm confused between this and Rack, which is used by almost all Ruby web frameworks and libraries. It provides an interface for developing web applications in Ruby by wrapping HTTP requests and responses. So, Is

Force 'www' in Rails3 hosted on Heroku without .htaccess

强颜欢笑 提交于 2019-12-04 12:54:07
I was wondering if there was a Rack alternative to forcing the 'www' in the URL since Heroku doesn't use .htaccess files. Maybe even a nice way to do it in routes? Thanks A quick Google search reveals this Rack middleware , which appears to do exactly what you want. In your ApplicationController, you can simply create a before filter: before_filter :force_www! protected def force_www! if Rails.env.production? and request.host[0..3] != "www." redirect_to "#{request.protocol}www.#{request.host_with_port}#{request.fullpath}", :status => 301 end end Or to go the other direction and remove www:

Robust way to deploy a Rack application (Sinatra)

孤人 提交于 2019-12-04 12:19:52
问题 I'm looking for a robust way to deploy a Rack application (in this case a Sinatra app). Requests will take a little time (0.25-0.5 sec waiting on proxied HTTP requests) and there may be a decent amount of traffic. Should I go with a traditional mongrel cluster setup? Use HAProxy as a load balancer? nginx? rackup? What solutions have you used and what are the advantages? 回答1: Nginx / Unicorn FTW! Nginx in front to serve static files and unicorn to handle Sinatra app. Benefits: Performance,

Static website on Heroku Cedar

余生颓废 提交于 2019-12-04 12:14:09
问题 I tried following the instructions here in order to create a static website on Heroku's Cedar stack. I have put the site up here. When I try to push the app (using "git push heroku master"), I get the following error: Kushs-MacBook-Air:hgtr kushpatel$ git push heroku master Counting objects: 7, done. Delta compression using up to 4 threads. Compressing objects: 100% (7/7), done. Writing objects: 100% (7/7), 1.29 KiB, done. Total 7 (delta 1), reused 0 (delta 0) -----> Heroku receiving push ---

Requests got stuck in ActiveRecord::QueryCache middleware

試著忘記壹切 提交于 2019-12-04 11:20:21
问题 After deploying our Rails app (4.0.9, Ruby 2.1.2), we notice requests to our app get hang after a while , usually 1 day or so. Using the gem rack_timer , we're able to find out requests got stuck at ActiveRecord::QueryCache middleware. Rack Timer (incoming) -- ActiveRecord::QueryCache: 925626.7731189728 ms After removing it, our app seems to be back to normal. However, I understand the purpose of this middleware is to increase the performance, so removing is just a temporary solution. We're

problem with rack 1.3.2. You have already activated rack 1.3.2, but your Gemfile requires rack 1.2.3

夙愿已清 提交于 2019-12-04 10:51:25
i have passenger 3.0.9 on debian with gem rack 1.3.2 and 1.2.1. With a rails 3.0 application with passenger e bundler i have this error: You have already activated rack 1.3.2, but your Gemfile requires rack 1.2.3. Consider using bundle exec. With rails 3.1 is all ok. I can't make start application with rails 3.0 but only with 3.1. Passnnger load first rack 1.3.2 and don't load rack 1.2.3 on gems of bundler Short answer: you need to run bundle update rack This will update your rack version in Gemfile.lock Longer answer: This error usually happens when your activated rack/rake version is

Update middleware in Rails

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 10:21:40
Is there any way to MODIFY ( NOT replace) a middleware in rails? So instead of: config.middleware.delete ::Rack::Cache config.middleware.use ::Rack::Cache, :metastore => "rails:/", :entitystore => "rails:/", :verbose => false I want to simply write something like config.middleware.find!(::Rack::Cache).verbose = false . UPDATE: The reason to do it is because the capybara-webkit prints tons of messages when running from cucumber. I think for this particular middleware, you can set the Rack environment option to be merged with its default configuration as per: http://rtomayko.github.com/rack