alcapon 0.4.17 → 0.4.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/capezit +7 -0
- data/lib/alcapon/utils.rb +54 -0
- data/lib/capez.rb +21 -9
- data/lib/db.rb +27 -17
- data/lib/ext/spinner.rb +0 -0
- data/lib/ezpublish5/deploy.rb +0 -0
- data/lib/ezpublish5.rb +0 -0
- data/lib/utils.rb +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ad2a04b0b969ddcdd084c811fca9eded8b1c501
|
4
|
+
data.tar.gz: c657ccd1631591f313ecfc06940ca6297cad240e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0c27c326b6358b238912fab48f0555d9c8899ff7176c8c37252239172472ca48de9d78746a6db000c960468634f783f41a8f52148242ec7333155991b734744
|
7
|
+
data.tar.gz: e12957da18393dac9dbc6ba3d6e089ce0755b410195a1d989ed09c4c1868ac9127db060e4d90e36e2c5034dc03125adfb14f1e49fbe4d4716e63f4e4c60493fa
|
data/bin/capezit
CHANGED
@@ -188,6 +188,13 @@ files = {
|
|
188
188
|
# IMPORTANT: requires that the database is already created before it is run
|
189
189
|
set :ezp5_regenerate_config, false
|
190
190
|
|
191
|
+
# Parameters when ezdfs is used
|
192
|
+
#set :ezdfs_mount_path, "/path/to/your/(NFS|GlusterFS|Samba) mount"
|
193
|
+
#set :ezdfs_database_server, "localhost"
|
194
|
+
#set :ezdfs_database_name, "dbname"
|
195
|
+
#set :ezdfs_database_uname, "dbuname"
|
196
|
+
#set :ezdfs_database_passd, "dbpasswd"
|
197
|
+
|
191
198
|
|
192
199
|
# TODO : use yml files to manage database credentials securely
|
193
200
|
# See http://www.simonecarletti.com/blog/2009/06/capistrano-and-database-yml/
|
@@ -0,0 +1,54 @@
|
|
1
|
+
def unindent(string)
|
2
|
+
indentation = string[/\A\s*/]
|
3
|
+
string.strip.gsub(/^#{indentation}/, "")
|
4
|
+
end
|
5
|
+
|
6
|
+
def capez_puts_done
|
7
|
+
puts '✔'.green
|
8
|
+
end
|
9
|
+
|
10
|
+
def print_dotted( message, options={} )
|
11
|
+
defaults_options = { :eol => false,
|
12
|
+
:sol => false,
|
13
|
+
:max_length => 40,
|
14
|
+
:eol_msg => false }
|
15
|
+
|
16
|
+
options = defaults_options.merge( options )
|
17
|
+
message = "#{message} " + "." * [0,options[:max_length]-message.length-1].max
|
18
|
+
|
19
|
+
if options[:sol]
|
20
|
+
message = "\n#{message}"
|
21
|
+
end
|
22
|
+
|
23
|
+
if options[:eol_msg]
|
24
|
+
message += " #{options[:eol_msg]}"
|
25
|
+
end
|
26
|
+
|
27
|
+
if options[:eol]
|
28
|
+
puts message
|
29
|
+
else
|
30
|
+
print message
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def ezp5?
|
35
|
+
return ( fetch( :ezpublish_version, nil ) == 5 )
|
36
|
+
end
|
37
|
+
|
38
|
+
def ezp_legacy_path(path='')
|
39
|
+
elements = Array.new
|
40
|
+
|
41
|
+
if( fetch( :ezp_legacy, "" ) != "" )
|
42
|
+
elements += [ "#{ezp_legacy}" ]
|
43
|
+
end
|
44
|
+
|
45
|
+
if( path != '' )
|
46
|
+
elements += [ "#{path}" ]
|
47
|
+
end
|
48
|
+
|
49
|
+
return File.join( elements )
|
50
|
+
end
|
51
|
+
|
52
|
+
def alcapon_message(string)
|
53
|
+
puts( "[alcapon]".green+" #{string}" )
|
54
|
+
end
|
data/lib/capez.rb
CHANGED
@@ -336,26 +336,38 @@ namespace :ezpublish do
|
|
336
336
|
Sync your var directory with a remote one
|
337
337
|
DESC
|
338
338
|
task :sync_to_local, :roles => :web, :only => { :primary => true } do
|
339
|
-
|
339
|
+
puts "Cluster mode : " + (fetch( :ezdfs_mount_path, nil ) == nil ? "no".red : "yes".green )
|
340
|
+
confirmation = Capistrano::CLI.ui.ask "You're about to sync your local storage directory FROM a remote one (current stage = #{stage}). Are you sure (y/N) ?"
|
340
341
|
abort "Aborted" unless confirmation.downcase == 'y'
|
341
342
|
|
342
343
|
shared_host = fetch( :shared_host, nil )
|
343
344
|
abort "Please set 'shared_host'" if shared_host == nil
|
344
345
|
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
346
|
+
if fetch( :ezdfs_mount_path, nil ) == nil
|
347
|
+
# TODO : make it configurable
|
348
|
+
exclude_string = ""
|
349
|
+
exclude_paths = [ "/cache", "/log", "/*/cache", "/*/log", "/autoload" ]
|
350
|
+
exclude_paths.each{ |item|
|
351
|
+
exclude_string << "--exclude '#{item}' "
|
352
|
+
}
|
353
|
+
run_locally( "rsync -az #{exclude_string} #{user}@#{shared_host}:#{shared_path}/var/* " + ezp_legacy_path( "var/" ) )
|
354
|
+
else
|
355
|
+
puts "Syncing remote mount path (path = #{ezdfs_mount_path} on both side)".green
|
356
|
+
storage_directories.each{ |sd|
|
357
|
+
print_dotted( "var/#{sd}/storage" )
|
358
|
+
fullpath = "#{ezdfs_mount_path}/var/#{sd}/storage"
|
359
|
+
run_locally( "if [ ! -d #{fullpath} ]; then mkdir -p #{fullpath}; fi;" )
|
360
|
+
run_locally( "rsync -az #{user}@#{shared_host}:#{fullpath}/* #{fullpath}/" )
|
361
|
+
capez_puts_done
|
362
|
+
}
|
363
|
+
end
|
353
364
|
end
|
354
365
|
|
355
366
|
desc <<-DESC
|
356
367
|
Sync your a remote var folder with local datas
|
357
368
|
DESC
|
358
369
|
task :sync_to_remote, :roles => :web, :only => { :primary => true } do
|
370
|
+
puts "Please note that this task is not eZDFS compliant...".red
|
359
371
|
confirmation = Capistrano::CLI.ui.ask "You're about to sync your local var/ directory TO a remote one (current stage = #{stage}). Are you sure (y/N) ?"
|
360
372
|
abort "Aborted" unless confirmation.downcase == 'y'
|
361
373
|
|
data/lib/db.rb
CHANGED
@@ -32,24 +32,12 @@ namespace :db do
|
|
32
32
|
Creates a backup from a remote database server
|
33
33
|
DESC
|
34
34
|
task :backup, :roles => :web, :only => { :primary => true } do
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
run "rm #{file}"
|
40
|
-
end
|
41
|
-
dump_result = nil
|
42
|
-
run "mysqldump -h#{database_server} -u#{database_uname} -p #{database_name} | gzip > #{file}" do |ch, stream, out|
|
43
|
-
ch.send_data "#{database_passd}\n" if out =~ /^Enter password:/
|
44
|
-
dump_result = out
|
45
|
-
end
|
46
|
-
if dump_result =~ /.*error.*1045/i
|
47
|
-
puts "Access denied on '#{database_server}' with user '#{database_uname}'".red
|
48
|
-
else
|
49
|
-
create_backup_dir( backup_dir_for_this_stage )
|
50
|
-
get( file, File.join( backup_dir_for_this_stage, filename ), :via => :scp )
|
35
|
+
|
36
|
+
do_and_retrieve_backup( "#{database_server}", "#{database_name}", "#{database_uname}", "#{database_passd}" )
|
37
|
+
if fetch( :ezdfs_database_server, nil ) != nil
|
38
|
+
do_and_retrieve_backup( "#{ezdfs_database_server}", "#{ezdfs_database_name}", "#{ezdfs_database_uname}", "#{ezdfs_database_passd}" )
|
51
39
|
end
|
52
|
-
|
40
|
+
|
53
41
|
end
|
54
42
|
|
55
43
|
desc <<-DESC
|
@@ -73,4 +61,26 @@ namespace :db do
|
|
73
61
|
def get_backup_dir
|
74
62
|
return "#{ezp_legacy_path('extension/alcapon/backups/database')}"
|
75
63
|
end
|
64
|
+
|
65
|
+
def do_and_retrieve_backup( thisdbserver, thisdbname, thisdbuser, thisdbpass )
|
66
|
+
filename = generate_backup_name( thisdbname )
|
67
|
+
file = File.join( "/tmp", filename )
|
68
|
+
backup_dir_for_this_stage = File.join( get_backup_dir, "#{stage}" )
|
69
|
+
on_rollback do
|
70
|
+
run "rm #{file}"
|
71
|
+
end
|
72
|
+
|
73
|
+
dump_result = nil
|
74
|
+
run "mysqldump -h#{thisdbserver} -u#{thisdbuser} -p #{thisdbname} | gzip > #{file}" do |ch, stream, out|
|
75
|
+
ch.send_data "#{thisdbpass}\n" if out =~ /^Enter password:/
|
76
|
+
dump_result = out
|
77
|
+
end
|
78
|
+
if dump_result =~ /.*error.*1045/i
|
79
|
+
puts "Access denied on '#{thisdbserver}' with user '#{thisdbuser}'".red
|
80
|
+
else
|
81
|
+
create_backup_dir( backup_dir_for_this_stage )
|
82
|
+
get( file, File.join( backup_dir_for_this_stage, filename ), :via => :scp )
|
83
|
+
end
|
84
|
+
run "rm #{file}"
|
85
|
+
end
|
76
86
|
end
|
data/lib/ext/spinner.rb
CHANGED
File without changes
|
data/lib/ezpublish5/deploy.rb
CHANGED
File without changes
|
data/lib/ezpublish5.rb
CHANGED
File without changes
|
data/lib/utils.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alcapon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arnaud Lafon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -48,6 +48,7 @@ extensions: []
|
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
50
|
- bin/capezit
|
51
|
+
- lib/alcapon/utils.rb
|
51
52
|
- lib/capez.rb
|
52
53
|
- lib/db.rb
|
53
54
|
- lib/ext/spinner.rb
|