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.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +36 -36
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/avm.gemspec +1 -1
  5. data/sub/avm/lib/avm/entries/auto_values/entry.rb +11 -4
  6. data/sub/avm/lib/avm/entries/jobs/base.rb +62 -0
  7. data/sub/avm/lib/avm/entries/jobs/variables_source/read_entry.rb +50 -0
  8. data/sub/avm/lib/avm/entries/jobs/variables_source.rb +15 -0
  9. data/sub/avm/lib/avm/entries/jobs/with_variables_source.rb +15 -0
  10. data/sub/avm/lib/avm/{jobs.rb → entries/jobs.rb} +4 -2
  11. data/sub/avm/lib/avm/instances/base/entry_keys.rb +1 -1
  12. data/sub/avm/lib/avm/instances/entry_keys.rb +1 -1
  13. data/sub/avm/lib/avm/rspec/setup.rb +7 -8
  14. data/sub/avm/lib/avm/rspec/shared_examples/entries_values.rb +23 -0
  15. data/sub/avm/lib/avm/version.rb +1 -1
  16. data/sub/avm/spec/lib/avm/instances/base_spec.rb +77 -97
  17. data/sub/avm/spec/lib/avm/instances/{base_spec_configs_storage.yml → base_spec_files/config.yml} +0 -0
  18. data/sub/avm-eac_asciidoctor_base0/avm-eac_asciidoctor_base0.gemspec +2 -2
  19. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/apache_host.rb +2 -2
  20. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/apache_path.rb +2 -2
  21. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/deploy.rb +2 -2
  22. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
  23. data/sub/avm-eac_latex_base0/avm-eac_latex_base0.gemspec +3 -3
  24. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/apache_host.rb +2 -2
  25. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/deploy.rb +2 -2
  26. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/version.rb +1 -1
  27. data/sub/avm-eac_rails_base0/avm-eac_rails_base0.gemspec +2 -2
  28. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/apache_host.rb +2 -2
  29. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/apache_path.rb +2 -2
  30. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/deploy.rb +2 -2
  31. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb +1 -1
  32. data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +4 -4
  33. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/apache_host.rb +19 -0
  34. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit/service.rb +72 -0
  35. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit/tasks_scheduler_command.rb +31 -0
  36. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb +59 -0
  37. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/tasks_scheduler/systemd_unit.rb +4 -4
  38. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +1 -1
  39. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/{systemd_unit → instances/systemd_unit}/tasks_scheduler.service +0 -0
  40. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/{systemd_unit → instances/systemd_unit}/tasks_scheduler_command.sh +0 -0
  41. data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +2 -2
  42. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/apache_host.rb +2 -2
  43. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/database.rb +30 -0
  44. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/gitolite.rb +42 -0
  45. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/web.rb +20 -0
  46. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base.rb +1 -0
  47. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/deploy.rb +2 -2
  48. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/docker_image.rb +2 -6
  49. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
  50. data/sub/avm-eac_redmine_base0/spec/lib/avm/eac_redmine_base0/instances/base/gitolite_spec.rb +26 -0
  51. data/sub/avm-eac_redmine_base0/spec/lib/avm/eac_redmine_base0/instances/base/gitolite_spec_files/config.yml +10 -0
  52. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/deploy/config/install.sh.template +11 -3
  53. data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +2 -2
  54. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/apache_host.rb +85 -0
  55. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/apache_path.rb +54 -0
  56. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/base.rb +1 -1
  57. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/appended_directories.rb +27 -0
  58. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/build.rb +50 -0
  59. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/file_unit.rb +44 -0
  60. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/git_info.rb +64 -0
  61. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/version.rb +26 -0
  62. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/write_on_target.rb +20 -0
  63. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy.rb +75 -0
  64. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +1 -1
  65. data/sub/avm-eac_webapp_base0/template/avm/eac_webapp_base0/{apache_host → instances/apache_host}/no_ssl.conf +0 -0
  66. data/sub/avm-eac_webapp_base0/template/avm/eac_webapp_base0/{apache_path → instances/apache_path}/default.conf +0 -0
  67. data/sub/avm-eac_wordpress_base0/avm-eac_wordpress_base0.gemspec +3 -3
  68. data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/apache_host.rb +2 -2
  69. data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/deploy.rb +2 -2
  70. data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/version.rb +1 -1
  71. metadata +63 -31
  72. data/sub/avm/lib/avm/jobs/base.rb +0 -63
  73. data/sub/avm/lib/avm/jobs/variables_source.rb +0 -22
  74. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/apache_host.rb +0 -17
  75. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/service.rb +0 -70
  76. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.rb +0 -29
  77. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit.rb +0 -57
  78. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/apache_host.rb +0 -83
  79. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/apache_path.rb +0 -51
  80. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/appended_directories.rb +0 -25
  81. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/build.rb +0 -48
  82. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/file_unit.rb +0 -42
  83. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/git_info.rb +0 -62
  84. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/version.rb +0 -24
  85. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy/write_on_target.rb +0 -18
  86. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy.rb +0 -73
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_webapp_base0/deploy'
3
+ require 'avm/eac_webapp_base0/instances/deploy'
4
4
  require 'avm/eac_asciidoctor_base0/sources/base'
