avm-tools 0.25.0 → 0.26.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/git/commit/deploy.rb +1 -1
- data/lib/avm/instances/application.rb +4 -0
- data/lib/avm/instances/base/auto_values.rb +1 -1
- data/lib/avm/instances/base/auto_values/ruby.rb +15 -0
- data/lib/avm/instances/base/auto_values/web.rb +27 -1
- data/lib/avm/stereotypes/eac_redmine_base0/deploy.rb +55 -0
- data/lib/avm/stereotypes/eac_redmine_base0/instance.rb +4 -2
- data/lib/avm/stereotypes/eac_webapp_base0/deploy.rb +1 -1
- data/lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb +52 -0
- data/lib/avm/tools/runner/eac_rails_base0/deploy.rb +2 -28
- data/lib/avm/tools/runner/eac_redmine_base0/deploy.rb +15 -0
- data/lib/avm/tools/runner/eac_wordpress_base0/deploy.rb +2 -28
- data/lib/avm/tools/runner/git.rb +6 -2
- data/lib/avm/tools/runner/git/deploy.rb +16 -1
- data/lib/avm/tools/version.rb +1 -1
- data/template/avm/stereotypes/eac_redmine_base0/deploy/config/install.sh.template +14 -0
- data/template/avm/stereotypes/eac_redmine_base0/deploy/config/secrets.yml +8 -0
- metadata +8 -3
- data/lib/avm/tools/git.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cd4428c87bbb4fa7c5e7e49f2324bae1f9c34a63adad1790ca84dd3e44726bc
|
4
|
+
data.tar.gz: 0f658f19e437688c90766266a69f9aede92bde9036804eaed08562c8bd8bf2b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cce720c19266b3441dfd04c469179bad41e42e71d984b57ef32677d0a247637b829e2674c53f8e20f17a62f280d52e131da103db9b55f75d39ddf7b64893bb72
|
7
|
+
data.tar.gz: 9ae68611ffa2d35623a553ffb7d3b89ec0cb04878c472275544f33b17b7014c1a7bfe49c357eb78ebaf3361e3776aa40b268e50b3872618f943c0458ce6f8800
|
@@ -21,7 +21,7 @@ module Avm
|
|
21
21
|
def uri_to_env(uri)
|
22
22
|
case uri.scheme
|
23
23
|
when 'file' then ::EacRubyUtils::Envs.local
|
24
|
-
when 'ssh' then ::EacRubyUtils::Envs.ssh(uri
|
24
|
+
when 'ssh' then ::EacRubyUtils::Envs.ssh(uri)
|
25
25
|
else "Invalid schema \"#{uri.schema}\" (URI: #{uri})"
|
26
26
|
end
|
27
27
|
end
|
@@ -10,7 +10,7 @@ module Avm
|
|
10
10
|
extend ::ActiveSupport::Concern
|
11
11
|
|
12
12
|
included do
|
13
|
-
%w[Access Admin Database Filesystem Source System Web].each do |class_name|
|
13
|
+
%w[Access Admin Database Filesystem Ruby Source System Web].each do |class_name|
|
14
14
|
include const_get(class_name)
|
15
15
|
end
|
16
16
|
end
|
@@ -7,9 +7,35 @@ module Avm
|
|
7
7
|
class Base
|
8
8
|
module AutoValues
|
9
9
|
module Web
|
10
|
+
def auto_web_authority
|
11
|
+
web_url_as_uri(&:authority)
|
12
|
+
end
|
13
|
+
|
10
14
|
def auto_web_hostname
|
15
|
+
web_url_as_uri(&:host)
|
16
|
+
end
|
17
|
+
|
18
|
+
def auto_web_path
|
19
|
+
web_url_as_uri(&:path)
|
20
|
+
end
|
21
|
+
|
22
|
+
def auto_web_port
|
23
|
+
web_url_as_uri(&:port)
|
24
|
+
end
|
25
|
+
|
26
|
+
def auto_web_scheme
|
27
|
+
web_url_as_uri(&:scheme)
|
28
|
+
end
|
29
|
+
|
30
|
+
def auto_web_userinfo
|
31
|
+
web_url_as_uri(&:userinfo)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def web_url_as_uri
|
11
37
|
read_entry_optional('web.url').if_present do |v|
|
12
|
-
::Addressable::URI.parse(v)
|
38
|
+
yield(::Addressable::URI.parse(v))
|
13
39
|
end
|
14
40
|
end
|
15
41
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/stereotypes/eac_webapp_base0/deploy'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Stereotypes
|
7
|
+
module EacRedmineBase0
|
8
|
+
class Deploy < ::Avm::Stereotypes::EacWebappBase0::Deploy
|
9
|
+
set_callback :assert_instance_branch, :after, :run_installer
|
10
|
+
|
11
|
+
def run_installer
|
12
|
+
infom 'Running installer'
|
13
|
+
on_clean_ruby do
|
14
|
+
installer_command.system!
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def installer_command
|
19
|
+
instance.host_env.command(installer_path, install_task)
|
20
|
+
end
|
21
|
+
|
22
|
+
def installer_path
|
23
|
+
::File.join(instance.read_entry(:fs_path), 'plugins', 'redmine_installer', 'installer',
|
24
|
+
'run.sh')
|
25
|
+
end
|
26
|
+
|
27
|
+
def install_task
|
28
|
+
if instance.read_entry_optional('web.path').present?
|
29
|
+
'redmine_as_apache_path'
|
30
|
+
else
|
31
|
+
'redmine_as_apache_base'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def on_clean_ruby
|
36
|
+
on_clear_envvars('BUNDLE', 'RUBY') { yield }
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def on_clear_envvars(*start_with_vars)
|
42
|
+
old_values = envvars_starting_with(start_with_vars)
|
43
|
+
old_values.keys.each { |k| ENV.delete(k) }
|
44
|
+
yield
|
45
|
+
ensure
|
46
|
+
old_values&.each { |k, v| ENV[k] = v }
|
47
|
+
end
|
48
|
+
|
49
|
+
def envvars_starting_with(start_with_vars)
|
50
|
+
ENV.select { |k, _v| start_with_vars.any? { |var| k.start_with?(var) } }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/instances/base'
|
4
3
|
require 'avm/stereotypes/eac_ubuntu_base0/docker_image'
|
4
|
+
require 'avm/stereotypes/eac_webapp_base0/instance'
|
5
5
|
|
6
6
|
module Avm
|
7
7
|
module Stereotypes
|
8
8
|
module EacRedmineBase0
|
9
|
-
class Instance < ::Avm::
|
9
|
+
class Instance < ::Avm::Stereotypes::EacWebappBase0::Instance
|
10
|
+
FILES_UNITS = { files: 'files' }.freeze
|
11
|
+
|
10
12
|
def docker_image_class
|
11
13
|
::Avm::Stereotypes::EacUbuntuBase0::DockerImage
|
12
14
|
end
|
@@ -51,7 +51,7 @@ module Avm
|
|
51
51
|
::Avm::Git::Commit.new(git, commit_sha1).deploy_to_env_path(
|
52
52
|
instance.host_env,
|
53
53
|
instance.read_entry(:fs_path)
|
54
|
-
).append_directory(
|
54
|
+
).append_directory(template.path).variables_source_set(instance).run
|
55
55
|
end
|
56
56
|
|
57
57
|
def setup_files_units
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
4
|
+
require 'eac_ruby_utils/console/speaker'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Stereotypes
|
8
|
+
module EacWebappBase0
|
9
|
+
module Runner
|
10
|
+
class Deploy < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
include ::EacRubyUtils::Console::Speaker
|
12
|
+
|
13
|
+
DOC = <<~DOCOPT
|
14
|
+
Deploy for %%STEREOTYPE_NAME%% instance.
|
15
|
+
|
16
|
+
Usage:
|
17
|
+
__PROGRAM__ [options]
|
18
|
+
__PROGRAM__ -h | --help
|
19
|
+
|
20
|
+
Options:
|
21
|
+
-h --help Show this screen.
|
22
|
+
-r --reference=<git-reference> Git reference to deploy.
|
23
|
+
DOCOPT
|
24
|
+
def initialize(settings = {})
|
25
|
+
super settings.merge(doc: DOC.gsub('%%STEREOTYPE_NAME%%', stereotype_name))
|
26
|
+
end
|
27
|
+
|
28
|
+
def deploy_class
|
29
|
+
stereotype_module.const_get('Deploy')
|
30
|
+
end
|
31
|
+
|
32
|
+
def stereotype_module
|
33
|
+
"Avm::Stereotypes::#{stereotype_name}".constantize
|
34
|
+
end
|
35
|
+
|
36
|
+
def stereotype_name
|
37
|
+
self.class.name.deconstantize.demodulize
|
38
|
+
end
|
39
|
+
|
40
|
+
def run
|
41
|
+
result = deploy_class.new(context(:instance), options.fetch('--reference')).run
|
42
|
+
if result.error?
|
43
|
+
fatal_error result.to_s
|
44
|
+
else
|
45
|
+
infov 'Result', result.label
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -1,39 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_ruby_utils/console/docopt_runner'
|
4
|
-
require 'eac_ruby_utils/console/speaker'
|
5
3
|
require 'avm/stereotypes/eac_rails_base0/deploy'
|
4
|
+
require 'avm/stereotypes/eac_webapp_base0/runner/deploy'
|
6
5
|
|
7
6
|
module Avm
|
8
7
|
module Tools
|
9
8
|
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
10
9
|
class EacRailsBase0 < ::EacRubyUtils::Console::DocoptRunner
|
11
|
-
class Deploy < ::
|
12
|
-
include ::EacRubyUtils::Console::Speaker
|
13
|
-
|
14
|
-
DOC = <<~DOCOPT
|
15
|
-
Deploy for EacRailsBase0 instance.
|
16
|
-
|
17
|
-
Usage:
|
18
|
-
__PROGRAM__ [options]
|
19
|
-
__PROGRAM__ -h | --help
|
20
|
-
|
21
|
-
Options:
|
22
|
-
-h --help Show this screen.
|
23
|
-
-r --reference=<git-reference> Git reference to deploy.
|
24
|
-
DOCOPT
|
25
|
-
|
26
|
-
def run
|
27
|
-
result = ::Avm::Stereotypes::EacRailsBase0::Deploy.new(
|
28
|
-
context(:instance),
|
29
|
-
options.fetch('--reference')
|
30
|
-
).run
|
31
|
-
if result.error?
|
32
|
-
fatal_error result.to_s
|
33
|
-
else
|
34
|
-
infov 'Result', result.label
|
35
|
-
end
|
36
|
-
end
|
10
|
+
class Deploy < ::Avm::Stereotypes::EacWebappBase0::Runner::Deploy
|
37
11
|
end
|
38
12
|
end
|
39
13
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/stereotypes/eac_redmine_base0/deploy'
|
4
|
+
require 'avm/stereotypes/eac_webapp_base0/runner/deploy'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Tools
|
8
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
9
|
+
class EacRedmineBase0 < ::EacRubyUtils::Console::DocoptRunner
|
10
|
+
class Deploy < ::Avm::Stereotypes::EacWebappBase0::Runner::Deploy
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,39 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'eac_ruby_utils/console/speaker'
|
3
|
+
require 'avm/stereotypes/eac_webapp_base0/runner/deploy'
|
5
4
|
require 'avm/stereotypes/eac_wordpress_base0/deploy'
|
6
5
|
|
7
6
|
module Avm
|
8
7
|
module Tools
|
9
8
|
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
10
9
|
class EacWordpressBase0 < ::EacRubyUtils::Console::DocoptRunner
|
11
|
-
class Deploy < ::
|
12
|
-
include ::EacRubyUtils::Console::Speaker
|
13
|
-
|
14
|
-
DOC = <<~DOCOPT
|
15
|
-
Deploy for EacWordpressBase0 instance.
|
16
|
-
|
17
|
-
Usage:
|
18
|
-
__PROGRAM__ [options]
|
19
|
-
__PROGRAM__ -h | --help
|
20
|
-
|
21
|
-
Options:
|
22
|
-
-h --help Show this screen.
|
23
|
-
-r --reference=<git-reference> Git reference to deploy.
|
24
|
-
DOCOPT
|
25
|
-
|
26
|
-
def run
|
27
|
-
result = ::Avm::Stereotypes::EacWordpressBase0::Deploy.new(
|
28
|
-
context(:instance),
|
29
|
-
options.fetch('--reference')
|
30
|
-
).run
|
31
|
-
if result.error?
|
32
|
-
fatal_error result.to_s
|
33
|
-
else
|
34
|
-
infov 'Result', result.label
|
35
|
-
end
|
36
|
-
end
|
10
|
+
class Deploy < ::Avm::Stereotypes::EacWebappBase0::Runner::Deploy
|
37
11
|
end
|
38
12
|
end
|
39
13
|
end
|
data/lib/avm/tools/runner/git.rb
CHANGED
@@ -18,11 +18,15 @@ module Avm
|
|
18
18
|
|
19
19
|
Options:
|
20
20
|
-h --help Show this screen.
|
21
|
-
-C <path>
|
21
|
+
-C <path> Path to Git repository.
|
22
22
|
DOCOPT
|
23
23
|
|
24
24
|
def repository_path
|
25
|
-
options.fetch('-C')
|
25
|
+
repository_path? ? options.fetch('-C') : '.'
|
26
|
+
end
|
27
|
+
|
28
|
+
def repository_path?
|
29
|
+
options.fetch('-C').present?
|
26
30
|
end
|
27
31
|
|
28
32
|
def git
|
@@ -33,6 +33,7 @@ module Avm
|
|
33
33
|
validate
|
34
34
|
main_info_banner
|
35
35
|
deploy
|
36
|
+
success 'Done'
|
36
37
|
end
|
37
38
|
|
38
39
|
private
|
@@ -65,7 +66,21 @@ module Avm
|
|
65
66
|
end
|
66
67
|
|
67
68
|
def git_uncached
|
68
|
-
::EacLauncher::Git::Base.new(
|
69
|
+
::EacLauncher::Git::Base.new(git_repository_path)
|
70
|
+
end
|
71
|
+
|
72
|
+
def git_repository_path
|
73
|
+
if context('repository_path?') || dev_instance_fs_path.blank?
|
74
|
+
return context(:repository_path)
|
75
|
+
end
|
76
|
+
|
77
|
+
dev_instance_fs_path
|
78
|
+
end
|
79
|
+
|
80
|
+
def dev_instance_fs_path
|
81
|
+
instance.if_present do |v|
|
82
|
+
v.application.instance('dev').read_entry_optional(:fs_path)
|
83
|
+
end
|
69
84
|
end
|
70
85
|
|
71
86
|
def deploy
|
data/lib/avm/tools/version.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
export postgresql_database='%%DATABASE.NAME%%'
|
2
|
+
export postgresql_database_test='%%DATABASE.NAME%%_test'
|
3
|
+
export postgresql_user='%%DATABASE.USERNAME%%'
|
4
|
+
export postgresql_password='%%DATABASE.PASSWORD%%'
|
5
|
+
export rvm_ruby='ruby-%%RUBY.VERSION%%'
|
6
|
+
export redmine_git_hosting_ssh_key_name=redmine_git_hosting_id
|
7
|
+
if [ '%%WEB.SCHEME%%' == 'https' ]; then
|
8
|
+
export address_https='true'
|
9
|
+
else
|
10
|
+
export address_https='false'
|
11
|
+
fi
|
12
|
+
export address_host='%%WEB.AUTHORITY%%'
|
13
|
+
export address_path='%%WEB.PATH%%'
|
14
|
+
export git_repositories_hierarchical_organisation=false
|
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.26.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: 2019-12-
|
11
|
+
date: 2019-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -212,6 +212,7 @@ files:
|
|
212
212
|
- lib/avm/instances/base/auto_values/admin.rb
|
213
213
|
- lib/avm/instances/base/auto_values/database.rb
|
214
214
|
- lib/avm/instances/base/auto_values/filesystem.rb
|
215
|
+
- lib/avm/instances/base/auto_values/ruby.rb
|
215
216
|
- lib/avm/instances/base/auto_values/source.rb
|
216
217
|
- lib/avm/instances/base/auto_values/system.rb
|
217
218
|
- lib/avm/instances/base/auto_values/web.rb
|
@@ -231,6 +232,7 @@ files:
|
|
231
232
|
- lib/avm/stereotypes/eac_rails_base0/deploy.rb
|
232
233
|
- lib/avm/stereotypes/eac_rails_base0/instance.rb
|
233
234
|
- lib/avm/stereotypes/eac_redmine_base0.rb
|
235
|
+
- lib/avm/stereotypes/eac_redmine_base0/deploy.rb
|
234
236
|
- lib/avm/stereotypes/eac_redmine_base0/instance.rb
|
235
237
|
- lib/avm/stereotypes/eac_ubuntu_base0.rb
|
236
238
|
- lib/avm/stereotypes/eac_ubuntu_base0/apache.rb
|
@@ -240,6 +242,7 @@ files:
|
|
240
242
|
- lib/avm/stereotypes/eac_webapp_base0/apache_host.rb
|
241
243
|
- lib/avm/stereotypes/eac_webapp_base0/deploy.rb
|
242
244
|
- lib/avm/stereotypes/eac_webapp_base0/instance.rb
|
245
|
+
- lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb
|
243
246
|
- lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb
|
244
247
|
- lib/avm/stereotypes/eac_wordpress_base0/deploy.rb
|
245
248
|
- lib/avm/stereotypes/eac_wordpress_base0/instance.rb
|
@@ -248,12 +251,12 @@ files:
|
|
248
251
|
- lib/avm/stereotypes/postgresql/instance/data_unit.rb
|
249
252
|
- lib/avm/stereotypes/postgresql/instance_with.rb
|
250
253
|
- lib/avm/tools.rb
|
251
|
-
- lib/avm/tools/git.rb
|
252
254
|
- lib/avm/tools/runner.rb
|
253
255
|
- lib/avm/tools/runner/eac_rails_base0.rb
|
254
256
|
- lib/avm/tools/runner/eac_rails_base0/apache_host.rb
|
255
257
|
- lib/avm/tools/runner/eac_rails_base0/deploy.rb
|
256
258
|
- lib/avm/tools/runner/eac_redmine_base0.rb
|
259
|
+
- lib/avm/tools/runner/eac_redmine_base0/deploy.rb
|
257
260
|
- lib/avm/tools/runner/eac_redmine_base0/docker.rb
|
258
261
|
- lib/avm/tools/runner/eac_wordpress_base0.rb
|
259
262
|
- lib/avm/tools/runner/eac_wordpress_base0/apache_host.rb
|
@@ -276,6 +279,8 @@ files:
|
|
276
279
|
- template/avm/self/docker_image/Dockerfile
|
277
280
|
- template/avm/self/docker_image/entrypoint.sh
|
278
281
|
- template/avm/stereotypes/eac_rails_base0/deploy/config/database.yml.template
|
282
|
+
- template/avm/stereotypes/eac_redmine_base0/deploy/config/install.sh.template
|
283
|
+
- template/avm/stereotypes/eac_redmine_base0/deploy/config/secrets.yml
|
279
284
|
- template/avm/stereotypes/eac_ubuntu_base0/docker_image/Dockerfile
|
280
285
|
- template/avm/stereotypes/eac_webapp_base0/apache_host/no_ssl.conf
|
281
286
|
- template/avm/stereotypes/eac_wordpress_base0/deploy/wp-config.php.template
|