NCCU 上傳版本 0709
Merge branch 'nccu0621' Conflicts: Gemfile config/resque.god vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb
This commit is contained in:
commit
09d46f2f75
79 files changed
+683
-278
No files matched your search
@@ -1 +1,2 @@
|
||||
APP_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")[Rails.env]
|
||||
LDAP_CONFIG = YAML.load_file("#{Rails.root}/config/ldap.yml")[Rails.env]
|
||||
@@ -6,20 +6,11 @@ $nccu_ldap_connection
|
||||
module NccuLdapConnection
|
||||
BASE = 'ou=People,dc=nccu,dc=edu,dc=tw'
|
||||
|
||||
@ldap_host = {
|
||||
:host => '127.0.0.1', #140.119.166.23 or 127.0.0.1
|
||||
:port => 8001, #389 or 8001
|
||||
# :filter => "(uid=#{login_uid})",
|
||||
# :base => "ou=People,dc=nccu,dc=edu,dc=tw",
|
||||
:authenticate_info => "cn=uccn,ou=profile,dc=nccu,dc=edu,dc=tw",
|
||||
:authenticate_pwd => "nccu2ucc"
|
||||
}
|
||||
|
||||
def self.establish
|
||||
$nccu_ldap_connection = Net::LDAP.new
|
||||
$nccu_ldap_connection.port = @ldap_host[:port]
|
||||
$nccu_ldap_connection.host = @ldap_host[:host]
|
||||
$nccu_ldap_connection.authenticate(@ldap_host[:authenticate_info],@ldap_host[:authenticate_pwd])
|
||||
$nccu_ldap_connection = Net::LDAP.new
|
||||
$nccu_ldap_connection.port =LDAP_CONFIG["port"]
|
||||
$nccu_ldap_connection.host = LDAP_CONFIG["host"]
|
||||
$nccu_ldap_connection.authenticate(LDAP_CONFIG["authenticate_info"],LDAP_CONFIG["authenticate_pwd"])
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
defaults: &defaults
|
||||
authenticate_info: 'cn=uccn,ou=profile,dc=nccu,dc=edu,dc=tw'
|
||||
authenticate_pwd: 'nccu2ucc'
|
||||
|
||||
development:
|
||||
<<: *defaults
|
||||
host: '127.0.0.1'
|
||||
port: 8001
|
||||
production:
|
||||
<<: *defaults
|
||||
host: '140.119.166.23'
|
||||
port: 389
|
||||
@@ -289,4 +289,7 @@ en:
|
||||
modal:
|
||||
close: Close
|
||||
preview: Preview
|
||||
|
||||
sys:
|
||||
not_previewable: "Preview not support"
|
||||
limit_of_upload_file_size: "Upload file must be less than: %{best_size}"
|
||||
|
||||
@@ -508,3 +508,10 @@ zh_tw:
|
||||
modal:
|
||||
close: "關閉"
|
||||
preview: "預覽"
|
||||
sys:
|
||||
not_previewable: "不支援預覽"
|
||||
limit_of_upload_file_size: "上傳檔案大小限制: %{best_size}"
|
||||
|
||||
object_disable:
|
||||
change_to_true: "設為停用"
|
||||
change_to_false: "重新啓用"
|
||||
+25
-13
@@ -1,20 +1,31 @@
|
||||
rails_env = 'development' #ENV['RAILS_ENV'] || "production"
|
||||
rails_root = ENV['RAILS_ROOT'] || "/Users/kaito/Documents/MyWorkspeace/NCCU"
|
||||
#developer pls change here
|
||||
rails_root = "/home/nccu/NCCU/" #keep this blank when development
|
||||
|
||||
development_uid = 'kaito' #when dev
|
||||
development_gid = 'staff' #when dev
|
||||
|
||||
#rails_env = "developement"
|
||||
rails_env = "production"
|
||||
|
||||
development_rails_root = File.expand_path("..",File.dirname(__FILE__))
|
||||
#rails_root = (rails_env == 'production' )? production_rails_root : development_rails_root
|
||||
num_workers = rails_env == 'production' ? 5 : 2
|
||||
|
||||
num_workers.times do |num|
|
||||
God.watch do |w|
|
||||
w.dir = "#{rails_root}"
|
||||
w.log = "#{rails_root}/log/myprocess.log"
|
||||
w.name = "resque-#{num}"
|
||||
w.group = 'resque'
|
||||
w.interval = 30.seconds
|
||||
p "/usr/bin/rake -f #{rails_root}/Rakefile resque:work QUEUE=* RAILS_ENV=#{rails_env}"
|
||||
# w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env}
|
||||
w.start = "rake -f #{rails_root}/Rakefile resque:work QUEUE=* RAILS_ENV=#{rails_env}"
|
||||
|
||||
w.uid = 'kaito'
|
||||
w.gid = 'staff'
|
||||
w.dir = rails_root
|
||||
w.name = "resque-#{num}"
|
||||
w.group = 'resque'
|
||||
|
||||
w.interval = 30.seconds
|
||||
w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env}
|
||||
w.start = "rake -f #{rails_root}/Rakefile resque:work QUEUE=* RAILS_ENV=#{rails_env}"
|
||||
|
||||
w.uid = (rails_env == 'production' )? "root" : development_uid
|
||||
w.gid = (rails_env == 'production' )? "root" : development_gid
|
||||
|
||||
w.log = (rails_env == 'production' )? "/var/log/#{w.name}.log":"#{rails_root}/log/#{w.name}.log"
|
||||
|
||||
# restart if memory gets too high
|
||||
w.transition(:up, :restart) do |on|
|
||||
@@ -53,4 +64,5 @@ num_workers.times do |num|
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
#developer pls change here
|
||||
rails_root = "/home/nccu/NCCU/" #keep this blank when development
|
||||
|
||||
development_uid = 'kaito' #when dev
|
||||
development_gid = 'staff' #when dev
|
||||
|
||||
#rails_env = "developement"
|
||||
rails_env = "production"
|
||||
|
||||
development_rails_root = File.expand_path("..",File.dirname(__FILE__))
|
||||
#rails_root = (rails_env == 'production' )? production_rails_root : development_rails_root
|
||||
|
||||
God.watch do |w|
|
||||
w.dir = rails_root
|
||||
w.name = "resque-scheduler"
|
||||
w.group = 'resque'
|
||||
w.interval = 30.seconds
|
||||
w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env}
|
||||
w.start = "rake -f #{rails_root}/Rakefile resque:scheduler RAILS_ENV=#{rails_env}"
|
||||
|
||||
w.uid = (rails_env == 'production' )? "root" : development_uid
|
||||
w.gid = (rails_env == 'production' )? "root" : development_gid
|
||||
|
||||
w.log = (rails_env == 'production' )? "/var/log/#{w.name}.log":"#{rails_root}/log/#{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
|
||||
|
||||
@@ -5,19 +5,19 @@
|
||||
# description: Runs the perform method in FetchTime
|
||||
|
||||
nccu_daily_ldap_sync:
|
||||
cron: * * [0,12] * * *
|
||||
cron: 0 0 [0,12] * * *
|
||||
class: SyncDb
|
||||
args:
|
||||
description: Sync NCCU middle site with Orbit for LDAP data
|
||||
|
||||
nccu_daily_backup:
|
||||
cron: * * 3 * * *
|
||||
cron: 0 0 3 * * *
|
||||
class: BackupServer
|
||||
args:
|
||||
description: Backup NCCU site
|
||||
|
||||
nccu_claender_sync:
|
||||
cron: * * [0,12] * * *
|
||||
cron: 0 0 [0,12] * * *
|
||||
class: NccuCalendar
|
||||
args:
|
||||
description: Sync NCCU calendar RSS Feeds
|
||||
+2
-1
@@ -140,7 +140,8 @@ Orbit::Application.routes.draw do
|
||||
}
|
||||
|
||||
# routes for gridfs files
|
||||
match "/gridfs/*path" => "gridfs#serve"
|
||||
match "/gridfs/*path" => "gridfs#serve"
|
||||
|
||||
# match "/images/*path" => "gridfs#serve_images"
|
||||
# match "/admin/pages/images/*path" => "gridfs#serve_images"
|
||||
|
||||
|
||||
Reference in new issue
Block a user