add sidekiq

master
Thomas Riboulet 9 years ago
parent 1c84fb6e47
commit 79efb2a345

@ -1,2 +1,3 @@
RACK_ENV=production RACK_ENV=production
PORT=80 PORT=80
REDIS_URL=redis://dev1.fsquic.0001.euw1.cache.amazonaws.com:6379/1

@ -12,4 +12,4 @@ RUN git clone https://github.com/mcansky/sinatra_hello.git /var/app
RUN cd /var/app; bundle install RUN cd /var/app; bundle install
EXPOSE 80 EXPOSE 80
CMD ["/usr/local/bin/foreman","start","-d","/var/app"] CMD ["/usr/local/bin/foreman","run", "web","-d","/var/app"]

@ -2,4 +2,6 @@ source 'https://rubygems.org'
gem 'sinatra' gem 'sinatra'
gem 'haml' gem 'haml'
gem 'redis'
gem 'sidekiq'
gem 'puma' gem 'puma'

@ -1,45 +1,41 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
capistrano (2.15.5) celluloid (0.16.0)
highline timers (~> 4.0.0)
net-scp (>= 1.0.0) connection_pool (2.1.2)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
haml (4.0.5) haml (4.0.5)
tilt tilt
highline (1.6.21) hitimes (1.2.2)
kgio (2.9.2) json (1.8.2)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.8.0)
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
puma (2.11.1) puma (2.11.1)
rack (>= 1.1, < 2.0) rack (>= 1.1, < 2.0)
rack (1.5.2) rack (1.5.2)
rack-protection (1.5.2) rack-protection (1.5.2)
rack rack
raindrops (0.13.0) redis (3.2.1)
redis-namespace (1.5.1)
redis (~> 3.0, >= 3.0.4)
sidekiq (3.3.2)
celluloid (>= 0.16.0)
connection_pool (>= 2.1.1)
json
redis (>= 3.0.6)
redis-namespace (>= 1.3.1)
sinatra (1.4.4) sinatra (1.4.4)
rack (~> 1.4) rack (~> 1.4)
rack-protection (~> 1.4) rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4) tilt (~> 1.3, >= 1.3.4)
tilt (1.4.1) tilt (1.4.1)
unicorn (4.8.2) timers (4.0.1)
kgio (~> 2.6) hitimes
rack
raindrops (~> 0.7)
PLATFORMS PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
capistrano (= 2.15.5)
haml haml
puma puma
redis
sidekiq
sinatra sinatra
unicorn

@ -1,2 +1,3 @@
require './hello' require './hello'
run SimpleApp require 'sidekiq/web'
run Rack::URLMap.new('/' => SimpleApp, '/sidekiq' => Sidekiq::Web)

@ -1,10 +1,27 @@
require 'sinatra' require 'sinatra'
require 'haml' require 'haml'
require 'sidekiq'
Sidekiq.configure_server do |config|
config.redis = { url: ENV['REDIS_URL'] || 'redis://localhost:6379/1', namespace: 'sidekiq' }
end
class MyRedis
def self.redis
@@redis ||= Redis.new(url: ENV['REDIS_URL'] || 'redis://localhost:6379/1' )
@@redis.set('blob', '200000000000000000000000')
@@redis
end
def self.value
MyRedis.redis.get('blob')
end
end
class SimpleApp < Sinatra::Base class SimpleApp < Sinatra::Base
get '/' do get '/' do
haml "%h3 Hello THE BEANSTALK AWESOME World!" haml "%h3 Hello THE BEANSTALK AWESOME World! #{MyRedis.value}"
end end
get '/mu-c9478619-b3ea1fef-e218a7ee-09081759' do get '/mu-c9478619-b3ea1fef-e218a7ee-09081759' do

Loading…
Cancel
Save