avm-tools 0.68.0 → 0.70.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 +1 -1
- data/lib/avm/eac_rails_base0/apache_host.rb +17 -0
- data/lib/avm/eac_rails_base0/apache_path.rb +50 -0
- data/lib/avm/eac_rails_base0/deploy.rb +51 -0
- data/lib/avm/eac_rails_base0/instance.rb +14 -0
- data/lib/avm/eac_redmine_base0/deploy.rb +4 -4
- 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 +103 -0
- data/lib/avm/eac_webapp_base0/deploy.rb +102 -0
- data/lib/avm/eac_webapp_base0/deploy/appended_directories.rb +25 -0
- data/lib/avm/eac_webapp_base0/deploy/file_unit.rb +42 -0
- data/lib/avm/eac_webapp_base0/deploy/git_info.rb +49 -0
- data/lib/avm/eac_webapp_base0/deploy/version.rb +20 -0
- data/lib/avm/eac_webapp_base0/instance.rb +50 -0
- data/lib/avm/eac_webapp_base0/runner/apache_host.rb +39 -0
- data/lib/avm/eac_webapp_base0/runner/data.rb +25 -0
- data/lib/avm/eac_webapp_base0/runner/data/dump.rb +69 -0
- data/lib/avm/eac_webapp_base0/runner/data/load.rb +66 -0
- data/lib/avm/eac_webapp_base0/runner/deploy.rb +59 -0
- data/lib/avm/git/issue/complete/_git_subrepos.rb +1 -0
- data/lib/avm/instances/base/auto_values/filesystem.rb +3 -1
- data/lib/avm/instances/entries.rb +5 -8
- data/lib/avm/instances/entry.rb +47 -0
- data/lib/avm/instances/entry_keys.rb +2 -0
- data/lib/avm/self/instance.rb +1 -1
- data/lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb +3 -3
- data/lib/avm/stereotypes/eac_wordpress_base0/deploy.rb +2 -2
- data/lib/avm/stereotypes/eac_wordpress_base0/instance.rb +2 -2
- data/lib/avm/tools/runner/eac_rails_base0.rb +9 -14
- data/lib/avm/tools/runner/eac_rails_base0/apache_host.rb +3 -26
- data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +38 -0
- data/lib/avm/tools/runner/eac_rails_base0/data.rb +2 -2
- data/lib/avm/tools/runner/eac_rails_base0/deploy.rb +3 -3
- data/lib/avm/tools/runner/eac_redmine_base0/data.rb +1 -1
- data/lib/avm/tools/runner/eac_redmine_base0/data/dump.rb +2 -2
- data/lib/avm/tools/runner/eac_redmine_base0/deploy.rb +2 -2
- data/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb +1 -0
- data/lib/avm/tools/runner/eac_wordpress_base0/apache_host.rb +3 -25
- data/lib/avm/tools/runner/eac_wordpress_base0/data.rb +2 -2
- data/lib/avm/tools/runner/eac_wordpress_base0/deploy.rb +2 -2
- data/lib/avm/tools/runner/git/deploy.rb +3 -1
- data/lib/avm/tools/version.rb +1 -1
- data/template/avm/eac_rails_base0/apache_path/default.conf +13 -0
- data/template/avm/{stereotypes/eac_rails_base0 → eac_rails_base0}/deploy/config/database.yml.template +0 -0
- data/template/avm/{stereotypes/eac_webapp_base0 → eac_webapp_base0}/apache_host/no_ssl.conf +0 -0
- data/template/avm/self/docker_image/Dockerfile +1 -1
- data/vendor/eac_cli/Gemfile +5 -0
- data/vendor/eac_cli/eac_cli.gemspec +18 -0
- data/vendor/eac_cli/lib/eac_cli.rb +7 -0
- data/vendor/eac_cli/lib/eac_cli/core_ext.rb +4 -0
- data/vendor/eac_cli/lib/eac_cli/default_runner.rb +14 -0
- data/vendor/eac_cli/lib/eac_cli/definition.rb +72 -0
- data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +13 -0
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +26 -0
- data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +13 -0
- data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +27 -0
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +77 -0
- data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +45 -0
- data/vendor/eac_cli/lib/eac_cli/parser.rb +14 -0
- data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +56 -0
- data/vendor/eac_cli/lib/eac_cli/parser/error.rb +15 -0
- data/vendor/eac_cli/lib/eac_cli/parser/options_collection.rb +105 -0
- data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +21 -0
- data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +49 -0
- data/vendor/eac_cli/lib/eac_cli/patches.rb +4 -0
- data/vendor/eac_cli/lib/eac_cli/patches/object.rb +5 -0
- data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +24 -0
- data/vendor/eac_cli/lib/eac_cli/runner.rb +87 -0
- data/vendor/eac_cli/lib/eac_cli/runner/context.rb +18 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with.rb +9 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +19 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +26 -0
- data/vendor/eac_cli/lib/eac_cli/version.rb +5 -0
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +70 -0
- data/vendor/eac_cli/spec/rubocop_spec.rb +7 -0
- data/vendor/eac_cli/spec/spec_helper.rb +100 -0
- data/vendor/eac_git/lib/eac_git/version.rb +1 -1
- data/vendor/eac_git/vendor/git-subrepo/lib/git-subrepo +9 -7
- data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +3 -3
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +5 -1
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +10 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/version_file.rb +6 -5
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +5 -34
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +42 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/result.rb +25 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
- data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb +14 -0
- data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb +7 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb +4 -4
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb +6 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_class_methods.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_subcommands.rb +8 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +18 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/value.rb +3 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +9 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +6 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +53 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/inflector_spec.rb +15 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/struct_spec.rb +46 -0
- metadata +66 -22
- data/lib/avm/instances/entries/entry_reader.rb +0 -45
- data/lib/avm/stereotypes/eac_rails_base0/apache_host.rb +0 -19
- data/lib/avm/stereotypes/eac_rails_base0/deploy.rb +0 -52
- data/lib/avm/stereotypes/eac_rails_base0/instance.rb +0 -16
- 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/eac_webapp_base0/apache_host.rb +0 -97
- data/lib/avm/stereotypes/eac_webapp_base0/deploy.rb +0 -104
- data/lib/avm/stereotypes/eac_webapp_base0/deploy/appended_directories.rb +0 -27
- data/lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb +0 -43
- data/lib/avm/stereotypes/eac_webapp_base0/deploy/git_info.rb +0 -51
- data/lib/avm/stereotypes/eac_webapp_base0/deploy/version.rb +0 -22
- data/lib/avm/stereotypes/eac_webapp_base0/instance.rb +0 -52
- data/lib/avm/stereotypes/eac_webapp_base0/runner/data.rb +0 -27
- data/lib/avm/stereotypes/eac_webapp_base0/runner/data/dump.rb +0 -71
- data/lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb +0 -68
- data/lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb +0 -61
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/stereotypes/eac_webapp_base0/apache_host'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Stereotypes
|
7
|
-
module EacRailsBase0
|
8
|
-
class ApacheHost < ::Avm::Stereotypes::EacWebappBase0::ApacheHost
|
9
|
-
def document_root
|
10
|
-
"#{instance.read_entry(:fs_path)}/public"
|
11
|
-
end
|
12
|
-
|
13
|
-
def extra_content
|
14
|
-
'PassengerEnabled On'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/stereotypes/eac_webapp_base0/deploy'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Stereotypes
|
7
|
-
module EacRailsBase0
|
8
|
-
class Deploy < ::Avm::Stereotypes::EacWebappBase0::Deploy
|
9
|
-
set_callback :assert_instance_branch, :after do
|
10
|
-
bundle_install
|
11
|
-
assert_database
|
12
|
-
database_migrate
|
13
|
-
compile_assets
|
14
|
-
restart_tasks_scheduler
|
15
|
-
touch_restart_file
|
16
|
-
end
|
17
|
-
|
18
|
-
def assert_database
|
19
|
-
infom 'Asserting database...'
|
20
|
-
instance.rake('db:create').system!
|
21
|
-
end
|
22
|
-
|
23
|
-
def bundle_install
|
24
|
-
infom 'Running "bundle install"...'
|
25
|
-
instance.bundle('install').system!
|
26
|
-
end
|
27
|
-
|
28
|
-
def compile_assets
|
29
|
-
infom 'Compiling assets...'
|
30
|
-
instance.rake('assets:clean', 'assets:precompile').system!
|
31
|
-
end
|
32
|
-
|
33
|
-
def database_migrate
|
34
|
-
infom 'Running database migrations...'
|
35
|
-
instance.rake('db:migrate').system!
|
36
|
-
end
|
37
|
-
|
38
|
-
def restart_tasks_scheduler
|
39
|
-
infom 'Restarting Tasks Scheduler\'s daemon...'
|
40
|
-
instance.bundle('exec', 'tasks_scheduler', 'restart').system!
|
41
|
-
end
|
42
|
-
|
43
|
-
def touch_restart_file
|
44
|
-
infom 'Touching restart file...'
|
45
|
-
instance.host_env.command(
|
46
|
-
'touch', ::File.join(instance.read_entry(:fs_path), 'tmp', 'restart.txt')
|
47
|
-
).system!
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/stereotypes/eac_webapp_base0/instance'
|
4
|
-
require 'avm/stereotypes/rails/instance'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Stereotypes
|
8
|
-
module EacRailsBase0
|
9
|
-
class Instance < ::Avm::Stereotypes::EacWebappBase0::Instance
|
10
|
-
include ::Avm::Stereotypes::Rails::Instance
|
11
|
-
|
12
|
-
FILES_UNITS = { uploads: 'public/uploads' }.freeze
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_ruby_utils/require_sub'
|
5
|
-
::EacRubyUtils.require_sub(__FILE__)
|
6
|
-
|
7
|
-
module Avm
|
8
|
-
module Stereotypes
|
9
|
-
module EacUbuntuBase0
|
10
|
-
class Apache
|
11
|
-
common_constructor :host_env
|
12
|
-
|
13
|
-
def etc_root
|
14
|
-
'/etc/apache2'
|
15
|
-
end
|
16
|
-
|
17
|
-
def service(command)
|
18
|
-
host_env.command('sudo', 'service', 'apache2', command)
|
19
|
-
end
|
20
|
-
|
21
|
-
def site(name)
|
22
|
-
::Avm::Stereotypes::EacUbuntuBase0::Apache::Site.new(self, name)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Stereotypes
|
7
|
-
module EacUbuntuBase0
|
8
|
-
class Apache
|
9
|
-
class Site
|
10
|
-
common_constructor :apache, :name
|
11
|
-
|
12
|
-
def available_path
|
13
|
-
::File.join(apache.etc_root, 'sites-available', "#{name}.conf")
|
14
|
-
end
|
15
|
-
|
16
|
-
def available?
|
17
|
-
apache.host_env.file(available_path).exist?
|
18
|
-
end
|
19
|
-
|
20
|
-
def disable
|
21
|
-
apache.host_env.command('sudo', 'a2dissite', name).execute!
|
22
|
-
end
|
23
|
-
|
24
|
-
def enable
|
25
|
-
apache.host_env.command('sudo', 'a2ensite', name).execute!
|
26
|
-
end
|
27
|
-
|
28
|
-
def enabled_path
|
29
|
-
::File.join(apache.etc_root, 'sites-enabled', "#{name}.conf")
|
30
|
-
end
|
31
|
-
|
32
|
-
def enabled?
|
33
|
-
apache.host_env.file(enabled_path).exist?
|
34
|
-
end
|
35
|
-
|
36
|
-
def remove
|
37
|
-
remove_disabled
|
38
|
-
remove_available
|
39
|
-
end
|
40
|
-
|
41
|
-
def remove_available
|
42
|
-
raise 'Remove enabled before' if enabled?
|
43
|
-
|
44
|
-
apache.host_env.command('sudo', 'rm', '-f', available_path).execute! if available?
|
45
|
-
end
|
46
|
-
|
47
|
-
def remove_disabled
|
48
|
-
disable if enabled?
|
49
|
-
apache.host_env.command('sudo', 'rm', '-f', enabled_path).execute! if enabled?
|
50
|
-
end
|
51
|
-
|
52
|
-
def write(content)
|
53
|
-
::EacRubyUtils::Envs.local.command('echo', content).pipe(
|
54
|
-
apache.host_env.command('sudo', 'tee', available_path)
|
55
|
-
).execute!
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'avm/docker/image'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Stereotypes
|
8
|
-
module EacUbuntuBase0
|
9
|
-
class DockerImage < ::Avm::Docker::Image
|
10
|
-
def stereotype_tag
|
11
|
-
'eac_ubuntu_base0'
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,97 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'avm/patches/object/template'
|
5
|
-
require 'avm/stereotypes/eac_ubuntu_base0/apache'
|
6
|
-
require 'avm/patches/object/template'
|
7
|
-
|
8
|
-
module Avm
|
9
|
-
module Stereotypes
|
10
|
-
module EacWebappBase0
|
11
|
-
class ApacheHost
|
12
|
-
enable_console_speaker
|
13
|
-
enable_simple_cache
|
14
|
-
common_constructor :instance
|
15
|
-
|
16
|
-
def run
|
17
|
-
write_available_no_ssl_site
|
18
|
-
enable_no_ssl_site
|
19
|
-
remove_ssl_site
|
20
|
-
reload_apache
|
21
|
-
run_certbot
|
22
|
-
enable_ssl_site
|
23
|
-
reload_apache
|
24
|
-
::Avm::Result.success('Done')
|
25
|
-
end
|
26
|
-
|
27
|
-
def no_ssl_site_content
|
28
|
-
::Avm::Stereotypes::EacWebappBase0::ApacheHost.template.child('no_ssl.conf')
|
29
|
-
.apply(EntriesReader.new(self, instance))
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def apache_uncached
|
35
|
-
::Avm::Stereotypes::EacUbuntuBase0::Apache.new(instance.host_env)
|
36
|
-
end
|
37
|
-
|
38
|
-
def enable_no_ssl_site
|
39
|
-
infom 'Enabling no SSL site...'
|
40
|
-
no_ssl_site.enable
|
41
|
-
end
|
42
|
-
|
43
|
-
def enable_ssl_site
|
44
|
-
infom 'Enabling SSL site...'
|
45
|
-
ssl_site.enable
|
46
|
-
end
|
47
|
-
|
48
|
-
def no_ssl_site_uncached
|
49
|
-
apache.site(instance.id)
|
50
|
-
end
|
51
|
-
|
52
|
-
def reload_apache
|
53
|
-
infom 'Reloading Apache...'
|
54
|
-
apache.service('reload')
|
55
|
-
end
|
56
|
-
|
57
|
-
def remove_ssl_site
|
58
|
-
infom 'Removing SSL site...'
|
59
|
-
ssl_site.remove
|
60
|
-
end
|
61
|
-
|
62
|
-
def run_certbot
|
63
|
-
infom 'Running Certbot...'
|
64
|
-
instance.host_env.command(
|
65
|
-
'sudo', 'certbot', '--apache', '--domain', instance.read_entry('web.hostname'),
|
66
|
-
'--redirect', '--non-interactive', '--agree-tos',
|
67
|
-
'--email', instance.read_entry('admin.email')
|
68
|
-
).system!
|
69
|
-
end
|
70
|
-
|
71
|
-
def ssl_site_uncached
|
72
|
-
apache.site(no_ssl_site.name + '-le-ssl')
|
73
|
-
end
|
74
|
-
|
75
|
-
def write_available_no_ssl_site
|
76
|
-
infom 'Writing no SSL site conf...'
|
77
|
-
no_ssl_site.write(no_ssl_site_content)
|
78
|
-
end
|
79
|
-
|
80
|
-
class EntriesReader
|
81
|
-
common_constructor :job, :instance
|
82
|
-
|
83
|
-
def read_entry(path, options = {})
|
84
|
-
entry_from_job(path) || instance.read_entry(path, options)
|
85
|
-
end
|
86
|
-
|
87
|
-
private
|
88
|
-
|
89
|
-
def entry_from_job(path)
|
90
|
-
method = path.gsub('.', '_').underscore
|
91
|
-
return job.send(method) if job.respond_to?(method, true)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
@@ -1,104 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'active_support/callbacks'
|
4
|
-
require 'delegate'
|
5
|
-
require 'eac_ruby_utils/core_ext'
|
6
|
-
require 'eac_launcher/git/base'
|
7
|
-
require 'avm/git'
|
8
|
-
require 'avm/patches/object/template'
|
9
|
-
require 'net/http'
|
10
|
-
|
11
|
-
module Avm
|
12
|
-
module Stereotypes
|
13
|
-
module EacWebappBase0
|
14
|
-
class Deploy
|
15
|
-
require_sub __FILE__, include_modules: true
|
16
|
-
include ::ActiveSupport::Callbacks
|
17
|
-
|
18
|
-
DEFAULT_REFERENCE = 'HEAD'
|
19
|
-
|
20
|
-
enable_console_speaker
|
21
|
-
enable_simple_cache
|
22
|
-
|
23
|
-
JOBS = %w[git_deploy setup_files_units assert_instance_branch request_test].freeze
|
24
|
-
define_callbacks(*JOBS)
|
25
|
-
|
26
|
-
attr_reader :instance, :options
|
27
|
-
|
28
|
-
def initialize(instance, options = {})
|
29
|
-
@instance = instance
|
30
|
-
@options = options
|
31
|
-
end
|
32
|
-
|
33
|
-
def build_git_commit
|
34
|
-
::Avm::Git::Commit.new(git, commit_sha1).deploy_to_env_path(
|
35
|
-
instance.host_env,
|
36
|
-
instance.read_entry(:fs_path)
|
37
|
-
).variables_source_set(instance)
|
38
|
-
end
|
39
|
-
|
40
|
-
def run
|
41
|
-
start_banner
|
42
|
-
JOBS.each do |job|
|
43
|
-
run_callbacks job do
|
44
|
-
send(job)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
::Avm::Result.success('Deployed')
|
48
|
-
rescue ::Avm::Result::Error => e
|
49
|
-
e.to_result
|
50
|
-
end
|
51
|
-
|
52
|
-
def start_banner
|
53
|
-
infov 'Instance', instance
|
54
|
-
infov 'Git reference (User)', git_reference.if_present('- BLANK -')
|
55
|
-
infov 'Git remote name', git_remote_name
|
56
|
-
infov 'Git reference (Found)', git_reference_found
|
57
|
-
infov 'Git commit SHA1', commit_sha1
|
58
|
-
infov 'Appended directories', appended_directories
|
59
|
-
end
|
60
|
-
|
61
|
-
def git_deploy
|
62
|
-
infom 'Deploying source code and appended content...'
|
63
|
-
build_git_commit
|
64
|
-
.append_directory(template.path)
|
65
|
-
.append_directories(appended_directories)
|
66
|
-
.append_file_content(VERSION_TARGET_PATH, version)
|
67
|
-
.run
|
68
|
-
end
|
69
|
-
|
70
|
-
def setup_files_units
|
71
|
-
instance.class.const_get('FILES_UNITS').each do |data_key, fs_path_subpath|
|
72
|
-
FileUnit.new(self, data_key, fs_path_subpath).run
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def assert_instance_branch
|
77
|
-
infom 'Setting instance branch...'
|
78
|
-
git.execute!('push', git_remote_name, "#{commit_sha1}:refs/heads/#{instance.id}", '-f')
|
79
|
-
end
|
80
|
-
|
81
|
-
def request_test
|
82
|
-
infom 'Requesting web interface...'
|
83
|
-
uri = URI(instance.read_entry('web.url'))
|
84
|
-
response = ::Net::HTTP.get_response(uri)
|
85
|
-
infov 'Response status', response.code
|
86
|
-
fatal_error "Request to #{uri} failed" unless response.code.to_i == 200
|
87
|
-
end
|
88
|
-
|
89
|
-
def git_uncached
|
90
|
-
::EacLauncher::Git::Base.new(git_repository_path)
|
91
|
-
end
|
92
|
-
|
93
|
-
def git_fetch_uncached
|
94
|
-
infom "Fetching remote \"#{git_remote_name}\" from \"#{git_repository_path}\"..."
|
95
|
-
git.fetch(git_remote_name)
|
96
|
-
end
|
97
|
-
|
98
|
-
def git_repository_path
|
99
|
-
instance.source_instance.read_entry(:fs_path)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/path_string'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Stereotypes
|
7
|
-
module EacWebappBase0
|
8
|
-
class Deploy
|
9
|
-
module AppendedDirectories
|
10
|
-
APPENDED_DIRECTORIES_ENTRY_KEY = 'deploy.appended_directories'
|
11
|
-
|
12
|
-
def appended_directories
|
13
|
-
appended_directories_from_instance_entry + appended_directories_from_options
|
14
|
-
end
|
15
|
-
|
16
|
-
def appended_directories_from_instance_entry
|
17
|
-
::Avm::PathString.paths(instance.read_entry_optional(APPENDED_DIRECTORIES_ENTRY_KEY))
|
18
|
-
end
|
19
|
-
|
20
|
-
def appended_directories_from_options
|
21
|
-
options[:appended_directories] || []
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module Stereotypes
|
5
|
-
module EacWebappBase0
|
6
|
-
class Deploy
|
7
|
-
class FileUnit < ::SimpleDelegator
|
8
|
-
attr_reader :data_key, :fs_path_subpath
|
9
|
-
|
10
|
-
def initialize(deploy, data_key, fs_path_subpath)
|
11
|
-
super(deploy)
|
12
|
-
@data_key = data_key
|
13
|
-
@fs_path_subpath = fs_path_subpath
|
14
|
-
end
|
15
|
-
|
16
|
-
def run
|
17
|
-
assert_source_directory
|
18
|
-
link_source_target
|
19
|
-
end
|
20
|
-
|
21
|
-
def assert_source_directory
|
22
|
-
infom "Asserting \"#{data_key}\" source directory..."
|
23
|
-
instance.host_env.command('mkdir', '-p', source_path).execute!
|
24
|
-
end
|
25
|
-
|
26
|
-
def source_path
|
27
|
-
::File.join(instance.read_entry(:data_fs_path), data_key.to_s)
|
28
|
-
end
|
29
|
-
|
30
|
-
def target_path
|
31
|
-
::File.join(instance.read_entry(:fs_path), fs_path_subpath.to_s)
|
32
|
-
end
|
33
|
-
|
34
|
-
def link_source_target
|
35
|
-
infom "Linking \"#{data_key}\" directory..."
|
36
|
-
instance.host_env.command('rm', '-rf', target_path).execute!
|
37
|
-
instance.host_env.command('ln', '-s', source_path, target_path).execute!
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|