5
5
  require 'avm/eac_asciidoctor_base0/sources/build'
6
6
 
7
7
  module Avm
8
8
  module EacAsciidoctorBase0
9
9
  module Instances
10
- class Deploy < ::Avm::EacWebappBase0::Deploy
10
+ class Deploy < ::Avm::EacWebappBase0::Instances::Deploy
11
11
  def build_content
12
12
  ::Avm::EacAsciidoctorBase0::Sources::Build.new(
13
13
  project,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacAsciidoctorBase0
5
- VERSION = '0.7.0'
5
+ VERSION = '0.7.1'
6
6
  end
7
7
  end
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.41'
16
- s.add_dependency 'avm-eac_webapp_base0', '~> 0.5', '>= 0.5.1'
17
- s.add_dependency 'eac_ruby_utils', '~> 0.102'
15
+ s.add_dependency 'avm', '~> 0.45'
16
+ s.add_dependency 'avm-eac_webapp_base0', '~> 0.9'
17
+ s.add_dependency 'eac_ruby_utils', '~> 0.104'
18
18
 
19
19
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5', '>= 0.5.1'
20
20
  end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_webapp_base0/apache_host'
3
+ require 'avm/eac_webapp_base0/instances/apache_host'
4
4
 
5
5
  module Avm
6
6
  module EacLatexBase0
7
7
  module Instances
8
- class ApacheHost < ::Avm::EacWebappBase0::ApacheHost
8
+ class ApacheHost < ::Avm::EacWebappBase0::Instances::ApacheHost
9
9
  def document_root
10
10
  instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH)
11
11
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_webapp_base0/deploy'
3
+ require 'avm/eac_webapp_base0/instances/deploy'
4
4
  require 'avm/eac_latex_base0/sources/base'
5
5
  require 'avm/eac_latex_base0/sources/build'
6
6
 
7
7
  module Avm
8
8
  module EacLatexBase0
9
9
  module Instances
10
- class Deploy < ::Avm::EacWebappBase0::Deploy
10
+ class Deploy < ::Avm::EacWebappBase0::Instances::Deploy
11
11
  def build_content
12
12
  ::Avm::EacLatexBase0::Sources::Build.new(project, output_file:
13
13
  build_dir.join(pdf_path))
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacLatexBase0
5
- VERSION = '0.2.0'
5
+ VERSION = '0.2.1'
6
6
  end
7
7
  end
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,template}/**/*']
14
14
 
15
- s.add_dependency 'avm-eac_rails_base1', '~> 0.6'
16
- s.add_dependency 'eac_ruby_utils', '~> 0.102'
15
+ s.add_dependency 'avm-eac_rails_base1', '~> 0.7'
16
+ s.add_dependency 'eac_ruby_utils', '~> 0.104'
17
17
 
18
18
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
19
19
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_rails_base1/apache_host'
3
+ require 'avm/eac_rails_base1/instances/apache_host'
4
4
 
5
5
  module Avm
6
6
  module EacRailsBase0
7
- class ApacheHost < ::Avm::EacRailsBase1::ApacheHost
7
+ class ApacheHost < ::Avm::EacRailsBase1::Instances::ApacheHost
8
8
  end
