avm-tools 0.114.2 → 0.116.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/tools/runner/git/deploy.rb +1 -1
  3. data/lib/avm/tools/version.rb +1 -1
  4. data/sub/avm/lib/avm/instances/base/auto_values/database.rb +2 -2
  5. data/sub/avm/lib/avm/instances/entry_keys.rb +4 -1
  6. data/sub/avm/lib/avm/self/instance.rb +0 -1
  7. data/sub/avm/lib/avm/sources/base/instance.rb +28 -0
  8. data/sub/avm/lib/avm/version.rb +1 -1
  9. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build/file.rb +1 -1
  10. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build.rb +2 -2
  11. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner/build.rb +1 -1
  12. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner.rb +2 -2
  13. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
  14. data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance/assert.rb +77 -0
  15. data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance.rb +23 -12
  16. data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/version.rb +1 -1
  17. data/sub/avm-eac_rails_base0/avm-eac_rails_base0.gemspec +1 -1
  18. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/deploy.rb +1 -1
  19. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb +1 -1
  20. data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +1 -1
  21. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/tasks_scheduler/systemd_unit.rb +46 -0
  22. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/tasks_scheduler.rb +17 -0
  23. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/service.rb +70 -0
  24. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.rb +29 -0
  25. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit.rb +57 -0
  26. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +1 -1
  27. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/systemd_unit/tasks_scheduler.service +12 -0
  28. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.sh +6 -0
  29. data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +1 -1
  30. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
  31. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/deploy/config/install.sh.template +3 -3
  32. data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/instances/base.rb +6 -0
  33. data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/version.rb +1 -1
  34. data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +1 -1
  35. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instance.rb +7 -0
  36. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +1 -1
  37. data/sub/eac_cli/lib/eac_cli/runner/context.rb +4 -0
  38. data/sub/eac_cli/lib/eac_cli/runner/instance_methods.rb +10 -0
  39. data/sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb +1 -1
  40. data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
  41. data/sub/eac_fs/lib/eac_fs/patches/object/fs_cache.rb +6 -1
  42. data/sub/eac_fs/lib/eac_fs/version.rb +1 -1
  43. data/sub/eac_ruby_utils/lib/eac_ruby_utils/bit.rb +46 -0
  44. data/sub/eac_ruby_utils/lib/eac_ruby_utils/bit_array.rb +81 -0
  45. data/sub/eac_ruby_utils/lib/eac_ruby_utils/byte.rb +105 -0
  46. data/sub/eac_ruby_utils/lib/eac_ruby_utils/byte_array.rb +36 -0
  47. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/process.rb +12 -4
  48. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/asserts.rb +11 -0
  49. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_noext.rb +10 -0
  50. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/reqdir_glob.rb +13 -0
  51. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  52. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/bit_array_spec.rb +22 -0
  53. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/byte_spec.rb +54 -0
  54. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/basename_noext_spec.rb +26 -0
  55. metadata +38 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e2a7df849fd040b8e6fddad4e1c8507139926f0b587ceab796c1416fb9af873
4
- data.tar.gz: 70eb055f94b37d37e05510563a654350137d0358283ad7d33a4d895110f1f2cc
3
+ metadata.gz: 9a2ba57966d3d9df50f672ea915acbf2d245c9a84665c57ea1618693c5e1e6b0
4
+ data.tar.gz: d3ab208447bf90b3eacac1bc9b9e824ab1d2b5c94caeec32aa8d6c2505257b8a
5
5
  SHA512:
6
- metadata.gz: 90be4e12df6cda16ffc88680a42a6d3dd118e96f97840cfb4a49b4418b76df1826485065ca069e3105d942136ed9273f03e9e15b340c4913abfeacae01ce1eba
7
- data.tar.gz: 262a63d17a298911bef85e025b678779e8d7795e2376349128999fc50442275a0303bde419921e2799a3f8a9923366d3996c655ea032d909ca555f6b7d6892a5
6
+ metadata.gz: 56714834b02e5f8d58091f4599dc0334d91c8953f62ca4112a0b2ae116a9be48d92e077702a9263f027157773b8b5fda3989ff82609d2e689053352e70dc9d86
7
+ data.tar.gz: 3acfd216f55ac712a087e4e5363f253a2633367d8f7f0f78107a0cb3e521dd9cdfb86eb058f1af2a8e8d78a388ed1897521bd5553c150589363d6347c64c3850
@@ -86,7 +86,7 @@ module Avm
86
86
 
87
87
  def target_url
88
88
  parsed.target_url.if_present { |v| return v }
