add sidekiq

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

@ -1,2 +1,3 @@
RACK_ENV=production
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
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 'haml'
gem 'redis'
gem 'sidekiq'
gem 'puma'

@ -1,45 +1,41 @@
GEM
remote: https://rubygems.org/
specs:
capistrano (2.15.5)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
celluloid (0.16.0)
timers (~> 4.0.0)
connection_pool (2.1.2)
haml (4.0.5)
tilt
highline (1.6.21)
kgio (2.9.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)
hitimes (1.2.2)
json (1.8.2)
puma (2.11.1)
rack (>= 1.1, < 2.0)
rack (1.5.2)
rack-protection (1.5.2)
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)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
tilt (1.4.1)
unicorn (4.8.2)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
timers (4.0.1)
hitimes
PLATFORMS
ruby
DEPENDENCIES
capistrano (= 2.15.5)
haml
puma
redis
sidekiq
sinatra
unicorn

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

@ -1,10 +1,27 @@
require 'sinatra'
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
get '/' do
haml "%h3 Hello THE BEANSTALK AWESOME World!"
haml "%h3 Hello THE BEANSTALK AWESOME World! #{MyRedis.value}"
end
get '/mu-c9478619-b3ea1fef-e218a7ee-09081759' do

Loading…
Cancel
Save