-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
48 lines (37 loc) · 1.37 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
dir = File.dirname __FILE__
$LOAD_PATH << "#{dir}/lib" unless $LOAD_PATH.include? "#{dir}/lib"
require 'my_cluster/require'
require 'rake_ext'
delete_task :default
desc 'deploy app'
task :deploy do
cluster.services.fire_net.deploy
end
desc 'install basic tools'
task :install_basic do
cluster.services.basic.install
end
desc "backup database and files"
task :backup do
backup_dir = cluster.config.backup_path.to_dir[Time.now.to_date.to_s]
raise "backup path #{backup_dir.path} already exist!" if backup_dir.exist?
backup_dir.create
cluster.services.mongodb.dump_to backup_dir['db'].path
cluster.services.fs.dump_to backup_dir['fs'].path
end
desc "restore database"
task :restore_db do
raise "Are You shure? Comment out this line to proceed."
backup_dir = ENV['path'] || raise("backup path not specified (use path=... argument)!")
backup_dir = backup_dir.to_dir
raise "backup path '#{backup_dir.path}' not exist!" unless backup_dir.exist?
cluster.services.mongodb.restore_from backup_dir['db'].path
end
desc "restore files"
task :restore_fs do
raise "Are You shure? Comment out this line to proceed."
backup_dir = ENV['path'] || raise("backup path not specified (use path=... argument)!")
backup_dir = backup_dir.to_dir
raise "backup path '#{backup_dir.path}' not exist!" unless backup_dir.exist?
cluster.services.fs.restore_from backup_dir['fs'].path
end