eac_tools 0.13.0 → 0.16.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 +39 -19
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/lib/avm/applications/base.rb +2 -2
- data/sub/avm/lib/avm/entries/auto_values/entry.rb +32 -0
- data/sub/avm/lib/avm/entries/auto_values.rb +11 -0
- data/sub/avm/lib/avm/{instances/entries.rb → entries/base.rb} +9 -5
- data/sub/avm/lib/avm/{instances → entries}/entry.rb +3 -12
- data/sub/avm/lib/avm/entries.rb +9 -0
- data/sub/avm/lib/avm/instances/base/auto_values/admin.rb +2 -2
- data/sub/avm/lib/avm/instances/base/auto_values/database.rb +1 -1
- data/sub/avm/lib/avm/instances/base/auto_values/filesystem.rb +9 -8
- data/sub/avm/lib/avm/instances/base/auto_values/install.rb +4 -4
- data/sub/avm/lib/avm/instances/base/auto_values/mailer.rb +5 -4
- data/sub/avm/lib/avm/instances/base/auto_values/ruby.rb +1 -1
- data/sub/avm/lib/avm/instances/base/auto_values/system.rb +3 -3
- data/sub/avm/lib/avm/instances/base/auto_values.rb +3 -4
- data/sub/avm/lib/avm/instances/base.rb +6 -6
- data/sub/avm/lib/avm/instances/entry_keys.rb +2 -2
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm/spec/lib/avm/instances/base_spec.rb +50 -50
- data/sub/avm/spec/lib/avm/instances/base_spec_configs_storage.yml +4 -2
- data/sub/avm-eac_asciidoctor_base0/Gemfile +8 -0
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/avm-eac_asciidoctor_base0.gemspec +0 -0
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/apache_host.rb +0 -0
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/apache_path.rb +0 -0
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/deploy.rb +0 -0
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/instance.rb +0 -0
- data/sub/{avm-tools/lib/avm/tools/runner/eac_asciidoctor_base0.rb → avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/runners/base.rb} +3 -4
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/runners.rb +11 -0
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/sources/base.rb +0 -0
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/sources/build/file.rb +0 -0
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/sources/build.rb +0 -0
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/sources/runner/build.rb +0 -0
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/sources/runner.rb +0 -0
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/build.rb +54 -0
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners.rb +13 -0
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/sources.rb +0 -0
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/lib/avm/eac_asciidoctor_base0.rb +0 -0
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/spec/lib/avm/eac_asciidoctor_base0/sources/base_spec.rb +0 -0
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/spec/rubocop_spec.rb +0 -0
- data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/spec/spec_helper.rb +0 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/gemspec/add_or_replace_gem_line.rb +62 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/gemspec/dependency.rb +19 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/gemspec.rb +42 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
- data/sub/avm-eac_webapp_base0/Gemfile +8 -0
- data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +22 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/apache_host.rb +78 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/apache_path.rb +51 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/appended_directories.rb +25 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/build.rb +48 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/file_unit.rb +42 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/git_info.rb +62 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/version.rb +24 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/write_on_target.rb +18 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy.rb +73 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instance/subcommand_parent.rb +24 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instance.rb +62 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/apache_host.rb +35 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/apache_path.rb +40 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/data/dump.rb +63 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/data/load.rb +55 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/data.rb +17 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/deploy.rb +39 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner.rb +12 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/sources/base.rb +15 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/sources.rb +11 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +7 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0.rb +9 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/sources/base_spec.rb +7 -0
- data/sub/avm-eac_webapp_base0/spec/rubocop_spec.rb +3 -0
- data/sub/avm-eac_webapp_base0/spec/spec_helper.rb +4 -0
- data/sub/avm-eac_webapp_base0/template/avm/eac_webapp_base0/apache_host/no_ssl.conf +11 -0
- data/sub/avm-eac_webapp_base0/template/avm/eac_webapp_base0/apache_path/default.conf +9 -0
- data/sub/avm-eac_wordpress_base0/Gemfile +8 -0
- data/sub/avm-eac_wordpress_base0/avm-eac_wordpress_base0.gemspec +19 -0
- data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/apache_host.rb +27 -0
- data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb +26 -0
- data/sub/{avm-tools/lib/avm/eac_wordpress_base0 → avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances}/deploy.rb +3 -1
- data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances.rb +11 -0
- data/sub/{avm-tools/lib/avm/tools/runner/eac_wordpress_base0.rb → avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/runners/base.rb} +3 -4
- data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/runners.rb +11 -0
- data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/version.rb +7 -0
- data/sub/{avm-tools → avm-eac_wordpress_base0}/lib/avm/eac_wordpress_base0.rb +0 -0
- data/sub/{avm-tools/spec/lib/avm/eac_wordpress_base0 → avm-eac_wordpress_base0/spec/lib/avm/eac_wordpress_base0/instances}/apache_host_spec.rb +4 -4
- data/sub/{avm-tools/spec/lib/avm/eac_wordpress_base0 → avm-eac_wordpress_base0/spec/lib/avm/eac_wordpress_base0/instances}/apache_host_spec_no_ssl_content.conf +0 -0
- data/sub/avm-eac_wordpress_base0/spec/rubocop_spec.rb +3 -0
- data/sub/avm-eac_wordpress_base0/spec/spec_helper.rb +5 -0
- data/sub/{avm-tools → avm-eac_wordpress_base0}/template/avm/eac_wordpress_base0/deploy/wp-config.php.template +10 -10
- data/sub/avm-tools/avm-tools.gemspec +0 -1
- data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
- metadata +127 -36
- data/sub/avm-tools/lib/avm/eac_wordpress_base0/apache_host.rb +0 -25
- data/sub/avm-tools/lib/avm/eac_wordpress_base0/instance.rb +0 -24
- data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_asciidoctor_base0/build.rb +0 -56
- data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_asciidoctor_base0.rb +0 -14
- data/sub/avm-tools/sub/avm-eac_asciidoctor_base0/Gemfile +0 -5
@@ -1,12 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/eac_webapp_base0/runner'
|
4
|
-
require 'avm/eac_asciidoctor_base0'
|
5
4
|
|
6
5
|
module Avm
|
7
|
-
module
|
8
|
-
|
9
|
-
class
|
6
|
+
module EacAsciidoctorBase0
|
7
|
+
module Runners
|
8
|
+
class Base < ::Avm::EacWebappBase0::Runner
|
10
9
|
require_sub __FILE__
|
11
10
|
end
|
12
11
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/tools/core_ext'
|
4
|
+
require 'avm/eac_asciidoctor_base0/sources/build'
|
5
|
+
require 'os'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module EacAsciidoctorBase0
|
9
|
+
module Sources
|
10
|
+
module Runners
|
11
|
+
class Build
|
12
|
+
runner_with :help do
|
13
|
+
desc 'Build the project'
|
14
|
+
arg_opt '-d', '--target-dir', 'Directory to build'
|
15
|
+
bool_opt '--open', 'Show the result.'
|
16
|
+
end
|
17
|
+
|
18
|
+
def run
|
19
|
+
start_banner
|
20
|
+
build.run
|
21
|
+
open
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def build_uncached
|
27
|
+
::Avm::EacAsciidoctorBase0::Sources::Build.new(runner_context.call(:project),
|
28
|
+
target_directory: parsed.target_dir)
|
29
|
+
end
|
30
|
+
|
31
|
+
def default_target_directory
|
32
|
+
runner_context.call(:project).root.join('build')
|
33
|
+
end
|
34
|
+
|
35
|
+
def open
|
36
|
+
return unless parsed.open?
|
37
|
+
|
38
|
+
infom "Opening \"#{open_path}\"..."
|
39
|
+
::EacRubyUtils::Envs.local.command(OS.open_file_command, open_path).system!
|
40
|
+
end
|
41
|
+
|
42
|
+
def open_path
|
43
|
+
build.source_files.first.target_path
|
44
|
+
end
|
45
|
+
|
46
|
+
def start_banner
|
47
|
+
runner_context.call(:project_banner)
|
48
|
+
infov 'Target directory', build.target_directory
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/spec/rubocop_spec.rb
RENAMED
File without changes
|
data/sub/{avm-tools/sub/avm-eac_asciidoctor_base0 → avm-eac_asciidoctor_base0}/spec/spec_helper.rb
RENAMED
File without changes
|
data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/gemspec/add_or_replace_gem_line.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacRubyBase1
|
7
|
+
module Rubygems
|
8
|
+
class Gemspec
|
9
|
+
class AddOrReplaceGemLine
|
10
|
+
enable_method_class
|
11
|
+
common_constructor :sender, :gem_name, :gem_specs
|
12
|
+
delegate :lines, to: :sender
|
13
|
+
|
14
|
+
DEPENDENCY_PREFIX = ' s.add_dependency'
|
15
|
+
|
16
|
+
def existing_gem_line_index
|
17
|
+
lines.index { |line| line.start_with?(gem_line_prefix) }
|
18
|
+
end
|
19
|
+
|
20
|
+
def result
|
21
|
+
if existing_gem_line_index.present?
|
22
|
+
replace_line
|
23
|
+
else
|
24
|
+
add_line
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_line
|
29
|
+
lines.insert(add_line_index, new_gem_line)
|
30
|
+
end
|
31
|
+
|
32
|
+
def add_line_index
|
33
|
+
(gems_lines_start_index..(lines.count - 1)).each do |e|
|
34
|
+
return e if new_gem_line < lines[e]
|
35
|
+
end
|
36
|
+
lines.count
|
37
|
+
end
|
38
|
+
|
39
|
+
def gems_lines_start_index
|
40
|
+
lines.index { |line| line.start_with?(DEPENDENCY_PREFIX) } || lines.count
|
41
|
+
end
|
42
|
+
|
43
|
+
def new_gem_line
|
44
|
+
([gem_line_prefix] + quoted_gem_specs).join(', ')
|
45
|
+
end
|
46
|
+
|
47
|
+
def gem_line_prefix
|
48
|
+
"#{DEPENDENCY_PREFIX} '#{gem_name}'"
|
49
|
+
end
|
50
|
+
|
51
|
+
def replace_line
|
52
|
+
lines[existing_gem_line_index] = new_gem_line
|
53
|
+
end
|
54
|
+
|
55
|
+
def quoted_gem_specs
|
56
|
+
gem_specs.map { |gem_spec| "'#{gem_spec}'" }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacRubyBase1
|
7
|
+
module Rubygems
|
8
|
+
class Gemspec
|
9
|
+
class Dependency
|
10
|
+
common_constructor :gemspec, :gem_name
|
11
|
+
|
12
|
+
def version_specs=(version_specs)
|
13
|
+
gemspec.add_or_replace_gem_line(gem_name, version_specs)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacRubyBase1
|
7
|
+
module Rubygems
|
8
|
+
class Gemspec
|
9
|
+
require_sub __FILE__, require_dependency: true
|
10
|
+
|
11
|
+
DEPENDENCY_LINE_PARSER = /s\.add_dependency\s*'(\S+)'/.to_parser { |m| m[1] }
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def from_file(path)
|
15
|
+
new(path.read.each_line.map(&:rstrip))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
common_constructor :lines
|
20
|
+
|
21
|
+
# @return [Avm::EacRubyBase1::Bundler::Gemfile::Dependency]
|
22
|
+
def dependency(gem_name)
|
23
|
+
::Avm::EacRubyBase1::Rubygems::Gemspec::Dependency.new(self, gem_name)
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Array<Avm::EacRubyBase1::Bundler::Gemfile::Dependency>]
|
27
|
+
def dependencies
|
28
|
+
lines.lazy.map { |line| DEPENDENCY_LINE_PARSER.parse(line) }.reject(&:blank?)
|
29
|
+
.map { |gem_name| dependency(gem_name) }.to_a
|
30
|
+
end
|
31
|
+
|
32
|
+
def write(path)
|
33
|
+
path.to_pathname.write(to_text)
|
34
|
+
end
|
35
|
+
|
36
|
+
def to_text
|
37
|
+
lines.map { |line| "#{line}\n" }.join
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
+
|
5
|
+
require 'avm/eac_webapp_base0/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'avm-eac_webapp_base0'
|
9
|
+
s.version = Avm::EacWebappBase0::VERSION
|
10
|
+
s.authors = ['Put here the authors']
|
11
|
+
s.summary = 'Put here de description.'
|
12
|
+
|
13
|
+
s.files = Dir['{lib,template}/**/*']
|
14
|
+
|
15
|
+
s.add_dependency 'avm', '~> 0.1'
|
16
|
+
s.add_dependency 'avm-eac_generic_base0', '~> 0.1'
|
17
|
+
s.add_dependency 'avm-eac_postgresql_base0', '~> 0.1'
|
18
|
+
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
|
19
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.68'
|
20
|
+
|
21
|
+
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
|
22
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'avm/jobs/base'
|
5
|
+
require 'avm/eac_ubuntu_base0/apache'
|
6
|
+
require 'eac_templates/core_ext'
|
7
|
+
|
8
|
+
module Avm
|
9
|
+
module EacWebappBase0
|
10
|
+
class ApacheHost
|
11
|
+
JOBS = %w[write_available_no_ssl_site enable_no_ssl_site remove_ssl_site reload_apache
|
12
|
+
run_certbot enable_ssl_site reload_apache].freeze
|
13
|
+
include ::Avm::Jobs::Base
|
14
|
+
|
15
|
+
def no_ssl_site_content
|
16
|
+
::Avm::EacWebappBase0::ApacheHost
|
17
|
+
.template.child('no_ssl.conf')
|
18
|
+
.apply(variables_source)
|
19
|
+
end
|
20
|
+
|
21
|
+
def ssl?
|
22
|
+
options[:certbot]
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def apache_uncached
|
28
|
+
::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
|
29
|
+
end
|
30
|
+
|
31
|
+
def enable_no_ssl_site
|
32
|
+
infom 'Enabling no SSL site...'
|
33
|
+
no_ssl_site.enable
|
34
|
+
end
|
35
|
+
|
36
|
+
def enable_ssl_site
|
37
|
+
return unless ssl?
|
38
|
+
|
39
|
+
infom 'Enabling SSL site...'
|
40
|
+
ssl_site.enable
|
41
|
+
end
|
42
|
+
|
43
|
+
def no_ssl_site_uncached
|
44
|
+
apache.site(instance.id)
|
45
|
+
end
|
46
|
+
|
47
|
+
def reload_apache
|
48
|
+
infom 'Reloading Apache...'
|
49
|
+
apache.service('reload')
|
50
|
+
end
|
51
|
+
|
52
|
+
def remove_ssl_site
|
53
|
+
infom 'Removing SSL site...'
|
54
|
+
ssl_site.remove
|
55
|
+
end
|
56
|
+
|
57
|
+
def run_certbot
|
58
|
+
return unless ssl?
|
59
|
+
|
60
|
+
infom 'Running Certbot...'
|
61
|
+
instance.host_env.command(
|
62
|
+
'sudo', 'certbot', '--apache', '--domain', instance.read_entry('web.hostname'),
|
63
|
+
'--redirect', '--non-interactive', '--agree-tos',
|
64
|
+
'--email', instance.read_entry('admin.email')
|
65
|
+
).system!
|
66
|
+
end
|
67
|
+
|
68
|
+
def ssl_site_uncached
|
69
|
+
apache.site(no_ssl_site.name + '-le-ssl')
|
70
|
+
end
|
71
|
+
|
72
|
+
def write_available_no_ssl_site
|
73
|
+
infom 'Writing no SSL site conf...'
|
74
|
+
no_ssl_site.write(no_ssl_site_content)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/jobs/base'
|
4
|
+
require 'avm/eac_ubuntu_base0/apache'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module EacWebappBase0
|
9
|
+
class ApachePath
|
10
|
+
JOBS = %w[write_available_conf enable_conf reload_apache].freeze
|
11
|
+
include ::Avm::Jobs::Base
|
12
|
+
|
13
|
+
def content
|
14
|
+
::Avm::EacWebappBase0::ApachePath.template.child('default.conf').apply(variables_source)
|
15
|
+
end
|
16
|
+
|
17
|
+
def document_root
|
18
|
+
instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
|
19
|
+
end
|
20
|
+
|
21
|
+
def extra_content
|
22
|
+
''
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def apache_uncached
|
28
|
+
::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
|
29
|
+
end
|
30
|
+
|
31
|
+
def enable_conf
|
32
|
+
infom 'Enabling configuration...'
|
33
|
+
conf.enable
|
34
|
+
end
|
35
|
+
|
36
|
+
def reload_apache
|
37
|
+
infom 'Reloading Apache...'
|
38
|
+
apache.service('reload')
|
39
|
+
end
|
40
|
+
|
41
|
+
def conf_uncached
|
42
|
+
apache.conf(instance.id)
|
43
|
+
end
|
44
|
+
|
45
|
+
def write_available_conf
|
46
|
+
infom 'Writing available configuration...'
|
47
|
+
conf.write(content)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,25 @@
|
|
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
|
@@ -0,0 +1,48 @@
|
|
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
|
@@ -0,0 +1,42 @@
|
|
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.read_entry(:data_fs_path), data_key.to_s)
|
27
|
+
end
|
28
|
+
|
29
|
+
def target_path
|
30
|
+
::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_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
|
@@ -0,0 +1,62 @@
|
|
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::FS_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
|
@@ -0,0 +1,24 @@
|
|
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
|
@@ -0,0 +1,18 @@
|
|
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::FS_PATH)
|
13
|
+
).append_plain_directory(build_dir).run
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|