scalingo_databases_rake_tasks 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/scalingo_databases_rake_tasks/tasks/mongodb.rake +9 -6
- data/lib/scalingo_databases_rake_tasks/tasks/mysql.rake +2 -2
- data/lib/scalingo_databases_rake_tasks/tasks/postgresql.rake +3 -3
- data/lib/scalingo_databases_rake_tasks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0924ed88a76b3f23eff86859e42ada5579331c2c'
|
4
|
+
data.tar.gz: 35aad8839729081c3d7f4e340912de956da7850e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81b514490cdeb6ecd90d25b8778b6fee3fc4a3acad1a1261539ac71a8864812c7cb17eb26f536c9de4d8b18270c18b5d54b899cff0a1c3fa842a732dcc4c4141
|
7
|
+
data.tar.gz: 0b9e25f9cf7fe5e5aa70c43afc655f086900baa4b3c4b1d08fc7063fd449aa56071f0bd06bb05dcd257d4a1581090108958f69daf10244efd2f118f3b2282800
|
data/CHANGELOG.md
CHANGED
@@ -7,7 +7,7 @@ namespace :scalingo do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
desc "Backup remote Scalingo MongoDB database"
|
10
|
-
task :backup_remote
|
10
|
+
task :backup_remote do
|
11
11
|
open_tunnel("SCALINGO_MONGO_URL") do |database, user, password|
|
12
12
|
ScalingoMongoDB.backup(database, user, password, "127.0.0.1:27717")
|
13
13
|
end
|
@@ -20,7 +20,7 @@ namespace :scalingo do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
desc "Restore remote Scalingo MongoDB database using local backup"
|
23
|
-
task :restore_remote
|
23
|
+
task :restore_remote do
|
24
24
|
open_tunnel("SCALINGO_MONGO_URL") do |database, user, password|
|
25
25
|
confirm_remote(database)
|
26
26
|
ScalingoMongoDB.restore(database, user, password, "127.0.0.1:27717")
|
@@ -31,7 +31,6 @@ namespace :scalingo do
|
|
31
31
|
|
32
32
|
module ScalingoMongoDB
|
33
33
|
DUMP_NAME = "scalingo_mongodb_dump"
|
34
|
-
DUMP_PATH = Dir.tmpdir() + "/#{DUMP_NAME}"
|
35
34
|
|
36
35
|
def self.local_credentials(filename)
|
37
36
|
filename ||= "mongoid"
|
@@ -63,7 +62,8 @@ namespace :scalingo do
|
|
63
62
|
if ENV["EXCLUDE_COLLECTIONS"]
|
64
63
|
extra_args = ENV["EXCLUDE_COLLECTIONS"].split(",").map{|c| "--excludeCollection=\"#{c}\""}.join(" ")
|
65
64
|
end
|
66
|
-
|
65
|
+
workdir = Dir.mktmpdir("scalingo-mongodb")
|
66
|
+
cmd = "/usr/bin/env mongodump -h #{host} -d #{database} -o #{workdir} #{extra_args}"
|
67
67
|
if user.blank?
|
68
68
|
output = cmd
|
69
69
|
else
|
@@ -87,8 +87,9 @@ namespace :scalingo do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def self.restore database, user, password, host
|
90
|
-
|
91
|
-
cmd
|
90
|
+
workdir = Dir.mktmpdir("scalingo-mongodb")
|
91
|
+
cmd = "tar xvzf #{archive_name DUMP_NAME} -C #{workdir}"
|
92
|
+
cmd << " && /usr/bin/env mongorestore --drop -h #{host} -d #{database} --dir #{workdir}/*"
|
92
93
|
if user.blank?
|
93
94
|
output = cmd
|
94
95
|
else
|
@@ -104,6 +105,8 @@ namespace :scalingo do
|
|
104
105
|
|
105
106
|
puts "*** Executing #{output}"
|
106
107
|
system(cmd)
|
108
|
+
puts "*** Cleaning #{workdir}"
|
109
|
+
FileUtils.rm_r workdir
|
107
110
|
end
|
108
111
|
|
109
112
|
def self.mongoid_configuration_key
|
@@ -7,7 +7,7 @@ namespace :scalingo do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
desc "Backup remote Scalingo MySQL database"
|
10
|
-
task :backup_remote
|
10
|
+
task :backup_remote do
|
11
11
|
open_tunnel("SCALINGO_MYSQL_URL") do |database, user, password|
|
12
12
|
ScalingoMySQL.backup(database, user, password, "127.0.0.1", 27717)
|
13
13
|
end
|
@@ -20,7 +20,7 @@ namespace :scalingo do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
desc "Restore remote Scalingo MySQL database using local backup"
|
23
|
-
task :restore_remote
|
23
|
+
task :restore_remote do
|
24
24
|
open_tunnel("SCALINGO_MYSQL_URL") do |database, user, password|
|
25
25
|
confirm_remote(database)
|
26
26
|
ScalingoMySQL.restore(database, user, password, "127.0.0.1", 27717)
|
@@ -7,7 +7,7 @@ namespace :scalingo do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
desc "Backup remote Scalingo PostgreSQL database"
|
10
|
-
task :backup_remote
|
10
|
+
task :backup_remote do
|
11
11
|
open_tunnel("SCALINGO_POSTGRESQL_URL") do |database, user, password|
|
12
12
|
ScalingoPostgreSQL.backup(database, user, password, "127.0.0.1", "27717")
|
13
13
|
end
|
@@ -20,7 +20,7 @@ namespace :scalingo do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
desc "Restore remote Scalingo PostgreSQL database using local backup"
|
23
|
-
task :restore_remote
|
23
|
+
task :restore_remote do
|
24
24
|
open_tunnel("SCALINGO_POSTGRESQL_URL") do |database, user, password|
|
25
25
|
confirm_remote(database)
|
26
26
|
ScalingoPostgreSQL.restore(database, user, password, "127.0.0.1", "27717")
|
@@ -117,7 +117,7 @@ namespace :scalingo do
|
|
117
117
|
major, minor = version.split('.')
|
118
118
|
major.to_i >= 9 && minor.to_i >= 4
|
119
119
|
end
|
120
|
-
|
120
|
+
|
121
121
|
def self.pg_restore_9_1?
|
122
122
|
pg_restore_cmd = ENV["PG_RESTORE_CMD"] || "pg_restore"
|
123
123
|
version = `#{pg_restore_cmd} --version`.split.last
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scalingo_databases_rake_tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scalingo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|