shiplane_bootstrappers_chef 0.1.1

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: 9f36b1b1eecfa13d2bbc5d693d37ff8d99e0bf8262654f37a76717b0fbaa15d0
4
+ data.tar.gz: 2eda901801e8c15be506b26651c87903f547b72d8e2bda06f74021c43a4f803c
5
+ SHA512:
6
+ metadata.gz: a2dfe91cf16afb28e5efecb68e026de9e83bee5d9d23d45dd6bac259608a6d2ecc2e4fd493eb4909280341cbf66ac8565e3871ea9ae47e986f56e736ee6f0d33
7
+ data.tar.gz: 6b419a9c484f0cc70994f7d6f09d52f64d47adaefaee308fb0c6aae4bac78b61a635ff7f64e4df104bad80817e13112409a0b15e93d18e1a5dfeb51cf00adee3
data/cookbooks.tar.gz ADDED
Binary file
@@ -0,0 +1,35 @@
1
+ module Shiplane
2
+ class ChefErrorParser
3
+ ERROR_LINE_REGEXP = /================================================================================/
4
+ CHEF_ERRORS = [
5
+ /ERROR: Exception handlers complete/,
6
+ /FATAL: Chef::Exceptions::ChildConvergeError/,
7
+ ]
8
+
9
+ attr_accessor :error
10
+
11
+ def initialize(error)
12
+ @error = error
13
+ end
14
+
15
+ def lines
16
+ @lines ||= error.message.split("\n")
17
+ end
18
+
19
+ def first_line
20
+ @first_line ||= lines.index(lines.reverse_each.find{|line| line =~ ERROR_LINE_REGEXP }) || 0
21
+ end
22
+
23
+ def last_line
24
+ @last_line ||= lines.index{|line| CHEF_ERRORS.any?{ |error| line =~ error } } || -1
25
+ end
26
+
27
+ def parse
28
+ lines[first_line..last_line]
29
+ end
30
+
31
+ def self.parse(error)
32
+ new(error).parse
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,71 @@
1
+ require 'shiplane/host'
2
+ require_relative './chef_error_parser'
3
+
4
+ module Shiplane
5
+ class ChefHost < Host
6
+ include Airbrussh::Colors
7
+
8
+ REMOTE_CHEF_FOLDER_PATH = File.join("/var","chef")
9
+ LOCAL_CHEF_FOLDER_PATH = File.expand_path("../../../lib/chef", __FILE__)
10
+ COOKBOOKS_FILE_NAME = "cookbooks.tar.gz"
11
+ LOCAL_COOKBOOKS_FILE_PATH = File.expand_path("../../../#{COOKBOOKS_FILE_NAME}", __FILE__)
12
+ REMOTE_COOKBOOKS_FILE_PATH = File.join(REMOTE_CHEF_FOLDER_PATH, COOKBOOKS_FILE_NAME)
13
+ CHEF_PACKAGE_NAME = config.fetch("bootstrap", {}).fetch("chef-bootstrapper", {}).fetch("package_name")
14
+ CHEF_PACKAGE_DOWNLOAD_URL = config.fetch("bootstrap", {}).fetch("chef-bootstrapper", {}).fetch("package_url")
15
+ APT_PACKAGES = %w(build-essential wget)
16
+
17
+ def install
18
+ with_context do
19
+ SSHKit::Coordinator.new(host).each in: :parallel do
20
+ context_variables = fetch(:shiplane_sshkit_values)
21
+
22
+ install_started = test("[ -f #{File.join(Shiplane::ChefHost::REMOTE_CHEF_FOLDER_PATH, '.install-started')} ]")
23
+ install_finished = test("[ -f #{File.join(Shiplane::ChefHost::REMOTE_CHEF_FOLDER_PATH, '.install')} ]")
24
+
25
+ if install_started && !install_finished
26
+ execute :sudo, :dpkg, '--configure', '-a', interaction_handler: context_variables[:interaction_handler]
27
+ # execute :sudo, :dpkg, "--remove", "--force-remove-reinstreq", *Shiplane::ChefHost::APT_PACKAGES - %w(wget build-essential), interaction_handler: context_variables[:interaction_handler]
28
+ end
29
+
30
+ unless install_finished
31
+ execute :sudo, :mkdir, '-m', '2777', '-p', Shiplane::ChefHost::REMOTE_CHEF_FOLDER_PATH, interaction_handler: context_variables[:interaction_handler]
32
+ execute :sudo, :touch, File.join(Shiplane::ChefHost::REMOTE_CHEF_FOLDER_PATH, '.install-started'), interaction_handler: context_variables[:interaction_handler]
33
+ execute :sudo, 'apt-get', 'update', interaction_handler: context_variables[:interaction_handler]
34
+ execute :sudo, 'apt-get', 'install', '-y', *Shiplane::ChefHost::APT_PACKAGES, interaction_handler: context_variables[:interaction_handler]
35
+ execute :wget, Shiplane::ChefHost::CHEF_PACKAGE_DOWNLOAD_URL
36
+ execute :sudo, :dpkg, '-i', Shiplane::ChefHost::CHEF_PACKAGE_NAME, interaction_handler: context_variables[:interaction_handler]
37
+ execute :sudo, :ls, '-al', Shiplane::ChefHost::REMOTE_CHEF_FOLDER_PATH, interaction_handler: context_variables[:interaction_handler]
38
+ execute :sudo, :touch, File.join(Shiplane::ChefHost::REMOTE_CHEF_FOLDER_PATH, '.install'), interaction_handler: context_variables[:interaction_handler]
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+ def configure
45
+ with_context do
46
+ errors = {}
47
+ SSHKit::Coordinator.new(host).each in: :parallel do |h|
48
+ context_variables = fetch(:shiplane_sshkit_values)
49
+
50
+ begin
51
+ execute :sudo, 'chef-solo', '-c', "#{Shiplane::ChefHost::REMOTE_CHEF_FOLDER_PATH}/solo.rb", interaction_handler: context_variables[:interaction_handler]
52
+ rescue => e
53
+ errors["#{h}"] = Shiplane::ChefErrorParser.parse(e)
54
+ end
55
+ end
56
+
57
+ unless errors.empty?
58
+ write_message(SSHKit::Logger::ERROR, "#{errors.keys.size} Errors encountered:")
59
+ errors.each do |h, trace|
60
+ write_message SSHKit::Logger::INFO, "~" * 80
61
+ write_message SSHKit::Logger::INFO, green("Server: #{h}")
62
+ trace.each do |line|
63
+ write_message SSHKit::Logger::INFO, line
64
+ end
65
+ write_message SSHKit::Logger::INFO, "~" * 80
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module ShiplaneBootstrappersChef
3
+ VERSION = Shiplane::Bootstrappers::Chef::VERSION
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'shiplane/bootstrappers/chef/version'
2
+
3
+ load File.expand_path('../tasks/shiplane_bootstrap.rake', __FILE__)
4
+ load File.expand_path('../tasks/bootstrap.rake', __FILE__)
5
+
@@ -0,0 +1,67 @@
1
+ require 'dotenv'
2
+ require_relative '../chef_host'
3
+
4
+ namespace :shiplane do
5
+ namespace :bootstrap do
6
+ # task :prepare do
7
+ # end
8
+
9
+ task :install do
10
+ fetch(:shiplane_hosts).each do |host|
11
+ host.install
12
+ end
13
+ end
14
+
15
+ task configure: %i(evaluate_erb_files rsync_chef_configuration upload_cookbooks fix_file_permissions) do
16
+ fetch(:shiplane_hosts).each do |host|
17
+ host.configure
18
+ end
19
+ end
20
+
21
+ # task :cleanup do
22
+ # end
23
+
24
+ task :evaluate_erb_files, :username, :keypath do |task, args|
25
+ Dotenv.load Shiplane::ChefHost.env_file
26
+ on fetch(:shiplane_hosts).map(&:capistrano_role) do |host|
27
+ Dir["#{File.expand_path("../../../chef", __FILE__)}/**/*.erb"].map do |filename|
28
+ compiled_template = ERB.new(File.read(filename)).result(binding)
29
+ compiled_file_name = filename.match(/.*\/chef\/(.*)\.erb/)[1]
30
+
31
+ sudo :mkdir, '-m', '777', '-p', File.join(Shiplane::ChefHost::REMOTE_CHEF_FOLDER_PATH, File.dirname(compiled_file_name))
32
+ upload! StringIO.new(compiled_template), File.join(Shiplane::ChefHost::REMOTE_CHEF_FOLDER_PATH, compiled_file_name)
33
+ end
34
+ end
35
+ end
36
+
37
+ task :rsync_chef_configuration do |task, args|
38
+ run_locally do
39
+ fetch(:shiplane_hosts).map(&:capistrano_role).each do |host|
40
+ rsync_arguments = [
41
+ '-r',
42
+ '-e', "\"ssh -p #{host.port || 22} -i #{host.netssh_options.fetch(:keys)}\"",
43
+ "#{Shiplane::ChefHost::LOCAL_CHEF_FOLDER_PATH}/",
44
+ "#{host.netssh_options.fetch(:user)}@#{host}:#{Shiplane::ChefHost::REMOTE_CHEF_FOLDER_PATH}"
45
+ ]
46
+
47
+ execute 'rsync', *rsync_arguments
48
+ end
49
+ end
50
+ end
51
+
52
+ task :upload_cookbooks do |task, args|
53
+ on fetch(:shiplane_hosts).map(&:capistrano_role) do |host|
54
+ sudo :rm, '-Rf', Shiplane::ChefHost::REMOTE_COOKBOOKS_FILE_PATH
55
+ upload!(Shiplane::ChefHost::LOCAL_COOKBOOKS_FILE_PATH, Shiplane::ChefHost::REMOTE_CHEF_FOLDER_PATH)
56
+ sudo :rm, '-Rf', File.join(Shiplane::ChefHost::REMOTE_CHEF_FOLDER_PATH, 'cookbooks')
57
+ execute :tar, '-xzf', Shiplane::ChefHost::REMOTE_COOKBOOKS_FILE_PATH, '-C', Shiplane::ChefHost::REMOTE_CHEF_FOLDER_PATH
58
+ end
59
+ end
60
+
61
+ task :fix_file_permissions do |task, args|
62
+ on fetch(:shiplane_hosts).map(&:capistrano_role) do |host|
63
+ sudo :chmod, '-R', '777', Shiplane::ChefHost::REMOTE_CHEF_FOLDER_PATH
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,34 @@
1
+ deploy_tasks = %w(
2
+ deploy
3
+ deploy:check
4
+ deploy:check:directories
5
+ deploy:check:linked_dirs
6
+ deploy:check:linked_files
7
+ deploy:check:make_linked_dirs
8
+ deploy:cleanup
9
+ deploy:cleanup_rollback
10
+ deploy:finished
11
+ deploy:finishing
12
+ deploy:finishing_rollback
13
+ deploy:log_revision
14
+ deploy:published
15
+ deploy:publishing
16
+ deploy:revert_release
17
+ deploy:reverted
18
+ deploy:reverting
19
+ deploy:rollback
20
+ deploy:set_current_revision
21
+ deploy:started
22
+ deploy:starting
23
+ deploy:symlink:linked_dirs
24
+ deploy:symlink:linked_files
25
+ deploy:symlink:release
26
+ deploy:symlink:shared
27
+ deploy:updated
28
+ deploy:updating
29
+ install
30
+ )
31
+
32
+ deploy_tasks.each do |task|
33
+ Rake::Task[task].clear
34
+ end
@@ -0,0 +1,198 @@
1
+ require 'rake'
2
+ require 'dotenv'
3
+
4
+ desc "Provision host"
5
+ task :provision, [:role, :username, :keypath] => ['provision:default']
6
+
7
+ namespace :provision do
8
+ task :default, [:role, :username, :keypath] => [
9
+ :prepare_files,
10
+ 'cookbooks.tar.gz',
11
+ :set_host_options,
12
+ :prepare_host,
13
+ :evaluate_erb_files,
14
+ :rsync_chef,
15
+ 'upload-cookbooks',
16
+ :fix_file_permissions,
17
+ ] do |task, args|
18
+ errors = {}
19
+ on roles(fetch(:host_options).role) do |host|
20
+ begin
21
+ sudo 'chef-solo', '-c', '/var/chef/solo.rb'
22
+ rescue => e
23
+ error_line_regexp = /================================================================================/
24
+ message_lines = e.message.split("\n").reverse
25
+ error_message_start = message_lines.index(message_lines.find{|line| line =~ error_line_regexp }) || message_lines.size - 1
26
+ error_message_end = message_lines.index(message_lines.find{|line| line =~ /ERROR: Exception handlers complete/ || line =~ /FATAL: Chef::Exceptions::ChildConvergeError/ }) || 0
27
+ error_lines = message_lines[error_message_end..error_message_start].reverse
28
+ errors["#{host}"] = error_lines
29
+ end
30
+ end
31
+
32
+ unless errors.empty?
33
+ puts "#{errors.keys.size} Errors encountered:"
34
+ errors.each do |host, trace|
35
+ puts "~" * 80
36
+ puts "Server: #{host}"
37
+ puts *trace
38
+ puts "~" * 80
39
+ end
40
+ end
41
+ end
42
+
43
+ task :set_host_options, :role, :username, :keypath do |task, args|
44
+ set :host_options, HostOptions.new(**args.to_h)
45
+
46
+ roles(args['role']).each do |role|
47
+ role.ssh_options = fetch(:host_options).ssh_options #unless role.user == fetch(:host_options).ssh_options[:user]
48
+ role.user = fetch(:host_options).username
49
+ role.keys = fetch(:host_options).keys
50
+ end
51
+ end
52
+
53
+ task :prepare_host, :role, :username, :keypath do |task, args|
54
+ on roles(fetch(:host_options).role) do |host|
55
+ #preparation_started = test("[ -f #{File.join(chef_path, '.preparation-started')} ]")
56
+ preparation_finished = test("[ -f #{File.join(chef_path, '.prepared')} ]")
57
+ #if preparation_started && !preparation_finished
58
+ #sudo :dpkg, '--configure', '-a'
59
+ #sudo :dpkg, "--remove", "--force-remove-reinstreq", *packages
60
+ #end
61
+
62
+ unless preparation_finished
63
+ sudo :mkdir, '-m', '2777', '-p', chef_path
64
+ sudo :touch, File.join(chef_path, '.preparation-started')
65
+ sudo 'apt-get', 'update'
66
+ sudo 'apt-get', 'install', '-y', *packages
67
+ execute :wget, chef_package_url
68
+ sudo :dpkg, '-i', chef_package_name
69
+ sudo :ls, '-al', chef_path
70
+ sudo :touch, File.join(chef_path, '.prepared')
71
+ end
72
+ end
73
+ end
74
+
75
+ task :rsync_chef, :role, :username, :keypath do |task, args|
76
+ on roles(fetch(:host_options).role) do |host|
77
+ rsync_arguments = [
78
+ '-r',
79
+ '-e', "ssh -p #{host.port || 22} -i #{host.netssh_options.fetch(:keys)}",
80
+ "#{chef_folder_path}/",
81
+ "#{host.netssh_options.fetch(:user)}@#{host}:/var/chef"
82
+ ]
83
+ Kernel.system 'rsync', *rsync_arguments
84
+ end
85
+ end
86
+
87
+ desc "Uploads the tarballed cookbooks"
88
+ task :'upload-cookbooks', :role, :username, :keypath do |task, args|
89
+ on roles(args['role']) do |host|
90
+ sudo :rm, '-Rf', File.join(chef_path, 'cookbooks.tar.gz')
91
+ upload!('cookbooks.tar.gz', chef_path)
92
+ sudo :rm, '-Rf', File.join(chef_path, 'cookbooks')
93
+ execute :tar, '-xzf', File.join(chef_path, 'cookbooks.tar.gz'), '-C', chef_path
94
+ end
95
+ end
96
+
97
+ task :fix_file_permissions, :role, :username, :keypath do |task, args|
98
+ on roles(args['role']) do |host|
99
+ sudo :chmod, '-R', '777', chef_path
100
+ end
101
+ end
102
+
103
+ task :evaluate_erb_files, :role, :username, :keypath do |task, args|
104
+ Dotenv.load ".env.#{ENV['RAILS_ENV']}"
105
+ on roles(args['role']) do |host|
106
+ Dir["#{chef_folder_path}/**/*.erb"].map do |filename|
107
+ compiled_template = ERB.new(File.read(filename)).result(binding)
108
+ compiled_file_name = filename.match(/.*\/chef\/(.*)\.erb/)[1]
109
+ sudo :mkdir, '-m', '777', '-p', File.join(chef_path, File.dirname(compiled_file_name))
110
+ upload! StringIO.new(compiled_template), File.join(chef_path, compiled_file_name)
111
+ end
112
+ end
113
+ end
114
+
115
+ task :prepare_files do |task|
116
+ rm 'cookbooks.tar.gz', force: true
117
+ rm_r 'cookbooks', force: true
118
+ end
119
+
120
+ file "cookbooks.tar.gz" => :cookbooks do |task|
121
+ sh "tar -cvzf #{task.name} cookbooks"
122
+ end
123
+
124
+ file cookbooks: :prepare_files do |task|
125
+ cp_r 'berks-cookbooks/.', "cookbooks"
126
+ cp_r 'site-cookbooks/.', "cookbooks"
127
+ end
128
+ end
129
+
130
+ def packages
131
+ %w(ruby ruby2.3-dev build-essential wget)
132
+ end
133
+
134
+ def chef_package_url
135
+ "https://packages.chef.io/files/stable/chefdk/3.3.23/ubuntu/16.04/#{chef_package_name}"
136
+ end
137
+
138
+ def chef_package_name
139
+ 'chefdk_3.3.23-1_amd64.deb'
140
+ end
141
+
142
+ def chef_folder_path
143
+ File.expand_path("../../../chef", __FILE__)
144
+ end
145
+
146
+ def sudo(*args)
147
+ execute :sudo, *args, interaction_handler: {
148
+ "[sudo] password for #{fetch(:host_options).username}: " => "#{fetch(:host_options).password}\n"
149
+ }
150
+ end
151
+
152
+ def chef_path
153
+ File.join("/var","chef")
154
+ end
155
+
156
+ class HostOptions
157
+ attr_accessor :role, :keypath, :username, :password
158
+
159
+ def initialize(username: nil, password: nil, keypath: nil, role: nil)
160
+ @username = username
161
+ @password = password
162
+ @keypath = keypath
163
+ @role = role
164
+ end
165
+
166
+ def username
167
+ @username ||= config['username'] || 'deploy'
168
+ end
169
+
170
+ def password
171
+ @password ||= config['password']
172
+ end
173
+
174
+ def keypath
175
+ @keypath ||= config['keypath'] || "#{Dir.home}/.ssh/id_rsa"
176
+ end
177
+
178
+ def keys
179
+ @keys ||= keypath.split('/')
180
+ end
181
+
182
+ def config
183
+ @config ||= YAML.load(File.read(config_file_path))['capistrano']
184
+ end
185
+
186
+ def ssh_options
187
+ @ssh_options ||= {
188
+ user: username,
189
+ keys: File.join(keys),
190
+ forward_agent: true,
191
+ auth_methods: %w(publickey),
192
+ }
193
+ end
194
+
195
+ def config_file_path
196
+ File.expand_path("../../../../config/config.yml", __FILE__)
197
+ end
198
+ end
@@ -0,0 +1,30 @@
1
+ namespace :shiplane do
2
+ desc "Bootstrap host - provisions docker and nginx-proxy"
3
+ task :bootstrap, [:role] => ['bootstrap:default']
4
+
5
+ namespace :bootstrap do
6
+ task :default, [:role] do |task, args|
7
+ hosts = roles(args['role']).map do |host|
8
+ Shiplane::ChefHost.new(host, env)
9
+ end
10
+
11
+ set :shiplane_hosts, hosts
12
+
13
+ %w{ prepare install configure cleanup }.each do |task|
14
+ invoke "shiplane:bootstrap:#{task}"
15
+ end
16
+ end
17
+
18
+ task :prepare do
19
+ end
20
+
21
+ task :install do
22
+ end
23
+
24
+ task :configure do
25
+ end
26
+
27
+ task :cleanup do
28
+ end
29
+ end
30
+ end
File without changes
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "production",
3
+ "default_attributes": {
4
+ },
5
+ "json_class":"Chef::Environment",
6
+ "chef_type":"environment"
7
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "staging",
3
+ "default_attributes": {
4
+ },
5
+ "override_attributes": {
6
+ },
7
+ "json_class":"Chef::Environment",
8
+ "chef_type":"environment"
9
+ }
File without changes
@@ -0,0 +1,21 @@
1
+ {
2
+ "environment":"production",
3
+ "barebones-docker": {
4
+ "ssl": true,
5
+ "cert_path": "/etc/lego/certificates/",
6
+ "docker": {
7
+ "version": "18.06.1"
8
+ },
9
+ "group": {
10
+ "name": "docker"
11
+ },
12
+ "user": {
13
+ "name": "docker"
14
+ }
15
+ },
16
+ "run_list":
17
+ [
18
+ "role[server]",
19
+ "recipe[barebones-docker]"
20
+ ]
21
+ }
File without changes
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "docker-server",
3
+ "description": "Something which needs docker installed.",
4
+ "default_attributes": {
5
+ },
6
+ "json_class": "Chef::Role",
7
+ "run_list": [
8
+ "recipe[n2docker::default]"
9
+ ],
10
+ "chef_type": "role",
11
+ "override_attributes": {
12
+ "n2docker": {
13
+ "version": "18.03.1"
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,73 @@
1
+ // Things we want standard on all server boxes, primarily:
2
+ // - Security
3
+ // - Look and feel
4
+ // - default users, groups etc
5
+ {
6
+ "name": "server",
7
+ "description": "A server of some kind...",
8
+ "default_attributes": {
9
+ "apt" : {
10
+ "compile_time_update": true,
11
+ "unattended_upgrades" : {
12
+ "enable" : true,
13
+ "allowed_origins" : [
14
+ "${distro_id} stable",
15
+ "${distro_id} ${distro_codename}-security",
16
+ "${distro_id} ${distro_codename}-updates"
17
+ ],
18
+ "automatic_reboot" : false
19
+ }
20
+ },
21
+ "authorization": {
22
+ "sudo": {
23
+ // everyone in the group sysadmin gets sudo rights
24
+ "groups": ["sudo"],
25
+ // the deploy user specifically gets sudo rights
26
+ "users": ["deploy"],
27
+ // whether a user with sudo rights can execute sudo
28
+ // commands without entering their password.
29
+ "passwordless": true
30
+ }
31
+ },
32
+ "build-essential": {
33
+ "compile_time": true
34
+ },
35
+ "locales" : {
36
+ "locale_file": "/etc/locale.gen",
37
+ "packages" : ["locales"],
38
+ "default" : "en_US.utf8"
39
+ },
40
+ "openssh" : {
41
+ "server" : {
42
+ "password_authentication" : "no",
43
+ "challenge_response_authentication" : "no",
44
+ "permit_empty_passwords" : "no",
45
+ "use_pam" : "no",
46
+ "x11_forwarding" : "no",
47
+ "permit_root_login" : "no"
48
+ }
49
+ }
50
+ },
51
+ "json_class": "Chef::Role",
52
+ "run_list": [
53
+ "recipe[apt]",
54
+ // required for generating secure passwords
55
+ "recipe[openssl::default]",
56
+ // required for building from source
57
+ "recipe[build-essential::default]",
58
+ // enable unattended upgrades
59
+ "recipe[apt::unattended-upgrades]",
60
+ // enable automatic time sync
61
+ "recipe[ntp::default]",
62
+ // make sure deploy user has sudo rights
63
+ "recipe[sudo::default]",
64
+ // Make sure we have a valid locale setup
65
+ "recipe[locales::default]",
66
+ // Block repeated failed login attempts
67
+ "recipe[fail2ban::default]"
68
+ ],
69
+ "chef_type": "role",
70
+ "override_attributes": {
71
+ }
72
+ }
73
+
@@ -0,0 +1,9 @@
1
+ solo true
2
+ log_level :info
3
+ json_attribs "/var/chef/nodes/<%= host.properties.node %>.json"
4
+ node_name "<%= host.properties.node %>"
5
+ cookbook_path ["/var/chef/cookbooks"]
6
+ data_bag_path "/var/chef/data_bags"
7
+ role_path "/var/chef/roles"
8
+ environment_path "/var/chef/environments"
9
+ environment "<%= ENV['ENVIRONMENT'] %>"
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Shiplane
4
+ module Bootstrappers
5
+ module Chef
6
+ VERSION = "0.1.1"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ namespace :release do
2
+ desc "Refresh Cookbooks"
3
+ task refresh_cookbooks: ["cookbooks.tar.gz"] do
4
+ end
5
+
6
+ task :prepare_files do |task|
7
+ rm 'cookbooks.tar.gz', force: true
8
+ rm_r 'cookbooks', force: true
9
+ end
10
+
11
+ file "cookbooks.tar.gz" => :cookbooks do |task|
12
+ sh "tar -cvzf #{task.name} cookbooks"
13
+ end
14
+
15
+ file cookbooks: :prepare_files do |task|
16
+ cp_r 'berks-cookbooks/.', "cookbooks"
17
+ cp_r 'site-cookbooks/.', "cookbooks"
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shiplane_bootstrappers_chef
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - John Epperson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-04-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.7'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 3.7.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '3.7'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 3.7.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: airbrussh
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.1'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.1.1
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.1'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.1.1
53
+ - !ruby/object:Gem::Dependency
54
+ name: berkshelf
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '5.6'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 5.6.5
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '5.6'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 5.6.5
73
+ description: Converts docker-compose.yml files into images that can be uploaded to
74
+ any docker image repository.
75
+ email:
76
+ - john.epperson@rockagile.io
77
+ executables: []
78
+ extensions: []
79
+ extra_rdoc_files: []
80
+ files:
81
+ - cookbooks.tar.gz
82
+ - lib/capistrano/chef_error_parser.rb
83
+ - lib/capistrano/chef_host.rb
84
+ - lib/capistrano/shiplane_bootstrappers_chef.rb
85
+ - lib/capistrano/shiplane_bootstrappers_chef/version.rb
86
+ - lib/capistrano/tasks/bootstrap.rake
87
+ - lib/capistrano/tasks/clear_deploy_tasks.rake
88
+ - lib/capistrano/tasks/provision.rake
89
+ - lib/capistrano/tasks/shiplane_bootstrap.rake
90
+ - lib/chef/environments/.gitkeep
91
+ - lib/chef/environments/production.json
92
+ - lib/chef/environments/staging.json
93
+ - lib/chef/nodes/.gitkeep
94
+ - lib/chef/nodes/docker.json.erb
95
+ - lib/chef/roles/.gitkeep
96
+ - lib/chef/roles/docker.json
97
+ - lib/chef/roles/server.json
98
+ - lib/chef/solo.rb.erb
99
+ - lib/shiplane/bootstrappers/chef/version.rb
100
+ - lib/tasks/release_tasks.rake
101
+ homepage: https://github.com/kirillian/shiplane
102
+ licenses:
103
+ - MIT
104
+ metadata: {}
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: 2.3.1
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubyforge_project:
121
+ rubygems_version: 2.7.7
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: A toolbox for converting developer docker-compose files into production-ready
125
+ images.
126
+ test_files: []