avm-tools 0.66.0 → 0.69.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/eac_rails_base0/apache_host.rb +17 -0
- data/lib/avm/eac_rails_base0/deploy.rb +50 -0
- data/lib/avm/eac_rails_base0/instance.rb +14 -0
- data/lib/avm/eac_redmine_base0/deploy.rb +2 -2
- data/lib/avm/eac_redmine_base0/instance.rb +2 -2
- 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 +41 -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/configuration/_locale.rb +16 -0
- data/lib/avm/local_projects/instance.rb +20 -1
- data/lib/avm/patches/i18n.rb +22 -0
- data/lib/avm/patches/object/i18n.rb +17 -0
- data/lib/avm/projects/stereotype.rb +1 -0
- data/lib/avm/projects/stereotypes/git_subrepo/warp.rb +2 -2
- data/lib/avm/projects/stereotypes/rails_application.rb +2 -0
- data/lib/avm/projects/stereotypes/rails_application/local_project_mixin.rb +18 -0
- data/lib/avm/projects/stereotypes/rails_application/update.rb +14 -0
- data/lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb +9 -0
- data/lib/avm/projects/stereotypes/ruby_gem/version_bump.rb +61 -0
- data/lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb +2 -2
- 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 +2 -2
- data/lib/avm/tools/runner/eac_rails_base0/apache_host.rb +3 -26
- 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/local_project/update.rb +1 -2
- data/lib/avm/tools/runner/local_project/version_bump.rb +89 -0
- data/lib/avm/tools/version.rb +1 -1
- data/lib/avm/version.rb +45 -0
- data/lib/eac_launcher/git/sub_warp_base.rb +1 -1
- data/lib/eac_launcher/publish/base.rb +1 -1
- 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/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/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_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 +15 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/version_file.rb +41 -0
- 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/object/if_respond.rb +22 -0
- 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 +65 -19
- data/lib/avm/local_projects/jobs/update.rb +0 -29
- 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_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,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
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module Stereotypes
|
5
|
-
module EacWebappBase0
|
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_reference
|
17
|
-
options[:reference] || DEFAULT_REFERENCE
|
18
|
-
end
|
19
|
-
|
20
|
-
def git_reference_found_uncached
|
21
|
-
%w[git_reference instance_branch master_branch].map { |b| send(b) }.find(&:present?) ||
|
22
|
-
raise(
|
23
|
-
::Avm::Result::Error,
|
24
|
-
'No git reference found (Searched for option, instance and master)'
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
def git_remote_hashs_uncached
|
29
|
-
git.remote_hashs(git_remote_name)
|
30
|
-
end
|
31
|
-
|
32
|
-
def git_remote_name
|
33
|
-
::Avm::Git::DEFAULT_REMOTE_NAME
|
34
|
-
end
|
35
|
-
|
36
|
-
def instance_branch
|
37
|
-
remote_branch(instance.id)
|
38
|
-
end
|
39
|
-
|
40
|
-
def remote_branch(name)
|
41
|
-
git_remote_hashs.key?("refs/heads/#{name}") ? "#{git_remote_name}/#{name}" : nil
|
42
|
-
end
|
43
|
-
|
44
|
-
def master_branch
|
45
|
-
remote_branch('master')
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module Stereotypes
|
5
|
-
module EacWebappBase0
|
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
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/instances/base'
|
4
|
-
require 'avm/stereotypes/postgresql/instance_with'
|
5
|
-
require 'avm/data/instance/files_unit'
|
6
|
-
require 'avm/data/instance/package'
|
7
|
-
require 'avm/stereotypes/eac_webapp_base0/deploy/file_unit'
|
8
|
-
|
9
|
-
module Avm
|
10
|
-
module Stereotypes
|
11
|
-
module EacWebappBase0
|
12
|
-
class Instance < ::Avm::Instances::Base
|
13
|
-
include ::Avm::Stereotypes::Postgresql::InstanceWith
|
14
|
-
|
15
|
-
def stereotype_name
|
16
|
-
self.class.name.desconstantize.demodulize
|
17
|
-
end
|
18
|
-
|
19
|
-
def data_dump(argv = [])
|
20
|
-
run_subcommand(::Avm::Tools::Runner::EacWordpressBase0::Data::Dump, argv)
|
21
|
-
end
|
22
|
-
|
23
|
-
def data_dump_runner_class
|
24
|
-
"::Avm::Tools::Runner::#{stereotype_name}::Data::Dump".constantize
|
25
|
-
end
|
26
|
-
|
27
|
-
def run_subcommand(subcommand_class, argv)
|
28
|
-
parent = ::OpenStruct.new(instance: self)
|
29
|
-
subcommand_class.new(argv: argv, parent: parent).run
|
30
|
-
end
|
31
|
-
|
32
|
-
def data_package
|
33
|
-
@data_package ||= ::Avm::Data::Instance::Package.new(
|
34
|
-
self, units: { database: database_unit }.merge(files_units)
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
38
|
-
def database_unit
|
39
|
-
pg.data_unit
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
def files_units
|
45
|
-
self.class.const_get('FILES_UNITS').transform_values do |fs_path_subpath|
|
46
|
-
::Avm::Data::Instance::FilesUnit.new(self, fs_path_subpath)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|