9
9
  end
10
10
  end
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_templates/core_ext'
4
- require 'avm/eac_webapp_base0/apache_path'
4
+ require 'avm/eac_webapp_base0/instances/apache_path'
5
5
  require 'eac_ruby_utils/core_ext'
6
6
 
7
7
  module Avm
8
8
  module EacRailsBase0
9
- class ApachePath < ::Avm::EacWebappBase0::ApachePath
9
+ class ApachePath < ::Avm::EacWebappBase0::Instances::ApachePath
10
10
  def document_root
11
11
  ::File.join(super, 'public')
12
12
  end
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_templates/core_ext'
4
- require 'avm/eac_webapp_base0/deploy'
4
+ require 'avm/eac_webapp_base0/instances/deploy'
5
5
  require 'avm/instances/entry_keys'
6
6
 
7
7
  module Avm
8
8
  module EacRailsBase0
9
- class Deploy < ::Avm::EacWebappBase0::Deploy
9
+ class Deploy < ::Avm::EacWebappBase0::Instances::Deploy
10
10
  set_callback :assert_instance_branch, :after do
11
11
  bundle_install
12
12
  assert_database
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRailsBase0
5
- VERSION = '0.8.0'
5
+ VERSION = '0.8.1'
6
6
  end
7
7
  end
@@ -12,10 +12,10 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,template}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.41'
16
- s.add_dependency 'avm-eac_ruby_base1', '~> 0.20'
17
- s.add_dependency 'avm-eac_webapp_base0', '~> 0.6'
18
- s.add_dependency 'eac_ruby_utils', '~> 0.102'
15
+ s.add_dependency 'avm', '~> 0.45'
16
+ s.add_dependency 'avm-eac_ruby_base1', '~> 0.21'
17
+ s.add_dependency 'avm-eac_webapp_base0', '~> 0.9'
18
+ s.add_dependency 'eac_ruby_utils', '~> 0.104'
19
19
 
