avm-tools 0.69.3 → 0.70.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83ba40f1bd12e44664ec4bd6824bc269eb6a5012f51fdb7fdf38f90194f084d8
4
- data.tar.gz: 872cf085c7de0dda3da9104b28b8a48ac100473ae902d4596e89295ee808b40b
3
+ metadata.gz: 4f29b6293211fb41769c831fee400ab44f3e7b23cce9a80cbe43fe66ff6c793f
4
+ data.tar.gz: b4ae8baa035b47388bf6266033a3a901911adbbf3841a4c5dc401bbf2e5081b8
5
5
  SHA512:
6
- metadata.gz: 3654fc45fe954c2a3caaa7d9d0d6bfc2ad883d0e2f93cb85fe798f0e12785eeb1f2da2c72cc0921e514a48c9942f2a05cf2afc0788faa6e574af3af78195bf22
7
- data.tar.gz: f14791c5d6f811644243763d6e2e3d6dfb0c6812dd1d55f2e7d96afc65ac16aea399178cb9fe335a047808e7a34a457741f5eda4598e196237d44e02a4bf133b
6
+ metadata.gz: 12892c4a448f9238bd4e3ec55e1c4f03761a0a29ed5fb0fcf5a65962c314eae74903a4e1412acdeef945b896dc44f6f22bdaf4a3c989b78edd8b2f880efb32fe
7
+ data.tar.gz: 1f24a30ed4cd5f821ade563da4e1e3595cc3416fec7037ff847a988d8dc49f932a45c15143a3637a155ed5372027e2fd3be66c97bf34f99b53f55e234a2553b5
@@ -18,7 +18,7 @@ module Avm
18
18
  before_load :clear_files
19
19
 
20
20
  def files_path
21
- ::File.join(instance.read_entry(:fs_path), fs_path_subpath)
21
+ ::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH), fs_path_subpath)
22
22
  end
23
23
 
24
24
  def dump_command
@@ -6,7 +6,7 @@ module Avm
6
6
  module EacRailsBase0
7
7
  class ApacheHost < ::Avm::EacWebappBase0::ApacheHost
8
8
  def document_root
9
- "#{instance.read_entry(:fs_path)}/public"
9
+ "#{instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)}/public"
10
10
  end
11
11
 
12
12
  def extra_content
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_ubuntu_base0/apache'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRailsBase0
8
+ class ApachePath
9
+ enable_console_speaker
10
+ enable_simple_cache
11
+ common_constructor :instance, :options, default: [{}]
12
+
13
+ def run
14
+ write_available_conf
15
+ enable_conf
16
+ reload_apache
17
+ ::Avm::Result.success('Done')
18
+ end
19
+
20
+ def content
21
+ template.child('default.conf').apply(instance)
22
+ end
23
+
24
+ private
25
+
26
+ def apache_uncached
27
+ ::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
28
+ end
29
+
30
+ def enable_conf
31
+ infom 'Enabling configuration...'
32
+ conf.enable
33
+ end
34
+
35
+ def reload_apache
36
+ infom 'Reloading Apache...'
37
+ apache.service('reload')
38
+ end
39
+
40
+ def conf_uncached
41
+ apache.conf(instance.id)
42
+ end
43
+
44
+ def write_available_conf
45
+ infom 'Writing available configuration...'
46
+ conf.write(content)
47
+ end
48
+ end
49
+ end
50
+ end
@@ -42,7 +42,8 @@ module Avm
42
42
  def touch_restart_file
43
43
  infom 'Touching restart file...'
44
44
  instance.host_env.command(
45
- 'touch', ::File.join(instance.read_entry(:fs_path), 'tmp', 'restart.txt')
45
+ 'touch', ::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH),
46
+ 'tmp', 'restart.txt')
46
47
  ).system!
47
48
  end
48
49
  end
@@ -20,8 +20,8 @@ module Avm
20
20
  end
21
21
 
22
22
  def installer_path
23
- ::File.join(instance.read_entry(:fs_path), 'plugins', 'redmine_installer', 'installer',
24
- 'run.sh')
23
+ ::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH), 'plugins',
24
+ 'redmine_installer', 'installer', 'run.sh')
25
25
  end
26
26
 
