syncwrap 2.7.1 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.rdoc +61 -0
- data/Manifest.txt +3 -0
- data/lib/syncwrap/base.rb +1 -1
- data/lib/syncwrap/change_key_listener.rb +56 -0
- data/lib/syncwrap/cli.rb +71 -8
- data/lib/syncwrap/components/arch.rb +8 -10
- data/lib/syncwrap/components/bundle.rb +3 -6
- data/lib/syncwrap/components/bundled_iyyov_daemon.rb +3 -8
- data/lib/syncwrap/components/bundler_gem.rb +2 -2
- data/lib/syncwrap/components/cruby_vm.rb +9 -5
- data/lib/syncwrap/components/debian.rb +13 -11
- data/lib/syncwrap/components/iyyov.rb +21 -4
- data/lib/syncwrap/components/jruby_vm.rb +5 -4
- data/lib/syncwrap/components/postgresql.rb +28 -7
- data/lib/syncwrap/components/puma.rb +112 -35
- data/lib/syncwrap/components/qpid.rb +2 -2
- data/lib/syncwrap/components/rhel.rb +65 -34
- data/lib/syncwrap/components/run_user.rb +11 -4
- data/lib/syncwrap/components/source_tree.rb +5 -1
- data/lib/syncwrap/components/tarpit_gem.rb +2 -2
- data/lib/syncwrap/components/users.rb +2 -1
- data/lib/syncwrap/context.rb +15 -2
- data/lib/syncwrap/distro.rb +5 -7
- data/lib/syncwrap/shell.rb +2 -2
- data/lib/syncwrap/systemd_service.rb +140 -0
- data/lib/syncwrap.rb +4 -3
- data/sync/etc/systemd/system/puma.service.erb +3 -0
- data/sync/etc/systemd/system/puma.socket.erb +15 -0
- data/sync/postgresql/postgresql.conf.erb +25 -5
- data/test/test_components.rb +14 -2
- data/test/test_context.rb +1 -1
- data/test/test_context_rput.rb +1 -1
- data/test/test_rsync.rb +1 -1
- data/test/test_shell.rb +2 -1
- data/test/test_space.rb +22 -1
- data/test/test_space_main.rb +6 -2
- data/test/test_version_support.rb +1 -1
- data/test/test_zone_balancer.rb +2 -2
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13c35dd94712da0efcf94baf546fe093c22ea98b
|
4
|
+
data.tar.gz: 7ab95e5de09411aeebb0999611e04eda2380fe49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00008c83b2ef58df4ca10b2913257963d9f64cc3ca992f6838d8a9bd075f8863a52265115016e1c93585bff946da6ac324a9bc6bf673ff3af308be95a3a3866a
|
7
|
+
data.tar.gz: b3c96fe0054c7011e05fb8bc858eaaab57dd08ea32ff0d9633fceddbce195bca6079d069fff7e9accfc3adb42a71ab37becf19f9bb25097cff80b1b4646fa7d0
|
data/History.rdoc
CHANGED
@@ -1,3 +1,64 @@
|
|
1
|
+
=== 2.8.0 (2016-7-19)
|
2
|
+
* Only allow public component methods to be executed via the
|
3
|
+
SyncWrap::Space#execute and thus the CLI. Previously it was possible
|
4
|
+
to execute protected or private methods.
|
5
|
+
* Uniformly name start, stop, and restart methods on SyncWrap::Iyyov
|
6
|
+
and SyncWrap::PostgreSQL for consistency and use in the CLI. Also
|
7
|
+
add reload and status methods to these components.
|
8
|
+
* Add optional SyncWrap::Puma systemd_socket (activation) support:
|
9
|
+
* The systemd_unit property is deprecated in favor of systemd_service
|
10
|
+
* Add lookup for systemd unit source files under the specific names
|
11
|
+
configured, before using generic puma.service/puma.socket
|
12
|
+
templates.
|
13
|
+
* Add systemctl daemon-reload based on changes
|
14
|
+
* Restart service or both socket and service based on changes
|
15
|
+
* Don't set a default port for SyncWrap::Puma, since users may prefer
|
16
|
+
to set port(s) in a puma config file. If relying on this port
|
17
|
+
selection, users will need to specify `port: 5874` on upgrade.
|
18
|
+
* Add SyncWrap::Puma start, stop, restart, and status methods.
|
19
|
+
* Add SyncWrap::SystemDService module for reuse
|
20
|
+
* Make systemd flag consistent between RHEL and Debian and respect
|
21
|
+
false.
|
22
|
+
* SyncWrap::Bundle, SyncWrap::BundledIyyovDaemon and SyncWrap::Puma
|
23
|
+
now support 'listening' for changes on multiple change keys, which
|
24
|
+
is more intuitive to configure than having SyncWrap::SourceTree
|
25
|
+
produce changes on multiple change keys. However, the later is
|
26
|
+
still supported.
|
27
|
+
* Add SyncWrap::ChangeKeyListener module for reuse
|
28
|
+
* Add :mode option to SyncWrap::RunUser#mkdir_run_user,
|
29
|
+
SyncWrap::RunUser#run_dir_mode, SyncWrap::SourceTree#remote_dir_mode
|
30
|
+
and change defaults to 0755. This was previously hard-coded to 0775,
|
31
|
+
which caused ssh access as the :run_user to fail and other conflicts
|
32
|
+
with distro security features.
|
33
|
+
* Set ssh option PasswordAuthentication=no when using
|
34
|
+
Users#ssh_user_pem. This is reasonable with use of a PEM file and
|
35
|
+
provides a (partial) workaround for an occasionally observed timing
|
36
|
+
issue causing a password prompt to be temporarily offered on a
|
37
|
+
booting CentOS host with Cloud-Init.
|
38
|
+
* CLI (-l --list*) listings now attempt to format output to (Unix)
|
39
|
+
terminal width
|
40
|
+
* The :check_install option to Distro#dist_install added in 2.7.0 is
|
41
|
+
now true (on) by default
|
42
|
+
* The previously deprecated :succeed flag to
|
43
|
+
Disto#dist_install/dist_uninstall has been dropped
|
44
|
+
* Replace RHEL installed test with "rpm -q" which is considerably
|
45
|
+
faster than "yum list"
|
46
|
+
* Add RHEL#dist_install :yum_flags options for special cases
|
47
|
+
* Fully replace the original use case for the :succeed option with
|
48
|
+
SyncWrap::RHEL#dist_install_url, defaulting to package name
|
49
|
+
extracted from rpm URL or file path for the install check
|
50
|
+
* SyncWrap::Iyyov with systemd should also conditionally daemon-reload
|
51
|
+
* Update SyncWrap::PostgreSQL and postgresql.conf for support of
|
52
|
+
version 9.6 (as of beta 2). Changes remain backward compatible with
|
53
|
+
9.1+ and SyncWrap 2.3+
|
54
|
+
* Minor fixes based on ruby 2.4 testing (including with frozen string
|
55
|
+
literals)
|
56
|
+
* Upgrade dev dependencies to minitest 5.8.4 and tarpit 2.1.1
|
57
|
+
* Upgrade SyncWrap::CRubyVM default version to 2.1.10 (+ hash for 2.2.5)
|
58
|
+
* Upgrade SyncWrap::JRubyVM default version to 1.7.24 (+ hash for 1.7.25)
|
59
|
+
* Upgrade SyncWrap::BundlerGem default version to 1.12.5
|
60
|
+
* Upgrade SyncWrap::TarpitGem default version to 2.1.1
|
61
|
+
|
1
62
|
=== 2.7.1 (2016-3-2)
|
2
63
|
* Fix handling of the -R/--components-in-role flag to correctly limit
|
3
64
|
to hosts including the role, for both execution and listing
|
data/Manifest.txt
CHANGED
@@ -18,6 +18,7 @@ lib/syncwrap/base.rb
|
|
18
18
|
lib/syncwrap.rb
|
19
19
|
lib/syncwrap/amazon_ec2.rb
|
20
20
|
lib/syncwrap/amazon_ws.rb
|
21
|
+
lib/syncwrap/change_key_listener.rb
|
21
22
|
lib/syncwrap/cli.rb
|
22
23
|
lib/syncwrap/component.rb
|
23
24
|
lib/syncwrap/context.rb
|
@@ -32,6 +33,7 @@ lib/syncwrap/rsync.rb
|
|
32
33
|
lib/syncwrap/ruby_support.rb
|
33
34
|
lib/syncwrap/shell.rb
|
34
35
|
lib/syncwrap/systemd.rb
|
36
|
+
lib/syncwrap/systemd_service.rb
|
35
37
|
lib/syncwrap/user_data.rb
|
36
38
|
lib/syncwrap/version_support.rb
|
37
39
|
lib/syncwrap/zone_balancer.rb
|
@@ -74,6 +76,7 @@ sync/etc/sysconfig/pgsql/postgresql.erb
|
|
74
76
|
sync/etc/sysctl.d/61-postgresql-shm.conf.erb
|
75
77
|
sync/etc/systemd/system/iyyov.service.erb
|
76
78
|
sync/etc/systemd/system/puma.service.erb
|
79
|
+
sync/etc/systemd/system/puma.socket.erb
|
77
80
|
sync/jruby/bin/jgem
|
78
81
|
sync/postgresql/environment
|
79
82
|
sync/postgresql/pg_ctl.conf
|
data/lib/syncwrap/base.rb
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2011-2016 David Kellum
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
5
|
+
# may not use this file except in compliance with the License. You may
|
6
|
+
# obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
13
|
+
# implied. See the License for the specific language governing
|
14
|
+
# permissions and limitations under the License.
|
15
|
+
#++
|
16
|
+
|
17
|
+
module SyncWrap
|
18
|
+
|
19
|
+
# Support module for components which listen for and act on changes
|
20
|
+
# set on SyncWrap::Context#state keys.
|
21
|
+
module ChangeKeyListener
|
22
|
+
|
23
|
+
protected
|
24
|
+
|
25
|
+
def initialize( opts = {} )
|
26
|
+
@change_key = nil
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
# An optional state key, or array of state keys, to check for
|
31
|
+
# changes. (Default: nil; Example: :source_tree)
|
32
|
+
attr_accessor :change_key
|
33
|
+
|
34
|
+
# Returns true if there are any changes with any #change_key.
|
35
|
+
def change_key_changes?
|
36
|
+
Array( change_key ).any? do |k|
|
37
|
+
c = state[ k ]
|
38
|
+
c && !c.emtpy?
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Returns the combined array of all changes on all #change_key.
|
43
|
+
def change_key_changes
|
44
|
+
Array( change_key ).inject( [] ) do |m,k|
|
45
|
+
c = state[ k ]
|
46
|
+
if c
|
47
|
+
m + c
|
48
|
+
else
|
49
|
+
m
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
data/lib/syncwrap/cli.rb
CHANGED
@@ -308,7 +308,7 @@ TEXT
|
|
308
308
|
table = roles.map do |role|
|
309
309
|
row = [ ':' + role.to_s ]
|
310
310
|
classes = space.role( role ).map( &:class )
|
311
|
-
row << short_class_names( classes )
|
311
|
+
row << short_class_names( classes )
|
312
312
|
end
|
313
313
|
print_table( table )
|
314
314
|
puts if multi
|
@@ -333,19 +333,56 @@ TEXT
|
|
333
333
|
def print_table( table )
|
334
334
|
max_columns = table.map( &:count ).max || 0
|
335
335
|
col_widths = max_columns.times.map do |i|
|
336
|
-
table.map
|
336
|
+
table.map do |row|
|
337
|
+
case row[i]
|
338
|
+
when String
|
339
|
+
row[i].length
|
340
|
+
when Array
|
341
|
+
1
|
342
|
+
end
|
343
|
+
end.compact.max
|
337
344
|
end
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
345
|
+
wfirst = unless col_widths.empty?
|
346
|
+
col_widths[0] += 4 # Extra pad first col
|
347
|
+
col_widths[0] + 1
|
348
|
+
end
|
349
|
+
|
350
|
+
table = table.map do |row|
|
351
|
+
row.map do |cell|
|
352
|
+
if cell.is_a?( Array )
|
353
|
+
l = 0
|
354
|
+
cell.inject( String.new ) do |m,i|
|
355
|
+
if l == 0 || ( wfirst + l + i.length + 1 < term_width )
|
356
|
+
m << i << ' '
|
357
|
+
l += i.length + 1
|
358
|
+
else
|
359
|
+
m << "\n" + (' ' * wfirst)
|
360
|
+
m << i << ' '
|
361
|
+
l = wfirst + i.length + 1
|
362
|
+
end
|
363
|
+
m
|
364
|
+
end
|
365
|
+
else
|
366
|
+
cell
|
367
|
+
end
|
343
368
|
end
|
344
369
|
end
|
345
370
|
|
371
|
+
wall = 0
|
372
|
+
format = col_widths.inject( String.new ) do |f,w|
|
373
|
+
if f.empty? || ( wall + w + 1 < term_width )
|
374
|
+
f << "%-#{w}s "
|
375
|
+
wall += w + 1
|
376
|
+
else
|
377
|
+
f[-1,1] = "\n"
|
378
|
+
f << ( ' ' * wfirst ) + "%-#{w}s "
|
379
|
+
wall = wfirst + w + 1
|
380
|
+
end
|
381
|
+
f
|
382
|
+
end
|
346
383
|
table.each do |row|
|
347
384
|
row[ max_columns ] = nil
|
348
|
-
puts format % row
|
385
|
+
puts (format % row ).gsub( /\s+$/, '' )
|
349
386
|
end
|
350
387
|
end
|
351
388
|
|
@@ -413,5 +450,31 @@ TEXT
|
|
413
450
|
end
|
414
451
|
end
|
415
452
|
|
453
|
+
def term_width
|
454
|
+
@term_width ||= ( unix? && (check_stty_width || check_tput_width) ) || 80
|
455
|
+
end
|
456
|
+
|
457
|
+
def unix?
|
458
|
+
!!( RbConfig::CONFIG['host_os'] =~
|
459
|
+
/(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i )
|
460
|
+
end
|
461
|
+
|
462
|
+
def check_stty_width
|
463
|
+
s = `stty size 2>/dev/null`
|
464
|
+
s &&= s.split[1]
|
465
|
+
s &&= s.to_i
|
466
|
+
s if s && s >= 30
|
467
|
+
rescue
|
468
|
+
nil
|
469
|
+
end
|
470
|
+
|
471
|
+
def check_tput_width
|
472
|
+
s = `tput cols 2>/dev/null`
|
473
|
+
s &&= s.to_i
|
474
|
+
s if s && s >= 30
|
475
|
+
rescue
|
476
|
+
nil
|
477
|
+
end
|
478
|
+
|
416
479
|
end
|
417
480
|
end
|
@@ -35,26 +35,24 @@ module SyncWrap
|
|
35
35
|
# ==== Options
|
36
36
|
#
|
37
37
|
# :check_install:: Short-circuit if all packages already
|
38
|
-
# installed. Thus no upgrades will be
|
38
|
+
# installed. Thus no upgrades will be
|
39
|
+
# performed. (Default: true)
|
39
40
|
#
|
40
|
-
#
|
41
|
+
# Options are also passed to the sudo calls.
|
41
42
|
def dist_install( *pkgs )
|
42
|
-
opts = pkgs.last.is_a?( Hash ) && pkgs.pop
|
43
|
-
opts.delete( :minimal )
|
43
|
+
opts = pkgs.last.is_a?( Hash ) && pkgs.pop || {}
|
44
44
|
pkgs.flatten!
|
45
|
-
chk = opts
|
46
|
-
chk = opts.delete( :succeed ) if chk.nil?
|
45
|
+
chk = opts[ :check_install ]
|
47
46
|
chk = check_install? if chk.nil?
|
48
|
-
dist_if_not_installed?( pkgs, chk, opts ) do
|
47
|
+
dist_if_not_installed?( pkgs, chk != false, opts ) do
|
49
48
|
sudo( "pacman -S --noconfirm #{pkgs.join ' '}", opts )
|
50
49
|
end
|
51
50
|
end
|
52
51
|
|
53
52
|
# Uninstall the specified package names. A trailing hash is
|
54
|
-
# interpreted as options
|
53
|
+
# interpreted as options and passed to the sudo calls.
|
55
54
|
def dist_uninstall( *pkgs )
|
56
|
-
opts = pkgs.last.is_a?( Hash ) && pkgs.pop
|
57
|
-
opts.delete( :succeed )
|
55
|
+
opts = pkgs.last.is_a?( Hash ) && pkgs.pop || {}
|
58
56
|
pkgs.flatten!
|
59
57
|
pkgs.each do |pkg|
|
60
58
|
dist_if_installed?( pkg, opts ) do
|
@@ -18,6 +18,7 @@ require 'syncwrap/component'
|
|
18
18
|
|
19
19
|
require 'syncwrap/git_help'
|
20
20
|
require 'syncwrap/path_util'
|
21
|
+
require 'syncwrap/change_key_listener'
|
21
22
|
|
22
23
|
module SyncWrap
|
23
24
|
|
@@ -26,6 +27,7 @@ module SyncWrap
|
|
26
27
|
# Host component dependencies: RunUser?, SourceTree?, BundlerGem
|
27
28
|
class Bundle < Component
|
28
29
|
include PathUtil
|
30
|
+
include ChangeKeyListener
|
29
31
|
|
30
32
|
# Path to the Gemfile(.lock)
|
31
33
|
# (Default: SourceTree#remote_source_path)
|
@@ -45,10 +47,6 @@ module SyncWrap
|
|
45
47
|
|
46
48
|
protected
|
47
49
|
|
48
|
-
# An optional state key to check, indicating changes requiring
|
49
|
-
# bundle install (Default: nil; Example: :source_tree)
|
50
|
-
attr_accessor :change_key
|
51
|
-
|
52
50
|
# Hash of environment key/values to set on call to bundle install
|
53
51
|
# (Default: {} -> none)
|
54
52
|
attr_accessor :bundle_install_env
|
@@ -69,7 +67,6 @@ module SyncWrap
|
|
69
67
|
public
|
70
68
|
|
71
69
|
def initialize( opts = {} )
|
72
|
-
@change_key = nil
|
73
70
|
@bundle_path = nil
|
74
71
|
@bundle_install_env = {}
|
75
72
|
@bundle_install_path = '~/.gem'
|
@@ -79,7 +76,7 @@ module SyncWrap
|
|
79
76
|
end
|
80
77
|
|
81
78
|
def install
|
82
|
-
bundle_install if change_key.nil? ||
|
79
|
+
bundle_install if change_key.nil? || change_key_changes?
|
83
80
|
end
|
84
81
|
|
85
82
|
def bundle_install
|
@@ -15,6 +15,7 @@
|
|
15
15
|
#++
|
16
16
|
|
17
17
|
require 'syncwrap/component'
|
18
|
+
require 'syncwrap/change_key_listener'
|
18
19
|
|
19
20
|
module SyncWrap
|
20
21
|
|
@@ -30,6 +31,7 @@ module SyncWrap
|
|
30
31
|
#
|
31
32
|
# Host component dependencies: RunUser, <ruby>, Iyyov
|
32
33
|
class BundledIyyovDaemon < Component
|
34
|
+
include ChangeKeyListener
|
33
35
|
|
34
36
|
protected
|
35
37
|
|
@@ -44,16 +46,11 @@ module SyncWrap
|
|
44
46
|
# one of 'name' on a host. (Default: nil)
|
45
47
|
attr_accessor :instance
|
46
48
|
|
47
|
-
# An optional state key to check, indicating changes requiring
|
48
|
-
# a daemon restart (Default: nil; Example: :source_tree)
|
49
|
-
attr_accessor :change_key
|
50
|
-
|
51
49
|
public
|
52
50
|
|
53
51
|
def initialize( opts = {} )
|
54
52
|
@name = nil
|
55
53
|
@instance = nil
|
56
|
-
@change_key = nil
|
57
54
|
|
58
55
|
super
|
59
56
|
end
|
@@ -76,9 +73,7 @@ module SyncWrap
|
|
76
73
|
user: run_user )
|
77
74
|
job_changes += iyyov_install_jobs
|
78
75
|
|
79
|
-
|
80
|
-
|
81
|
-
if ( ( src_changes + conf_changes ).length > 0 ||
|
76
|
+
if ( change_key_changes? || !conf_changes.empty? ||
|
82
77
|
state[ :hashdot_updated ] ||
|
83
78
|
state[ :imaging ] )
|
84
79
|
rudo( "kill $(< #{daemon_service_dir}/#{name}.pid ) || true" )
|
@@ -24,11 +24,11 @@ module SyncWrap
|
|
24
24
|
#
|
25
25
|
class BundlerGem < Component
|
26
26
|
|
27
|
-
# Bundler version to install (Default: 1.
|
27
|
+
# Bundler version to install (Default: 1.12.5)
|
28
28
|
attr_accessor :bundler_version
|
29
29
|
|
30
30
|
def initialize( opts = {} )
|
31
|
-
@bundler_version = '1.
|
31
|
+
@bundler_version = '1.12.5'
|
32
32
|
super
|
33
33
|
end
|
34
34
|
|
@@ -36,7 +36,7 @@ module SyncWrap
|
|
36
36
|
# some common utility methods.
|
37
37
|
#
|
38
38
|
# Alternatives like RVM, rbenv, etc. are disfavored by this author
|
39
|
-
# for server provisioning because of their
|
39
|
+
# for server provisioning because of their intrusive shell and
|
40
40
|
# environment modifications and obscure interations with non-/login
|
41
41
|
# or non-/interactive sessions. These are fine tools if needed for
|
42
42
|
# development however. Again you are currently on your own (beyond
|
@@ -47,22 +47,26 @@ module SyncWrap
|
|
47
47
|
include HashSupport
|
48
48
|
|
49
49
|
# Default #ruby_version to install
|
50
|
-
DEFAULT_VERSION = '2.1.
|
50
|
+
DEFAULT_VERSION = '2.1.10'
|
51
51
|
|
52
52
|
# A set of known (sha256) cryptographic hashes, keyed by version
|
53
|
-
# string.
|
53
|
+
# string, for the source ruby-(version).tar.gz package.
|
54
54
|
KNOWN_HASHES = {
|
55
55
|
'2.1.7' =>
|
56
56
|
'f59c1596ac39cc7e60126e7d3698c19f482f04060674fdfe0124e1752ba6dd81',
|
57
57
|
'2.1.8' =>
|
58
|
-
'afd832b8d5ecb2e3e1477ec6a9408fdf9898ee73e4c5df17a2b2cb36bd1c355d'
|
58
|
+
'afd832b8d5ecb2e3e1477ec6a9408fdf9898ee73e4c5df17a2b2cb36bd1c355d',
|
59
|
+
'2.1.10' =>
|
60
|
+
'fb2e454d7a5e5a39eb54db0ec666f53eeb6edc593d1d2b970ae4d150b831dd20',
|
61
|
+
'2.2.5' =>
|
62
|
+
'30c4b31697a4ca4ea0c8db8ad30cf45e6690a0f09687e5d483c933c03ca335e3' }
|
59
63
|
|
60
64
|
# The ruby version to install, as it appears in source packages
|
61
65
|
# from ruby-lang.org. Note that starting with 2.1.0, the patch
|
62
66
|
# release (p#) no longer appears in package names.
|
63
67
|
# (Default: DEFAULT_VERSION)
|
64
68
|
#
|
65
|
-
# Example values: '2.0.0-p481', '2.1.
|
69
|
+
# Example values: '2.0.0-p481', '2.1.10', '2.2.5'
|
66
70
|
attr_accessor :ruby_version
|
67
71
|
|
68
72
|
# If true, attempt to uninstall any pre-existing distro packaged
|
@@ -46,7 +46,10 @@ module SyncWrap
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def systemd?
|
49
|
-
@systemd
|
49
|
+
if @systemd.nil?
|
50
|
+
@systemd = version_gte?( debian_version, [8] )
|
51
|
+
end
|
52
|
+
@systemd
|
50
53
|
end
|
51
54
|
|
52
55
|
# Install the specified package names. The first time this is
|
@@ -56,30 +59,29 @@ module SyncWrap
|
|
56
59
|
# ==== Options
|
57
60
|
#
|
58
61
|
# :check_install:: Short-circuit if all packages already
|
59
|
-
# installed. Thus no upgrades will be
|
62
|
+
# installed. Thus no upgrades will be
|
63
|
+
# performed. (Default: true)
|
60
64
|
#
|
61
65
|
# :minimal:: Eqv to --no-install-recommends
|
62
66
|
#
|
63
|
-
#
|
67
|
+
# Options are also passed to the sudo calls.
|
64
68
|
def dist_install( *args )
|
65
|
-
opts = args.last.is_a?( Hash ) && args.pop
|
69
|
+
opts = args.last.is_a?( Hash ) && args.pop || {}
|
66
70
|
args.flatten!
|
67
71
|
flags = []
|
68
|
-
flags << '--no-install-recommends' if opts
|
69
|
-
chk = opts
|
70
|
-
chk = opts.delete( :succeed ) if chk.nil?
|
72
|
+
flags << '--no-install-recommends' if opts[ :minimal ]
|
73
|
+
chk = opts[ :check_install ]
|
71
74
|
chk = check_install? if chk.nil?
|
72
|
-
dist_if_not_installed?( args, chk, opts ) do
|
75
|
+
dist_if_not_installed?( args, chk != false, opts ) do
|
73
76
|
sudo( "apt-get -yqq update", opts ) if first_apt?
|
74
77
|
sudo( "apt-get -yq install #{(flags + args).join ' '}", opts )
|
75
78
|
end
|
76
79
|
end
|
77
80
|
|
78
81
|
# Uninstall the specified package names. A trailing hash is
|
79
|
-
# interpreted as options
|
82
|
+
# interpreted as options and passed to the sudo calls.
|
80
83
|
def dist_uninstall( *pkgs )
|
81
|
-
opts = pkgs.last.is_a?( Hash ) && pkgs.pop
|
82
|
-
opts.delete( :succeed )
|
84
|
+
opts = pkgs.last.is_a?( Hash ) && pkgs.pop || {}
|
83
85
|
pkgs.flatten!
|
84
86
|
pkgs.each do |pkg|
|
85
87
|
dist_if_installed?( pkg, opts ) do
|
@@ -41,7 +41,7 @@ module SyncWrap
|
|
41
41
|
# empty jobs.rb.
|
42
42
|
def install
|
43
43
|
# Shorten if the desired iyyov version is already running
|
44
|
-
|
44
|
+
_,ver = capture_running_version( 'iyyov' )
|
45
45
|
if ver != iyyov_version
|
46
46
|
install_run_dir #as root
|
47
47
|
install_iyyov_gem #as root
|
@@ -140,6 +140,7 @@ module SyncWrap
|
|
140
140
|
def install_iyyov_init
|
141
141
|
if systemd?
|
142
142
|
changes = rput( 'etc/systemd/system/iyyov.service', user: :root )
|
143
|
+
systemctl( 'daemon-reload' ) unless changes.empty?
|
143
144
|
systemctl( 'enable', 'iyyov.service' )
|
144
145
|
else
|
145
146
|
rput( 'etc/init.d/iyyov', user: :root,
|
@@ -150,18 +151,34 @@ module SyncWrap
|
|
150
151
|
end
|
151
152
|
end
|
152
153
|
|
153
|
-
def
|
154
|
+
def start
|
154
155
|
dist_service( 'iyyov', 'start' )
|
155
156
|
end
|
156
157
|
|
157
|
-
def
|
158
|
+
def stop
|
158
159
|
dist_service( 'iyyov', 'stop' )
|
159
160
|
end
|
160
161
|
|
161
|
-
def
|
162
|
+
def restart
|
162
163
|
dist_service( 'iyyov', 'restart' )
|
163
164
|
end
|
164
165
|
|
166
|
+
# Output the server status (useful via CLI with --verbose)
|
167
|
+
def status
|
168
|
+
dist_service( 'iyyov', 'status' )
|
169
|
+
end
|
170
|
+
|
171
|
+
# Reload server configuration
|
172
|
+
def reload
|
173
|
+
dist_service( 'iyyov', 'reload' )
|
174
|
+
end
|
175
|
+
|
176
|
+
protected
|
177
|
+
|
178
|
+
alias :iyyov_start :start
|
179
|
+
alias :iyyov_restart :restart
|
180
|
+
alias :iyyov_stop :stop
|
181
|
+
|
165
182
|
end
|
166
183
|
|
167
184
|
end
|
@@ -22,8 +22,8 @@ require 'syncwrap/hash_support'
|
|
22
22
|
module SyncWrap
|
23
23
|
|
24
24
|
# Provision JRuby (jruby.org - Ruby on the Java Virtual Machine) by
|
25
|
-
# direct download from public S3 repo. Includes utility methods
|
26
|
-
# checking and installing JRuby gems.
|
25
|
+
# direct download from the public S3 repo. Includes utility methods
|
26
|
+
# for checking and installing JRuby gems.
|
27
27
|
#
|
28
28
|
# Host component dependencies: <Distro>
|
29
29
|
class JRubyVM < Component
|
@@ -32,14 +32,15 @@ module SyncWrap
|
|
32
32
|
include HashSupport
|
33
33
|
|
34
34
|
# Default #jruby_version to install
|
35
|
-
DEFAULT_VERSION = '1.7.
|
35
|
+
DEFAULT_VERSION = '1.7.24'
|
36
36
|
|
37
37
|
# A set of known cryptographic hashes, keyed by version
|
38
38
|
# string. Note, we prefer sha256 but sha1 is what is currently
|
39
39
|
# published.
|
40
40
|
KNOWN_HASHES = { '1.7.22' => '6b9e310a04ad8173d0d6dbe299da04c0ef85fc15',
|
41
41
|
'1.7.23' => '2b5e796feeed2bcfab02f8bf2ff3d77ca318e310',
|
42
|
-
'1.7.24' => '0c321d2192768dfec419bee6b44c7190f4db32e1'
|
42
|
+
'1.7.24' => '0c321d2192768dfec419bee6b44c7190f4db32e1',
|
43
|
+
'1.7.25' => 'cd15aef419f97cff274491e53fcfb8b88ec36785' }
|
43
44
|
|
44
45
|
# JRuby version to install (default: DEFAULT_VERSION)
|
45
46
|
attr_accessor :jruby_version
|
@@ -80,7 +80,7 @@ module SyncWrap
|
|
80
80
|
|
81
81
|
# Location of postgresql data (and possibly also config) directory.
|
82
82
|
# (Default: #pg_default_data_dir)
|
83
|
-
|
83
|
+
attr_writer :pg_data_dir
|
84
84
|
|
85
85
|
def pg_data_dir
|
86
86
|
@pg_data_dir || pg_default_data_dir
|
@@ -120,7 +120,11 @@ module SyncWrap
|
|
120
120
|
attr_writer :pg_specify_etc_config
|
121
121
|
|
122
122
|
def pg_specify_etc_config
|
123
|
-
@pg_specify_etc_config
|
123
|
+
if @pg_specify_etc_config.nil?
|
124
|
+
distro.is_a?( Debian )
|
125
|
+
else
|
126
|
+
@pg_specify_etc_config
|
127
|
+
end
|
124
128
|
end
|
125
129
|
|
126
130
|
# The package names, including \PostgreSQL server of the
|
@@ -174,10 +178,10 @@ module SyncWrap
|
|
174
178
|
# Shared buffers (Default: '256MB' vs PG: '128MB')
|
175
179
|
attr_accessor :shared_buffers
|
176
180
|
|
177
|
-
# Work memory (Default: '128MB' vs PG
|
181
|
+
# Work memory (Default: '128MB' vs PG 9.4+: '4MB')
|
178
182
|
attr_accessor :work_mem
|
179
183
|
|
180
|
-
# Maintenance work memory (Default: '128MB' vs PG
|
184
|
+
# Maintenance work memory (Default: '128MB' vs PG 9.4+: '64MB')
|
181
185
|
attr_accessor :maintenance_work_mem
|
182
186
|
|
183
187
|
# Maximum stack depth (Default: '4MB' vs PG: '2MB')
|
@@ -245,6 +249,7 @@ module SyncWrap
|
|
245
249
|
@pg_data_dir = nil
|
246
250
|
@pg_default_data_dir = nil
|
247
251
|
@pg_version = nil
|
252
|
+
@pg_specify_etc_config = nil
|
248
253
|
@package_names = nil
|
249
254
|
@service_name = 'postgresql'
|
250
255
|
@synchronous_commit = :on
|
@@ -355,20 +360,36 @@ module SyncWrap
|
|
355
360
|
end
|
356
361
|
|
357
362
|
# Start the server
|
358
|
-
def
|
363
|
+
def start
|
359
364
|
dist_service( service_name, 'start' )
|
360
365
|
end
|
361
366
|
|
362
367
|
# Restart the server
|
363
|
-
def
|
368
|
+
def restart
|
364
369
|
dist_service( service_name, 'restart' )
|
365
370
|
end
|
366
371
|
|
367
372
|
# Stop the server
|
368
|
-
def
|
373
|
+
def stop
|
369
374
|
dist_service( service_name, 'stop' )
|
370
375
|
end
|
371
376
|
|
377
|
+
# Output the server status (useful via CLI with --verbose)
|
378
|
+
def status
|
379
|
+
dist_service( service_name, 'status' )
|
380
|
+
end
|
381
|
+
|
382
|
+
# Reload server configuration
|
383
|
+
def reload
|
384
|
+
dist_service( service_name, 'reload' )
|
385
|
+
end
|
386
|
+
|
387
|
+
protected
|
388
|
+
|
389
|
+
alias :pg_start :start
|
390
|
+
alias :pg_restart :restart
|
391
|
+
alias :pg_stop :stop
|
392
|
+
|
372
393
|
end
|
373
394
|
|
374
395
|
end
|