eac_tools 0.31.1 → 0.32.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +36 -36
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +1 -1
- data/sub/avm/lib/avm/entries/auto_values/entry.rb +11 -4
- data/sub/avm/lib/avm/entries/jobs/base.rb +62 -0
- data/sub/avm/lib/avm/entries/jobs/variables_source/read_entry.rb +50 -0
- data/sub/avm/lib/avm/entries/jobs/variables_source.rb +15 -0
- data/sub/avm/lib/avm/entries/jobs/with_variables_source.rb +15 -0
- data/sub/avm/lib/avm/{jobs.rb → entries/jobs.rb} +4 -2
- data/sub/avm/lib/avm/instances/base/entry_keys.rb +1 -1
- data/sub/avm/lib/avm/instances/entry_keys.rb +1 -1
- data/sub/avm/lib/avm/rspec/setup.rb +7 -8
- data/sub/avm/lib/avm/rspec/shared_examples/entries_values.rb +23 -0
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm/spec/lib/avm/instances/base_spec.rb +77 -97
- data/sub/avm/spec/lib/avm/instances/{base_spec_configs_storage.yml → base_spec_files/config.yml} +0 -0
- data/sub/avm-eac_asciidoctor_base0/avm-eac_asciidoctor_base0.gemspec +2 -2
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/apache_host.rb +2 -2
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/apache_path.rb +2 -2
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/deploy.rb +2 -2
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
- data/sub/avm-eac_latex_base0/avm-eac_latex_base0.gemspec +3 -3
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/apache_host.rb +2 -2
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/deploy.rb +2 -2
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/version.rb +1 -1
- data/sub/avm-eac_rails_base0/avm-eac_rails_base0.gemspec +2 -2
- data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/apache_host.rb +2 -2
- data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/apache_path.rb +2 -2
- data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/deploy.rb +2 -2
- data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb +1 -1
- data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +4 -4
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/apache_host.rb +19 -0
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit/service.rb +72 -0
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit/tasks_scheduler_command.rb +31 -0
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb +59 -0
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/tasks_scheduler/systemd_unit.rb +4 -4
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +1 -1
- data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/{systemd_unit → instances/systemd_unit}/tasks_scheduler.service +0 -0
- data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/{systemd_unit → instances/systemd_unit}/tasks_scheduler_command.sh +0 -0
- data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +2 -2
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/apache_host.rb +2 -2
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/database.rb +30 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/gitolite.rb +42 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/web.rb +20 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base.rb +1 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/deploy.rb +2 -2
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/docker_image.rb +2 -6
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
- data/sub/avm-eac_redmine_base0/spec/lib/avm/eac_redmine_base0/instances/base/gitolite_spec.rb +26 -0
- data/sub/avm-eac_redmine_base0/spec/lib/avm/eac_redmine_base0/instances/base/gitolite_spec_files/config.yml +10 -0
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/deploy/config/install.sh.template +11 -3
- data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +2 -2
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/apache_host.rb +85 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/apache_path.rb +54 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/base.rb +1 -1
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/appended_directories.rb +27 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/build.rb +50 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/file_unit.rb +44 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/git_info.rb +64 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/version.rb +26 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/write_on_target.rb +20 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy.rb +75 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +1 -1
- data/sub/avm-eac_webapp_base0/template/avm/eac_webapp_base0/{apache_host → instances/apache_host}/no_ssl.conf +0 -0
- data/sub/avm-eac_webapp_base0/template/avm/eac_webapp_base0/{apache_path → instances/apache_path}/default.conf +0 -0
- data/sub/avm-eac_wordpress_base0/avm-eac_wordpress_base0.gemspec +3 -3
- data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/apache_host.rb +2 -2
- data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/deploy.rb +2 -2
- data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/version.rb +1 -1
- metadata +63 -31
- data/sub/avm/lib/avm/jobs/base.rb +0 -63
- data/sub/avm/lib/avm/jobs/variables_source.rb +0 -22
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/apache_host.rb +0 -17
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/service.rb +0 -70
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.rb +0 -29
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit.rb +0 -57
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/apache_host.rb +0 -83
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/apache_path.rb +0 -51
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/appended_directories.rb +0 -25
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/build.rb +0 -48
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/file_unit.rb +0 -42
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/git_info.rb +0 -62
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/version.rb +0 -24
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/write_on_target.rb +0 -18
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy.rb +0 -73
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'avm/entries/jobs/base'
|
5
|
+
require 'avm/eac_ubuntu_base0/apache'
|
6
|
+
require 'eac_templates/core_ext'
|
7
|
+
|
8
|
+
module Avm
|
9
|
+
module EacWebappBase0
|
10
|
+
module Instances
|
11
|
+
class ApacheHost
|
12
|
+
APACHE_DIRECTORY_EXTRA_CONFIG_KEY = 'install.apache_directory_extra_config'
|
13
|
+
JOBS = %w[write_available_no_ssl_site enable_no_ssl_site remove_ssl_site reload_apache
|
14
|
+
run_certbot enable_ssl_site reload_apache].freeze
|
15
|
+
include ::Avm::Entries::Jobs::Base
|
16
|
+
|
17
|
+
def directory_extra_config
|
18
|
+
instance.entry(APACHE_DIRECTORY_EXTRA_CONFIG_KEY).value.if_present { |v| " #{v}\n" }
|
19
|
+
end
|
20
|
+
|
21
|
+
def no_ssl_site_content
|
22
|
+
::Avm::EacWebappBase0::Instances::ApacheHost
|
23
|
+
.template.child('no_ssl.conf')
|
24
|
+
.apply(variables_source)
|
25
|
+
end
|
26
|
+
|
27
|
+
def ssl?
|
28
|
+
options[:certbot]
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def apache_uncached
|
34
|
+
::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
|
35
|
+
end
|
36
|
+
|
37
|
+
def enable_no_ssl_site
|
38
|
+
infom 'Enabling no SSL site...'
|
39
|
+
no_ssl_site.enable
|
40
|
+
end
|
41
|
+
|
42
|
+
def enable_ssl_site
|
43
|
+
return unless ssl?
|
44
|
+
|
45
|
+
infom 'Enabling SSL site...'
|
46
|
+
ssl_site.enable
|
47
|
+
end
|
48
|
+
|
49
|
+
def no_ssl_site_uncached
|
50
|
+
apache.site(instance.id)
|
51
|
+
end
|
52
|
+
|
53
|
+
def reload_apache
|
54
|
+
infom 'Reloading Apache...'
|
55
|
+
apache.service('reload')
|
56
|
+
end
|
57
|
+
|
58
|
+
def remove_ssl_site
|
59
|
+
infom 'Removing SSL site...'
|
60
|
+
ssl_site.remove
|
61
|
+
end
|
62
|
+
|
63
|
+
def run_certbot
|
64
|
+
return unless ssl?
|
65
|
+
|
66
|
+
infom 'Running Certbot...'
|
67
|
+
instance.host_env.command(
|
68
|
+
'sudo', 'certbot', '--apache', '--domain', instance.read_entry('web.hostname'),
|
69
|
+
'--redirect', '--non-interactive', '--agree-tos',
|
70
|
+
'--email', instance.install_email
|
71
|
+
).system!
|
72
|
+
end
|
73
|
+
|
74
|
+
def ssl_site_uncached
|
75
|
+
apache.site(no_ssl_site.name + '-le-ssl')
|
76
|
+
end
|
77
|
+
|
78
|
+
def write_available_no_ssl_site
|
79
|
+
infom 'Writing no SSL site conf...'
|
80
|
+
no_ssl_site.write(no_ssl_site_content)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/entries/jobs/base'
|
4
|
+
require 'avm/eac_ubuntu_base0/apache'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module EacWebappBase0
|
9
|
+
module Instances
|
10
|
+
class ApachePath
|
11
|
+
JOBS = %w[write_available_conf enable_conf reload_apache].freeze
|
12
|
+
include ::Avm::Entries::Jobs::Base
|
13
|
+
|
14
|
+
def content
|
15
|
+
::Avm::EacWebappBase0::Instances::ApachePath.template.child('default.conf')
|
16
|
+
.apply(variables_source)
|
17
|
+
end
|
18
|
+
|
19
|
+
def document_root
|
20
|
+
instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH)
|
21
|
+
end
|
22
|
+
|
23
|
+
def extra_content
|
24
|
+
''
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def apache_uncached
|
30
|
+
::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
|
31
|
+
end
|
32
|
+
|
33
|
+
def enable_conf
|
34
|
+
infom 'Enabling configuration...'
|
35
|
+
conf.enable
|
36
|
+
end
|
37
|
+
|
38
|
+
def reload_apache
|
39
|
+
infom 'Reloading Apache...'
|
40
|
+
apache.service('reload')
|
41
|
+
end
|
42
|
+
|
43
|
+
def conf_uncached
|
44
|
+
apache.conf(instance.id)
|
45
|
+
end
|
46
|
+
|
47
|
+
def write_available_conf
|
48
|
+
infom 'Writing available configuration...'
|
49
|
+
conf.write(content)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -4,7 +4,7 @@ require 'avm/instances/base'
|
|
4
4
|
require 'avm/eac_postgresql_base0/instance_with'
|
5
5
|
require 'avm/data/instance/files_unit'
|
6
6
|
require 'avm/data/instance/package'
|
7
|
-
require 'avm/eac_webapp_base0/deploy/file_unit'
|
7
|
+
require 'avm/eac_webapp_base0/instances/deploy/file_unit'
|
8
8
|
require 'avm/eac_webapp_base0/instances/runners'
|
9
9
|
require 'avm/eac_ubuntu_base0/instances/base'
|
10
10
|
|
data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/appended_directories.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/path_string'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacWebappBase0
|
7
|
+
module Instances
|
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[OPTION_APPENDED_DIRECTORIES] || []
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/files/appender'
|
4
|
+
require 'avm/files/deploy'
|
5
|
+
require 'eac_ruby_utils/envs'
|
6
|
+
require 'eac_ruby_utils/fs/temp'
|
7
|
+
|
8
|
+
module Avm
|
9
|
+
module EacWebappBase0
|
10
|
+
module Instances
|
11
|
+
class Deploy
|
12
|
+
module Build
|
13
|
+
private
|
14
|
+
|
15
|
+
attr_accessor :build_dir
|
16
|
+
|
17
|
+
def append_instance_content
|
18
|
+
::Avm::Files::Appender
|
19
|
+
.new
|
20
|
+
.variables_source_set(variables_source)
|
21
|
+
.append_templatized_directory(template.path)
|
22
|
+
.append_templatized_directories(appended_directories)
|
23
|
+
.append_file_content(version_target_path, version)
|
24
|
+
.write_appended_on(build_dir)
|
25
|
+
end
|
26
|
+
|
27
|
+
def build_dir_env
|
28
|
+
::EacRubyUtils::Envs.local
|
29
|
+
end
|
30
|
+
|
31
|
+
def create_build_dir
|
32
|
+
self.build_dir = ::EacRubyUtils::Fs::Temp.directory
|
33
|
+
end
|
34
|
+
|
35
|
+
def remove_build_dir
|
36
|
+
build_dir&.remove
|
37
|
+
end
|
38
|
+
|
39
|
+
def build_content
|
40
|
+
infom 'Writing Git source code...'
|
41
|
+
::Avm::Git::Commit.new(git, commit_sha1).deploy_to_env_path(
|
42
|
+
build_dir_env,
|
43
|
+
build_dir
|
44
|
+
).variables_source_set(variables_source).run
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Avm
|
4
|
+
module EacWebappBase0
|
5
|
+
module Instances
|
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.install_data_path, data_key.to_s)
|
28
|
+
end
|
29
|
+
|
30
|
+
def target_path
|
31
|
+
::File.join(instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH),
|
32
|
+
fs_path_subpath.to_s)
|
33
|
+
end
|
34
|
+
|
35
|
+
def link_source_target
|
36
|
+
infom "Linking \"#{data_key}\" directory..."
|
37
|
+
instance.host_env.command('rm', '-rf', target_path).execute!
|
38
|
+
instance.host_env.command('ln', '-s', source_path, target_path).execute!
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Avm
|
4
|
+
module EacWebappBase0
|
5
|
+
module Instances
|
6
|
+
class Deploy
|
7
|
+
module GitInfo
|
8
|
+
def commit_sha1_uncached
|
9
|
+
git_fetch
|
10
|
+
r = git.rev_parse(git_reference_found)
|
11
|
+
return r if r
|
12
|
+
|
13
|
+
raise ::Avm::Result::Error, "No commit SHA1 found for \"#{git_reference_found}\""
|
14
|
+
end
|
15
|
+
|
16
|
+
def git_fetch_uncached
|
17
|
+
infom "Fetching remote \"#{git_remote_name}\" from \"#{git_repository_path}\"..."
|
18
|
+
git.fetch(git_remote_name)
|
19
|
+
end
|
20
|
+
|
21
|
+
def git_reference
|
22
|
+
options[OPTION_REFERENCE] || DEFAULT_REFERENCE
|
23
|
+
end
|
24
|
+
|
25
|
+
def git_reference_found_uncached
|
26
|
+
%w[git_reference instance_branch master_branch].map { |b| send(b) }.find(&:present?) ||
|
27
|
+
raise(
|
28
|
+
::Avm::Result::Error,
|
29
|
+
'No git reference found (Searched for option, instance and master)'
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
def git_remote_hashs_uncached
|
34
|
+
git.remote_hashs(git_remote_name)
|
35
|
+
end
|
36
|
+
|
37
|
+
def git_remote_name
|
38
|
+
::Avm::Git::DEFAULT_REMOTE_NAME
|
39
|
+
end
|
40
|
+
|
41
|
+
def git_repository_path
|
42
|
+
instance.source_instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH)
|
43
|
+
end
|
44
|
+
|
45
|
+
def git_uncached
|
46
|
+
::Avm::Launcher::Git::Base.new(git_repository_path)
|
47
|
+
end
|
48
|
+
|
49
|
+
def instance_branch
|
50
|
+
remote_branch(instance.id)
|
51
|
+
end
|
52
|
+
|
53
|
+
def remote_branch(name)
|
54
|
+
git_remote_hashs.key?("refs/heads/#{name}") ? "#{git_remote_name}/#{name}" : nil
|
55
|
+
end
|
56
|
+
|
57
|
+
def master_branch
|
58
|
+
remote_branch('master')
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Avm
|
4
|
+
module EacWebappBase0
|
5
|
+
module Instances
|
6
|
+
class Deploy
|
7
|
+
module Version
|
8
|
+
VERSION_TARGET_PATH = 'VERSION'
|
9
|
+
|
10
|
+
def version
|
11
|
+
([::Time.now, commit_sha1] + version_git_refs).join('|')
|
12
|
+
end
|
13
|
+
|
14
|
+
def version_git_refs
|
15
|
+
git_remote_hashs.select { |_name, sha1| sha1 == commit_sha1 }.keys
|
16
|
+
.map { |ref| ref.gsub(%r{\Arefs/}, '') }.reject { |ref| ref == 'HEAD' }
|
17
|
+
end
|
18
|
+
|
19
|
+
def version_target_path
|
20
|
+
VERSION_TARGET_PATH
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacWebappBase0
|
7
|
+
module Instances
|
8
|
+
class Deploy
|
9
|
+
module WriteOnTarget
|
10
|
+
def write_on_target
|
11
|
+
::Avm::Files::Deploy.new(
|
12
|
+
instance.host_env,
|
13
|
+
instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH)
|
14
|
+
).append_plain_directory(build_dir).run
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/callbacks'
|
4
|
+
require 'avm/entries/jobs/base'
|
5
|
+
require 'avm/git'
|
6
|
+
require 'eac_ruby_utils/core_ext'
|
7
|
+
require 'eac_templates/core_ext'
|
8
|
+
require 'avm/launcher/git/base'
|
9
|
+
require 'net/http'
|
10
|
+
|
11
|
+
module Avm
|
12
|
+
module EacWebappBase0
|
13
|
+
module Instances
|
14
|
+
class Deploy
|
15
|
+
require_sub __FILE__, include_modules: true
|
16
|
+
|
17
|
+
DEFAULT_REFERENCE = 'HEAD'
|
18
|
+
|
19
|
+
REQUEST_TEST_JOB = 'request_test'
|
20
|
+
JOBS = (%w[create_build_dir build_content append_instance_content write_on_target
|
21
|
+
setup_files_units assert_instance_branch] + [REQUEST_TEST_JOB]).freeze
|
22
|
+
|
23
|
+
include ::Avm::Entries::Jobs::Base
|
24
|
+
|
25
|
+
lists.add_symbol :option, :appended_directories, :no_request_test, :reference
|
26
|
+
|
27
|
+
def option_list
|
28
|
+
::Avm::EacWebappBase0::Instances::Deploy.lists.option
|
29
|
+
end
|
30
|
+
|
31
|
+
def run
|
32
|
+
super
|
33
|
+
ensure
|
34
|
+
remove_build_dir
|
35
|
+
end
|
36
|
+
|
37
|
+
def start_banner
|
38
|
+
infov 'Instance', instance
|
39
|
+
infov 'Git reference (User)', git_reference.if_present('- BLANK -')
|
40
|
+
infov 'Git remote name', git_remote_name
|
41
|
+
infov 'Git reference (Found)', git_reference_found
|
42
|
+
infov 'Git commit SHA1', commit_sha1
|
43
|
+
infov 'Appended directories', appended_directories
|
44
|
+
end
|
45
|
+
|
46
|
+
def setup_files_units
|
47
|
+
instance.class.const_get('FILES_UNITS').each do |data_key, fs_path_subpath|
|
48
|
+
FileUnit.new(self, data_key, fs_path_subpath).run
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def assert_instance_branch
|
53
|
+
infom 'Setting instance branch...'
|
54
|
+
git.execute!('push', git_remote_name, "#{commit_sha1}:refs/heads/#{instance.id}", '-f')
|
55
|
+
end
|
56
|
+
|
57
|
+
def request_test
|
58
|
+
infom 'Requesting web interface...'
|
59
|
+
uri = URI(instance.read_entry('web.url'))
|
60
|
+
response = ::Net::HTTP.get_response(uri)
|
61
|
+
infov 'Response status', response.code
|
62
|
+
fatal_error "Request to #{uri} failed" unless response.code.to_i == 200
|
63
|
+
end
|
64
|
+
|
65
|
+
protected
|
66
|
+
|
67
|
+
def jobs
|
68
|
+
r = super
|
69
|
+
r.delete(REQUEST_TEST_JOB) if options[OPTION_NO_REQUEST_TEST]
|
70
|
+
r
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
File without changes
|
File without changes
|
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,template}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm', '~> 0.
|
16
|
-
s.add_dependency 'avm-eac_webapp_base0', '~> 0.
|
17
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
15
|
+
s.add_dependency 'avm', '~> 0.45'
|
16
|
+
s.add_dependency 'avm-eac_webapp_base0', '~> 0.9'
|
17
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.104'
|
18
18
|
|
19
19
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5', '>= 0.5.1'
|
20
20
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/eac_webapp_base0/apache_host'
|
3
|
+
require 'avm/eac_webapp_base0/instances/apache_host'
|
4
4
|
|
5
5
|
module Avm
|
6
6
|
module EacWordpressBase0
|
7
7
|
module Instances
|
8
|
-
class ApacheHost < ::Avm::EacWebappBase0::ApacheHost
|
8
|
+
class ApacheHost < ::Avm::EacWebappBase0::Instances::ApacheHost
|
9
9
|
def document_root
|
10
10
|
instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH)
|
11
11
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/eac_webapp_base0/deploy'
|
3
|
+
require 'avm/eac_webapp_base0/instances/deploy'
|
4
4
|
|
5
5
|
module Avm
|
6
6
|
module EacWordpressBase0
|
7
7
|
module Instances
|
8
|
-
class Deploy < ::Avm::EacWebappBase0::Deploy
|
8
|
+
class Deploy < ::Avm::EacWebappBase0::Instances::Deploy
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|