89
- instance.if_present { |v| return v.read_entry('fs.url') }
89
+ instance.if_present { |v| return v.read_entry(::Avm::Instances::EntryKeys::FS_URL) }
90
90
  nil
91
91
  end
92
92
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.114.2'
5
+ VERSION = '0.116.1'
6
6
  end
7
7
  end
@@ -37,7 +37,7 @@ module Avm
37
37
  end
38
38
 
39
39
  def auto_database_password
40
- database_auto_common('password')
40
+ database_auto_common('password') || id
41
41
  end
42
42
 
43
43
  def auto_database_port
@@ -45,7 +45,7 @@ module Avm
45
45
  end
46
46
 
47
47
  def auto_database_username
48
- database_auto_common('username')
48
+ database_auto_common('username') || id
49
49
  end
50
50
 
51
51
  def auto_database_system
@@ -43,11 +43,14 @@ module Avm
43
43
 
44
44
  {
45
45
  '' => %w[data_fs_path fs_path host_id name source_instance_id],
46
+ admin: %w[username password api_key],
46
47
  database: %w[id hostname limit name password port system timeout username extra],
47
48
  docker: %w[registry],
49
+ fs: %w[url],
48
50
  mailer: {
49
51
  '' => %w[id from reply_to],
50
- smtp: %w[address port domain username password authentication starttls_auto]
52
+ smtp: %w[address port domain username password authentication openssl_verify_mode
53
+ starttls_auto tls]
51
54
  },
52
55
  ssh: %w[hostname port url username],
53
56
  web: %w[authority hostname path port scheme url userinfo]
@@ -3,7 +3,6 @@
3
3
  require 'avm/instances/base'
4
4
  require 'avm/self/docker_image'
5
5
  require 'avm/self/instance/entry_keys'
6
- require 'avm/eac_ubuntu_base0/docker_image'
7
6
 
8
7
  module Avm
9
8
  module Self
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/application'
4
+ require 'avm/instances/base'
5
+
6
+ module Avm
7
+ module Sources
8
+ class Base
9
+ module Instance
10
+ DEFAULT_INSTANCE_SUFFIX = 'dev'
11
+
12
+ def instance_suffix
13
+ DEFAULT_INSTANCE_SUFFIX
14
+ end
15
+
16
+ private
17
+
18
+ def application_uncached
19
+ ::Avm::Instances::Application.new(path.basename)
20
+ end
21
+
22
+ def instance_uncached
23
+ ::Avm::Instances::Base.new(application, DEFAULT_INSTANCE_SUFFIX)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.15.0'
4
+ VERSION = '0.18.0'
5
5
  end
@@ -17,7 +17,7 @@ module Avm
17
17
  end
18
18
 
19
19
  def source_path
20
- build.project.root.join(subpath)
20
+ build.project.path.join(subpath)
21
21
  end
22
22
 
23
23
  def target_path
@@ -25,7 +25,7 @@ module Avm
25
25
  end
26
26
 
27
27
  def default_target_directory
28
- project.root.join('build')
28
+ project.path.join('build')
29
29
  end
30
30
 
31
31
  def target_directory
@@ -36,7 +36,7 @@ module Avm
36
36
 
37
37
  def source_files_uncached
38
38
  r = []
39
- project.root.children.each do |child|
39
+ project.path.children.each do |child|
40
40
  next unless SOURCE_EXTNAMES.include?(child.extname)
41
41
 
42
42
  r << ::Avm::EacAsciidoctorBase0::Sources::Build::File.new(self, child.basename)
@@ -29,7 +29,7 @@ module Avm
29
29
  end
30
30
 
31
31
  def default_target_directory
32
- runner_context.call(:project).root.join('build')
32
+ runner_context.call(:project).path.join('build')
33
33
  end
34
34
 
35
35
  def open
@@ -15,8 +15,8 @@ module Avm
15
15
  end
16
16
 
17
17
  def project_banner
18
- infov 'Project', project.name
19
- infov 'Path', project.root
18
+ infov 'Project', project.application.name
19
+ infov 'Path', project.path
20
20
  end
21
21
 
22
22
  private
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacAsciidoctorBase0
5
- VERSION = '0.3.3'
5
+ VERSION = '0.3.4'
6
6
  end
7
7
  end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacPostgresqlBase0
7
+ class Instance
8
+ class Assert
9
+ common_constructor :instance
10
+ delegate :name, :password, :user, to: :instance
11
+
12
+ def perform
13
+ create_user unless user_exist?
14
+ change_password unless password_ok?
15
+ create_database unless database_exist?
16
+ change_owner unless user_owner?
17
+ end
18
+
19
+ def change_owner
20
+ root_execute("ALTER DaTABASE \"#{name}\" OWNER TO \"#{user}\"")
21
+ end
22
+
23
+ def change_password
24
+ root_execute("ALTER USER \"#{user}\" WITH PASSWORD '#{password}'")
25
+ end
26
+
27
+ def create_user
28
+ root_execute("CREATE USER \"#{user}\" WITH PASSWORD '#{password}'")
29
+ end
30
+
31
+ def current_owner
32
+ root_query(<<~SQL
33
+ SELECT pg_catalog.pg_get_userbyid(datdba)
34
+ FROM pg_catalog.pg_database
35
+ WHERE datname = '#{name}'
36
+ SQL
37
+ )
38
+ end
39
+
40
+ def database_exist?
41
+ root_boolean_query("FROM pg_database WHERE datname='#{name}'")
42
+ end
43
+
44
+ def password_ok?
45
+ instance.psql_command_command('SELECT 1', false)
46
+ .execute!(exit_outputs: { 512 => 'login_failed' }).strip == '1'
47
+ end
48
+
49
+ def user_exist?
50
+ root_boolean_query("FROM pg_roles WHERE rolname='#{user}'")
51
+ end
52
+
53
+ def user_owner?
54
+ user == current_owner
55
+ end
56
+
57
+ def create_database
58
+ root_execute("CREATE DATABASE \"#{name}\" WITH OWNER \"#{user}\"")
59
+ end
60
+
61
+ private
62
+
63
+ def root_boolean_query(sql_after_projection)
64
+ root_query("SELECT 1 #{sql_after_projection}") == '1'
65
+ end
66
+
67
+ def root_execute(sql)
68
+ instance.root_psql_command(sql).execute!
69
+ end
70
+
71
+ def root_query(sql)
72
+ root_execute(sql).strip
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -1,13 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/eac_postgresql_base0/instance/data_unit'
4
+ require 'eac_ruby_utils/core_ext'
4
5
 
5
6
  module Avm
6
7
  module EacPostgresqlBase0
7
8
  class Instance
8
- def initialize(env, connection_params)
9
- @env = env
10
- @connection_params = connection_params.with_indifferent_access
9
+ require_sub __FILE__
10
+
11
+ MAINTENANCE_DATABASE = 'postgres'
12
+
13
+ common_constructor :env, :connection_params do
14
+ self.connection_params = connection_params.with_indifferent_access
15
+ end
16
+
17
+ def assert
18
+ ::Avm::EacPostgresqlBase0::Instance::Assert.new(self).perform
11
19
  end
12
20
 
13
21
  def data_unit
@@ -23,20 +31,23 @@ module Avm
23
31
  dump_command.append(['@ESC_|', 'gzip', '-9', '-c'])
24
32
  end
25
33
 
26
- def psql_command
27
- env.command("@ESC_PGPASSWORD=#{password}", 'psql', *common_command_args)
34
+ def psql_command(database = true)
35
+ env.command("@ESC_PGPASSWORD=#{password}", 'psql', *common_command_args(database))
28
36
  end
29
37
 
30
- def psql_command_command(sql)
31
- psql_command.append(['--quiet', '--tuples-only', '--command', sql])
38
+ def psql_command_command(sql, database = true)
39
+ psql_command(database).append(['--quiet', '--tuples-only', '--command', sql])
32
40
  end
33
41
 
34
- private
35
-
36
- attr_reader :env, :connection_params
42
+ def root_psql_command(sql = nil)
43
+ args = ['sudo', '-u', 'postgres', 'psql']
44
+ args += ['--quiet', '--tuples-only', '--command', sql] if sql.present?
45
+ env.command(*args)
46
+ end
37
47
 
38
- def common_command_args
39
- ['--host', host, '--username', user, '--port', port, name]
48
+ def common_command_args(database = true)
49
+ ['--host', host, '--username', user, '--port', port,
50
+ (database ? name : MAINTENANCE_DATABASE)]
40
51
  end
41
52
 
42
53
  def host
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacPostgresqlBase0
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
@@ -12,7 +12,7 @@ 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.1', '>= 0.1.3'
15
+ s.add_dependency 'avm-eac_rails_base1', '~> 0.2'
16
16
  s.add_dependency 'eac_ruby_utils', '~> 0.80', '>= 0.80.2'
17
17
 
18
18
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
@@ -18,7 +18,7 @@ module Avm
18
18
 
19
19
  def assert_database
20
20
  infom 'Asserting database...'
21
- instance.rake('db:create').system!
21
+ instance.pg.assert
22
22
  end
23
23
 
24
24
  def bundle_install
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRailsBase0
5
- VERSION = '0.1.3'
5
+ VERSION = '0.3.0'
6
6
  end
7
7
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
- s.add_dependency 'avm-eac_webapp_base0', '~> 0.2', '>= 0.2.1'
15
+ s.add_dependency 'avm-eac_webapp_base0', '~> 0.3'
16
16
  s.add_dependency 'eac_ruby_gems_utils', '~> 0.9', '>= 0.9.9'
17
17
  s.add_dependency 'eac_ruby_utils', '~> 0.68'
18
18
 
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/systemd_unit'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRailsBase1
8
+ class Runner < ::Avm::EacWebappBase0::Runner
9
+ class TasksScheduler
10
+ class SystemdUnit
11
+ DEFAULT_RESTART = 'on-failure'
12
+
13
+ runner_with :help do
14
+ desc 'Configure Systemd unit for instace\'s tasks scheduler daemon (Reference: ' \
15
+ 'https://www.freedesktop.org/software/systemd/man/systemd.service.html).'
16
+ bool_opt '-e', '--exec-run', 'Run daemon with "run" instead of "start"/"stop".'
17
+ arg_opt '-r', '--restart', 'Value for systemd.service, Restart=.',
18
+ default: DEFAULT_RESTART
19
+ end
20
+
21
+ delegate :restart, to: :parsed
22
+
23
+ def run
24
+ if result.error?
25
+ fatal_error result.to_s
26
+ else
27
+ infov 'Result', result.label
28
+ end
29
+ end
30
+
31
+ private
32
+
33
+ def systemd_unit_uncached
34
+ ::Avm::EacRailsBase1::SystemdUnit.new(runner_context.call(:instance),
35
+ restart: parsed.restart,
36
+ exec_run: parsed.exec_run?)
37
+ end
38
+
39
+ def result_uncached
40
+ systemd_unit.run
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ class Runner < ::Avm::EacWebappBase0::Runner
8
+ class TasksScheduler
9
+ require_sub __FILE__
10
+
11
+ runner_with :help, :subcommands do
12
+ subcommands
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ class SystemdUnit
8
+ module Service
9
+ def service_content
10
+ template.child('tasks_scheduler.service').apply(variables_source)
11
+ end
12
+
13
+ def service_exec_lines
14
+ service_exec_operations
15
+ .map { |k, v| "#{k}=#{tasks_scheduler_command_path} #{v}" }
16
+ .join("\n")
17
+ end
18
+
19
+ def service_path
20
+ ::Pathname.new('/etc/systemd/system').join(unit_name)
21
+ end
22
+
23
+ def service_link_path
24
+ ::Pathname.new('/etc/systemd/system/multi-user.target.wants').join(unit_name)
25
+ end
26
+
27
+ def verify_service
28
+ sudo_system!('systemd-analyze', 'verify', service_path)
29
+ end
30
+
31
+ private
32
+
33
+ def enable_service
34
+ systemctl('enable', unit_name)
35
+ end
36
+
37
+ def link_service
38
+ sudo_execute!('rm', '-f', service_link_path)
39
+ sudo_execute!('ln', '-s', service_path, service_link_path)
40
+ end
41
+
42
+ def reload_systemd
43
+ systemctl('daemon-reload')
44
+ end
45
+
46
+ # @return [Hash<String, String>]
47
+ def service_exec_operations
48
+ if exec_run?
49
+ { 'ExecStart' => 'run' }
50
+ else
51
+ { 'ExecStart' => 'start', 'ExecStop' => 'stop' }
52
+ end
53
+ end
54
+
55
+ def start_service
56
+ systemctl('start', unit_name)
57
+ end
58
+
59
+ def systemctl(*args)
60
+ sudo_system!('systemctl', *args)
61
+ end
62
+
63
+ def write_service
64
+ infom 'Writing service\'s unit file...'
65
+ platform_instance.file_sudo_write(service_path, service_content)
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ class SystemdUnit
8
+ module TasksSchedulerCommand
9
+ def tasks_scheduler_command_content
10
+ template.child('tasks_scheduler_command.sh').apply(variables_source)
11
+ end
12
+
13
+ def tasks_scheduler_command_path
14
+ "/opt/aux/#{instance.id}/tasks_scheduler.sh"
15
+ end
16
+
17
+ private
18
+
19
+ def write_tasks_scheduler_command
20
+ infom 'Writing tasks scheduler\'s command...'
21
+ sudo_execute!('mkdir', '-p', ::File.dirname(tasks_scheduler_command_path))
22
+ platform_instance.file_sudo_write(tasks_scheduler_command_path,
23
+ tasks_scheduler_command_content)
24
+ sudo_execute!('chmod', '+x', tasks_scheduler_command_path)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,57 @@
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 EacRailsBase1
9
+ class SystemdUnit
10
+ JOBS = %w[write_tasks_scheduler_command write_service link_service verify_service
11
+ reload_systemd enable_service start_service].freeze
12
+
13
+ include ::Avm::Jobs::Base
14
+ require_sub __FILE__, include_modules: true
15
+ delegate :platform_instance, to: :instance
16
+
17
+ enable_listable
18
+ lists.add_symbol :option, :exec_run, :restart
19
+
20
+ def description
21
+ "#{instance.id} Tasks Scheduler"
22
+ end
23
+
24
+ def exec_run?
25
+ options[OPTION_EXEC_RUN]
26
+ end
27
+
28
+ def option_list
29
+ self.class.lists.option
30
+ end
31
+
32
+ def restart
33
+ options[OPTION_RESTART]
34
+ end
35
+
36
+ def unit_name
37
+ "#{instance.id}_tasks_scheduler.service"
38
+ end
39
+
40
+ def user
41
+ instance.ssh_username
42
+ end
43
+
44
+ private
45
+
46
+ def sudo_execute!(*args)
47
+ platform_instance.host_env.command(['sudo'] + args).execute!
48
+ end
49
+
50
+ def sudo_system!(*args)
51
+ command_args = ['sudo'] + args
52
+ infom "Running \"#{::Shellwords.join(command_args)}\"..."
53
+ platform_instance.host_env.command(command_args).system!
54
+ end
55
+ end
56
+ end
57
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRailsBase1
5
- VERSION = '0.1.4'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
@@ -0,0 +1,12 @@
1
+ [Unit]
2
+ Description='%%description%%'
3
+ After=postgresql.service
4
+
5
+ [Service]
6
+ Type=forking
7
+ %%service_exec_lines%%
8
+ Restart=%%restart%%
9
+ User=%%user%%
10
+
11
+ [Install]
12
+ WantedBy=multi-user.target
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ source "$HOME/.rvm/scripts/rvm"
6
+ ( cd '%%fs_path%%'; bundle exec tasks_scheduler "$@" )
@@ -12,7 +12,7 @@ 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.1'
15
+ s.add_dependency 'avm-eac_rails_base1', '~> 0.2'
16
16
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.2'
17
17
  s.add_dependency 'curb', '~> 0.9.10'
18
18
  s.add_dependency 'eac_fs', '~> 0.4'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRedmineBase0
5
- VERSION = '0.4.0'
5
+ VERSION = '0.5.0'
6
6
  end
7
7
  end
@@ -18,9 +18,9 @@ export git_repositories_hierarchical_organisation=false
18
18
  export smtp_server='%%MAILER.SMTP.ADDRESS%%'
19
19
  export smtp_port='%%MAILER.SMTP.PORT%%'
20
20
  export smtp_domain='%%MAILER.SMTP.DOMAIN%%'
21
- export smtp_tls='%%MAILER_SMTP_TLS%%'
22
- export smtp_enable_starttls_auto='%%MAILER_SMTP_STARTTLS_AUTO%%'
23
- export smtp_openssl_verify_mode='%%MAILER_SMTP_OPENSSL_VERIFY_MODE%%'
21
+ export smtp_tls='%%MAILER.SMTP.TLS%%'
22
+ export smtp_enable_starttls_auto='%%MAILER.SMTP.STARTTLS_AUTO%%'
23
+ export smtp_openssl_verify_mode='%%MAILER.SMTP.OPENSSL_VERIFY_MODE%%'
24
24
  export smtp_authentication='%%MAILER.SMTP.AUTHENTICATION%%'
25
25
  export smtp_username='%%MAILER.SMTP.USERNAME%%'
26
26
  export smtp_password='%%MAILER.SMTP.PASSWORD%%'
@@ -10,6 +10,12 @@ module Avm
10
10
  def docker_image_class
11
11
  ::Avm::EacUbuntuBase0::DockerImage
12
12
  end
13
+
14
+ def file_sudo_write(path, content)
15
+ ::EacRubyUtils::Envs.local.command('echo', content).pipe(
16
+ host_env.command('sudo', 'tee', path)
17
+ ).execute!
18
+ end
13
19
  end
14
20
  end
15
21
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacUbuntuBase0
5
- VERSION = '0.2.1'
5
+ VERSION = '0.3.0'
6
6
  end
7
7
  end