-
Notifications
You must be signed in to change notification settings - Fork 135
Heroku compatibility (WIP) #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,12 @@ | ||
| source :rubygems | ||
| ruby '1.9.3', :engine => 'jruby', :engine_version => '1.7.2' | ||
|
|
||
| # SERVER | ||
| gem 'puma' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we specifying that everyone use Puma?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's from the Heroku JRuby instructions. (I know pretty much nothing about JRuby web server choices.) The default presumably works…will try taking this out.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather not force everyone in the world to use Puma for the sake of the Heroku users :) If it can be done as part of the Heroku deploy process, that would be ideal; second-best option would be to ask the user if he intends to use Heroku as part of setup.rb, and add Puma to the Gemfile if he answers yes. |
||
| gem 'jruby-openssl', platform: :jruby | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The latest version of JRuby includes the OpenSSL library by default. Including the gem only gets you a bunch of "Already initialized constant" warnings. |
||
|
|
||
| # FRAMEWORK | ||
| gem 'rails', git: 'git://github.com/rails/rails.git', branch: '3-2-stable' | ||
| gem 'rails', git: 'https://github.com/rails/rails.git', branch: '3-2-stable' | ||
| # We need to use this branch of Rails because it includes fixes for ActiveRecord | ||
| # and concurrency that we need for our thread-spawning background job paradigm | ||
| # to work | ||
|
|
@@ -11,14 +16,14 @@ gem 'rack-cors', require: 'rack/cors' | |
| # MODELS | ||
| gem 'pg', platform: :mri | ||
| gem 'activerecord-jdbcpostgresql-adapter', platform: :jruby | ||
| gem 'has_metadata_column', git: 'git://github.com/RISCfuture/has_metadata_column.git' | ||
| gem 'has_metadata_column', git: 'https://github.com/RISCfuture/has_metadata_column.git' | ||
| gem 'slugalicious' | ||
| gem 'email_validation' | ||
| gem 'url_validation' | ||
| gem 'json_serialize' | ||
| gem 'validates_timeliness' | ||
| gem 'find_or_create_on_scopes', '>= 1.2.1' | ||
| gem 'composite_primary_keys', git: 'git://github.com/RISCfuture/composite_primary_keys.git' | ||
| gem 'composite_primary_keys', git: 'https://github.com/RISCfuture/composite_primary_keys.git' | ||
| gem 'activerecord-postgresql-cursors' | ||
|
|
||
| # VIEWS | ||
|
|
@@ -28,7 +33,7 @@ gem 'kramdown' | |
|
|
||
| # UTILITIES | ||
| gem 'json' | ||
| gem 'git', git: 'git://github.com/RISCfuture/ruby-git.git' | ||
| gem 'git', git: 'https://github.com/RISCfuture/ruby-git.git' | ||
| gem 'user-agent' | ||
|
|
||
| # AUTH | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| web: bundle exec rails server puma -p $PORT -e $RACK_ENV |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,5 +67,12 @@ | |
| get 'search/suggestions' => 'search#suggestions' | ||
| get 'search' => 'search#search' | ||
|
|
||
| match 'api/1.0/notify', :constraints => {:method => 'OPTIONS'}, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Project standard is to use Ruby 1.9 hash syntax. |
||
| :to => lambda { |env| [200, { | ||
| 'Access-Control-Allow-Origin' => '*', | ||
| 'Access-Control-Request-Method' => '*', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure I understand — this is the response for OPTIONS, not POST.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless I'm mistaken, an OPTIONS request is used to determine who can make a request to that same route, what headers they can use, what methods they can use, etc. So, when a client makes an OPTIONS request to
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, sorry, I thought you meant the route constraints — yes,
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And of course this doesn't belong in this pull request, as it has nothing to do with Heroku! :)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I figured for some reason Heroku needed this =/
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Chrome dev channel didn't want to send the notification without this. I haven't tried it in other browsers to see if it makes a difference, but my reading of CORS indicates that they all will require it eventually.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. I've got |
||
| 'Access-Control-Allow-Headers' => 'Content-Type' | ||
| }, []] } | ||
|
|
||
| root to: 'projects#index' | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This constrains everyone to using JRuby, correct? Right now Squash is confirmed to work on CRuby 1.9.3, and JRuby 1.7.2 with the
--1.9flag. I'd like to preserve compatibility with both of these platforms and allow for the possibility of others in the future.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I wasn't sure what to do about this. This seems to be how you tell Heroku to use the JRuby buildpack. Perhaps this should be a setup.rb question? Or perhaps there's another way to specify it and there should be a README.Heroku with an explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Heroku need to use the JRuby buildpack? Obviously Squash's threaded model is more ideal under JRuby, but we could still open it to user choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it wasn't clear to me whether it was tested with the MRI. If that works, then sure.
I'd like to somehow have an "optimized" Heroku config that's easy to set up, because I suspect a lot of people will want to use Heroku. The only actual requirement to make it work may well be the git -> https change in Gemfile. But there are these other choices that may have a "right" non-default answer if you're not an expert. Maybe it should all be encapsulated in setup.rb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The git -> http change can be global; I see no harm in that. If you can determine a minimal set of changes necessary to make Heroku deployment as painless as possible, we can wrap them up into setup.rb.