gearheads
/
mastodon
Archived
2
0
Fork 0

Adding Sidekiq for background processing (firstly just of mailers)

gh/stable
Eugen Rochko 2016-03-25 02:50:48 +01:00
parent a08e724476
commit 42dcb0d4cb
6 changed files with 46 additions and 2 deletions

View File

@ -37,6 +37,8 @@ gem 'simple_form'
gem 'will_paginate', '~> 3.0.6' gem 'will_paginate', '~> 3.0.6'
gem 'rack-attack' gem 'rack-attack'
gem 'turbolinks', '~> 5.0.0.beta' gem 'turbolinks', '~> 5.0.0.beta'
gem 'sidekiq'
gem 'sinatra', :require => nil
group :development, :test do group :development, :test do
gem 'rspec-rails' gem 'rspec-rails'

View File

@ -60,6 +60,7 @@ GEM
execjs execjs
coffee-script-source (1.10.0) coffee-script-source (1.10.0)
concurrent-ruby (1.0.1) concurrent-ruby (1.0.1)
connection_pool (2.2.0)
crack (0.4.3) crack (0.4.3)
safe_yaml (~> 1.0.0) safe_yaml (~> 1.0.0)
debug_inspector (0.0.2) debug_inspector (0.0.2)
@ -188,6 +189,8 @@ GEM
rack rack
rack-mini-profiler (0.9.9.2) rack-mini-profiler (0.9.9.2)
rack (>= 1.2.0) rack (>= 1.2.0)
rack-protection (1.5.3)
rack
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
rails (4.2.5.2) rails (4.2.5.2)
@ -271,6 +274,10 @@ GEM
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0) rdoc (~> 4.0)
sexp_processor (4.7.0) sexp_processor (4.7.0)
sidekiq (4.1.1)
concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0)
redis (~> 3.2, >= 3.2.1)
simple_form (3.2.1) simple_form (3.2.1)
actionpack (> 4, < 5.1) actionpack (> 4, < 5.1)
activemodel (> 4, < 5.1) activemodel (> 4, < 5.1)
@ -279,6 +286,10 @@ GEM
json (~> 1.8) json (~> 1.8)
simplecov-html (~> 0.10.0) simplecov-html (~> 0.10.0)
simplecov-html (0.10.0) simplecov-html (0.10.0)
sinatra (1.4.7)
rack (~> 1.5)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
slop (3.6.0) slop (3.6.0)
sprockets (3.5.2) sprockets (3.5.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
@ -362,8 +373,10 @@ DEPENDENCIES
rubocop rubocop
sass-rails (~> 5.0) sass-rails (~> 5.0)
sdoc (~> 0.4.0) sdoc (~> 0.4.0)
sidekiq
simple_form simple_form
simplecov simplecov
sinatra
therubyracer therubyracer
turbolinks (~> 5.0.0.beta) turbolinks (~> 5.0.0.beta)
uglifier (>= 1.3.0) uglifier (>= 1.3.0)

View File

@ -28,6 +28,8 @@ module Mastodon
config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb') config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')] config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
config.active_job.queue_adapter = :sidekiq
config.to_prepare do config.to_prepare do
Doorkeeper::ApplicationsController.layout 'dashboard' Doorkeeper::ApplicationsController.layout 'dashboard'
Doorkeeper::AuthorizedApplicationsController.layout 'dashboard' Doorkeeper::AuthorizedApplicationsController.layout 'dashboard'

View File

@ -0,0 +1,11 @@
redis_conn = proc {
$redis.dup
}
Sidekiq.configure_server do |config|
config.redis = ConnectionPool.new(size: 5, &redis_conn)
end
Sidekiq.configure_client do |config|
config.redis = ConnectionPool.new(size: 25, &redis_conn)
end

View File

@ -1,4 +1,10 @@
require 'sidekiq/web'
Rails.application.routes.draw do Rails.application.routes.draw do
authenticate :user do
mount Sidekiq::Web => '/sidekiq'
end
use_doorkeeper do use_doorkeeper do
controllers applications: 'oauth/applications' controllers applications: 'oauth/applications'
end end

View File

@ -4,8 +4,11 @@ services:
image: postgres image: postgres
redis: redis:
image: redis image: redis
web: app:
build: . build: .
env_file: .env.production
web:
extends: app
command: bundle exec rails s -p 3000 -b '0.0.0.0' command: bundle exec rails s -p 3000 -b '0.0.0.0'
ports: ports:
- "3000:3000" - "3000:3000"
@ -15,4 +18,11 @@ services:
volumes: volumes:
- ./public/assets:/mastodon/public/assets - ./public/assets:/mastodon/public/assets
- ./public/system:/mastodon/public/system - ./public/system:/mastodon/public/system
env_file: .env.production sidekiq:
extends: app
command: bundle exec sidekiq -q default -q mailers
depends_on:
- db
- redis
volumes:
- ./public/system:/mastodon/public/system