avm-tools 0.69.3 → 0.72.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/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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acf6e22d7179f5a2ad489b5091ef57883c91d94020815952bc3135df2f1cfd7d
|
4
|
+
data.tar.gz: 4f4eb1ef234e44157bc7b66dc44b2903e2c881e3406f31ee6a183eebba3f2ec0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0fbaaa584f10fc580e2f6c1c2635b673b9f481603b00a5851c2894955cc930d748111d3eb15a5e7069d0f35ac93fe6da7e1519e757822e03641eae989bf08f3
|
7
|
+
data.tar.gz: 8040458407704e5d6541556dfc03929ff6cf753e7e1fec83ac835602faac08327fece6b7e684cf58f80ddf1938d8ade8059fd2f6343f78010ca437228947e4e0
|
@@ -18,7 +18,7 @@ module Avm
|
|
18
18
|
before_load :clear_files
|
19
19
|
|
20
20
|
def files_path
|
21
|
-
::File.join(instance.read_entry(
|
21
|
+
::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH), fs_path_subpath)
|
22
22
|
end
|
23
23
|
|
24
24
|
def dump_command
|
@@ -31,6 +31,7 @@ module Avm
|
|
31
31
|
|
32
32
|
def clear_files
|
33
33
|
infom "Removing all files under #{files_path}..."
|
34
|
+
instance.host_env.command('mkdir', '-p', files_path).execute!
|
34
35
|
instance.host_env.command('find', files_path, '-mindepth', 1, '-delete').execute!
|
35
36
|
end
|
36
37
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_ubuntu_base0/apache'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacRailsBase0
|
8
|
+
class ApachePath
|
9
|
+
enable_console_speaker
|
10
|
+
enable_simple_cache
|
11
|
+
common_constructor :instance, :options, default: [{}]
|
12
|
+
|
13
|
+
def run
|
14
|
+
write_available_conf
|
15
|
+
enable_conf
|
16
|
+
reload_apache
|
17
|
+
::Avm::Result.success('Done')
|
18
|
+
end
|
19
|
+
|
20
|
+
def content
|
21
|
+
template.child('default.conf').apply(instance)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def apache_uncached
|
27
|
+
::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
|
28
|
+
end
|
29
|
+
|
30
|
+
def enable_conf
|
31
|
+
infom 'Enabling configuration...'
|
32
|
+
conf.enable
|
33
|
+
end
|
34
|
+
|
35
|
+
def reload_apache
|
36
|
+
infom 'Reloading Apache...'
|
37
|
+
apache.service('reload')
|
38
|
+
end
|
39
|
+
|
40
|
+
def conf_uncached
|
41
|
+
apache.conf(instance.id)
|
42
|
+
end
|
43
|
+
|
44
|
+
def write_available_conf
|
45
|
+
infom 'Writing available configuration...'
|
46
|
+
conf.write(content)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -42,7 +42,8 @@ module Avm
|
|
42
42
|
def touch_restart_file
|
43
43
|
infom 'Touching restart file...'
|
44
44
|
instance.host_env.command(
|
45
|
-
'touch', ::File.join(instance.read_entry(
|
45
|
+
'touch', ::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH),
|
46
|
+
'tmp', 'restart.txt')
|
46
47
|
).system!
|
47
48
|
end
|
48
49
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/eac_webapp_base0/instance'
|
4
|
-
require 'avm/
|
4
|
+
require 'avm/rails/instance'
|
5
5
|
|
6
6
|
module Avm
|
7
7
|
module EacRailsBase0
|
8
8
|
class Instance < ::Avm::EacWebappBase0::Instance
|
9
|
-
include ::Avm::
|
9
|
+
include ::Avm::Rails::Instance
|
10
10
|
|
11
11
|
FILES_UNITS = { uploads: 'public/uploads' }.freeze
|
12
12
|
end
|
@@ -20,8 +20,8 @@ module Avm
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def installer_path
|
23
|
-
::File.join(instance.read_entry(
|
24
|
-
'run.sh')
|
23
|
+
::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH), 'plugins',
|
24
|
+
'redmine_installer', 'installer', 'run.sh')
|
25
25
|
end
|
26
26
|
|
27
27
|
def install_task
|
@@ -1,24 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/eac_redmine_base0/data_unit'
|
4
|
-
require 'avm/
|
4
|
+
require 'avm/eac_ubuntu_base0/docker_image'
|
5
5
|
require 'avm/eac_webapp_base0/instance'
|
6
|
-
require 'avm/
|
6
|
+
require 'avm/rails/instance'
|
7
7
|
|
8
8
|
module Avm
|
9
9
|
module EacRedmineBase0
|
10
10
|
class Instance < ::Avm::EacWebappBase0::Instance
|
11
|
-
include ::Avm::
|
11
|
+
include ::Avm::Rails::Instance
|
12
12
|
|
13
13
|
FILES_UNITS = { files: 'files' }.freeze
|
14
14
|
|
15
15
|
def docker_image_class
|
16
|
-
::Avm::
|
16
|
+
::Avm::EacUbuntuBase0::DockerImage
|
17
17
|
end
|
18
18
|
|
19
19
|
def docker_run_arguments
|
20
20
|
[
|
21
|
-
'--volume',
|
21
|
+
'--volume',
|
22
|
+
"#{read_entry(::Avm::Instances::EntryKeys::FS_PATH)}:/home/myuser/eac_redmine_base0",
|
22
23
|
'--publish', "#{read_entry(:ssh_port)}:22",
|
23
24
|
'--publish', "#{read_entry(:http_port)}:80",
|
24
25
|
'--publish', "#{read_entry(:https_port)}:443"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacUbuntuBase0
|
7
|
+
class Apache
|
8
|
+
require_sub __FILE__
|
9
|
+
common_constructor :host_env
|
10
|
+
|
11
|
+
def etc_root
|
12
|
+
'/etc/apache2'
|
13
|
+
end
|
14
|
+
|
15
|
+
def service(command)
|
16
|
+
host_env.command('sudo', 'service', 'apache2', command)
|
17
|
+
end
|
18
|
+
|
19
|
+
{ conf: :conf, site: :sites }.each do |type, directory_prefix|
|
20
|
+
define_method type do |name|
|
21
|
+
::Avm::EacUbuntuBase0::Apache::Resource.new(self, type, directory_prefix, name)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacUbuntuBase0
|
7
|
+
class Apache
|
8
|
+
class Resource
|
9
|
+
common_constructor :apache, :type, :directory_prefix, :name
|
10
|
+
|
11
|
+
def available_path
|
12
|
+
::File.join(apache.etc_root, "#{directory_prefix}-available", "#{name}.conf")
|
13
|
+
end
|
14
|
+
|
15
|
+
def available?
|
16
|
+
apache.host_env.file(available_path).exist?
|
17
|
+
end
|
18
|
+
|
19
|
+
def disable
|
20
|
+
apache.host_env.command('sudo', "a2dis#{type}", name).execute!
|
21
|
+
end
|
22
|
+
|
23
|
+
def enable
|
24
|
+
apache.host_env.command('sudo', "a2en#{type}", name).execute!
|
25
|
+
end
|
26
|
+
|
27
|
+
def enabled_path
|
28
|
+
::File.join(apache.etc_root, "#{directory_prefix}-enabled", "#{name}.conf")
|
29
|
+
end
|
30
|
+
|
31
|
+
def enabled?
|
32
|
+
apache.host_env.file(enabled_path).exist?
|
33
|
+
end
|
34
|
+
|
35
|
+
def remove
|
36
|
+
remove_disabled
|
37
|
+
remove_available
|
38
|
+
end
|
39
|
+
|
40
|
+
def remove_available
|
41
|
+
raise 'Remove enabled before' if enabled?
|
42
|
+
|
43
|
+
apache.host_env.command('sudo', 'rm', '-f', available_path).execute! if available?
|
44
|
+
end
|
45
|
+
|
46
|
+
def remove_disabled
|
47
|
+
disable if enabled?
|
48
|
+
apache.host_env.command('sudo', 'rm', '-f', enabled_path).execute! if enabled?
|
49
|
+
end
|
50
|
+
|
51
|
+
def write(content)
|
52
|
+
::EacRubyUtils::Envs.local.command('echo', content).pipe(
|
53
|
+
apache.host_env.command('sudo', 'tee', available_path)
|
54
|
+
).execute!
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
4
4
|
require 'avm/patches/object/template'
|
5
|
-
require 'avm/
|
5
|
+
require 'avm/eac_ubuntu_base0/apache'
|
6
6
|
require 'avm/patches/object/template'
|
7
7
|
|
8
8
|
module Avm
|
@@ -35,7 +35,7 @@ module Avm
|
|
35
35
|
private
|
36
36
|
|
37
37
|
def apache_uncached
|
38
|
-
::Avm::
|
38
|
+
::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
|
39
39
|
end
|
40
40
|
|
41
41
|
def enable_no_ssl_site
|
@@ -32,7 +32,7 @@ module Avm
|
|
32
32
|
def build_git_commit
|
33
33
|
::Avm::Git::Commit.new(git, commit_sha1).deploy_to_env_path(
|
34
34
|
instance.host_env,
|
35
|
-
instance.read_entry(
|
35
|
+
instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
|
36
36
|
).variables_source_set(instance)
|
37
37
|
end
|
38
38
|
|
@@ -95,7 +95,7 @@ module Avm
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def git_repository_path
|
98
|
-
instance.source_instance.read_entry(
|
98
|
+
instance.source_instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
@@ -6,9 +6,11 @@ module Avm
|
|
6
6
|
module Git
|
7
7
|
class AutoCommitPath
|
8
8
|
enable_console_speaker
|
9
|
-
common_constructor :git, :path
|
9
|
+
common_constructor :git, :path do
|
10
|
+
self.path = path.to_pathname
|
11
|
+
end
|
10
12
|
|
11
|
-
CLASS_NAME_PATTERNS = [%r{lib/(.+)\.rb\z}, %r{app/[^/]+/(.+)\.rb\z}].freeze
|
13
|
+
CLASS_NAME_PATTERNS = [%r{lib/((?!.*/lib/).+)\.rb\z}, %r{app/[^/]+/(.+)\.rb\z}].freeze
|
12
14
|
|
13
15
|
def run
|
14
16
|
banner
|
data/lib/avm/instances/base.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'eac_ruby_utils/require_sub'
|
4
4
|
require 'eac_ruby_utils/simple_cache'
|
5
5
|
require 'avm/instances/entries'
|
6
|
+
require 'avm/instances/entry_keys'
|
6
7
|
::EacRubyUtils.require_sub(__FILE__)
|
7
8
|
|
8
9
|
module Avm
|
@@ -62,7 +63,7 @@ module Avm
|
|
62
63
|
private
|
63
64
|
|
64
65
|
def source_instance_uncached
|
65
|
-
::Avm::Instances::Base.by_id(read_entry(
|
66
|
+
::Avm::Instances::Base.by_id(read_entry(::Avm::Instances::EntryKeys::SOURCE_INSTANCE_ID))
|
66
67
|
end
|
67
68
|
end
|
68
69
|
end
|
@@ -10,19 +10,20 @@ module Avm
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def auto_ssh_hostname
|
13
|
-
inherited_entry_value(
|
13
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.hostname')
|
14
14
|
end
|
15
15
|
|
16
16
|
def auto_ssh_port
|
17
|
-
inherited_entry_value(
|
17
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.port') || 22
|
18
18
|
end
|
19
19
|
|
20
20
|
def auto_ssh_username
|
21
|
-
inherited_entry_value(
|
21
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.username')
|
22
22
|
end
|
23
23
|
|
24
24
|
def auto_ssh_url
|
25
|
-
inherited_entry_value(
|
25
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.url') ||
|
26
|
+
auto_ssh_url_by_parts
|
26
27
|
end
|
27
28
|
|
28
29
|
def auto_ssh_url_by_parts
|
@@ -6,11 +6,11 @@ module Avm
|
|
6
6
|
module AutoValues
|
7
7
|
module Admin
|
8
8
|
def auto_admin_email
|
9
|
-
inherited_entry_value(
|
9
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'admin.email')
|
10
10
|
end
|
11
11
|
|
12
12
|
def auto_admin_name
|
13
|
-
inherited_entry_value(
|
13
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'admin.name')
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -46,7 +46,7 @@ module Avm
|
|
46
46
|
def database_auto_common(suffix)
|
47
47
|
database_key = ::Avm::Instances::EntryKeys.const_get("database_#{suffix}".upcase)
|
48
48
|
inherited_entry_value(::Avm::Instances::EntryKeys::DATABASE_ID, database_key) ||
|
49
|
-
inherited_entry_value(
|
49
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, database_key)
|
50
50
|
end
|
51
51
|
|
52
52
|
def database_port_by_system
|
@@ -5,12 +5,18 @@ module Avm
|
|
5
5
|
class Base
|
6
6
|
module AutoValues
|
7
7
|
module Filesystem
|
8
|
+
FS_PATH_KEY = :fs_path
|
9
|
+
|
8
10
|
def auto_fs_path
|
9
|
-
inherited_entry_value(
|
11
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, FS_PATH_KEY) do |v|
|
12
|
+
v + '/' + id
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
16
|
def auto_data_fs_path
|
13
|
-
inherited_entry_value(
|
17
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, :data_fs_path) do |v|
|
18
|
+
v + '/' + id
|
19
|
+
end
|
14
20
|
end
|
15
21
|
|
16
22
|
def auto_fs_url
|
@@ -8,12 +8,12 @@ module Avm
|
|
8
8
|
module AutoValues
|
9
9
|
module System
|
10
10
|
def auto_system_username
|
11
|
-
inherited_entry_value(
|
11
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'system.username') ||
|
12
12
|
read_entry_optional('ssh.username')
|
13
13
|
end
|
14
14
|
|
15
15
|
def auto_system_groupname
|
16
|
-
inherited_entry_value(
|
16
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'system.groupname') ||
|
17
17
|
read_entry_optional('system.username')
|
18
18
|
end
|
19
19
|
end
|