27
27
  def install_task
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/eac_redmine_base0/data_unit'
4
- require 'avm/stereotypes/eac_ubuntu_base0/docker_image'
4
+ require 'avm/eac_ubuntu_base0/docker_image'
5
5
  require 'avm/eac_webapp_base0/instance'
6
6
  require 'avm/stereotypes/rails/instance'
7
7
 
@@ -13,12 +13,13 @@ module Avm
13
13
  FILES_UNITS = { files: 'files' }.freeze
14
14
 
15
15
  def docker_image_class
16
- ::Avm::Stereotypes::EacUbuntuBase0::DockerImage
16
+ ::Avm::EacUbuntuBase0::DockerImage
17
17
  end
18
18
 
19
19
  def docker_run_arguments
20
20
  [
21
- '--volume', "#{read_entry(:fs_path)}:/home/myuser/eac_redmine_base0",
21
+ '--volume',
22
+ "#{read_entry(::Avm::Instances::EntryKeys::FS_PATH)}:/home/myuser/eac_redmine_base0",
22
23
  '--publish', "#{read_entry(:ssh_port)}:22",
23
24
  '--publish', "#{read_entry(:http_port)}:80",
24
25
  '--publish', "#{read_entry(:https_port)}:443"
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacUbuntuBase0
7
+ class Apache
8
+ require_sub __FILE__
9
+ common_constructor :host_env
10
+
11
+ def etc_root
12
+ '/etc/apache2'
13
+ end
14
+
15
+ def service(command)
16
+ host_env.command('sudo', 'service', 'apache2', command)
17
+ end
18
+
19
+ { conf: :conf, site: :sites }.each do |type, directory_prefix|
20
+ define_method type do |name|
21
+ ::Avm::EacUbuntuBase0::Apache::Resource.new(self, type, directory_prefix, name)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacUbuntuBase0
7
+ class Apache
8
+ class Resource
9
+ common_constructor :apache, :type, :directory_prefix, :name
10
+
11
+ def available_path
12
+ ::File.join(apache.etc_root, "#{directory_prefix}-available", "#{name}.conf")
13
+ end
14
+
15
+ def available?
16
+ apache.host_env.file(available_path).exist?
17
+ end
18
+
19
+ def disable
20
+ apache.host_env.command('sudo', "a2dis#{type}", name).execute!
21
+ end
22
+
23
+ def enable
24
+ apache.host_env.command('sudo', "a2en#{type}", name).execute!
25
+ end
26
+
27
+ def enabled_path
28
+ ::File.join(apache.etc_root, "#{directory_prefix}-enabled", "#{name}.conf")
29
+ end
30
+
31
+ def enabled?
32
+ apache.host_env.file(enabled_path).exist?
33
+ end
34
+
35
+ def remove
36
+ remove_disabled
37
+ remove_available
38
+ end
39
+
40
+ def remove_available
41
+ raise 'Remove enabled before' if enabled?
42
+
43
+ apache.host_env.command('sudo', 'rm', '-f', available_path).execute! if available?
44
+ end
45
+
46
+ def remove_disabled
47
+ disable if enabled?
48
+ apache.host_env.command('sudo', 'rm', '-f', enabled_path).execute! if enabled?
49
+ end
50
+
51
+ def write(content)
52
+ ::EacRubyUtils::Envs.local.command('echo', content).pipe(
53
+ apache.host_env.command('sudo', 'tee', available_path)
54
+ ).execute!
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/docker/image'
5
+
6
+ module Avm
7
+ module EacUbuntuBase0
8
+ class DockerImage < ::Avm::Docker::Image
9
+ def stereotype_tag
10
+ 'eac_ubuntu_base0'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
4
  require 'avm/patches/object/template'
5
- require 'avm/stereotypes/eac_ubuntu_base0/apache'
5
+ require 'avm/eac_ubuntu_base0/apache'
6
6
  require 'avm/patches/object/template'
7
7
 
8
8
  module Avm
@@ -35,7 +35,7 @@ module Avm
35
35
  private
36
36
 
37
37
  def apache_uncached
38
- ::Avm::Stereotypes::EacUbuntuBase0::Apache.new(instance.host_env)
38
+ ::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
39
39
  end
40
40
 
41
41
  def enable_no_ssl_site
@@ -32,7 +32,7 @@ module Avm
32
32
  def build_git_commit
33
33
  ::Avm::Git::Commit.new(git, commit_sha1).deploy_to_env_path(
34
34
  instance.host_env,
35
- instance.read_entry(:fs_path)
35
+ instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
36
36
  ).variables_source_set(instance)
37
37
  end
38
38
 
@@ -95,7 +95,7 @@ module Avm
95
95
  end
96
96
 
97
97
  def git_repository_path
98
- instance.source_instance.read_entry(:fs_path)
98
+ instance.source_instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
99
99
  end
100
100
  end
101
101
  end
@@ -27,7 +27,8 @@ module Avm
27
27
  end
28
28
 
29
29
  def target_path
30
- ::File.join(instance.read_entry(:fs_path), fs_path_subpath.to_s)
30
+ ::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH),
31
+ fs_path_subpath.to_s)
31
32
  end
