backup_utility 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d41654a1ca31d6f78003b58f3e4114cb0e264a2f
4
+ data.tar.gz: 82a58888249ce927b8ec81e997103a3e3e7681b3
5
+ SHA512:
6
+ metadata.gz: cdca41a706c5e0999c55a70e1ca04245f8042b1457701e7acffda450867ccd977ee4343fa94aedbf698b20369244f9c7cb69eb73e8c497792c0aa539e1dd4ddc
7
+ data.tar.gz: 375797fcadb2bb340ea2d23f4b7ea6e5f10c801c1ba8ebd74ff2b81028202f2d2f778200980fd6c735ac5fa5cae398a05fa7705f11b10da2fe272623c79c3546
@@ -1,4 +1,5 @@
1
1
  module BackupUtility; end
2
2
  require 'backup_utility/base'
3
+ require 'backup_utility/file'
3
4
  require 'backup_utility/postgres'
4
5
  require 'backup_utility/mongo'
@@ -1,6 +1,6 @@
1
1
  require 'fileutils'
2
2
 
3
- CODE_DIR = '/home/twist/code'
3
+ CODE_DIR = '/srv/www/stats/current/script/code'
4
4
  BACKUP_DIR = '/home/twist/backups'
5
5
  SHARED_DIR = '/mnt/shared_storage2/database/backups'
6
6
  class BackupUtility::Base
@@ -191,7 +191,7 @@ class BackupUtility::Base
191
191
 
192
192
  def send_file_to_s3(backup_file)
193
193
  if @use_code
194
- `/usr/bin/python #{@code_dir}/S3Storage.py upload #{backup_file}`
194
+ `/usr/local/bin/ruby #{@code_dir}/s3_storage.rb upload #{backup_file}`
195
195
  return true
196
196
  end
197
197
  bucket = 'twistage-backup'
@@ -35,7 +35,7 @@ class BackupUtility::File < BackupUtility::Base
35
35
  type = label.to_sym
36
36
  else
37
37
  type = type.to_sym
38
- map = {:logs => '/home/twist/stats_prod/shared/nginx_logs/archive'
38
+ map = {:logs => '/var/log/nginx'
39
39
  }
40
40
  if map.has_key?(type)
41
41
  src_dir = map[type]
@@ -80,8 +80,11 @@ class BackupUtility::Postgres < BackupUtility::Base
80
80
  end
81
81
 
82
82
  def pg_dump_command
83
- cmd = "#{BIN}/pg_dump -F#{@backup_format} -U #{@pg_user}"
84
- cmd += " -h #{@pg_host}" if @pg_host
83
+ config = Rails.configuration.database_configuration[Rails.env]
84
+ password = config ['password']
85
+ host = config['host']
86
+ cmd = "export PGPASSWORD=#{password};#{BIN}/pg_dump -F#{@backup_format} -U #{@pg_user}"
87
+ cmd += " -h #{host}"
85
88
  cmd += " -p #{@pg_port}" if @pg_port
86
89
  cmd
87
90
  end
@@ -165,9 +168,12 @@ class BackupUtility::Postgres < BackupUtility::Base
165
168
  end
166
169
 
167
170
  def psql_dump_cmd(cmd, dump_file)
168
- cmd = "#{BIN}/psql -c \"#{cmd}\" -F '"
171
+ config = Rails.configuration.database_configuration[Rails.env]
172
+ password = config ['password']
173
+ host = config['host']
174
+ cmd = "export PGPASSWORD=#{password};#{BIN}/psql -c \"#{cmd}\" -F '"
169
175
  cmd += 9.chr
170
- cmd += "' -A -d #{@db_name} -U #{@pg_user} -t | gzip > #{dump_file}"
176
+ cmd += "' -A -d #{@db_name} -U #{@pg_user} -h #{host} -t | gzip > #{dump_file}"
171
177
  cmd
172
178
  end
173
179
 
metadata CHANGED
@@ -1,68 +1,47 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: backup_utility
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 0
8
- - 1
9
- version: 1.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Bruce Wang
13
8
  autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
-
17
- date: 2012-11-02 00:00:00 -07:00
18
- default_executable:
11
+ date: 2016-08-26 00:00:00.000000000 Z
19
12
  dependencies: []
20
-
21
13
  description: Create database dumps and store them in a remote location
22
14
  email: bwang@twistage.com
23
15
  executables: []
24
-
25
16
  extensions: []
26
-
27
17
  extra_rdoc_files: []
28
-
29
- files:
18
+ files:
30
19
  - lib/backup_utility.rb
31
20
  - lib/backup_utility/base.rb
32
21
  - lib/backup_utility/file.rb
33
22
  - lib/backup_utility/mongo.rb
34
23
  - lib/backup_utility/postgres.rb
35
- has_rdoc: true
36
24
  homepage: http://rubygems.org/gems/backup_utility
37
25
  licenses: []
38
-
26
+ metadata: {}
39
27
  post_install_message:
40
28
  rdoc_options: []
41
-
42
- require_paths:
29
+ require_paths:
43
30
  - lib
44
- required_ruby_version: !ruby/object:Gem::Requirement
45
- none: false
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- segments:
50
- - 0
51
- version: "0"
52
- required_rubygems_version: !ruby/object:Gem::Requirement
53
- none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- segments:
58
- - 0
59
- version: "0"
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
60
41
  requirements: []
61
-
62
42
  rubyforge_project:
63
- rubygems_version: 1.3.7
43
+ rubygems_version: 2.0.14.1
64
44
  signing_key:
65
- specification_version: 3
45
+ specification_version: 4
66
46
  summary: Backup Utility
67
47
  test_files: []
68
-