avm-eac_ubuntu_base0 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: '0458409a75617694a688f070514704e9bfa76f4455878410c5be04558f98b55e'
4
+ data.tar.gz: d4f93d4d02fdd2bef2d7b5b4969392ba3b7e0f4c22c9fbf0964abcb9842a6db3
5
+ SHA512:
6
+ metadata.gz: 0dd402dd2f54671756ce27651734dcf44ccf3c8dc6740fd7478a0aa298edea6995b0e0168f7baaa5324a72f9a7e91db4746735e8ecba2ba3ea4a2254cc7af12b
7
+ data.tar.gz: c7c0b33f4bf7dc09bfa27f25b49a31634b715fe7d775d0a1bb34857a2707071052af482fd73acd527a5612dd0dc2d32fa1b16fd7df2bc014427dc6aed78c1043
@@ -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,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,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/docker/image'
4
+ require 'avm/eac_ubuntu_base0/patches/object/template'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
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
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_ubuntu_base0/docker_image'
4
+ require 'avm/instances/base'
5
+
6
+ module Avm
7
+ module EacUbuntuBase0
8
+ module Instances
9
+ class Base < ::Avm::Instances::Base
10
+ def docker_image_class
11
+ ::Avm::EacUbuntuBase0::DockerImage
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacUbuntuBase0
7
+ module Instances
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_templates/patches/object/template'
5
+
6
+ ::EacTemplates::Searcher.default.included_paths <<
7
+ __dir__.to_pathname.expand_path.parent_n(5).join('template')
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/docker/runner'
4
+ require 'avm/runners/base'
5
+ require 'eac_ruby_utils/struct'
6
+
7
+ module Avm
8
+ module EacUbuntuBase0
9
+ module Runners
10
+ class Base < ::Avm::Runners::Base
11
+ class Docker < ::Avm::Docker::Runner
12
+ def use_default_registry?
13
+ true
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/runners/base'
4
+ require 'avm/eac_ubuntu_base0/instances/base'
5
+ require 'eac_ruby_utils/patches/module/require_sub'
6
+
7
+ module Avm
8
+ module EacUbuntuBase0
9
+ module Runners
10
+ class Base < ::Avm::Runners::Base
11
+ enable_simple_cache
12
+ require_sub __FILE__
13
+
14
+ INSTANCE_ID = 'eac-ubuntu-base0_self'
15
+
16
+ private
17
+
18
+ def instance_uncached
19
+ ::Avm::EacUbuntuBase0::Instances::Base.by_id(INSTANCE_ID)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacUbuntuBase0
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacUbuntuBase0
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ FROM ubuntu:20.04
2
+ RUN apt-get update -y
3
+ RUN apt-get install -y sudo tzdata
4
+ RUN /usr/sbin/useradd --shell /bin/bash --home-dir /home/myuser --create-home myuser
5
+ RUN /bin/echo 'myuser:myuser' | /usr/sbin/chpasswd
6
+ RUN /bin/chown myuser:myuser /home/myuser -R
7
+ RUN /bin/echo "myuser ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/myuser_all_nopasswd && chmod 0440 /etc/sudoers.d/myuser_all_nopasswd
8
+ USER myuser
9
+ WORKDIR /home/myuser
10
+ ENTRYPOINT /bin/bash
11
+ CMD apt-get update -y && apt-get dist-upgrade -y
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: avm-eac_ubuntu_base0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Put here the authors
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-11-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: avm
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: eac_ruby_utils
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.77'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 0.77.1
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '0.77'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 0.77.1
47
+ - !ruby/object:Gem::Dependency
48
+ name: eac_templates
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0.2'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0.2'
61
+ - !ruby/object:Gem::Dependency
62
+ name: eac_ruby_gem_support
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '0.4'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '0.4'
75
+ description:
76
+ email:
77
+ executables: []
78
+ extensions: []
79
+ extra_rdoc_files: []
80
+ files:
81
+ - lib/avm/eac_ubuntu_base0.rb
82
+ - lib/avm/eac_ubuntu_base0/apache.rb
83
+ - lib/avm/eac_ubuntu_base0/apache/resource.rb
84
+ - lib/avm/eac_ubuntu_base0/docker_image.rb
85
+ - lib/avm/eac_ubuntu_base0/instances.rb
86
+ - lib/avm/eac_ubuntu_base0/instances/base.rb
87
+ - lib/avm/eac_ubuntu_base0/patches/object/template.rb
88
+ - lib/avm/eac_ubuntu_base0/runners/base.rb
89
+ - lib/avm/eac_ubuntu_base0/runners/base/docker.rb
90
+ - lib/avm/eac_ubuntu_base0/version.rb
91
+ - template/avm/eac_ubuntu_base0/docker_image/Dockerfile
92
+ homepage:
93
+ licenses: []
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubygems_version: 3.1.6
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Put here de description.
114
+ test_files: []