32
33
 
33
34
  def link_source_target
@@ -5,8 +5,10 @@ module Avm
5
5
  class Base
6
6
  module AutoValues
7
7
  module Filesystem
8
+ FS_PATH_KEY = :fs_path
9
+
8
10
  def auto_fs_path
9
- inherited_entry_value(:host_id, :fs_path) { |v| v + '/' + id }
11
+ inherited_entry_value(:host_id, FS_PATH_KEY) { |v| v + '/' + id }
10
12
  end
11
13
 
12
14
  def auto_data_fs_path
@@ -1,13 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
- require 'eac_ruby_utils/require_sub'
5
4
  require 'avm/configs'
6
- ::EacRubyUtils.require_sub(__FILE__)
5
+ require 'avm/instances/entry'
7
6
 
8
7
  module Avm
9
8
  module Instances
10
9
  module Entries
10
+ def entry(suffix, options = {})
11
+ ::Avm::Instances::Entry.new(self, suffix, options)
12
+ end
13
+
11
14
  def path_prefix
12
15
  @path_prefix ||= [id].freeze
13
16
  end
@@ -36,12 +39,6 @@ module Avm
36
39
  def other_entry_value(instance_id, entry_suffix)
37
40
  ::Avm::Instances::Base.by_id(instance_id).read_entry_optional(entry_suffix)
38
41
  end
39
-
40
- private
41
-
42
- def entry(suffix, options)
43
- ::Avm::Instances::Entries::EntryReader.new(self, suffix, options)
44
- end
45
42
  end
46
43
  end
47
44
  end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Instances
7
+ class Entry
8
+ common_constructor :parent, :suffix, :options
9
+
10
+ def auto_value
11
+ parent.respond_to?(auto_value_method, true) ? parent.send(auto_value_method) : nil
12
+ end
13
+
14
+ def auto_value_method
15
+ "auto_#{suffix.to_s.gsub('.', '_')}"
16
+ end
17
+
18
+ def full_path
19
+ (parent.path_prefix + suffix_as_array).join('.')
20
+ end
21
+
22
+ def optional_value
23
+ read(required: false, noinput: true) || auto_value
24
+ end
25
+
26
+ def read(extra_options = {})
27
+ ::Avm.configs.read_entry(full_path, options.merge(extra_options))
28
+ end
29
+
30
+ def suffix_as_array
31
+ if suffix.is_a?(::Array)
32
+ suffix.dup
33
+ else
34
+ ::EacRubyUtils::PathsHash.parse_entry_key(suffix.to_s)
35
+ end
36
+ end
37
+
38
+ def value
39
+ optional_value || read
40
+ end
41
+
42
+ def write(value)
43
+ ::Avm.configs.configs.write_entry(full_path, value)
44
+ end
45
+ end
46
+ end
47
+ end
@@ -12,6 +12,8 @@ module Avm
12
12
  const_set(key.gsub('.', '_').upcase, key)
13
13
  end
14
14
  end
15
+
16
+ FS_PATH = 'fs_path'
15
17
  end
16
18
  end
17
19
  end
@@ -3,7 +3,7 @@
3
3
  require 'avm/instances/base'
4
4
  require 'avm/self/docker_image'
5
5
  require 'avm/self/instance/entry_keys'
6
- require 'avm/stereotypes/eac_ubuntu_base0/docker_image'
6
+ require 'avm/eac_ubuntu_base0/docker_image'
7
7
 
8
8
  module Avm
