cheftacular 2.15.0 → 2.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cheftacular/README.md +39 -17
- data/lib/cheftacular/actions/console.rb +1 -0
- data/lib/cheftacular/actions/deploy.rb +2 -0
- data/lib/cheftacular/actions/log.rb +1 -0
- data/lib/cheftacular/actions/tail.rb +1 -0
- data/lib/cheftacular/error.rb +1 -1
- data/lib/cheftacular/file_system.rb +1 -1
- data/lib/cheftacular/helper.rb +1 -1
- data/lib/cheftacular/stateless_actions/cloud_bootstrap_from_queue.rb +2 -2
- data/lib/cheftacular/stateless_actions/environment.rb +12 -4
- data/lib/cheftacular/stateless_actions/server_update.rb +2 -2
- data/lib/cheftacular/version.rb +1 -1
- data/lib/sshkit/actions/start_task.rb +1 -0
- data/lib/sshkit/getters.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fff84acfdd06903b3e33c1106f34605608aa11c
|
4
|
+
data.tar.gz: ee853b823047510927ca0cac9f735cf2968079b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 563d2cb089d43b99091d727e8775ced547ea5627979a7d135ca074328c3d989d25031ea2b3388d2170448a7254475f849a8912e80a27edb319892e781dbfe8db
|
7
|
+
data.tar.gz: c1b78fd70bd6a4b82f148061632c3a347c9de72dd1b4b125ef990f4287f39610f63f85a802e3f88260c63720cf545536024304d1b9a0749226d7ee7dab438540
|
data/lib/cheftacular/README.md
CHANGED
@@ -41,9 +41,9 @@
|
|
41
41
|
|
42
42
|
7. `-R|--repository NAME` will make the command run against a specific repository or context (automatically set for application mode)
|
43
43
|
|
44
|
-
8. `-
|
44
|
+
8. `-N|--search-node-name NODE_NAME` option will make this command return results that INCLUDE the NODE_NAME.
|
45
45
|
|
46
|
-
9. `-
|
46
|
+
9. `-L|--search-role-name ROLE_NAME` option will make this command return results that INCLUDE the ROLE_NAME.
|
47
47
|
|
48
48
|
10. `-E|--search-env-name ENV_NAME` option will make this command return results that have this environment.
|
49
49
|
|
@@ -80,7 +80,7 @@
|
|
80
80
|
|
81
81
|
4. `load` will fetch the latest backup from the production primary **if it doesn't already exist on the server** and run the _backup loading command_ to load this backup into the env.
|
82
82
|
|
83
|
-
5. `restore` will simply just run the _backup loading command_ to load the latest backup onto the server.
|
83
|
+
5. `restore` will simply just run the _backup loading command_ to load the latest backup onto the server. This command is REPOSITORY SENSITIVE, to restore a repo other than default, you must use the -R REPOSITORY flag.
|
84
84
|
|
85
85
|
6. `status` will display the current state of the backups
|
86
86
|
|
@@ -92,7 +92,7 @@
|
|
92
92
|
|
93
93
|
2. If the all argument is provided, all repositories will be checked for the current environment
|
94
94
|
|
95
|
-
3. If the verify argument is provided, cft will attempt to see if the servers are using the latest commits
|
95
|
+
3. If the verify argument is provided, cft will attempt to see if the servers are using the latest commits. This is also aliased to `cft ch ve`
|
96
96
|
|
97
97
|
4. Aliased to `cft ch`
|
98
98
|
|
@@ -174,11 +174,13 @@
|
|
174
174
|
|
175
175
|
5. The `-v|--verbose` option will cause failed deploys to output to the terminal window and to their normal log file. Useful for debugging.
|
176
176
|
|
177
|
-
6. The `cft deploy check` argument will force a check run under the same environment as the initial deploy.
|
177
|
+
6. The `cft deploy check` argument will force a check run under the same environment as the initial deploy. This is also aliased to `cft d ch`
|
178
178
|
|
179
|
-
7. The `cft deploy verify` argument will force a check AND verify run under the same environment as the initial deploy
|
179
|
+
7. The `cft deploy verify` argument will force a check AND verify run under the same environment as the initial deploy. This is also aliased to `cft d ve`
|
180
180
|
|
181
|
-
8.
|
181
|
+
8. Deploy locks (if set in the cheftacular.yml for the repo(s)) can be bypassed with the `--override-deploy-locks` flag
|
182
|
+
|
183
|
+
9. Aliased to `cft d`
|
182
184
|
|
183
185
|
12. `cft disk_report` will fetch useful statistics from every server for every environment and output it into your log directory.
|
184
186
|
|
@@ -196,7 +198,9 @@
|
|
196
198
|
|
197
199
|
6. This command also accepts a *comma delimited list* of server names to boot / destroy instead of all the stored ones for an environment.
|
198
200
|
|
199
|
-
7.
|
201
|
+
7. This command works with all the flags that `cft deploy` works with, like -Z -z -O and so on.
|
202
|
+
|
203
|
+
8. Aliased to `cft e`
|
200
204
|
|
201
205
|
14. `cft file NODE_NAME LOCATION_ALIAS MODE FILE_NAME` interacts with a file on the remote server
|
202
206
|
|
@@ -238,6 +242,8 @@
|
|
238
242
|
|
239
243
|
1. This command runs on all servers in an environment by default
|
240
244
|
|
245
|
+
2. Packets can be examined more closely with `tcpdump src port PORT`
|
246
|
+
|
241
247
|
17. `cft get_haproxy_log` this command will generate a haproxy html file for the load balancer(s) associated with a repository in the log directory. Opening this log file in the browser will show the status of that haproxy at the time of the log.
|
242
248
|
|
243
249
|
1. In devops mode, this command will not do anything without the -R repository passed.
|
@@ -302,7 +308,9 @@
|
|
302
308
|
|
303
309
|
1. In the case of server creation, this command takes a great deal of time to execute. It will output what stage it is currently on to the terminal but <b>you must not kill this command while it is executing</b>.A failed build may require the server to be destroyed / examined by a DevOps engineer.
|
304
310
|
|
305
|
-
29. `cft ssh NODE_NAME` ssh you into the node name you are trying to access. It will also drop the server's sudo password into your clipboard.
|
311
|
+
29. `cft ssh NODE_NAME [exec] [command]` ssh you into the node name you are trying to access. It will also drop the server's sudo password into your clipboard.
|
312
|
+
|
313
|
+
1. `cft ssh NODE_NAME exec COMMAND` will execute a command on the server as root
|
306
314
|
|
307
315
|
30. `cft tail [PATTERN_TO_MATCH]` will tail the logs (return continuous output) of the first node if finds that has an application matching the repository running on it. Currently only supports rails stacks
|
308
316
|
|
@@ -318,6 +326,8 @@
|
|
318
326
|
|
319
327
|
1. This command is functionally the same as `cft check verify`.
|
320
328
|
|
329
|
+
2. This command is aliased to `cft ve`
|
330
|
+
|
321
331
|
33. `cft version` this command prints out the current version of cheftacular.
|
322
332
|
|
323
333
|
1. Aliased to `cft v`
|
@@ -535,7 +545,9 @@
|
|
535
545
|
|
536
546
|
6. This command also accepts a *comma delimited list* of server names to boot / destroy instead of all the stored ones for an environment.
|
537
547
|
|
538
|
-
7.
|
548
|
+
7. This command works with all the flags that `cft deploy` works with, like -Z -z -O and so on.
|
549
|
+
|
550
|
+
8. Aliased to `cft e`
|
539
551
|
|
540
552
|
20. `cft file NODE_NAME LOCATION_ALIAS MODE FILE_NAME` interacts with a file on the remote server
|
541
553
|
|
@@ -581,6 +593,8 @@
|
|
581
593
|
|
582
594
|
1. This command runs on all servers in an environment by default
|
583
595
|
|
596
|
+
2. Packets can be examined more closely with `tcpdump src port PORT`
|
597
|
+
|
584
598
|
24. `cft get_haproxy_log` this command will generate a haproxy html file for the load balancer(s) associated with a repository in the log directory. Opening this log file in the browser will show the status of that haproxy at the time of the log.
|
585
599
|
|
586
600
|
1. In devops mode, this command will not do anything without the -R repository passed.
|
@@ -679,7 +693,9 @@
|
|
679
693
|
|
680
694
|
2. Remember, if you have auditing turned on in your cheftacular.yml, you can track who sends what to slack.
|
681
695
|
|
682
|
-
44. `cft ssh NODE_NAME` ssh you into the node name you are trying to access. It will also drop the server's sudo password into your clipboard.
|
696
|
+
44. `cft ssh NODE_NAME [exec] [command]` ssh you into the node name you are trying to access. It will also drop the server's sudo password into your clipboard.
|
697
|
+
|
698
|
+
1. `cft ssh NODE_NAME exec COMMAND` will execute a command on the server as root
|
683
699
|
|
684
700
|
45. `cft test_env [TARGET_ENV] boot|destroy` will create (or destroy) the test nodes for a particular environment (defaults to staging, prod split-envs can be set with `-p`). Please read below for how TARGET_ENV works
|
685
701
|
|
@@ -703,11 +719,13 @@
|
|
703
719
|
|
704
720
|
3. The argument `skip_update_tld` will stop the long process of checking and updating all the server domains _before_ cloudflare is updated. Only skip if you believe your domain info on your cloud is accurate.
|
705
721
|
|
706
|
-
49. `cft update_cookbook [COOKBOOK_NAME] [INSTALL_VERSION]` allows you to specifically update a single cookbook
|
722
|
+
49. `cft update_cookbook [COOKBOOK_NAME] [INSTALL_VERSION|local]` allows you to specifically update a single cookbook
|
707
723
|
|
708
724
|
1. This command passed with no arguments will update TheCheftacularCookbook
|
709
725
|
|
710
|
-
2.
|
726
|
+
2. If the 2nd argument is local, the command will drop a local version of the cookbook onto your chef-repo
|
727
|
+
|
728
|
+
3. Aliased to `cft uc`
|
711
729
|
|
712
730
|
50. `cft update_split_branches` will perform a series of git commands that will merge all the split branches for your split_branch enabled repositories with what is currently on master and push them.
|
713
731
|
|
@@ -719,9 +737,13 @@
|
|
719
737
|
|
720
738
|
4. This command will return a helpful error statement if you attempt to run the command with changes to your current working directory. You must commit these changes before running this command.
|
721
739
|
|
722
|
-
51. `cft
|
740
|
+
51. `cft update_the_cheftacular_cookbook_and_knife_upload` update your local cheftacular cookbook with your local (out of chef-repo) cheftacular cookbook and knife_upload afterwards.
|
741
|
+
|
742
|
+
1. This method is aliased to `cft utccaku` and `cft utcc`.
|
743
|
+
|
744
|
+
52. `cft update_tld TLD` command will force a full dns update for a tld in the preferred cloud. It will ensure all the subdomain entries are correct (based on the contents of the addresses data bag) and update them if they are not. It will also create the local subdomain for the entry as well if it does exist and point it to the correct private address.
|
723
745
|
|
724
|
-
|
746
|
+
53. `cft upload_nodes` This command will resync the chef server's nodes with the data in our chef-repo/node_roles.
|
725
747
|
|
726
748
|
1. This command changes behavior depending on several factors about both your mode and the state of your environment
|
727
749
|
|
@@ -735,10 +757,10 @@
|
|
735
757
|
|
736
758
|
4. Aliased to `cft un`
|
737
759
|
|
738
|
-
|
760
|
+
54. `cft upload_roles` This command will resync the chef server's roles with the data in the chef-repo/roles.
|
739
761
|
|
740
762
|
1. Aliased to `cft ur`
|
741
763
|
|
742
|
-
|
764
|
+
55. `cft version` this command prints out the current version of cheftacular.
|
743
765
|
|
744
766
|
1. Aliased to `cft v`
|
@@ -60,6 +60,7 @@ class Cheftacular
|
|
60
60
|
def start_console_ruby_on_rails ip_address, run_list
|
61
61
|
app_loc = "#{ @config['cheftacular']['base_file_path'] }/#{ @options['repository'] }/current"
|
62
62
|
true_env = @config['dummy_sshkit'].get_true_environment run_list, @config['cheftacular']['run_list_environments'][@options['env']], @options['env']
|
63
|
+
true_env = @config['dummy_sshkit'].get_override_environment @config['cheftacular']['repositories'][@options['role']], @options['env']
|
63
64
|
|
64
65
|
#the >/dev/tty after the ssh block redirects the full output to stdout, not /dev/null where it normally goes
|
65
66
|
`ssh #{ Cheftacular::SSH_INLINE_VARS } -tt #{ @config['cheftacular']['deploy_user'] }@#{ ip_address } "cd #{ app_loc } && RAILS_ENV=#{ true_env } #{ @config['bundle_command'] } exec rails c" > /dev/tty`
|
@@ -70,6 +70,8 @@ class Cheftacular
|
|
70
70
|
|
71
71
|
@config['auditor'].notify_slack_on_completion_for_deploy(nodes.map {|n| n.name }, logs_bag_hash) if @config['cheftacular']['auditing'] && !@options['run_migration_already']
|
72
72
|
|
73
|
+
return false if @options['skip_further_deploy_steps']
|
74
|
+
|
73
75
|
@config['action'].migrate(nodes) if @config['getter'].get_current_repo_config['database'] != 'none' && !@options['run_migration_already']
|
74
76
|
|
75
77
|
split_nodes_hash = {}
|
@@ -82,6 +82,7 @@ module SSHKit
|
|
82
82
|
def start_log_fetch_ruby_on_rails name, ip_address, run_list, options, locs, cheftacular, passwords, out=""
|
83
83
|
log_loc, timestamp = set_log_loc_and_timestamp(locs)
|
84
84
|
true_env = get_true_environment run_list, cheftacular['run_list_environments'][options['env']], options['env']
|
85
|
+
true_env = get_override_environment cheftacular['repositories'][options['role']], options['env']
|
85
86
|
app_log_loc = "#{ cheftacular['base_file_path'] }/#{ options['repository'] }/current/log"
|
86
87
|
log_cmnd, log_lines = get_log_command_and_lines(options)
|
87
88
|
|
@@ -52,6 +52,7 @@ class Cheftacular
|
|
52
52
|
|
53
53
|
def start_tail_ruby_on_rails ip_address, run_list, pattern_to_match
|
54
54
|
true_env = @config['dummy_sshkit'].get_true_environment run_list, @config['cheftacular']['run_list_environments'][@options['env']], @options['env']
|
55
|
+
true_env = @config['dummy_sshkit'].get_override_environment @config['cheftacular']['repositories'][@options['role']], @options['env']
|
55
56
|
|
56
57
|
#special servers should be listed first as most of them will have web role
|
57
58
|
log_loc = "#{ @config['cheftacular']['base_file_path'] }/#{ @options['repository'] }/current/log/#{ true_env }.log"
|
data/lib/cheftacular/error.rb
CHANGED
@@ -15,7 +15,7 @@ class Cheftacular
|
|
15
15
|
|
16
16
|
nodes = @config['parser'].exclude_nodes( nodes, exclusion_args, true )
|
17
17
|
|
18
|
-
raise "Node not found for #{ @options['node_name'] }" if nodes.empty?
|
18
|
+
raise "Node not found for node name: #{ @options['node_name'] }" if nodes.empty?
|
19
19
|
|
20
20
|
nodes
|
21
21
|
end
|
@@ -5,7 +5,7 @@ class Cheftacular
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def log_directories
|
8
|
-
['applog', 'deploy', 'failed-deploy', 'rolelog', 'rvm', 'server-setup', 'stashedlog']
|
8
|
+
['applog', 'deploy', 'failed-deploy', 'rolelog', 'rvm', 'server-setup', 'stashedlog', 'server-update']
|
9
9
|
end
|
10
10
|
|
11
11
|
def write_version_file version
|
data/lib/cheftacular/helper.rb
CHANGED
@@ -315,7 +315,7 @@ class Cheftacular
|
|
315
315
|
|
316
316
|
puts "Please re-run your deploy again and if this continues to not work, check with your DevOps personel!"
|
317
317
|
|
318
|
-
|
318
|
+
@options['skip_further_deploy_steps'] = true
|
319
319
|
elsif !git_output.include?(revision_to_check)
|
320
320
|
puts "! The remote organization #{ org_name_to_check } does not have a revision / branch #{ revision_to_check } for repository: #{ @options['repository'] } !"
|
321
321
|
|
@@ -20,11 +20,11 @@ class Cheftacular
|
|
20
20
|
def cloud_bootstrap_from_queue
|
21
21
|
raise "This action is not meant to be called directly!" unless @options['in_scaling']
|
22
22
|
|
23
|
-
puts("Preparing to boot server #{ @options['node_name'] } for #{ @options['env'] }!") unless @options['quiet']
|
24
|
-
|
25
23
|
@config['in_server_creation_queue'] = true
|
26
24
|
|
27
25
|
@config['server_creation_queue'].each do |server_hash|
|
26
|
+
puts("Preparing to boot server #{ server_hash['node_name'] } for #{ @options['env'] }!") unless @options['quiet']
|
27
|
+
|
28
28
|
puts("Creating server #{ server_hash['node_name'] } with arguments:") unless @options['quiet']
|
29
29
|
ap(server_hash.except('node_name')) unless @options['quiet']
|
30
30
|
|
@@ -100,15 +100,21 @@ class Cheftacular
|
|
100
100
|
|
101
101
|
@options['unset_address_and_node_name'] = true
|
102
102
|
|
103
|
-
@config['
|
103
|
+
database_host = @config['parser'].exclude_nodes( @config['getter'].get_true_node_objects(true), [{ unless: "role[#{ @options['role'] }]"}, { if: { not_env: @options['env'] } }], true).first
|
104
|
+
|
105
|
+
unless database_host.nil?
|
106
|
+
@config['action'].deploy
|
107
|
+
|
108
|
+
backup_pid = Process.spawn("cft backups load --env=#{ @options['env'] }")
|
109
|
+
end
|
104
110
|
|
105
|
-
|
111
|
+
puts("NOTE! This command is not finished until your terminal returns to an input state!") unless database_host.nil?
|
106
112
|
|
107
113
|
@options['role'] = 'all'
|
108
114
|
|
109
115
|
@config['action'].deploy
|
110
116
|
|
111
|
-
Process.wait
|
117
|
+
Process.wait(backup_pid) unless database_host.nil?
|
112
118
|
|
113
119
|
puts "Done loading data and setting up #{ @options['env'] }!"
|
114
120
|
end
|
@@ -141,7 +147,9 @@ class Cheftacular
|
|
141
147
|
|
142
148
|
sleep 15
|
143
149
|
end
|
144
|
-
end
|
150
|
+
end
|
151
|
+
|
152
|
+
@config['auditor'].notify_slack_on_completion("environment #{ type } command completed for env: #{ @options['env'] }\n") if @config['cheftacular']['auditing']
|
145
153
|
end
|
146
154
|
|
147
155
|
alias_method :e, :environment
|
@@ -77,7 +77,7 @@ module SSHKit
|
|
77
77
|
|
78
78
|
puts(out) if options['output'] || options['verbose']
|
79
79
|
|
80
|
-
::File.open("#{ log_loc }/#{ name }-apt-update-#{ timestamp }.txt", "w") { |f| f.write(out.scrub_pretty_text) } unless options['no_logs']
|
80
|
+
::File.open("#{ log_loc }/server-update/#{ name }-apt-update-#{ timestamp }.txt", "w") { |f| f.write(out.scrub_pretty_text) } unless options['no_logs']
|
81
81
|
|
82
82
|
puts "Succeeded upgrade of #{ name } (#{ ip_address })"
|
83
83
|
|
@@ -89,7 +89,7 @@ module SSHKit
|
|
89
89
|
|
90
90
|
out << sudo_capture( passwords[ip_address], 'shutdown', '1', '-r' )
|
91
91
|
|
92
|
-
::File.open("#{ log_loc }/#{ name }-upgrade-#{ timestamp }.txt", "w") { |f| f.write(out.scrub_pretty_text) }
|
92
|
+
::File.open("#{ log_loc }/server-update/#{ name }-upgrade-#{ timestamp }.txt", "w") { |f| f.write(out.scrub_pretty_text) }
|
93
93
|
|
94
94
|
puts(out) if options['output'] || options['verbose']
|
95
95
|
|
data/lib/cheftacular/version.rb
CHANGED
@@ -4,6 +4,7 @@ module SSHKit
|
|
4
4
|
def start_task name, ip_address, run_list, command, options, locs, cheftacular, passwords, sudo=false, out=""
|
5
5
|
log_loc, timestamp = set_log_loc_and_timestamp(locs)
|
6
6
|
true_env = get_true_environment run_list, cheftacular['run_list_environments'][options['env']], options['env']
|
7
|
+
true_env = get_override_environment cheftacular['repositories'][options['role']], options['env']
|
7
8
|
|
8
9
|
puts "Running #{ command } for #{ name } (#{ ip_address }) (Run with with --debug to generate a log as well)"
|
9
10
|
|
data/lib/sshkit/getters.rb
CHANGED
@@ -74,6 +74,18 @@ module SSHKit
|
|
74
74
|
|
75
75
|
ret_hash
|
76
76
|
end
|
77
|
+
|
78
|
+
def get_override_environment repo_hash, default_env
|
79
|
+
repo_hash['db_env_node_bypass'].each_pair do |original_env, original_env_hash|
|
80
|
+
next if default_env != original_env
|
81
|
+
|
82
|
+
default_env = original_env_hash['environment_to_bypass_into']
|
83
|
+
|
84
|
+
break
|
85
|
+
end
|
86
|
+
|
87
|
+
default_env
|
88
|
+
end
|
77
89
|
end
|
78
90
|
end
|
79
91
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cheftacular
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.15.
|
4
|
+
version: 2.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Louis Alridge
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|