add log rotate into site build procedure.
This commit is contained in:
parent
a63193dc65
commit
a88ad35641
|
@ -18,6 +18,10 @@ namespace :site do
|
|||
Info.create!(key: "profile", built_in: true, disabled: false, title: {"zh_tw"=>"基本欄位", "en"=>"Basic Info"}, to_search: false)
|
||||
end
|
||||
|
||||
task :create_logrotate => :environment do #Can remove after all products update
|
||||
create_rulingcom_logrotate
|
||||
end
|
||||
|
||||
task :necessary_data => :environment do
|
||||
puts "Enter your resque namespace[Orbit]:......"
|
||||
@resque_namespace = STDIN.gets.gsub("\n",'')
|
||||
|
@ -44,6 +48,7 @@ namespace :site do
|
|||
if site_is_primary
|
||||
solr_setting = ERB.new(File.new("lib/template/setting/solr.god.erb").read)
|
||||
File.open("config/solr.god", 'w') { |file| file.write(solr_setting.result) }
|
||||
create_rulingcom_logrotate
|
||||
end
|
||||
|
||||
site = Site.first
|
||||
|
@ -63,6 +68,24 @@ namespace :site do
|
|||
home.save
|
||||
|
||||
puts "Rember to restart server after you setup all sites for starting God"
|
||||
|
||||
def create_rulingcom_logrotate
|
||||
@project_folder = ENV["PWD"]
|
||||
puts "Is your Orbit folder: #{@project_folder} (If YES => Press enter,or enter your path)"
|
||||
user_enter_project_folder = STDIN.gets.gsub("\n",'')
|
||||
@project_folder = user_enter_project_folder unless user_enter_project_folder.empty?
|
||||
|
||||
@user_home_folder = ENV["HOME"]
|
||||
puts "Is your Home folder: #{@user_home_folder} (If YES => Press enter,or enter your path)"
|
||||
user_enter_home_folder = STDIN.gets.gsub("\n",'')
|
||||
@user_home_folder = user_enter_home_folder unless user_enter_home_folder.empty?
|
||||
|
||||
logrotate_setting = ERB.new(File.new("lib/template/setting/rulingcom_log.erb").read)
|
||||
File.open("#{@project_loc}/tmp/logrotate_setting", 'w') { |file| file.write(logrotate_setting.result) }
|
||||
|
||||
`sudo cp #{@project_loc}/tmp/logrotate_setting /etc/logrotate.d/rulingcom`
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
#Put logrotate setting for Orbit here
|
||||
|
||||
|
||||
#Might need partial
|
||||
/var/log/basedir/*.log /var/log/basedir/*/*.log {
|
||||
daily
|
||||
rotate 5
|
||||
}
|
||||
|
||||
#Resque
|
||||
#Orbit
|
||||
#DB log
|
||||
|
||||
|
||||
|
||||
#Remember to save this file as /etc/logrotate.d/orbit
|
|
@ -0,0 +1,25 @@
|
|||
/var/log/rulingcom/*.log {
|
||||
daily
|
||||
rotate 5
|
||||
}
|
||||
|
||||
#Resque
|
||||
<%= "#{@project_folder}/nginx/logs/access.log" %>{
|
||||
daily
|
||||
rotate 5
|
||||
}
|
||||
|
||||
#DB log
|
||||
/var/log/mongodb{
|
||||
daily
|
||||
rotate 5
|
||||
}
|
||||
|
||||
#Orbit
|
||||
<%= "#{@project_folder}/log/*production.log" %>{
|
||||
daily
|
||||
rotate 5
|
||||
}
|
||||
# end of Orbit,EXTEND IF NEEDED
|
||||
|
||||
#Remember to save this file as /etc/logrotate.d/rulingcom
|
Loading…
Reference in New Issue