machinery-tool 1.12.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/NEWS +20 -0
- data/export_helpers/containerize_readme.md +28 -11
- data/html/comparison.html.haml +3 -3
- data/lib/build_task.rb +8 -6
- data/lib/cli.rb +69 -17
- data/lib/compare_task.rb +1 -1
- data/lib/config_base.rb +1 -1
- data/lib/config_task.rb +4 -1
- data/lib/containerize_task.rb +15 -1
- data/lib/containerized_app.rb +27 -0
- data/lib/hint.rb +18 -6
- data/lib/html.rb +17 -0
- data/lib/inspect_task.rb +6 -0
- data/lib/inspector.rb +2 -1
- data/lib/kiwi_config.rb +14 -1
- data/lib/logged_cheetah.rb +1 -20
- data/lib/machinery.rb +1 -0
- data/lib/remote_system.rb +2 -1
- data/lib/scope.rb +22 -2
- data/lib/serve_html_task.rb +1 -1
- data/lib/show_task.rb +1 -1
- data/lib/system.rb +6 -0
- data/lib/system_description.rb +4 -3
- data/lib/version.rb +1 -1
- data/lib/workload_mapper.rb +1 -0
- data/man/generated/machinery.1.gz +0 -0
- data/man/generated/machinery.1.html +16 -4
- data/plugins/changed_managed_files/schema/system-description-changed-managed-files.schema-v5.json +126 -0
- data/plugins/config_files/schema/system-description-config-files.schema-v5.json +126 -0
- data/plugins/environment/environment.md +1 -0
- data/plugins/environment/environment_inspector.rb +50 -0
- data/plugins/environment/environment_model.rb +22 -0
- data/plugins/environment/schema/system-description-environment.schema-v5.json +13 -0
- data/plugins/groups/schema/system-description-groups.schema-v5.json +30 -0
- data/plugins/os/os_model.rb +4 -0
- data/plugins/os/schema/system-description-os.schema-v5.json +21 -0
- data/plugins/packages/schema/system-description-packages.schema-v5.json +34 -0
- data/plugins/patterns/schema/system-description-patterns.schema-v5.json +24 -0
- data/plugins/repositories/schema/system-description-repositories.schema-v5.json +45 -0
- data/plugins/services/schema/system-description-services.schema-v5.json +30 -0
- data/plugins/unmanaged_files/schema/system-description-unmanaged-files.schema-v5.json +144 -0
- data/plugins/unmanaged_files/unmanaged_files_inspector.rb +45 -23
- data/plugins/users/schema/system-description-users.schema-v5.json +61 -0
- data/schema/migrations/migrate4to5.rb +28 -0
- data/schema/system-description-global.schema-v5.json +43 -0
- data/workload_mapper/docker-registry/clue.rb +14 -0
- data/workload_mapper/docker-registry/compose-template.yml +5 -0
- data/workload_mapper/docker-registry/container/Dockerfile +12 -0
- data/workload_mapper/mariadb/clue.rb +5 -0
- data/workload_mapper/mariadb/compose-template.yml +9 -0
- data/workload_mapper/mariadb/container/Dockerfile +13 -0
- data/workload_mapper/mariadb/container/scripts/config_mariadb.sh +49 -0
- data/workload_mapper/mariadb/container/scripts/start.sh +11 -0
- data/workload_mapper/rails/clue.rb +16 -0
- data/workload_mapper/rails/compose-template.yml +5 -0
- data/workload_mapper/rails/config/config/database.yml +7 -0
- data/workload_mapper/rails/container/Dockerfile +48 -0
- data/workload_mapper/rails/container/apache2/httpd.conf.local +5 -0
- data/workload_mapper/rails/container/apache2/listen.conf +1 -0
- data/workload_mapper/rails/container/apache2/rails_app_vhost.conf +13 -0
- data/workload_mapper/rails/container/apache2/sysconfig_apache2 +280 -0
- data/workload_mapper/rails/setup/setup.rb.erb +72 -0
- metadata +248 -214
@@ -139,7 +139,6 @@ class UnmanagedFilesInspector < Inspector
|
|
139
139
|
dep = depth - 1
|
140
140
|
files = {}
|
141
141
|
dirs = {}
|
142
|
-
excluded_files = []
|
143
142
|
|
144
143
|
# compute command line
|
145
144
|
cmd = ["find", dir, "-xdev", "-maxdepth", "1", "-maxdepth", depth.to_s]
|
@@ -178,11 +177,9 @@ class UnmanagedFilesInspector < Inspector
|
|
178
177
|
broken_names = []
|
179
178
|
if path.include?("\uFFFD")
|
180
179
|
broken_names << "filename '#{path}'"
|
181
|
-
excluded_files << raw_path
|
182
180
|
end
|
183
181
|
if link.include?("\uFFFD")
|
184
182
|
broken_names << "link target '#{link}'"
|
185
|
-
excluded_files << raw_link
|
186
183
|
end
|
187
184
|
|
188
185
|
warning = broken_names.join(" and ")
|
@@ -201,8 +198,9 @@ class UnmanagedFilesInspector < Inspector
|
|
201
198
|
# dirs at maxdepth could be non-leafs all othere are leafs
|
202
199
|
dirs[path] = path.count("/") == dep if type == "d"
|
203
200
|
end
|
204
|
-
Machinery.logger.debug "get_find_data dir:#{dir} depth:#{depth} file:#{files.size}
|
205
|
-
|
201
|
+
Machinery.logger.debug "get_find_data dir:#{dir} depth:#{depth} file:#{files.size}" \
|
202
|
+
" dirs:#{dirs.size}"
|
203
|
+
[files, dirs]
|
206
204
|
end
|
207
205
|
|
208
206
|
def max_depth
|
@@ -240,17 +238,8 @@ class UnmanagedFilesInspector < Inspector
|
|
240
238
|
|
241
239
|
helper = MachineryHelper.new(@system)
|
242
240
|
if helper_usable?(helper, options)
|
243
|
-
|
244
|
-
|
245
|
-
helper.run_helper(scope)
|
246
|
-
ensure
|
247
|
-
helper.remove_helper
|
248
|
-
end
|
249
|
-
scope.extracted = false
|
250
|
-
|
251
|
-
scope.files.delete_if { |f| file_filter.matches?(f.name) }
|
252
|
-
|
253
|
-
@description["unmanaged_files"] = scope
|
241
|
+
run_helper_inspection(helper, file_filter, do_extract, file_store_tmp, file_store_final,
|
242
|
+
scope)
|
254
243
|
else
|
255
244
|
run_inspection(file_filter, options, do_extract, file_store_tmp, file_store_final, scope)
|
256
245
|
end
|
@@ -262,11 +251,6 @@ class UnmanagedFilesInspector < Inspector
|
|
262
251
|
"Note: Using traditional inspection because there is no helper binary for" \
|
263
252
|
" architecture '#{@system.arch}' available."
|
264
253
|
)
|
265
|
-
elsif options[:extract_unmanaged_files]
|
266
|
-
Machinery::Ui.puts(
|
267
|
-
"Note: Using traditional inspection because file extraction is not" \
|
268
|
-
" supported by the helper binary."
|
269
|
-
)
|
270
254
|
elsif options[:remote_user] && options[:remote_user] != "root"
|
271
255
|
Machinery::Ui.puts(
|
272
256
|
"Note: Using traditional inspection because only 'root' is supported as remote user."
|
@@ -279,6 +263,45 @@ class UnmanagedFilesInspector < Inspector
|
|
279
263
|
false
|
280
264
|
end
|
281
265
|
|
266
|
+
def run_helper_inspection(helper, filter, do_extract, file_store_tmp, file_store_final, scope)
|
267
|
+
begin
|
268
|
+
helper.inject_helper
|
269
|
+
helper.run_helper(scope)
|
270
|
+
ensure
|
271
|
+
helper.remove_helper
|
272
|
+
end
|
273
|
+
|
274
|
+
scope.files.delete_if { |f| filter.matches?(f.name) }
|
275
|
+
|
276
|
+
if do_extract
|
277
|
+
mount_points = MountPoints.new(@system)
|
278
|
+
excluded_trees = mount_points.remote + mount_points.special
|
279
|
+
|
280
|
+
file_store_tmp.remove
|
281
|
+
file_store_tmp.create
|
282
|
+
|
283
|
+
files = scope.files.select { |f| f.file? || f.link? }.map(&:name)
|
284
|
+
scope.retrieve_files_from_system_as_archive(@system, files, [])
|
285
|
+
show_extraction_progress(files.count)
|
286
|
+
|
287
|
+
scope.retrieve_trees_from_system_as_archive(@system,
|
288
|
+
scope.files.select(&:directory?).map(&:name), excluded_trees) do |count|
|
289
|
+
show_extraction_progress(files.count + count)
|
290
|
+
end
|
291
|
+
|
292
|
+
scope.files = extract_tar_metadata(scope.files, file_store_tmp.path)
|
293
|
+
file_store_final.remove
|
294
|
+
file_store_tmp.rename(file_store_final.store_name)
|
295
|
+
scope.scope_file_store = file_store_final
|
296
|
+
scope.extracted = true
|
297
|
+
else
|
298
|
+
file_store_final.remove
|
299
|
+
scope.extracted = false
|
300
|
+
end
|
301
|
+
|
302
|
+
@description["unmanaged_files"] = scope
|
303
|
+
end
|
304
|
+
|
282
305
|
def run_inspection(file_filter, options, do_extract, file_store_tmp, file_store_final, scope)
|
283
306
|
mount_points = MountPoints.new(@system)
|
284
307
|
|
@@ -325,8 +348,7 @@ class UnmanagedFilesInspector < Inspector
|
|
325
348
|
|
326
349
|
# determine files and directories below find_dir until a certain depth
|
327
350
|
depth = local_filesystems.include?(find_dir) ? start : max
|
328
|
-
files, dirs
|
329
|
-
excluded_files += excluded
|
351
|
+
files, dirs = get_find_data(find_dir, depth)
|
330
352
|
find_count += 1
|
331
353
|
find_dir += "/" if find_dir.size > 1
|
332
354
|
if !local_filesystems.empty?
|
@@ -0,0 +1,61 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
3
|
+
|
4
|
+
"type": "array",
|
5
|
+
"items": {
|
6
|
+
"type": "object",
|
7
|
+
"required": ["name", "password", "uid", "gid", "comment", "home", "shell"],
|
8
|
+
"properties": {
|
9
|
+
"name": {
|
10
|
+
"type": "string",
|
11
|
+
"minLength": 1
|
12
|
+
},
|
13
|
+
"password": {
|
14
|
+
"type": "string"
|
15
|
+
},
|
16
|
+
"uid": {
|
17
|
+
"type": ["integer", "null"],
|
18
|
+
"minimum": 0
|
19
|
+
},
|
20
|
+
"gid": {
|
21
|
+
"type": ["integer", "null"],
|
22
|
+
"minimum": 0
|
23
|
+
},
|
24
|
+
"comment": {
|
25
|
+
"type": "string"
|
26
|
+
},
|
27
|
+
"home": {
|
28
|
+
"type": "string"
|
29
|
+
},
|
30
|
+
"shell": {
|
31
|
+
"type": "string"
|
32
|
+
},
|
33
|
+
"encrypted_password": {
|
34
|
+
"type": "string"
|
35
|
+
},
|
36
|
+
"last_changed_date": {
|
37
|
+
"type": "integer"
|
38
|
+
},
|
39
|
+
"min_days": {
|
40
|
+
"type": "integer",
|
41
|
+
"minimum": 0
|
42
|
+
},
|
43
|
+
"max_days": {
|
44
|
+
"type": "integer",
|
45
|
+
"minimum": 0
|
46
|
+
},
|
47
|
+
"warn_days": {
|
48
|
+
"type": "integer",
|
49
|
+
"minimum": 0
|
50
|
+
},
|
51
|
+
"disable_days": {
|
52
|
+
"type": "integer",
|
53
|
+
"minimum": 0
|
54
|
+
},
|
55
|
+
"disabled_date": {
|
56
|
+
"type": "integer"
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright (c) 2013-2014 SUSE LLC
|
2
|
+
#
|
3
|
+
# This program is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of version 3 of the GNU General Public License as
|
5
|
+
# published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This program is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
+
# GNU General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU General Public License
|
13
|
+
# along with this program; if not, contact SUSE LLC.
|
14
|
+
#
|
15
|
+
# To contact SUSE about this file by physical or electronic mail,
|
16
|
+
# you may find current contact information at www.suse.com
|
17
|
+
|
18
|
+
class Migrate4To5 < Migration
|
19
|
+
desc <<-EOT
|
20
|
+
Schema version 5 adds a "environment" scope which stores information about the inspected system.
|
21
|
+
EOT
|
22
|
+
|
23
|
+
def migrate
|
24
|
+
@hash["environment"] = {
|
25
|
+
locale: "en_US.utf8"
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
3
|
+
|
4
|
+
"type": "object",
|
5
|
+
"required": ["meta"],
|
6
|
+
"properties": {
|
7
|
+
"meta": {
|
8
|
+
"required": ["format_version"],
|
9
|
+
"properties": {
|
10
|
+
"format_version": {
|
11
|
+
"type": "integer",
|
12
|
+
"minimum": 1
|
13
|
+
},
|
14
|
+
"filters": {
|
15
|
+
"type": "object",
|
16
|
+
"required": ["inspect"],
|
17
|
+
"properties": {
|
18
|
+
"inspect": {
|
19
|
+
"type": "array",
|
20
|
+
"items": {
|
21
|
+
"type": "string"
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
},
|
27
|
+
"additionalProperties": {
|
28
|
+
"type": "object",
|
29
|
+
"required": ["modified", "hostname"],
|
30
|
+
"properties": {
|
31
|
+
"modified": {
|
32
|
+
"type": "string",
|
33
|
+
"format": "date-time"
|
34
|
+
},
|
35
|
+
"hostname": {
|
36
|
+
"type": "string",
|
37
|
+
"format": "hostname"
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
docker_registry_config = "/etc/registry/config.yml"
|
2
|
+
if system.runs_service?("registry") && system.has_file?(docker_registry_config)
|
3
|
+
identify "docker-registry", "registry"
|
4
|
+
volume = "registry:/registry"
|
5
|
+
parameter "volumes", [volume]
|
6
|
+
used_port = /.*:(\d\d\d\d+)/.match(system.read_config(docker_registry_config, "addr")).
|
7
|
+
to_a.fetch(1, nil)
|
8
|
+
port = "#{used_port}:5000"
|
9
|
+
parameter "ports", [port]
|
10
|
+
parameter "links", ["web"]
|
11
|
+
cert = system.read_config(docker_registry_config, "rootcertbundle")
|
12
|
+
extract docker_registry_config, "data"
|
13
|
+
extract cert, "data"
|
14
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
FROM opensuse:13.2
|
2
|
+
|
3
|
+
RUN zypper -n --gpg-auto-import-keys ar http://download.opensuse.org/repositories/Virtualization:/containers/openSUSE_13.2/ virt
|
4
|
+
RUN zypper -n --gpg-auto-import-keys refresh
|
5
|
+
RUN zypper -n --gpg-auto-import-keys update
|
6
|
+
RUN zypper -n --gpg-auto-import-keys install docker docker-distribution-registry
|
7
|
+
|
8
|
+
ADD ./data/etc/registry /etc/registry
|
9
|
+
|
10
|
+
EXPOSE 5000
|
11
|
+
ENTRYPOINT ["registry"]
|
12
|
+
CMD ["/etc/registry/config.yml"]
|
@@ -0,0 +1,13 @@
|
|
1
|
+
FROM opensuse:13.2
|
2
|
+
|
3
|
+
RUN zypper -n --gpg-auto-import-keys refresh
|
4
|
+
RUN zypper -n --gpg-auto-import-keys update
|
5
|
+
RUN zypper -n --gpg-auto-import-keys install mariadb pwgen psmisc net-tools
|
6
|
+
|
7
|
+
ADD scripts /scripts
|
8
|
+
RUN chmod 755 /scripts/*
|
9
|
+
|
10
|
+
VOLUME ["/var/lib/mysql", "/var/log/mysql"]
|
11
|
+
EXPOSE 3306
|
12
|
+
|
13
|
+
CMD ["/bin/bash", "/scripts/start.sh"]
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
__mysql_config() {
|
6
|
+
echo "Running the mysql_config function."
|
7
|
+
mysql_install_db
|
8
|
+
chown -R mysql:mysql /var/lib/mysql
|
9
|
+
/usr/bin/mysqld_safe &
|
10
|
+
sleep 10
|
11
|
+
}
|
12
|
+
|
13
|
+
__start_mysql() {
|
14
|
+
printf "Running the start_mysql function.\n"
|
15
|
+
DB_ROOT_PASS="${DB_ROOT_PASS-$(pwgen -s -1 12)}"
|
16
|
+
DB_USER="${DB_USER-dbuser}"
|
17
|
+
DB_PASS="${DB_PASS-$(pwgen -s -1 12)}"
|
18
|
+
DB_NAME="${DB_NAME-db}"
|
19
|
+
printf "root password=%s\n" "$DB_ROOT_PASS"
|
20
|
+
printf "DB_NAME=%s\n" "$DB_NAME"
|
21
|
+
printf "DB_USER=%s\n" "$DB_USER"
|
22
|
+
printf "DB_PASS=%s\n" "$DB_PASS"
|
23
|
+
mysqladmin -u root password "$DB_ROOT_PASS"
|
24
|
+
mysql -uroot -p"$DB_ROOT_PASS" <<-EOF
|
25
|
+
DELETE FROM mysql.user WHERE user = '$DB_USER';
|
26
|
+
FLUSH PRIVILEGES;
|
27
|
+
CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';
|
28
|
+
GRANT ALL PRIVILEGES ON *.* TO '$DB_USER'@'localhost' WITH GRANT OPTION;
|
29
|
+
CREATE USER '$DB_USER'@'%' IDENTIFIED BY '$DB_PASS';
|
30
|
+
GRANT ALL PRIVILEGES ON *.* TO '$DB_USER'@'%' WITH GRANT OPTION;
|
31
|
+
CREATE DATABASE $DB_NAME;
|
32
|
+
EOF
|
33
|
+
|
34
|
+
killall mysqld
|
35
|
+
sleep 10
|
36
|
+
}
|
37
|
+
|
38
|
+
# Call all functions
|
39
|
+
DB_FILES=$(echo /var/lib/mysql/*)
|
40
|
+
DB_FILES="${DB_FILES#/var/lib/mysql/\*}"
|
41
|
+
DB_FILES="${DB_FILES#/var/lib/mysql/lost+found}"
|
42
|
+
if [ -z "$DB_FILES" ]; then
|
43
|
+
printf "Initializing empty /var/lib/mysql...\n"
|
44
|
+
__mysql_config
|
45
|
+
__start_mysql
|
46
|
+
fi
|
47
|
+
|
48
|
+
touch /var/lib/mysql/configured.txt
|
49
|
+
kill 1
|
@@ -0,0 +1,16 @@
|
|
1
|
+
if system.runs_service?("apache2") && system.has_file?("/usr/bin/rails")
|
2
|
+
apache_vhosts = system["unmanaged_files"].files.select { |f| /vhosts\.d/ =~ f.name }.map(&:name)
|
3
|
+
apache_vhosts.each do |vhost|
|
4
|
+
rails_env = system.read_config(vhost, "PassengerAppEnv")
|
5
|
+
rails_public = system.read_config(vhost, "DocumentRoot")
|
6
|
+
|
7
|
+
if rails_env && !rails_env.empty? && /public/.match(rails_public)
|
8
|
+
identify "rails", "web"
|
9
|
+
parameter "ports", ["3000:3000"]
|
10
|
+
parameter "links", ["db"]
|
11
|
+
rails_root = File.join(rails_public.gsub(/\/public/, ""), "")
|
12
|
+
extract rails_root, "data"
|
13
|
+
break # for now we only handle the first rails app that was found
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
FROM opensuse:13.2
|
2
|
+
|
3
|
+
# see update.sh for why all "apt-get install"s have to stay as one long line
|
4
|
+
RUN zypper -n --gpg-auto-import-keys refresh
|
5
|
+
RUN zypper -n --gpg-auto-import-keys update
|
6
|
+
RUN zypper -n --gpg-auto-import-keys install ca-certificates-mozilla \
|
7
|
+
apache2-devel \
|
8
|
+
gcc \
|
9
|
+
gcc-c++ \
|
10
|
+
git-core \
|
11
|
+
libcurl-devel \
|
12
|
+
mariadb-client \
|
13
|
+
libmysqlclient-devel \
|
14
|
+
libopenssl-devel \
|
15
|
+
libstdc++-devel \
|
16
|
+
libxml2-devel \
|
17
|
+
libxslt-devel \
|
18
|
+
make \
|
19
|
+
nodejs \
|
20
|
+
patch \
|
21
|
+
ruby2.1-devel \
|
22
|
+
rubygem-bundler \
|
23
|
+
zlib-devel \
|
24
|
+
which
|
25
|
+
|
26
|
+
RUN touch /etc/apache2/sysconfig.d/include.conf
|
27
|
+
|
28
|
+
RUN gem install passenger -v 5.0.7
|
29
|
+
RUN passenger-install-apache2-module.ruby2.1 -a
|
30
|
+
|
31
|
+
#variable?
|
32
|
+
RUN mkdir /srv/www/rails
|
33
|
+
WORKDIR /srv/www/rails
|
34
|
+
ADD ./data /srv/www/rails
|
35
|
+
RUN chown -R wwwrun:www /srv/www/rails
|
36
|
+
|
37
|
+
RUN bundle config build.nokogiri --use-system-libraries
|
38
|
+
RUN bundle install
|
39
|
+
|
40
|
+
ADD apache2/sysconfig_apache2 /etc/sysconfig/apache2
|
41
|
+
ADD apache2/httpd.conf.local /etc/apache2/httpd.conf.local
|
42
|
+
ADD apache2/listen.conf /etc/apache2/listen.conf
|
43
|
+
ADD apache2/rails_app_vhost.conf /etc/apache2/vhosts.d/
|
44
|
+
RUN cat /etc/apache2/httpd.conf.local >> /etc/apache2/httpd.conf
|
45
|
+
|
46
|
+
ENV COMPOSE=1
|
47
|
+
|
48
|
+
EXPOSE 3000
|