forked from gitlabhq/gitlabhq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7bfd38e
commit c7bb3a1
Showing
14 changed files
with
75 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
web: bundle exec rails s -p $PORT | ||
worker: bundle exec rake environment resque:work QUEUE=* VVERBOSE=1 | ||
worker: bundle exec sidekiq -q post_receive,mailer,system_hook,common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
%h3.page_title Resque | ||
%h3.page_title Background Jobs | ||
%br | ||
.ui-box | ||
%iframe{src: resque_path, width: '100%', height: 600, style: "border: none"} | ||
%iframe{src: sidekiq_path, width: '100%', height: 900, style: "border: none"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
class SystemHookWorker | ||
@queue = :system_hook | ||
include Sidekiq::Worker | ||
|
||
def self.perform(hook_id, data) | ||
sidekiq_options queue: :system_hook | ||
|
||
def perform(hook_id, data) | ||
SystemHook.find(hook_id).execute data | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,22 @@ | ||
# Custom Redis configuration | ||
config_file = Rails.root.join('config', 'resque.yml') | ||
|
||
if File.exists?(config_file) | ||
resque_config = YAML.load_file(config_file) | ||
Resque.redis = resque_config[Rails.env] | ||
end | ||
Resque.redis.namespace = 'resque:gitlab' | ||
Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection } | ||
|
||
# Authentication | ||
require 'resque/server' | ||
class ResqueAuthentication | ||
def initialize(app) | ||
@app = app | ||
end | ||
resque_url = if File.exists?(config_file) | ||
YAML.load_file(config_file)[Rails.env] | ||
else | ||
"localhost:6379" | ||
end | ||
|
||
def call(env) | ||
account = env['warden'].authenticate!(:database_authenticatable, :rememberable, scope: :user) | ||
raise "Access denied" if !account.admin? | ||
@app.call(env) | ||
end | ||
Sidekiq.configure_server do |config| | ||
config.redis = { | ||
url: "redis://#{resque_url}", | ||
namespace: 'resque:gitlab' | ||
} | ||
end | ||
|
||
Resque::Server.use ResqueAuthentication | ||
|
||
# Mailer | ||
Resque::Mailer.excluded_environments = [] | ||
|
||
Sidekiq.configure_client do |config| | ||
config.redis = { | ||
url: "redis://#{resque_url}", | ||
namespace: 'resque:gitlab' | ||
} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters