avm-tools 0.69.3 → 0.72.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/data/instance/files_unit.rb +2 -1
- data/lib/avm/eac_rails_base0/apache_host.rb +1 -1
- data/lib/avm/eac_rails_base0/apache_path.rb +50 -0
- data/lib/avm/eac_rails_base0/deploy.rb +2 -1
- data/lib/avm/eac_rails_base0/instance.rb +2 -2
- data/lib/avm/eac_redmine_base0/deploy.rb +2 -2
- data/lib/avm/eac_redmine_base0/instance.rb +6 -5
- data/lib/avm/eac_ubuntu_base0/apache.rb +26 -0
- data/lib/avm/eac_ubuntu_base0/apache/resource.rb +59 -0
- data/lib/avm/eac_ubuntu_base0/docker_image.rb +14 -0
- data/lib/avm/eac_webapp_base0/apache_host.rb +2 -2
- data/lib/avm/eac_webapp_base0/deploy.rb +2 -2
- data/lib/avm/eac_webapp_base0/deploy/file_unit.rb +2 -1
- data/lib/avm/git/auto_commit_path.rb +4 -2
- data/lib/avm/instances/application.rb +4 -0
- data/lib/avm/instances/base.rb +2 -1
- data/lib/avm/instances/base/auto_values/access.rb +5 -4
- data/lib/avm/instances/base/auto_values/admin.rb +2 -2
- data/lib/avm/instances/base/auto_values/database.rb +1 -1
- data/lib/avm/instances/base/auto_values/filesystem.rb +8 -2
- data/lib/avm/instances/base/auto_values/ruby.rb +1 -1
- data/lib/avm/instances/base/auto_values/system.rb +2 -2
- data/lib/avm/instances/entries.rb +5 -8
- data/lib/avm/instances/entry.rb +53 -0
- data/lib/avm/instances/entry_keys.rb +39 -6
- data/lib/avm/patches/i18n.rb +1 -1
- data/lib/avm/patches/object/template.rb +1 -1
- data/lib/avm/rails/instance.rb +19 -0
- data/lib/avm/self.rb +0 -4
- data/lib/avm/self/instance.rb +1 -1
- data/lib/avm/self/root.rb +13 -0
- data/lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb +1 -1
- data/lib/avm/tools/runner/eac_rails_base0.rb +7 -12
- data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +38 -0
- data/lib/avm/tools/runner/eac_rails_base0/rails_server.rb +41 -0
- data/lib/avm/tools/runner/git/deploy.rb +3 -1
- data/lib/avm/tools/runner/instance.rb +28 -0
- data/lib/avm/tools/runner/instance/info.rb +44 -0
- data/lib/avm/tools/version.rb +1 -1
- data/template/avm/eac_rails_base0/apache_path/default.conf +13 -0
- data/vendor/eac_cli/lib/eac_cli/runner.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/runner/context.rb +19 -2
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +2 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/command.rb +1 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +10 -6
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
- data/vendor/eac_ruby_gems_utils/spec/{rubocop_check_spec.rb → code/rubocop_check_spec.rb} +0 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/ruby/command.rb +2 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- metadata +15 -8
- data/lib/avm/instances/entries/entry_reader.rb +0 -45
- data/lib/avm/stereotypes/eac_ubuntu_base0/apache.rb +0 -27
- data/lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb +0 -61
- data/lib/avm/stereotypes/eac_ubuntu_base0/docker_image.rb +0 -16
- data/lib/avm/stereotypes/rails/instance.rb +0 -20
@@ -1,13 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_ruby_utils/require_sub'
|
5
4
|
require 'avm/configs'
|
6
|
-
|
5
|
+
require 'avm/instances/entry'
|
7
6
|
|
8
7
|
module Avm
|
9
8
|
module Instances
|
10
9
|
module Entries
|
10
|
+
def entry(suffix, options = {})
|
11
|
+
::Avm::Instances::Entry.new(self, suffix, options)
|
12
|
+
end
|
13
|
+
|
11
14
|
def path_prefix
|
12
15
|
@path_prefix ||= [id].freeze
|
13
16
|
end
|
@@ -36,12 +39,6 @@ module Avm
|
|
36
39
|
def other_entry_value(instance_id, entry_suffix)
|
37
40
|
::Avm::Instances::Base.by_id(instance_id).read_entry_optional(entry_suffix)
|
38
41
|
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
def entry(suffix, options)
|
43
|
-
::Avm::Instances::Entries::EntryReader.new(self, suffix, options)
|
44
|
-
end
|
45
42
|
end
|
46
43
|
end
|
47
44
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Instances
|
7
|
+
class Entry
|
8
|
+
class << self
|
9
|
+
def auto_value_method_name(suffix)
|
10
|
+
"auto_#{suffix.to_s.gsub('.', '_')}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
common_constructor :parent, :suffix, :options
|
15
|
+
|
16
|
+
def auto_value
|
17
|
+
parent.respond_to?(auto_value_method, true) ? parent.send(auto_value_method) : nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def auto_value_method
|
21
|
+
self.class.auto_value_method_name(suffix)
|
22
|
+
end
|
23
|
+
|
24
|
+
def full_path
|
25
|
+
(parent.path_prefix + suffix_as_array).join('.')
|
26
|
+
end
|
27
|
+
|
28
|
+
def optional_value
|
29
|
+
read(required: false, noinput: true) || auto_value
|
30
|
+
end
|
31
|
+
|
32
|
+
def read(extra_options = {})
|
33
|
+
::Avm.configs.read_entry(full_path, options.merge(extra_options))
|
34
|
+
end
|
35
|
+
|
36
|
+
def suffix_as_array
|
37
|
+
if suffix.is_a?(::Array)
|
38
|
+
suffix.dup
|
39
|
+
else
|
40
|
+
::EacRubyUtils::PathsHash.parse_entry_key(suffix.to_s)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def value
|
45
|
+
optional_value || read
|
46
|
+
end
|
47
|
+
|
48
|
+
def write(value)
|
49
|
+
::Avm.configs.configs.write_entry(full_path, value)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -3,15 +3,48 @@
|
|
3
3
|
module Avm
|
4
4
|
module Instances
|
5
5
|
module EntryKeys
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
class << self
|
7
|
+
def all
|
8
|
+
all_keys.to_a
|
9
|
+
end
|
10
|
+
|
11
|
+
def keys_consts_set(prefix, suffixes)
|
12
|
+
if suffixes.is_a?(::Hash)
|
13
|
+
keys_consts_set_from_hash(prefix, suffixes)
|
14
|
+
elsif suffixes.is_a?(::Enumerable)
|
15
|
+
keys_consts_set_from_enum(prefix, suffixes)
|
16
|
+
else
|
17
|
+
raise "Unmapped suffixes class: #{suffixes.class}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def key_const_set(prefix, suffix)
|
22
|
+
key = [prefix, suffix].reject(&:blank?).join('.')
|
12
23
|
const_set(key.gsub('.', '_').upcase, key)
|
24
|
+
all_keys << key
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def all_keys
|
30
|
+
@all_keys ||= ::Set.new
|
31
|
+
end
|
32
|
+
|
33
|
+
def keys_consts_set_from_enum(prefix, suffixes)
|
34
|
+
suffixes.each { |suffix| key_const_set(prefix, suffix) }
|
35
|
+
end
|
36
|
+
|
37
|
+
def keys_consts_set_from_hash(prefix, suffixes)
|
38
|
+
suffixes.each { |k, v| keys_consts_set(prefix.to_s + (k.blank? ? '' : ".#{k}"), v) }
|
13
39
|
end
|
14
40
|
end
|
41
|
+
|
42
|
+
{
|
43
|
+
'' => %w[fs_path host_id source_instance_id],
|
44
|
+
database: %w[id hostname name password port system username],
|
45
|
+
ssh: %w[hostname port url username],
|
46
|
+
web: %w[authority hostname path port scheme url userinfo]
|
47
|
+
}.each { |prefix, suffixes| keys_consts_set(prefix, suffixes) }
|
15
48
|
end
|
16
49
|
end
|
17
50
|
end
|
data/lib/avm/patches/i18n.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Avm
|
4
|
+
module Rails
|
5
|
+
module Instance
|
6
|
+
def bundle(*args)
|
7
|
+
the_gem.bundle(*args).chdir_root.envvar('RAILS_ENV', 'production')
|
8
|
+
end
|
9
|
+
|
10
|
+
def rake(*args)
|
11
|
+
bundle('exec', 'rake', *args)
|
12
|
+
end
|
13
|
+
|
14
|
+
def the_gem
|
15
|
+
@the_gem ||= ::EacRubyGemsUtils::Gem.new(::File.join(read_entry('fs_path')), host_env)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/avm/self.rb
CHANGED
data/lib/avm/self/instance.rb
CHANGED
@@ -1,27 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_cli/core_ext'
|
3
4
|
require 'eac_ruby_utils/console/docopt_runner'
|
4
5
|
require 'eac_ruby_utils/simple_cache'
|
5
6
|
require 'avm/eac_rails_base0/instance'
|
6
|
-
require 'eac_ruby_utils/require_sub'
|
7
7
|
::EacRubyUtils.require_sub(__FILE__)
|
8
8
|
|
9
9
|
module Avm
|
10
10
|
module Tools
|
11
11
|
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
12
12
|
class EacRailsBase0 < ::EacRubyUtils::Console::DocoptRunner
|
13
|
-
|
13
|
+
runner_with
|
14
14
|
|
15
|
-
|
16
|
-
Utilities for EacRailsBase0 instances.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
__PROGRAM__ -h | --help
|
21
|
-
|
22
|
-
Options:
|
23
|
-
-h --help Show this screen.
|
24
|
-
DOCOPT
|
15
|
+
runner_definition do
|
16
|
+
desc 'Utilities for EacRailsBase0 instances.'
|
17
|
+
pos_arg :instance_id
|
18
|
+
subcommands
|
19
|
+
end
|
25
20
|
|
26
21
|
private
|
27
22
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
require 'avm/eac_webapp_base0/runner/apache_host'
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
6
|
+
require 'avm/eac_rails_base0/apache_path'
|
7
|
+
|
8
|
+
module Avm
|
9
|
+
module Tools
|
10
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
class EacRailsBase0 < ::EacRubyUtils::Console::DocoptRunner
|
12
|
+
class ApachePath < ::EacRubyUtils::Console::DocoptRunner
|
13
|
+
runner_with
|
14
|
+
|
15
|
+
runner_definition do
|
16
|
+
desc 'Configure Apache path configuration for instance.'
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
if result.error?
|
21
|
+
fatal_error result.to_s
|
22
|
+
else
|
23
|
+
infov 'Result', result.label
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def apache_path_uncached
|
28
|
+
::Avm::EacRailsBase0::ApachePath.new(context(:instance))
|
29
|
+
end
|
30
|
+
|
31
|
+
def result_uncached
|
32
|
+
apache_path.run
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/entry_keys'
|
4
|
+
require 'eac_cli/core_ext'
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
6
|
+
require 'shellwords'
|
7
|
+
|
8
|
+
module Avm
|
9
|
+
module Tools
|
10
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
class EacRailsBase0 < ::EacRubyUtils::Console::DocoptRunner
|
12
|
+
class RailsServer
|
13
|
+
runner_with
|
14
|
+
|
15
|
+
runner_definition do
|
16
|
+
desc 'Run the embbeded Rails web server.'
|
17
|
+
arg_opt '-e', '--environment', 'Specifies the environment to run this server under' \
|
18
|
+
' (development/test/production).'
|
19
|
+
end
|
20
|
+
|
21
|
+
def run
|
22
|
+
infov 'Bundle args', ::Shellwords.join(bundle_args)
|
23
|
+
infov 'Result', command.system
|
24
|
+
end
|
25
|
+
|
26
|
+
protected
|
27
|
+
|
28
|
+
def bundle_args
|
29
|
+
['exec', 'rails', 'server', '--port',
|
30
|
+
runner_context.call(:instance).read_entry(::Avm::Instances::EntryKeys::WEB_PORT)] +
|
31
|
+
parsed.environment.if_present([]) { |v| ['--environment', v] }
|
32
|
+
end
|
33
|
+
|
34
|
+
def command
|
35
|
+
runner_context.call(:instance).bundle(*bundle_args).chdir_root
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/base'
|
4
|
+
require 'eac_cli/core_ext'
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Tools
|
9
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
10
|
+
class Instance < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
require_sub __FILE__
|
12
|
+
runner_with
|
13
|
+
|
14
|
+
runner_definition do
|
15
|
+
desc 'Utilities for generic instances.'
|
16
|
+
pos_arg :instance_id
|
17
|
+
subcommands
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def instance_uncached
|
23
|
+
::Avm::Instances::Base.by_id(options['<instance_id>'])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/entry_keys'
|
4
|
+
require 'eac_cli/core_ext'
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Tools
|
9
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
10
|
+
class Instance < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
class Info < ::EacRubyUtils::Console::DocoptRunner
|
12
|
+
runner_with
|
13
|
+
|
14
|
+
runner_definition do
|
15
|
+
desc 'Show info about a instance.'
|
16
|
+
end
|
17
|
+
|
18
|
+
def run
|
19
|
+
base_banner
|
20
|
+
entry_keys_banner
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def base_banner
|
26
|
+
infov 'ID', instance.id
|
27
|
+
infov 'Application ID', instance.application.id
|
28
|
+
infov 'Suffix', instance.suffix
|
29
|
+
end
|
30
|
+
|
31
|
+
def entry_keys_banner
|
32
|
+
::Avm::Instances::EntryKeys.all.each do |key|
|
33
|
+
infov key, instance.read_entry_optional(key)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def instance
|
38
|
+
context(:instance)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/avm/tools/version.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
<IfModule mod_passenger.c>
|
2
|
+
Alias "%%WEB.PATH%%" "%%FS_PATH%%/public"
|
3
|
+
<Location "%%WEB.PATH%%">
|
4
|
+
PassengerBaseURI "%%WEB.PATH%%"
|
5
|
+
PassengerAppRoot "%%FS_PATH%%"
|
6
|
+
PassengerAppEnv production
|
7
|
+
</Location>
|
8
|
+
<Directory "%%FS_PATH%%/public">
|
9
|
+
Allow from all
|
10
|
+
Options -MultiViews
|
11
|
+
Require all granted
|
12
|
+
</Directory>
|
13
|
+
</IfModule>
|