diff --git a/Gemfile b/Gemfile index b9791555..ef1c408a 100644 --- a/Gemfile +++ b/Gemfile @@ -23,6 +23,8 @@ gem 'dalli' gem 'pry' gem 'metriks', '0.9.9.2' +gem 'ar-octopus', github: 'tchandy/octopus', require: 'octopus' + group :test do gem 'rspec', '~> 2.11' gem 'factory_girl', '~> 2.4.0' diff --git a/Gemfile.lock b/Gemfile.lock index 9ea8a22b..230d1cff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,6 +43,14 @@ GIT activesupport hashr (~> 0.0.10) +GIT + remote: git://github.com/tchandy/octopus.git + revision: 8df2768bf37e75e6cc30816eeb9440748a2a3ae9 + specs: + ar-octopus (0.5.0beta) + activerecord (>= 2.3.0) + activesupport (>= 2.3.0) + GIT remote: git://github.com/travis-ci/travis-core.git revision: 75986691f25bd5533fa812dbe81638c7d1da3651 @@ -274,6 +282,7 @@ PLATFORMS ruby DEPENDENCIES + ar-octopus! bunny dalli database_cleaner (~> 0.8.0) diff --git a/lib/travis/api/app.rb b/lib/travis/api/app.rb index 609c5f0a..cd07ea96 100644 --- a/lib/travis/api/app.rb +++ b/lib/travis/api/app.rb @@ -118,6 +118,12 @@ module Travis::Api def self.setup_travis Travis::Amqp.config = Travis.config.amqp Travis::Database.connect + + Octopus.setup do |config| + config.shards = { :follower => Travis.config.database_follower } + config.environments = [:production] + end + Travis::Features.start if Travis.env == 'production' || Travis.env == 'staging' diff --git a/lib/travis/api/app/endpoint/repos.rb b/lib/travis/api/app/endpoint/repos.rb index 40c430ce..6e36e104 100644 --- a/lib/travis/api/app/endpoint/repos.rb +++ b/lib/travis/api/app/endpoint/repos.rb @@ -52,7 +52,9 @@ class Travis::Api::App # # json(:repository) get '/:owner_name/:name' do - respond_with service(:find_repo, params) + Octopus.using(:follower) do + respond_with service(:find_repo, params) + end end # Gets the builds for the repository with the given name.