From 947ebc5cde72334753d9dbca094e0a827087b68f Mon Sep 17 00:00:00 2001 From: Walter Smith Date: Fri, 25 Jan 2013 21:15:57 -0800 Subject: [PATCH 1/4] Use Puma web server --- Gemfile | 4 ++++ Gemfile.lock | 9 +++++++++ Procfile | 1 + 3 files changed, 14 insertions(+) create mode 100644 Procfile diff --git a/Gemfile b/Gemfile index e38df340..a6164db3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,9 @@ source :rubygems +# SERVER +gem 'puma' +gem 'jruby-openssl', platform: :jruby + # FRAMEWORK gem 'rails', git: 'git://github.com/rails/rails.git', branch: '3-2-stable' # We need to use this branch of Rails because it includes fixes for ActiveRecord diff --git a/Gemfile.lock b/Gemfile.lock index 81053816..dcecf8ac 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -78,6 +78,7 @@ GEM addressable (2.3.2) arel (3.0.2) boolean (1.0.1) + bouncy-castle-java (1.5.0146.1) builder (3.0.4) coffee-rails (3.2.2) coffee-script (>= 2.2.0) @@ -124,6 +125,8 @@ GEM jquery-rails (2.1.4) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) + jruby-openssl (0.8.2) + bouncy-castle-java (>= 1.5.0146.1) json (1.7.6) json (1.7.6-java) json-schema (1.1.1) @@ -151,6 +154,10 @@ GEM pg (0.14.1) plist (3.1.0) polyglot (0.3.3) + puma (1.6.3) + rack (~> 1.2) + puma (1.6.3-java) + rack (~> 1.2) rack (1.4.4) rack-cache (1.2) rack (>= 0.4) @@ -253,6 +260,7 @@ DEPENDENCIES has_metadata_column! jira-ruby jquery-rails + jruby-openssl json json_serialize kramdown @@ -260,6 +268,7 @@ DEPENDENCIES libv8 (~> 3.11.8) net-ldap pg + puma rack-cors rails! redcarpet diff --git a/Procfile b/Procfile new file mode 100644 index 00000000..a8a3fc4b --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: bundle exec rails server puma -p $PORT -e $RACK_ENV From e51b018f8e5267b1f4f036ba57d8065135a445d3 Mon Sep 17 00:00:00 2001 From: Walter Smith Date: Fri, 25 Jan 2013 21:16:14 -0800 Subject: [PATCH 2/4] Specify JRuby version in Gemfile --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index a6164db3..87c01f53 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ source :rubygems +ruby '1.9.3', :engine => 'jruby', :engine_version => '1.7.2' # SERVER gem 'puma' From ee3a49a8aa2c106b30d8fdcd1d04458b3d7d33d4 Mon Sep 17 00:00:00 2001 From: Walter Smith Date: Fri, 25 Jan 2013 21:53:38 -0800 Subject: [PATCH 3/4] Switch to https Git URLs in Gemfile Heroku can't use git@github.com URLs. --- Gemfile | 8 ++++---- Gemfile.lock | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index 87c01f53..fde5c389 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ gem 'puma' gem 'jruby-openssl', platform: :jruby # 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 @@ -16,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 @@ -33,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 diff --git a/Gemfile.lock b/Gemfile.lock index dcecf8ac..76313d6d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,12 @@ GIT - remote: git://github.com/RISCfuture/composite_primary_keys.git + remote: https://github.com/RISCfuture/composite_primary_keys.git revision: 4f624f3a431b5ad3fa2d80e58b118896c356dffe specs: composite_primary_keys (5.0.12) activerecord (~> 3.2.0, >= 3.2.9) GIT - remote: git://github.com/RISCfuture/has_metadata_column.git + remote: https://github.com/RISCfuture/has_metadata_column.git revision: 2aebf034ab97365cfbf56073c24c3a28fe2dc4ae specs: has_metadata_column (1.0.3) @@ -14,13 +14,13 @@ GIT rails (>= 3.0) GIT - remote: git://github.com/RISCfuture/ruby-git.git + remote: https://github.com/RISCfuture/ruby-git.git revision: 473d8ecc1fd49cbfcbabff0061484319d4bac9fa specs: git (1.2.5) GIT - remote: git://github.com/rails/rails.git + remote: https://github.com/rails/rails.git revision: a3aca81b21f793e8869440e9e84ead80c2479e3d branch: 3-2-stable specs: From cfa30e604bf0efee49d8802b2a6eff41a6e41e93 Mon Sep 17 00:00:00 2001 From: Walter Smith Date: Thu, 17 Jan 2013 17:15:30 -0800 Subject: [PATCH 4/4] Respond to OPTIONS /api/1.0/notify CORS-compliant browsers will make this request before allowing the notify request. --- config/routes.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/routes.rb b/config/routes.rb index aee2c2ba..afc04160 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -67,5 +67,12 @@ get 'search/suggestions' => 'search#suggestions' get 'search' => 'search#search' + match 'api/1.0/notify', :constraints => {:method => 'OPTIONS'}, + :to => lambda { |env| [200, { + 'Access-Control-Allow-Origin' => '*', + 'Access-Control-Request-Method' => '*', + 'Access-Control-Allow-Headers' => 'Content-Type' + }, []] } + root to: 'projects#index' end