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 +4 -4
- data/lib/avm/data/instance/files_unit.rb +1 -1
- data/lib/avm/eac_rails_base0/apache_host.rb +1 -1
- data/lib/avm/eac_rails_base0/apache_path.rb +50 -0
- data/lib/avm/eac_rails_base0/deploy.rb +2 -1
- data/lib/avm/eac_redmine_base0/deploy.rb +2 -2
- data/lib/avm/eac_redmine_base0/instance.rb +4 -3
- data/lib/avm/eac_ubuntu_base0/apache.rb +26 -0
- data/lib/avm/eac_ubuntu_base0/apache/resource.rb +59 -0
- data/lib/avm/eac_ubuntu_base0/docker_image.rb +14 -0
- data/lib/avm/eac_webapp_base0/apache_host.rb +2 -2
- data/lib/avm/eac_webapp_base0/deploy.rb +2 -2
- data/lib/avm/eac_webapp_base0/deploy/file_unit.rb +2 -1
- data/lib/avm/instances/base/auto_values/filesystem.rb +3 -1
- data/lib/avm/instances/entries.rb +5 -8
- data/lib/avm/instances/entry.rb +47 -0
- data/lib/avm/instances/entry_keys.rb +2 -0
- data/lib/avm/self/instance.rb +1 -1
- data/lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb +1 -1
- data/lib/avm/tools/runner/eac_rails_base0.rb +7 -12
- data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +38 -0
- data/lib/avm/tools/runner/git/deploy.rb +3 -1
- data/lib/avm/tools/version.rb +1 -1
- data/template/avm/eac_rails_base0/apache_path/default.conf +13 -0
- metadata +9 -6
- data/lib/avm/instances/entries/entry_reader.rb +0 -45
- data/lib/avm/stereotypes/eac_ubuntu_base0/apache.rb +0 -27
- data/lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb +0 -61
- data/lib/avm/stereotypes/eac_ubuntu_base0/docker_image.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f29b6293211fb41769c831fee400ab44f3e7b23cce9a80cbe43fe66ff6c793f
|
4
|
+
data.tar.gz: b4ae8baa035b47388bf6266033a3a901911adbbf3841a4c5dc401bbf2e5081b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12892c4a448f9238bd4e3ec55e1c4f03761a0a29ed5fb0fcf5a65962c314eae74903a4e1412acdeef945b896dc44f6f22bdaf4a3c989b78edd8b2f880efb32fe
|
7
|
+
data.tar.gz: 1f24a30ed4cd5f821ade563da4e1e3595cc3416fec7037ff847a988d8dc49f932a45c15143a3637a155ed5372027e2fd3be66c97bf34f99b53f55e234a2553b5
|
@@ -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(
|
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(
|
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/
|
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::
|
16
|
+
::Avm::EacUbuntuBase0::DockerImage
|
17
17
|
end
|
18
18
|
|
19
19
|
def docker_run_arguments
|
20
20
|
[
|
21
|
-
'--volume',
|
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
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
4
4
|
require 'avm/patches/object/template'
|
5
|
-
require 'avm/
|
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::
|
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(
|
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(
|
98
|
+
instance.source_instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
@@ -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,
|
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
|
-
|
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
|
data/lib/avm/self/instance.rb
CHANGED
@@ -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
|
-
|
13
|
+
runner_with
|
14
14
|
|
15
|
-
|
16
|
-
Utilities for EacRailsBase0 instances.
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
data/lib/avm/tools/version.rb
CHANGED
@@ -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.
|
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-
|
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/
|
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
|