syncwrap 2.5.1 → 2.6.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 +19 -0
- data/Manifest.txt +6 -0
- data/README.rdoc +6 -5
- data/lib/syncwrap/amazon_ec2.rb +3 -12
- data/lib/syncwrap/base.rb +1 -1
- data/lib/syncwrap/cli.rb +10 -0
- data/lib/syncwrap/components/arch.rb +8 -1
- data/lib/syncwrap/components/commercial_jdk.rb +21 -6
- data/lib/syncwrap/components/cruby_vm.rb +30 -5
- data/lib/syncwrap/components/debian.rb +31 -7
- data/lib/syncwrap/components/hashdot.rb +30 -4
- data/lib/syncwrap/components/iyyov.rb +13 -7
- data/lib/syncwrap/components/jruby_vm.rb +29 -4
- data/lib/syncwrap/components/lvm_cache.rb +116 -0
- data/lib/syncwrap/components/mdraid.rb +0 -9
- data/lib/syncwrap/components/postgresql.rb +24 -1
- data/lib/syncwrap/components/puma.rb +41 -12
- data/lib/syncwrap/components/rhel.rb +24 -6
- data/lib/syncwrap/components/ubuntu.rb +1 -0
- data/lib/syncwrap/distro.rb +32 -4
- data/lib/syncwrap/hash_support.rb +64 -0
- data/lib/syncwrap/host.rb +8 -0
- data/lib/syncwrap/main.rb +5 -0
- data/lib/syncwrap/systemd.rb +43 -0
- data/lib/syncwrap/user_data.rb +40 -0
- data/lib/syncwrap.rb +22 -1
- data/sync/etc/systemd/system/iyyov.service.erb +16 -0
- data/sync/etc/systemd/system/puma.service.erb +13 -0
- data/test/test_components.rb +4 -0
- data/test/test_space.rb +1 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00df7a5da1c7959e0e8536ef2c2365b834d2fa8d
|
4
|
+
data.tar.gz: 95e52e386b6f40581e445b4385ee1396159cf219
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b558fac6b8e8e7c8a5797c5762efbfa2380671d35b061353aa4a04b5fb918eea2c9a92b74458c078dca2c22ad08dfc0b94d2b5c4d45a5984e6b6d42b3a4f590
|
7
|
+
data.tar.gz: 68c4f6387575c2ecabc185799949f545975c3786013f06343052d64330cfc6ad30fdc06676e93db585595b16a10a7e18762a589fe81513334d94d7ba95e07645
|
data/History.rdoc
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
=== 2.6.0 (2015-11-13)
|
2
|
+
* Add SyncWrap::LVMCache component, with
|
3
|
+
SyncWrap::Distro#unmount_device moved from MDRaid.
|
4
|
+
* Add SyncWrap::Space#compose (and main) utility for sync file inline
|
5
|
+
components.
|
6
|
+
* Add systemd support for all distros: Arch, RHEL/CentOS 7+, and by
|
7
|
+
default, Debian 8+ and Ubuntu 15.04+ via the SyncWrap::SystemD
|
8
|
+
module. See also various updates in SyncWrap::Distro.
|
9
|
+
* Add SyncWrap::Iyyov systemd service unit file and install support.
|
10
|
+
* Add SyncWrap::Puma systemd service unit file and install support.
|
11
|
+
* Add cryptographic hash verification support to SyncWrap::CRubyVM,
|
12
|
+
SyncWrap::JRubyVM, SyncWrap::Hashdot, and SyncWrap::CommercialJDK.
|
13
|
+
* Add -R/--components-in-role flag support in CLI to limit components
|
14
|
+
executed to those contained by one or more roles.
|
15
|
+
* Upgrade SyncWrap::JRubyVM default version to 1.7.22
|
16
|
+
* Upgrade SyncWrap::CRubyVM default version to 2.1.7
|
17
|
+
* Move AmazonEC2.ec2_user_data to SyncWrap::UserData module for
|
18
|
+
broader use.
|
19
|
+
|
1
20
|
=== 2.5.1 (2015-10-19)
|
2
21
|
* Add SyncWrap::RHEL#dist_uninstall :succeed flag for removing
|
3
22
|
packages which may not exist
|
data/Manifest.txt
CHANGED
@@ -24,12 +24,15 @@ lib/syncwrap/context.rb
|
|
24
24
|
lib/syncwrap/distro.rb
|
25
25
|
lib/syncwrap/formatter.rb
|
26
26
|
lib/syncwrap/git_help.rb
|
27
|
+
lib/syncwrap/hash_support.rb
|
27
28
|
lib/syncwrap/host.rb
|
28
29
|
lib/syncwrap/main.rb
|
29
30
|
lib/syncwrap/path_util.rb
|
30
31
|
lib/syncwrap/rsync.rb
|
31
32
|
lib/syncwrap/ruby_support.rb
|
32
33
|
lib/syncwrap/shell.rb
|
34
|
+
lib/syncwrap/systemd.rb
|
35
|
+
lib/syncwrap/user_data.rb
|
33
36
|
lib/syncwrap/version_support.rb
|
34
37
|
lib/syncwrap/components/amazon_linux.rb
|
35
38
|
lib/syncwrap/components/arch.rb
|
@@ -46,6 +49,7 @@ lib/syncwrap/components/hashdot.rb
|
|
46
49
|
lib/syncwrap/components/iyyov.rb
|
47
50
|
lib/syncwrap/components/iyyov_daemon.rb
|
48
51
|
lib/syncwrap/components/jruby_vm.rb
|
52
|
+
lib/syncwrap/components/lvm_cache.rb
|
49
53
|
lib/syncwrap/components/mdraid.rb
|
50
54
|
lib/syncwrap/components/network.rb
|
51
55
|
lib/syncwrap/components/open_jdk.rb
|
@@ -67,6 +71,8 @@ sync/etc/init.d/iyyov.erb
|
|
67
71
|
sync/etc/init.d/qpidd
|
68
72
|
sync/etc/sysconfig/pgsql/postgresql.erb
|
69
73
|
sync/etc/sysctl.d/61-postgresql-shm.conf.erb
|
74
|
+
sync/etc/systemd/system/iyyov.service.erb
|
75
|
+
sync/etc/systemd/system/puma.service.erb
|
70
76
|
sync/jruby/bin/jgem
|
71
77
|
sync/postgresql/environment
|
72
78
|
sync/postgresql/pg_ctl.conf
|
data/README.rdoc
CHANGED
@@ -91,7 +91,8 @@ like dist_install and other distribution-specific behaviors:
|
|
91
91
|
|
92
92
|
Components implementing \#install:
|
93
93
|
|
94
|
-
* SyncWrap::MDRaid - Software raid, lvm volumes,
|
94
|
+
* SyncWrap::MDRaid, SyncWrap::LVMCache - Software raid, lvm volumes,
|
95
|
+
lvm cache, filesystems, mounts
|
95
96
|
|
96
97
|
* SyncWrap::Network and SyncWrap::EtcHosts - hostname, static names,
|
97
98
|
resolver config
|
@@ -127,14 +128,14 @@ Components implementing \#install:
|
|
127
128
|
The above only represents my more recent project needs. Pull requests
|
128
129
|
to add, for example, the following would be well received:
|
129
130
|
|
130
|
-
*
|
131
|
-
|
131
|
+
* Rails (based on SourceTree, Bundle and ideally without per-host
|
132
|
+
asset compile)
|
132
133
|
* Nginx
|
133
134
|
* Mongo
|
134
135
|
* Redis
|
135
136
|
|
136
|
-
\SyncWrap makes it reasonable to implement any of the above
|
137
|
-
|
137
|
+
\SyncWrap makes it reasonable to implement any of the above
|
138
|
+
yourself.
|
138
139
|
|
139
140
|
== License
|
140
141
|
|
data/lib/syncwrap/amazon_ec2.rb
CHANGED
@@ -20,6 +20,7 @@ require 'securerandom'
|
|
20
20
|
require 'syncwrap/amazon_ws'
|
21
21
|
require 'syncwrap/path_util'
|
22
22
|
require 'syncwrap/host'
|
23
|
+
require 'syncwrap/user_data'
|
23
24
|
|
24
25
|
module SyncWrap
|
25
26
|
|
@@ -37,6 +38,7 @@ module SyncWrap
|
|
37
38
|
class AmazonEC2
|
38
39
|
include AmazonWS
|
39
40
|
include PathUtil
|
41
|
+
include UserData
|
40
42
|
|
41
43
|
# FIXME: Interim strategy: use AmazonWS and defer deciding final
|
42
44
|
# organization.
|
@@ -128,7 +130,7 @@ module SyncWrap
|
|
128
130
|
# overrides (like for :availability_zone)?
|
129
131
|
|
130
132
|
if profile[ :user_data ] == :ec2_user_sudo
|
131
|
-
profile[ :user_data ] =
|
133
|
+
profile[ :user_data ] = no_tty_sudoer( 'ec2-user' )
|
132
134
|
end
|
133
135
|
|
134
136
|
dname = profile.delete( :default_name )
|
@@ -278,17 +280,6 @@ module SyncWrap
|
|
278
280
|
end
|
279
281
|
end
|
280
282
|
|
281
|
-
def ec2_user_data( user = 'ec2-user' )
|
282
|
-
#FIXME: Utility module for this (+ Users sudoers)?
|
283
|
-
script = <<-SH
|
284
|
-
#!/bin/sh -e
|
285
|
-
echo '#{user} ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/#{user}
|
286
|
-
echo 'Defaults:#{user} !requiretty' >> /etc/sudoers.d/#{user}
|
287
|
-
chmod 440 /etc/sudoers.d/#{user}
|
288
|
-
SH
|
289
|
-
script.split( "\n" ).map( &:strip ).join( "\n" )
|
290
|
-
end
|
291
|
-
|
292
283
|
end
|
293
284
|
|
294
285
|
end
|
data/lib/syncwrap/base.rb
CHANGED
data/lib/syncwrap/cli.rb
CHANGED
@@ -31,6 +31,7 @@ module SyncWrap
|
|
31
31
|
@list_components = false
|
32
32
|
@component_plan = []
|
33
33
|
@roles = []
|
34
|
+
@comp_roles = []
|
34
35
|
@host_patterns = []
|
35
36
|
@create_plan = []
|
36
37
|
@image_plan = []
|
@@ -69,6 +70,11 @@ TEXT
|
|
69
70
|
@roles << r.sub(/^:/,'').to_sym
|
70
71
|
end
|
71
72
|
|
73
|
+
opts.on( "-R", "--components-in-role ROLE",
|
74
|
+
"Constrain components by ROLE (may use multiple)" ) do |r|
|
75
|
+
@comp_roles << r.sub(/^:/,'').to_sym
|
76
|
+
end
|
77
|
+
|
72
78
|
opts.on( "-t", "--threads N",
|
73
79
|
"The number of hosts to process concurrently",
|
74
80
|
"(default: all hosts)",
|
@@ -270,6 +276,10 @@ TEXT
|
|
270
276
|
|
271
277
|
exit( 0 ) if lists > 0
|
272
278
|
|
279
|
+
unless @comp_roles.empty?
|
280
|
+
@options[ :comp_roles ] = @comp_roles
|
281
|
+
end
|
282
|
+
|
273
283
|
success = space.execute( @hosts, @component_plan, @options )
|
274
284
|
exit( success ? 0 : 1 )
|
275
285
|
end
|
@@ -16,12 +16,18 @@
|
|
16
16
|
|
17
17
|
require 'syncwrap/component'
|
18
18
|
require 'syncwrap/distro'
|
19
|
+
require 'syncwrap/systemd'
|
19
20
|
|
20
21
|
module SyncWrap
|
21
22
|
|
22
23
|
# \Arch Linux distro, partial implementation for pacman.
|
23
24
|
class Arch < Component
|
24
|
-
include
|
25
|
+
include Distro
|
26
|
+
include SystemD
|
27
|
+
|
28
|
+
def systemd?
|
29
|
+
true
|
30
|
+
end
|
25
31
|
|
26
32
|
def dist_install( *pkgs )
|
27
33
|
opts = pkgs.last.is_a?( Hash ) && pkgs.pop || {}
|
@@ -33,6 +39,7 @@ module SyncWrap
|
|
33
39
|
sudo "pacman -R --noconfirm #{pkgs.join ' '}"
|
34
40
|
end
|
35
41
|
|
42
|
+
alias_method :dist_service, :dist_service_via_systemctl
|
36
43
|
end
|
37
44
|
|
38
45
|
end
|
@@ -15,6 +15,7 @@
|
|
15
15
|
#++
|
16
16
|
|
17
17
|
require 'syncwrap/component'
|
18
|
+
require 'syncwrap/hash_support'
|
18
19
|
|
19
20
|
module SyncWrap
|
20
21
|
|
@@ -30,6 +31,7 @@ module SyncWrap
|
|
30
31
|
#
|
31
32
|
# Host component dependencies: <Distro>
|
32
33
|
class CommercialJDK < Component
|
34
|
+
include HashSupport
|
33
35
|
|
34
36
|
# HTTP URL to repo base directory. Note that the default
|
35
37
|
# (http://localhost/repo) is unlikely to work here.
|
@@ -40,10 +42,15 @@ module SyncWrap
|
|
40
42
|
# directory when unpackaged.
|
41
43
|
attr_accessor :jdk_name
|
42
44
|
|
45
|
+
# An optional cryptographic hash value (hexadecimal, some standard
|
46
|
+
# length) to use for verifying the 'jdk_name.tar.gz' package.
|
47
|
+
# Default: nil (no verification)
|
48
|
+
attr_accessor :hash
|
49
|
+
|
43
50
|
def initialize( opts = {} )
|
44
51
|
@java_repo_base_url = 'http://localhost/repo'
|
45
52
|
@jdk_name = 'jrs-ora-1.7.0_51-x64'
|
46
|
-
|
53
|
+
@hash = nil
|
47
54
|
super
|
48
55
|
end
|
49
56
|
|
@@ -58,17 +65,25 @@ module SyncWrap
|
|
58
65
|
end
|
59
66
|
|
60
67
|
def install
|
68
|
+
distro = "/tmp/#{jdk_name}.tar.gz"
|
61
69
|
bins = %w[ java jmap jstack jstat jps jinfo jhat javac ].
|
62
70
|
map { |b| "../lib/java/bin/#{b}" }.
|
63
71
|
join( ' ' )
|
64
72
|
|
65
|
-
sudo
|
66
|
-
|
67
|
-
curl -sSL #{
|
73
|
+
sudo( "if [ ! -d #{jdk_dir} ]; then", close: "fi" ) do
|
74
|
+
sudo <<-SH
|
75
|
+
curl -sSL -o #{distro} #{jdk_url}
|
76
|
+
SH
|
77
|
+
|
78
|
+
hash_verify( hash, distro, user: :root ) if hash
|
79
|
+
|
80
|
+
sudo <<-SH
|
81
|
+
tar -C #{local_root}/lib -zxf #{distro}
|
82
|
+
rm -f #{distro}
|
68
83
|
cd #{local_root}/lib && ln -sfn #{jdk_name} java
|
69
84
|
cd #{local_root}/bin && ln -sfn #{bins} .
|
70
|
-
|
71
|
-
|
85
|
+
SH
|
86
|
+
end
|
72
87
|
end
|
73
88
|
|
74
89
|
end
|
@@ -18,6 +18,7 @@ require 'syncwrap/component'
|
|
18
18
|
require 'syncwrap/components/rhel'
|
19
19
|
require 'syncwrap/ruby_support'
|
20
20
|
require 'syncwrap/version_support'
|
21
|
+
require 'syncwrap/hash_support'
|
21
22
|
|
22
23
|
module SyncWrap
|
23
24
|
|
@@ -43,13 +44,21 @@ module SyncWrap
|
|
43
44
|
class CRubyVM < Component
|
44
45
|
include VersionSupport
|
45
46
|
include RubySupport
|
47
|
+
include HashSupport
|
48
|
+
|
49
|
+
# Default version of #ruby_version to install
|
50
|
+
DEFAULT_VERSION = '2.1.7'
|
51
|
+
|
52
|
+
# SHA256 #hash for DEFAULT_VERSION
|
53
|
+
DEFAULT_VERSION_HASH =
|
54
|
+
'f59c1596ac39cc7e60126e7d3698c19f482f04060674fdfe0124e1752ba6dd81'
|
46
55
|
|
47
56
|
# The ruby version to install, as it appears in source packages
|
48
57
|
# from ruby-lang.org. Note that starting with 2.1.0, the patch
|
49
58
|
# release (p#) no longer appears in package names.
|
50
|
-
# (Default:
|
59
|
+
# (Default: DEFAULT_VERSION)
|
51
60
|
#
|
52
|
-
# Example values: '2.0.0-p481', '2.1.
|
61
|
+
# Example values: '2.0.0-p481', '2.1.7'
|
53
62
|
attr_accessor :ruby_version
|
54
63
|
|
55
64
|
# If true, attempt to uninstall any pre-existing distro packaged
|
@@ -57,13 +66,21 @@ module SyncWrap
|
|
57
66
|
# (Default: true)
|
58
67
|
attr_accessor :do_uninstall_distro_ruby
|
59
68
|
|
69
|
+
# A cryptographic hash value (hexadecimal, some standard length)
|
70
|
+
# to use for verifying the 'source.tar.gz' package.
|
71
|
+
attr_writer :hash
|
72
|
+
|
60
73
|
def initialize( opts = {} )
|
61
|
-
@ruby_version =
|
74
|
+
@ruby_version = DEFAULT_VERSION
|
62
75
|
@do_uninstall_distro_ruby = true
|
63
|
-
|
76
|
+
@hash = nil
|
64
77
|
super
|
65
78
|
end
|
66
79
|
|
80
|
+
def hash
|
81
|
+
@hash || ( ruby_version == DEFAULT_VERSION && DEFAULT_VERSION_HASH )
|
82
|
+
end
|
83
|
+
|
67
84
|
def install
|
68
85
|
install_ruby
|
69
86
|
install_gemrc # from RubySupport
|
@@ -134,11 +151,19 @@ module SyncWrap
|
|
134
151
|
# Arguably all but the final install should be run by an
|
135
152
|
# unprivileged user. But its more likely merged this way, and if
|
136
153
|
# "configure" or "make" can be exploited, so can "make install".
|
154
|
+
sfile = File.basename( src_url )
|
137
155
|
sudo <<-SH
|
138
156
|
[ -e /tmp/src ] && rm -rf /tmp/src || true
|
139
157
|
mkdir -p /tmp/src/ruby
|
140
158
|
cd /tmp/src/ruby
|
141
|
-
curl -sSL #{src_url}
|
159
|
+
curl -sSL -o #{sfile} #{src_url}
|
160
|
+
SH
|
161
|
+
|
162
|
+
hash_verify( hash, sfile, user: :root ) if hash
|
163
|
+
|
164
|
+
sudo <<-SH
|
165
|
+
tar -zxf #{sfile}
|
166
|
+
rm -f #{sfile}
|
142
167
|
cd ruby-#{ruby_version}
|
143
168
|
./configure --prefix=#{local_root} #{redirect?}
|
144
169
|
make #{redirect?}
|
@@ -17,24 +17,38 @@
|
|
17
17
|
require 'syncwrap/component'
|
18
18
|
require 'syncwrap/distro'
|
19
19
|
require 'syncwrap/version_support'
|
20
|
+
require 'syncwrap/systemd'
|
20
21
|
|
21
22
|
module SyncWrap
|
22
23
|
|
23
24
|
# Customizations for \Debian and possibly other deb packaged
|
24
25
|
# derivatives. Specific distros/versions may further specialize.
|
25
26
|
class Debian < Component
|
26
|
-
include
|
27
|
-
include
|
27
|
+
include Distro
|
28
|
+
include VersionSupport
|
29
|
+
include SystemD
|
28
30
|
|
29
31
|
# Debian version, i.e. '7.6' No default value.
|
30
32
|
attr_accessor :debian_version
|
31
33
|
|
32
34
|
alias :distro_version :debian_version
|
33
35
|
|
36
|
+
protected
|
37
|
+
|
38
|
+
# Set true/false to override the default, distro version based
|
39
|
+
# determination of whether systemd is PID 1 on the system.
|
40
|
+
attr_writer :systemd
|
41
|
+
|
42
|
+
public
|
43
|
+
|
34
44
|
def initialize( opts = {} )
|
35
45
|
super
|
36
46
|
end
|
37
47
|
|
48
|
+
def systemd?
|
49
|
+
@systemd ||= version_gte?( debian_version, [8] )
|
50
|
+
end
|
51
|
+
|
38
52
|
# Install the specified package names. The first time this is
|
39
53
|
# applied to any given host, an "apt-get update" is issued as
|
40
54
|
# well. A trailing hash is interpreted as options, see below.
|
@@ -63,15 +77,25 @@ module SyncWrap
|
|
63
77
|
sudo "/usr/sbin/update-rc.d #{name} defaults"
|
64
78
|
end
|
65
79
|
|
66
|
-
# Enable
|
80
|
+
# Enable a service by (short) name either via Debian/System V
|
81
|
+
# `update-rc.d` or systemd `systemctl enable`.
|
67
82
|
def dist_enable_init_service( name )
|
68
|
-
|
83
|
+
if systemd?
|
84
|
+
systemctl( 'enable', dot_service( name ) )
|
85
|
+
else
|
86
|
+
sudo "/usr/sbin/update-rc.d #{name} enable"
|
87
|
+
end
|
69
88
|
end
|
70
89
|
|
71
|
-
# Run
|
72
|
-
# '
|
90
|
+
# Run the service command typically supporting 'start', 'stop',
|
91
|
+
# 'restart', 'status', etc. actions.
|
92
|
+
# Arguments are in order: shortname, action
|
73
93
|
def dist_service( *args )
|
74
|
-
|
94
|
+
if systemd?
|
95
|
+
dist_service_via_systemctl( *args )
|
96
|
+
else
|
97
|
+
sudo( [ '/usr/sbin/service', *args ].join( ' ' ) )
|
98
|
+
end
|
75
99
|
end
|
76
100
|
|
77
101
|
protected
|
@@ -15,9 +15,11 @@
|
|
15
15
|
#++
|
16
16
|
|
17
17
|
require 'syncwrap/component'
|
18
|
+
require 'syncwrap/hash_support'
|
18
19
|
|
19
20
|
# For distro class comparison only (pre-load for safety)
|
20
21
|
require 'syncwrap/components/debian'
|
22
|
+
require 'syncwrap/components/rhel'
|
21
23
|
|
22
24
|
module SyncWrap
|
23
25
|
|
@@ -26,16 +28,32 @@ module SyncWrap
|
|
26
28
|
#
|
27
29
|
# Host component dependencies: <Distro>, <JDK>, JRubyVM
|
28
30
|
class Hashdot < Component
|
31
|
+
include HashSupport
|
29
32
|
|
30
|
-
#
|
33
|
+
# Default version of #hashdot_version to install
|
34
|
+
DEFAULT_VERSION = '1.4.0'
|
35
|
+
|
36
|
+
# SHA256 #hash for DEFAULT_VERSION
|
37
|
+
DEFAULT_VERSION_HASH =
|
38
|
+
'131e01b4ee2c6f63c4850bbcb71a83f902646436b4791a8717cc76efe26afab7'
|
39
|
+
|
40
|
+
# Hashdot version (default: DEFAULT_VERSION)
|
31
41
|
attr_accessor :hashdot_version
|
32
42
|
|
33
|
-
|
34
|
-
|
43
|
+
# A cryptographic hash value (hexadecimal, some standard length)
|
44
|
+
# to use for verifying the 'hashdot-*-src.tar.gz' package.
|
45
|
+
attr_writer :hash
|
35
46
|
|
47
|
+
def initialize( opts = {} )
|
48
|
+
@hashdot_version = DEFAULT_VERSION
|
49
|
+
@hash = nil
|
36
50
|
super
|
37
51
|
end
|
38
52
|
|
53
|
+
def hash
|
54
|
+
@hash || ( hashdot_version == DEFAULT_VERSION && DEFAULT_VERSION_HASH )
|
55
|
+
end
|
56
|
+
|
39
57
|
def hashdot_bin_url
|
40
58
|
[ 'http://downloads.sourceforge.net/project/hashdot/hashdot',
|
41
59
|
hashdot_version,
|
@@ -92,11 +110,18 @@ module SyncWrap
|
|
92
110
|
def install_hashdot
|
93
111
|
src_root = '/tmp/src/hashdot'
|
94
112
|
src = "#{src_root}/hashdot-#{hashdot_version}"
|
113
|
+
sfile = "#{src_root}/hashdot-#{hashdot_version}-src.tar.gz"
|
95
114
|
|
96
115
|
sh <<-SH
|
97
116
|
sudo rm -rf /tmp/src
|
98
117
|
mkdir -p #{src_root}
|
99
|
-
curl -sSL #{
|
118
|
+
curl -sSL -o #{sfile} #{hashdot_bin_url}
|
119
|
+
SH
|
120
|
+
|
121
|
+
hash_verify( hash, sfile ) if hash
|
122
|
+
|
123
|
+
sh <<-SH
|
124
|
+
tar -C #{src_root} -zxf #{sfile}
|
100
125
|
SH
|
101
126
|
|
102
127
|
rput( 'src/hashdot/', "#{src}/", :excludes => :dev )
|
@@ -105,6 +130,7 @@ module SyncWrap
|
|
105
130
|
cd #{src}
|
106
131
|
make
|
107
132
|
sudo make install
|
133
|
+
rm -rf #{src_root}
|
108
134
|
SH
|
109
135
|
|
110
136
|
end
|
@@ -37,7 +37,8 @@ module SyncWrap
|
|
37
37
|
super
|
38
38
|
end
|
39
39
|
|
40
|
-
# Deploy iyyov gem, init.d
|
40
|
+
# Deploy iyyov gem, init.d script or systemd unit, and at least an
|
41
|
+
# empty jobs.rb.
|
41
42
|
def install
|
42
43
|
# Shorten if the desired iyyov version is already running
|
43
44
|
pid, ver = capture_running_version( 'iyyov' )
|
@@ -130,18 +131,23 @@ module SyncWrap
|
|
130
131
|
SH
|
131
132
|
end
|
132
133
|
|
133
|
-
# Ensure install of same gem version as init.d
|
134
|
+
# Ensure install of same gem version as init.d script or unit file
|
134
135
|
def install_iyyov_gem
|
135
136
|
jruby_gem_install( 'iyyov', version: iyyov_version )
|
136
137
|
end
|
137
138
|
|
138
|
-
# Install iyyov daemon init.d script
|
139
|
+
# Install iyyov daemon init.d script or service unit
|
139
140
|
def install_iyyov_init
|
140
|
-
|
141
|
-
|
141
|
+
if systemd?
|
142
|
+
changes = rput( 'etc/systemd/system/iyyov.service', user: :root )
|
143
|
+
systemctl( 'enable', 'iyyov.service' )
|
144
|
+
else
|
145
|
+
rput( 'etc/init.d/iyyov', user: :root,
|
146
|
+
erb_vars: { lsb: distro.kind_of?( Debian ) } )
|
142
147
|
|
143
|
-
|
144
|
-
|
148
|
+
# Add to init.d
|
149
|
+
dist_install_init_service( 'iyyov' )
|
150
|
+
end
|
145
151
|
end
|
146
152
|
|
147
153
|
def iyyov_start
|
@@ -17,6 +17,7 @@
|
|
17
17
|
require 'syncwrap/component'
|
18
18
|
require 'syncwrap/ruby_support'
|
19
19
|
require 'syncwrap/version_support'
|
20
|
+
require 'syncwrap/hash_support'
|
20
21
|
|
21
22
|
module SyncWrap
|
22
23
|
|
@@ -28,17 +29,33 @@ module SyncWrap
|
|
28
29
|
class JRubyVM < Component
|
29
30
|
include VersionSupport
|
30
31
|
include RubySupport
|
32
|
+
include HashSupport
|
31
33
|
|
32
|
-
#
|
34
|
+
# Default version of #jruby_version to install
|
35
|
+
DEFAULT_VERSION = '1.7.22'
|
36
|
+
|
37
|
+
# The #hash for DEFAULT_VERSION. Prefer sha256 but sha1 is what is
|
38
|
+
# currently published.
|
39
|
+
DEFAULT_VERSION_HASH = '6b9e310a04ad8173d0d6dbe299da04c0ef85fc15'
|
40
|
+
|
41
|
+
# JRuby version to install (default: DEFAULT_VERSION)
|
33
42
|
attr_accessor :jruby_version
|
34
43
|
|
35
|
-
|
36
|
-
|
44
|
+
# A cryptographic hash value (hexadecimal, some standard length)
|
45
|
+
# to use for verifying the 'jruby-bin-*.tar.gz' package.
|
46
|
+
attr_writer :hash
|
37
47
|
|
48
|
+
def initialize( opts = {} )
|
49
|
+
@jruby_version = DEFAULT_VERSION
|
50
|
+
@hash = nil
|
38
51
|
super( { ruby_command: 'jruby',
|
39
52
|
gem_command: 'jgem' }.merge( opts ) )
|
40
53
|
end
|
41
54
|
|
55
|
+
def hash
|
56
|
+
@hash || ( jruby_version == DEFAULT_VERSION && DEFAULT_VERSION_HASH )
|
57
|
+
end
|
58
|
+
|
42
59
|
def jruby_dist_path
|
43
60
|
"#{local_root}/lib/jruby/jruby-#{jruby_version}"
|
44
61
|
end
|
@@ -67,12 +84,20 @@ module SyncWrap
|
|
67
84
|
def jruby_install
|
68
85
|
|
69
86
|
root = "#{local_root}/lib/jruby"
|
87
|
+
distro = "/tmp/jruby-bin-#{jruby_version}.tar.gz"
|
70
88
|
|
71
89
|
sudo <<-SH
|
72
90
|
if [ ! -d #{jruby_dist_path} ]; then
|
73
91
|
mkdir -p #{root}
|
74
92
|
mkdir -p #{root}/gems
|
75
|
-
curl -sSL #{
|
93
|
+
curl -sSL -o #{distro} #{jruby_bin_url}
|
94
|
+
SH
|
95
|
+
|
96
|
+
hash_verify( hash, distro, user: :root ) if hash
|
97
|
+
|
98
|
+
sudo <<-SH
|
99
|
+
tar -C #{root} -zxf #{distro}
|
100
|
+
rm -f #{distro}
|
76
101
|
mkdir -p #{gemrc_path}
|
77
102
|
cd #{root} && ln -sfn jruby-#{jruby_version} jruby
|
78
103
|
cd #{local_root}/bin && ln -sf ../lib/jruby/jruby/bin/jirb .
|