Removed omniauth and update dashboard disk usage for Ubuntu 14.04

This commit is contained in:
manson 2014-06-26 11:15:41 +08:00
parent f7f81c1bea
commit bb306364aa
5 changed files with 3 additions and 97 deletions

View File

@ -46,8 +46,7 @@ class Admin::DashboardsController < OrbitBackendController
end
def get_disk_usage
@usw = Usagewatch
render :json => @usw.uw_diskused_perc.to_s
render :json => `df -m /home`.scan(/\d+%/).first.gsub('%','') rescue '0'
end
def get_month_traffic

View File

@ -1,10 +0,0 @@
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def doorkeeper
oauth_data = request.env["omniauth.auth"]
@user = User.find_or_create_for_doorkeeper_oauth(oauth_data)
@user.update_doorkeeper_credentials(oauth_data)
@user.save
sign_in_and_redirect @user
end
end

View File

@ -1,5 +1,5 @@
update_tag_cloud:
cron: 0 0 [0,12] * * *
cron: 0 0 0,12 * * *
class: UpdateTagCloud
args:
description: UpdateTagCloud
@ -11,7 +11,7 @@ generate_system_summary:
description: Generate the system status such as disk free space,package version list for showing at site tab
email_cron:
cron: 0 0 [10,14,17,20] * * *
cron: 0 0 10,14,17,20 * * *
class: EmailCron
args:
description: EmailCron

View File

@ -1,57 +0,0 @@
rails_env = ENV['RAILS_ENV'] || "production"
rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/..'
user_home = ENV['HOME'] || File.dirname(__FILE__) + '/../..'
development_uid = ''
development_gid = ''
God.watch do |w|
w.dir = rails_root
w.name = "sunspot-solr"
w.group = 'rulingcom'
w.interval = 30.seconds
w.env = {"RAILS_ENV"=>rails_env}
w.start = "HOME=#{user_home} QUEUE=* RAILS_ENV=#{rails_env} rake -f #{rails_root}/Rakefile sunspot:solr:start"
w.keepalive
w.uid = (rails_env == 'production' )? "root" : development_uid
w.gid = (rails_env == 'production' )? "root" : development_gid
w.pid_file = "#{rails_root}/solr/pids/production/sunspot-solr-production.pid"
w.log = (rails_env == 'production' )? "/var/log/#{w.group}/#{w.name}.log":"#{rails_root}/log/dev-#{w.name}.log"
# restart if memory gets too high
w.transition(:up, :restart) do |on|
on.condition(:memory_usage) do |c|
c.above = 350.megabytes
c.times = 2
end
end
# determine the state on startup
w.transition(:init, { true => :up, false => :start }) do |on|
on.condition(:process_running) do |c|
c.running = true
end
end
# determine when process has finished starting
w.transition([:start, :restart], :up) do |on|
on.condition(:process_running) do |c|
c.running = true
c.interval = 5.seconds
end
# failsafe
on.condition(:tries) do |c|
c.times = 5
c.transition = :start
c.interval = 5.seconds
end
end
# start if process is not running
w.transition(:up, :start) do |on|
on.condition(:process_running) do |c|
c.running = false
end
end
end

View File

@ -1,26 +0,0 @@
module OmniAuth
module Strategies
class Doorkeeper < OmniAuth::Strategies::OAuth2
option :name, :doorkeeper
option :client_options, {
:site => "http://localhost:8000",
:authorize_path => "/oauth/authorize"
}
uid do
raw_info["id"]
end
info do
{
:email => raw_info["email"]
}
end
def raw_info
@raw_info ||= access_token.get('/api/v1/me.json').parsed
end
end
end
end