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
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/path_string'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module EacWebappBase0
|
7
|
-
class Deploy
|
8
|
-
module AppendedDirectories
|
9
|
-
APPENDED_DIRECTORIES_ENTRY_KEY = 'deploy.appended_directories'
|
10
|
-
|
11
|
-
def appended_directories
|
12
|
-
appended_directories_from_instance_entry + appended_directories_from_options
|
13
|
-
end
|
14
|
-
|
15
|
-
def appended_directories_from_instance_entry
|
16
|
-
::Avm::PathString.paths(instance.read_entry_optional(APPENDED_DIRECTORIES_ENTRY_KEY))
|
17
|
-
end
|
18
|
-
|
19
|
-
def appended_directories_from_options
|
20
|
-
options[OPTION_APPENDED_DIRECTORIES] || []
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,48 +0,0 @@
|
|
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
|
-
class Deploy
|
11
|
-
module Build
|
12
|
-
private
|
13
|
-
|
14
|
-
attr_accessor :build_dir
|
15
|
-
|
16
|
-
def append_instance_content
|
17
|
-
::Avm::Files::Appender
|
18
|
-
.new
|
19
|
-
.variables_source_set(variables_source)
|
20
|
-
.append_templatized_directory(template.path)
|
21
|
-
.append_templatized_directories(appended_directories)
|
22
|
-
.append_file_content(version_target_path, version)
|
23
|
-
.write_appended_on(build_dir)
|
24
|
-
end
|
25
|
-
|
26
|
-
def build_dir_env
|
27
|
-
::EacRubyUtils::Envs.local
|
28
|
-
end
|
29
|
-
|
30
|
-
def create_build_dir
|
31
|
-
self.build_dir = ::EacRubyUtils::Fs::Temp.directory
|
32
|
-
end
|
33
|
-
|
34
|
-
def remove_build_dir
|
35
|
-
build_dir&.remove
|
36
|
-
end
|
37
|
-
|
38
|
-
def build_content
|
39
|
-
infom 'Writing Git source code...'
|
40
|
-
::Avm::Git::Commit.new(git, commit_sha1).deploy_to_env_path(
|
41
|
-
build_dir_env,
|
42
|
-
build_dir
|
43
|
-
).variables_source_set(variables_source).run
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module EacWebappBase0
|
5
|
-
class Deploy
|
6
|
-
class FileUnit < ::SimpleDelegator
|
7
|
-
attr_reader :data_key, :fs_path_subpath
|
8
|
-
|
9
|
-
def initialize(deploy, data_key, fs_path_subpath)
|
10
|
-
super(deploy)
|
11
|
-
@data_key = data_key
|
12
|
-
@fs_path_subpath = fs_path_subpath
|
13
|
-
end
|
14
|
-
|
15
|
-
def run
|
16
|
-
assert_source_directory
|
17
|
-
link_source_target
|
18
|
-
end
|
19
|
-
|
20
|
-
def assert_source_directory
|
21
|
-
infom "Asserting \"#{data_key}\" source directory..."
|
22
|
-
instance.host_env.command('mkdir', '-p', source_path).execute!
|
23
|
-
end
|
24
|
-
|
25
|
-
def source_path
|
26
|
-
::File.join(instance.install_data_path, data_key.to_s)
|
27
|
-
end
|
28
|
-
|
29
|
-
def target_path
|
30
|
-
::File.join(instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH),
|
31
|
-
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
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module EacWebappBase0
|
5
|
-
class Deploy
|
6
|
-
module GitInfo
|
7
|
-
def commit_sha1_uncached
|
8
|
-
git_fetch
|
9
|
-
r = git.rev_parse(git_reference_found)
|
10
|
-
return r if r
|
11
|
-
|
12
|
-
raise ::Avm::Result::Error, "No commit SHA1 found for \"#{git_reference_found}\""
|
13
|
-
end
|
14
|
-
|
15
|
-
def git_fetch_uncached
|
16
|
-
infom "Fetching remote \"#{git_remote_name}\" from \"#{git_repository_path}\"..."
|
17
|
-
git.fetch(git_remote_name)
|
18
|
-
end
|
19
|
-
|
20
|
-
def git_reference
|
21
|
-
options[OPTION_REFERENCE] || DEFAULT_REFERENCE
|
22
|
-
end
|
23
|
-
|
24
|
-
def git_reference_found_uncached
|
25
|
-
%w[git_reference instance_branch master_branch].map { |b| send(b) }.find(&:present?) ||
|
26
|
-
raise(
|
27
|
-
::Avm::Result::Error,
|
28
|
-
'No git reference found (Searched for option, instance and master)'
|
29
|
-
)
|
30
|
-
end
|
31
|
-
|
32
|
-
def git_remote_hashs_uncached
|
33
|
-
git.remote_hashs(git_remote_name)
|
34
|
-
end
|
35
|
-
|
36
|
-
def git_remote_name
|
37
|
-
::Avm::Git::DEFAULT_REMOTE_NAME
|
38
|
-
end
|
39
|
-
|
40
|
-
def git_repository_path
|
41
|
-
instance.source_instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH)
|
42
|
-
end
|
43
|
-
|
44
|
-
def git_uncached
|
45
|
-
::Avm::Launcher::Git::Base.new(git_repository_path)
|
46
|
-
end
|
47
|
-
|
48
|
-
def instance_branch
|
49
|
-
remote_branch(instance.id)
|
50
|
-
end
|
51
|
-
|
52
|
-
def remote_branch(name)
|
53
|
-
git_remote_hashs.key?("refs/heads/#{name}") ? "#{git_remote_name}/#{name}" : nil
|
54
|
-
end
|
55
|
-
|
56
|
-
def master_branch
|
57
|
-
remote_branch('master')
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module EacWebappBase0
|
5
|
-
class Deploy
|
6
|
-
module Version
|
7
|
-
VERSION_TARGET_PATH = 'VERSION'
|
8
|
-
|
9
|
-
def version
|
10
|
-
([::Time.now, commit_sha1] + version_git_refs).join('|')
|
11
|
-
end
|
12
|
-
|
13
|
-
def version_git_refs
|
14
|
-
git_remote_hashs.select { |_name, sha1| sha1 == commit_sha1 }.keys
|
15
|
-
.map { |ref| ref.gsub(%r{\Arefs/}, '') }.reject { |ref| ref == 'HEAD' }
|
16
|
-
end
|
17
|
-
|
18
|
-
def version_target_path
|
19
|
-
VERSION_TARGET_PATH
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module EacWebappBase0
|
7
|
-
class Deploy
|
8
|
-
module WriteOnTarget
|
9
|
-
def write_on_target
|
10
|
-
::Avm::Files::Deploy.new(
|
11
|
-
instance.host_env,
|
12
|
-
instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH)
|
13
|
-
).append_plain_directory(build_dir).run
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'active_support/callbacks'
|
4
|
-
require 'avm/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
|
-
class Deploy
|
14
|
-
require_sub __FILE__, include_modules: true
|
15
|
-
|
16
|
-
DEFAULT_REFERENCE = 'HEAD'
|
17
|
-
|
18
|
-
REQUEST_TEST_JOB = 'request_test'
|
19
|
-
JOBS = (%w[create_build_dir build_content append_instance_content write_on_target
|
20
|
-
setup_files_units assert_instance_branch] + [REQUEST_TEST_JOB]).freeze
|
21
|
-
|
22
|
-
include ::Avm::Jobs::Base
|
23
|
-
|
24
|
-
lists.add_symbol :option, :appended_directories, :no_request_test, :reference
|
25
|
-
|
26
|
-
def option_list
|
27
|
-
::Avm::EacWebappBase0::Deploy.lists.option
|
28
|
-
end
|
29
|
-
|
30
|
-
def run
|
31
|
-
super
|
32
|
-
ensure
|
33
|
-
remove_build_dir
|
34
|
-
end
|
35
|
-
|
36
|
-
def start_banner
|
37
|
-
infov 'Instance', instance
|
38
|
-
infov 'Git reference (User)', git_reference.if_present('- BLANK -')
|
39
|
-
infov 'Git remote name', git_remote_name
|
40
|
-
infov 'Git reference (Found)', git_reference_found
|
41
|
-
infov 'Git commit SHA1', commit_sha1
|
42
|
-
infov 'Appended directories', appended_directories
|
43
|
-
end
|
44
|
-
|
45
|
-
def setup_files_units
|
46
|
-
instance.class.const_get('FILES_UNITS').each do |data_key, fs_path_subpath|
|
47
|
-
FileUnit.new(self, data_key, fs_path_subpath).run
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def assert_instance_branch
|
52
|
-
infom 'Setting instance branch...'
|
53
|
-
git.execute!('push', git_remote_name, "#{commit_sha1}:refs/heads/#{instance.id}", '-f')
|
54
|
-
end
|
55
|
-
|
56
|
-
def request_test
|
57
|
-
infom 'Requesting web interface...'
|
58
|
-
uri = URI(instance.read_entry('web.url'))
|
59
|
-
response = ::Net::HTTP.get_response(uri)
|
60
|
-
infov 'Response status', response.code
|
61
|
-
fatal_error "Request to #{uri} failed" unless response.code.to_i == 200
|
62
|
-
end
|
63
|
-
|
64
|
-
protected
|
65
|
-
|
66
|
-
def jobs
|
67
|
-
r = super
|
68
|
-
r.delete(REQUEST_TEST_JOB) if options[OPTION_NO_REQUEST_TEST]
|
69
|
-
r
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|