20
20
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
21
21
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_webapp_base0/instances/apache_host'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ module Instances
8
+ class ApacheHost < ::Avm::EacWebappBase0::Instances::ApacheHost
9
+ def document_root
10
+ "#{instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH)}/public"
11
+ end
12
+
13
+ def extra_content
14
+ 'PassengerEnabled On'
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ module Instances
8
+ class SystemdUnit
9
+ module Service
10
+ def service_content
11
+ template.child('tasks_scheduler.service').apply(variables_source)
12
+ end
13
+
14
+ def service_exec_lines
15
+ service_exec_operations
16
+ .map { |k, v| "#{k}=#{tasks_scheduler_command_path} #{v}" }
17
+ .join("\n")
18
+ end
19
+
20
+ def service_path
21
+ ::Pathname.new('/etc/systemd/system').join(unit_name)
22
+ end
23
+
24
+ def service_link_path
25
+ ::Pathname.new('/etc/systemd/system/multi-user.target.wants').join(unit_name)
26
+ end
27
+
28
+ def verify_service
29
+ sudo_system!('systemd-analyze', 'verify', service_path)
30
+ end
31
+
32
+ private
33
+
34
+ def enable_service
35
+ systemctl('enable', unit_name)
36
+ end
37
+
38
+ def link_service
39
+ sudo_execute!('rm', '-f', service_link_path)
40
+ sudo_execute!('ln', '-s', service_path, service_link_path)
41
+ end
42
+
43
+ def reload_systemd
44
+ systemctl('daemon-reload')
45
+ end
46
+
47
+ # @return [Hash<String, String>]
48
+ def service_exec_operations
49
+ if exec_run?
50
+ { 'ExecStart' => 'run' }
51
+ else
52
+ { 'ExecStart' => 'start', 'ExecStop' => 'stop' }
53
+ end
54
+ end
55
+
56
+ def start_service
57
+ systemctl('start', unit_name)
58
+ end
59
+
60
+ def systemctl(*args)
61
+ sudo_system!('systemctl', *args)
62
+ end
63
+
64
+ def write_service
65
+ infom 'Writing service\'s unit file...'
66
+ platform_instance.file_sudo_write(service_path, service_content)
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ module Instances
8
+ class SystemdUnit
9
+ module TasksSchedulerCommand
10
+ def tasks_scheduler_command_content
11
+ template.child('tasks_scheduler_command.sh').apply(variables_source)
12
+ end
13
+
14
+ def tasks_scheduler_command_path
15
+ "/opt/aux/#{instance.id}/tasks_scheduler.sh"
16
+ end
17
+
18
+ private
19
+
20
+ def write_tasks_scheduler_command
21
+ infom 'Writing tasks scheduler\'s command...'
22
+ sudo_execute!('mkdir', '-p', ::File.dirname(tasks_scheduler_command_path))
23
+ platform_instance.file_sudo_write(tasks_scheduler_command_path,
24
+ tasks_scheduler_command_content)
25
+ sudo_execute!('chmod', '+x', tasks_scheduler_command_path)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/entries/jobs/base'
4
+ require 'avm/eac_ubuntu_base0/apache'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module EacRailsBase1
9
+ module Instances
10
+ class SystemdUnit
11
+ JOBS = %w[write_tasks_scheduler_command write_service link_service verify_service
12
+ reload_systemd enable_service start_service].freeze
13
+
14
+ include ::Avm::Entries::Jobs::Base
15
+ require_sub __FILE__, include_modules: true
16
+ delegate :platform_instance, to: :instance
17
+
18
+ enable_listable
19
+ lists.add_symbol :option, :exec_run, :restart
20
+
21
+ def description
22
+ "#{instance.id} Tasks Scheduler"
23
+ end
24
+
25
+ def exec_run?
26
+ options[OPTION_EXEC_RUN]
27
+ end
28
+
29
+ def option_list
30
+ self.class.lists.option
31
+ end
32
+
33
+ def restart
34
+ options[OPTION_RESTART]
35
+ end
36
+
37
+ def unit_name
38
+ "#{instance.id}_tasks_scheduler.service"
39
+ end
40
+
41
+ def user
42
+ instance.install_username
43
+ end
44
+
45
+ private
46
+
47
+ def sudo_execute!(*args)
48
+ platform_instance.host_env.command(['sudo'] + args).execute!
49
+ end
50
+
51
+ def sudo_system!(*args)
52
+ command_args = ['sudo'] + args
53
+ infom "Running \"#{::Shellwords.join(command_args)}\"..."
54
+ platform_instance.host_env.command(command_args).system!
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_rails_base1/systemd_unit'
3
+ require 'avm/eac_rails_base1/instances/systemd_unit'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
@@ -31,9 +31,9 @@ module Avm
31
31
  private
32
32
 
33
33
  def systemd_unit_uncached
34
- ::Avm::EacRailsBase1::SystemdUnit.new(runner_context.call(:instance),
35
- restart: parsed.restart,
36
- exec_run: parsed.exec_run?)
34
+ ::Avm::EacRailsBase1::Instances::SystemdUnit.new(runner_context.call(:instance),
35
+ restart: parsed.restart,
36
+ exec_run: parsed.exec_run?)
37
37
  end
38
38
 
39
39
  def result_uncached
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRailsBase1
5
- VERSION = '0.6.0'
5
+ VERSION = '0.7.0'
6
6
  end
7
7
  end
@@ -12,14 +12,14 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,locale,template}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.43'
15
+ s.add_dependency 'avm', '~> 0.44'
16
16
  s.add_dependency 'avm-eac_generic_base0', '~> 0.5'
17
17
  s.add_dependency 'avm-eac_rails_base1', '~> 0.6'
18
18
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
19
19
  s.add_dependency 'curb', '~> 0.9', '>= 0.9.11'
20
20
  s.add_dependency 'eac_fs', '~> 0.12', '>= 0.12.3'
21
21
  s.add_dependency 'eac_rest', '~> 0.6', '>= 0.6.1'
22
- s.add_dependency 'eac_ruby_utils', '~> 0.103'
22
+ s.add_dependency 'eac_ruby_utils', '~> 0.104'
23
23
 
24
24
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
25
25
  end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_rails_base1/apache_host'
3
+ require 'avm/eac_rails_base1/instances/apache_host'
4
4
 
5
5
  module Avm
6
6
  module EacRedmineBase0