9
9
  module Self
@@ -7,7 +7,7 @@ module Avm
7
7
  module EacWordpressBase0
8
8
  class ApacheHost < ::Avm::EacWebappBase0::ApacheHost
9
9
  def document_root
10
- instance.read_entry(:fs_path)
10
+ instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
11
11
  end
12
12
 
13
13
  def extra_content
@@ -1,27 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_cli/core_ext'
3
4
  require 'eac_ruby_utils/console/docopt_runner'
4
5
  require 'eac_ruby_utils/simple_cache'
5
6
  require 'avm/eac_rails_base0/instance'
6
- require 'eac_ruby_utils/require_sub'
7
7
  ::EacRubyUtils.require_sub(__FILE__)
8
8
 
9
9
  module Avm
10
10
  module Tools
11
11
  class Runner < ::EacRubyUtils::Console::DocoptRunner
12
12
  class EacRailsBase0 < ::EacRubyUtils::Console::DocoptRunner
13
- include ::EacRubyUtils::SimpleCache
13
+ runner_with
14
14
 
15
- DOC = <<~DOCOPT
16
- Utilities for EacRailsBase0 instances.
17
-
18
- Usage:
19
- __PROGRAM__ [options] <instance_id> __SUBCOMMANDS__
20
- __PROGRAM__ -h | --help
21
-
22
- Options:
23
- -h --help Show this screen.
24
- DOCOPT
15
+ runner_definition do
16
+ desc 'Utilities for EacRailsBase0 instances.'
17
+ pos_arg :instance_id
18
+ subcommands
19
+ end
25
20
 
26
21
  private
27
22
 
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+ require 'avm/eac_webapp_base0/runner/apache_host'
5
+ require 'eac_ruby_utils/console/docopt_runner'
6
+ require 'avm/eac_rails_base0/apache_path'
7
+
8
+ module Avm
9
+ module Tools
10
+ class Runner < ::EacRubyUtils::Console::DocoptRunner
11
+ class EacRailsBase0 < ::EacRubyUtils::Console::DocoptRunner
12
+ class ApachePath < ::EacRubyUtils::Console::DocoptRunner
13
+ runner_with
14
+
15
+ runner_definition do
16
+ desc 'Configure Apache path configuration for instance.'
17
+ end
18
+
19
+ def run
20
+ if result.error?
21
+ fatal_error result.to_s
22
+ else
23
+ infov 'Result', result.label
24
+ end
25
+ end
26
+
27
+ def apache_path_uncached
28
+ ::Avm::EacRailsBase0::ApachePath.new(context(:instance))
29
+ end
30
+
31
+ def result_uncached
32
+ apache_path.run
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -79,7 +79,9 @@ module Avm
79
79
 
80
80
  def dev_instance_fs_path
81
81
  instance.if_present do |v|
82
- v.application.instance('dev').read_entry_optional(:fs_path)
82
+ v.application.instance('dev').read_entry_optional(
83
+ ::Avm::Instances::EntryKeys::FS_PATH
84
+ )
83
85
  end
84
86
  end
85
87
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.69.3'
5
+ VERSION = '0.70.0'
6
6
  end
7
7
  end
@@ -0,0 +1,13 @@
1
+ <IfModule mod_passenger.c>
2
+ Alias "%%WEB.PATH%%" "%%FS_PATH%%/public"
3
+ <Location "%%WEB.PATH%%">
4
+ PassengerBaseURI "%%WEB.PATH%%"
5
+ PassengerAppRoot "%%FS_PATH%%"
6
+ PassengerAppEnv production
7
+ </Location>
8
+ <Directory "%%FS_PATH%%/public">
9
+ Allow from all
10
+ Options -MultiViews
11
+ Require all granted
12
+ </Directory>
13
+ </IfModule>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.69.3
4
+ version: 0.70.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-04 00:00:00.000000000 Z
11
+ date: 2020-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -291,12 +291,16 @@ files:
291
291
  - lib/avm/docker/registry.rb
292
292
  - lib/avm/docker/runner.rb
293
293
  - lib/avm/eac_rails_base0/apache_host.rb
294
+ - lib/avm/eac_rails_base0/apache_path.rb
294
295
  - lib/avm/eac_rails_base0/deploy.rb