7
7
  module Instances
8
- class ApacheHost < ::Avm::EacRailsBase1::ApacheHost
8
+ class ApacheHost < ::Avm::EacRailsBase1::Instances::ApacheHost
9
9
  end
10
10
  end
11
11
  end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/instances/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRedmineBase0
8
+ module Instances
9
+ class Base < ::Avm::EacRailsBase1::Instances::Base
10
+ module Database
11
+ DATABASE_INTERNAL_HOSTNAME = 'localhost'
12
+ DEFAULT_POSTGRESQL_VERSION = '12'
13
+
14
+ common_concern do
15
+ uri_components_entries_values 'postgresql', %w[version]
16
+ end
17
+
18
+ def database_internal
19
+ entry(::Avm::Instances::EntryKeys::DATABASE_HOSTNAME).value ==
20
+ DATABASE_INTERNAL_HOSTNAME
21
+ end
22
+
23
+ def postgresql_version_default_value
24
+ DEFAULT_POSTGRESQL_VERSION
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/instances/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRedmineBase0
8
+ module Instances
9
+ class Base < ::Avm::EacRailsBase1::Instances::Base
10
+ module Gitolite
11
+ GITOLITE_ENTRY_KEYS_PREFIX = 'gitolite'
12
+ DEFAULT_HOSTNAME = 'localhost'
13
+ DEFAULT_PATH_PARENT = '/var/lib'
14
+ DEFAULT_SCHEME = 'file'
15
+ DEFAULT_USERNAME = 'git'
16
+
17
+ common_concern do
18
+ uri_components_entries_values GITOLITE_ENTRY_KEYS_PREFIX
19
+ end
20
+
21
+ def gitolite_hostname_default_value
22
+ DEFAULT_HOSTNAME
23
+ end
24
+
25
+ def gitolite_path_default_value
26
+ read_entry_optional([GITOLITE_ENTRY_KEYS_PREFIX, 'username']).if_present do |v|
27
+ ::File.join(DEFAULT_PATH_PARENT, v)
28
+ end
29
+ end
30
+
31
+ def gitolite_scheme_default_value
32
+ DEFAULT_SCHEME
33
+ end
34
+
35
+ def gitolite_username_default_value
36
+ DEFAULT_USERNAME
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/instances/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRedmineBase0
8
+ module Instances
9
+ class Base < ::Avm::EacRailsBase1::Instances::Base
10
+ module Web
11
+ def web_authority
12
+ web_hostname.if_present do |h|
13
+ h.to_s + web_port_optional.if_present('') { |p| ":#{p}" }
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -11,6 +11,7 @@ module Avm
11
11
  module EacRedmineBase0
12
12
  module Instances
13
13
  class Base < ::Avm::EacRailsBase1::Instances::Base
14
+ require_sub __FILE__, include_modules: true
14
15
  enable_simple_cache
15
16
 
16
17
  FILES_UNITS = { files: 'files' }.freeze
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_webapp_base0/deploy'
3
+ require 'avm/eac_webapp_base0/instances/deploy'
4
4
  require 'eac_ruby_utils/ruby'
5
5
 
6
6
  module Avm
7
7
  module EacRedmineBase0
8
8
  module Instances
9
- class Deploy < ::Avm::EacWebappBase0::Deploy
9
+ class Deploy < ::Avm::EacWebappBase0::Instances::Deploy
10
10
  set_callback :assert_instance_branch, :after, :run_installer
11
11
 
12
12
  def run_installer
@@ -14,9 +14,10 @@ module Avm
14
14
  BASE_IMAGE = 'ubuntu:20.04'
15
15
  INSTALLER_TARGET_TASK_WITH_WEB_PATH_BLANK = 'redmine_as_apache_base'
16
16
  INSTALLER_TARGET_TASK_WITH_WEB_PATH_PRESENT = 'redmine_as_apache_path'
17
- DATABASE_INTERNAL_HOSTNAME = 'localhost'
18
17
  REDMINE_SOURCE_HOST_SUBPATH = 'redmine_source'
19
18
 
19
+ delegate :database_internal, to: :instance
20
+
20
21
  def avm_fs_cache_object_id
21
22
  instance.id
22
23
  end