295
296
  - lib/avm/eac_rails_base0/instance.rb
296
297
  - lib/avm/eac_redmine_base0/core_update.rb
297
298
  - lib/avm/eac_redmine_base0/data_unit.rb
298
299
  - lib/avm/eac_redmine_base0/deploy.rb
299
300
  - lib/avm/eac_redmine_base0/instance.rb
301
+ - lib/avm/eac_ubuntu_base0/apache.rb
302
+ - lib/avm/eac_ubuntu_base0/apache/resource.rb
303
+ - lib/avm/eac_ubuntu_base0/docker_image.rb
300
304
  - lib/avm/eac_webapp_base0/apache_host.rb
301
305
  - lib/avm/eac_webapp_base0/deploy.rb
302
306
  - lib/avm/eac_webapp_base0/deploy/appended_directories.rb
@@ -380,7 +384,7 @@ files:
380
384
  - lib/avm/instances/configuration/_rubocop.rb
381
385
  - lib/avm/instances/configuration/_tests.rb
382
386
  - lib/avm/instances/entries.rb
383
- - lib/avm/instances/entries/entry_reader.rb
387
+ - lib/avm/instances/entry.rb
384
388
  - lib/avm/instances/entry_keys.rb
385
389
  - lib/avm/launcher/context/instance_manager.rb
386
390
  - lib/avm/launcher/context/instance_manager/cached_instance.rb
@@ -440,9 +444,6 @@ files:
440
444
  - lib/avm/stereotypes/eac_rails_base0.rb
441
445
  - lib/avm/stereotypes/eac_redmine_base0.rb
442
446
  - lib/avm/stereotypes/eac_ubuntu_base0.rb
443
- - lib/avm/stereotypes/eac_ubuntu_base0/apache.rb
444
- - lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb
445
- - lib/avm/stereotypes/eac_ubuntu_base0/docker_image.rb
446
447
  - lib/avm/stereotypes/eac_webapp_base0.rb
447
448
  - lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb
448
449
  - lib/avm/stereotypes/eac_wordpress_base0/deploy.rb
@@ -458,6 +459,7 @@ files:
458
459
  - lib/avm/tools/runner.rb
459
460
  - lib/avm/tools/runner/eac_rails_base0.rb
460
461
  - lib/avm/tools/runner/eac_rails_base0/apache_host.rb
462
+ - lib/avm/tools/runner/eac_rails_base0/apache_path.rb
461
463
  - lib/avm/tools/runner/eac_rails_base0/bundle.rb
462
464
  - lib/avm/tools/runner/eac_rails_base0/data.rb
463
465
  - lib/avm/tools/runner/eac_rails_base0/deploy.rb
@@ -543,6 +545,7 @@ files:
543
545
  - lib/eac_launcher/vendor.rb
544
546
  - lib/eac_launcher/vendor/github.rb
545
547
  - lib/eac_launcher/version.rb
548
+ - template/avm/eac_rails_base0/apache_path/default.conf
546
549
  - template/avm/eac_rails_base0/deploy/config/database.yml.template
547
550
  - template/avm/eac_redmine_base0/deploy/config/install.sh.template
548
551
  - template/avm/eac_redmine_base0/deploy/config/secrets.yml
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Instances
7
- module Entries
8
- class EntryReader
9
- common_constructor :parent, :suffix, :options
10
-
11
- def auto_value
12
- parent.respond_to?(auto_value_method, true) ? parent.send(auto_value_method) : nil
13
- end
14
-
15
- def auto_value_method
16
- "auto_#{suffix.to_s.gsub('.', '_')}"
17
- end
18
-
19
- def full_path
20
- (parent.path_prefix + suffix_as_array).join('.')
21
- end
22
-
23
- def optional_value
24
- read(required: false, noinput: true) || auto_value
25
- end
26
-
27
- def read(extra_options = {})
28
- ::Avm.configs.read_entry(full_path, options.merge(extra_options))
29
- end
30
-
31
- def suffix_as_array
32
- if suffix.is_a?(::Array)
33
- suffix.dup
34
- else
35
- ::EacRubyUtils::PathsHash.parse_entry_key(suffix.to_s)
36
- end
37
- end
38
-
39
- def value
40
- optional_value || read
41
- end
42
- end
43
- end
44
- end
45
- 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