@@ -31,11 +32,6 @@ module Avm
31
32
  eac_ubuntu_base0_instance.docker_image.provide.id
32
33
  end
33
34
 
34
- def database_internal
35
- instance.entry(::Avm::Instances::EntryKeys::DATABASE_HOSTNAME).value ==
36
- DATABASE_INTERNAL_HOSTNAME
37
- end
38
-
39
35
  def installer_target_task
40
36
  if web_path_present?
41
37
  INSTALLER_TARGET_TASK_WITH_WEB_PATH_PRESENT
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRedmineBase0
5
- VERSION = '0.15.0'
5
+ VERSION = '0.16.0'
6
6
  end
7
7
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_redmine_base0/instances/base'
4
+
5
+ RSpec.describe ::Avm::EacRedmineBase0::Instances::Base do
6
+ include_examples 'entries_values', __FILE__, {
7
+ 'app_0' => {
8
+ 'gitolite.username' => 'git',
9
+ 'gitolite.path' => '/var/lib/git',
10
+ 'gitolite.scheme' => 'file',
11
+ 'gitolite.hostname' => 'localhost'
12
+ },
13
+ 'app_1' => {
14
+ 'gitolite.username' => 'git1',
15
+ 'gitolite.path' => '/var/lib/git1',
16
+ 'gitolite.scheme' => 'file',
17
+ 'gitolite.hostname' => 'localhost'
18
+ },
19
+ 'app_2' => {
20
+ 'gitolite.username' => 'git2',
21
+ 'gitolite.path' => '/home/git2',
22
+ 'gitolite.scheme' => 'file',
23
+ 'gitolite.hostname' => 'localhost'
24
+ }
25
+ }
26
+ end
@@ -0,0 +1,10 @@
1
+ ---
2
+ app_0: {}
3
+ app_1:
4
+ gitolite:
5
+ username: git1
6
+ id: app_0
7
+ app_2:
8
+ gitolite:
9
+ username: git2
10
+ path: /home/git2
@@ -1,10 +1,17 @@
1
+ # Ruby
2
+ export rvm_ruby='ruby-%%RUBY.VERSION%%'
3
+
4
+ # Database
5
+ export postgresql_internal='%%DATABASE_INTERNAL%%'
6
+ export postgresql_host='%%DATABASE.HOSTNAME%%'
7
+ export postgresql_port='%%DATABASE.PORT%%'
1
8
  export postgresql_database='%%DATABASE.NAME%%'
2
- export postgresql_database_test='%%DATABASE.NAME%%_test'
3
9
  export postgresql_user='%%DATABASE.USERNAME%%'
4
10
  export postgresql_password='%%DATABASE.PASSWORD%%'
5
11
  export postgresql_version='%%POSTGRESQL.VERSION%%'
6
- export rvm_ruby='ruby-%%RUBY.VERSION%%'
7
- export redmine_git_hosting_ssh_key_name=redmine_git_hosting_id
12
+ export postgresql_extra_settings='%%DATABASE.EXTRA%%'
13
+
14
+ # Web
8
15
  if [ '%%WEB.SCHEME%%' == 'https' ]; then
9
16
  export address_https='true'
10
17
  else
@@ -17,6 +24,7 @@ export address_path='%%WEB.PATH%%'
17
24
  export git_repositories_hierarchical_organisation=false
18
25
  export gitolite_user='%%GIT.USERNAME%%'
19
26
  export gitolite_user_home="/var/lib/${gitolite_user}"
27
+ export redmine_git_hosting_ssh_key_name=redmine_git_hosting_id
20
28
 
21
29
  # Mail settings
22
30
  export smtp_server='%%MAILER.SMTP.ADDRESS%%'
@@ -12,11 +12,11 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,template}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.42'
15
+ s.add_dependency 'avm', '~> 0.45'
16
16
  s.add_dependency 'avm-eac_generic_base0', '~> 0.5'
17
17
  s.add_dependency 'avm-eac_postgresql_base0', '~> 0.2'
18
18
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
19
- s.add_dependency 'eac_ruby_utils', '~> 0.103'
19
+ s.add_dependency 'eac_ruby_utils', '~> 0.104'
20
20
 
21
21
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
22
22
  end