cheftacular 2.8.0 → 2.9.0
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 +92 -70
- data/lib/cheftacular/actions/check.rb +3 -2
- data/lib/cheftacular/actions/console.rb +8 -2
- data/lib/cheftacular/actions/db_console.rb +28 -4
- data/lib/cheftacular/actions/deploy.rb +6 -8
- data/lib/cheftacular/actions/log.rb +7 -2
- data/lib/cheftacular/actions/migrate.rb +16 -5
- data/lib/cheftacular/actions/run.rb +10 -3
- data/lib/cheftacular/actions/scale.rb +4 -1
- data/lib/cheftacular/actions/tail.rb +8 -3
- data/lib/cheftacular/cheftacular.rb +1 -1
- data/lib/cheftacular/cloud_provider.rb +5 -1
- data/lib/cheftacular/dns.rb +1 -1
- data/lib/cheftacular/error.rb +2 -2
- data/lib/cheftacular/file_system.rb +50 -0
- data/lib/cheftacular/getter.rb +1 -1
- data/lib/cheftacular/helper.rb +34 -5
- data/lib/cheftacular/initializer.rb +15 -25
- data/lib/cheftacular/parser.rb +2 -0
- data/lib/cheftacular/stateless_actions/add_ssh_key_to_bag.rb +4 -1
- data/lib/cheftacular/stateless_actions/arguments.rb +8 -3
- data/lib/cheftacular/stateless_actions/backups.rb +5 -2
- data/lib/cheftacular/stateless_actions/bootstrappers/ubuntu_bootstrap.rb +8 -5
- data/lib/cheftacular/stateless_actions/check_cheftacular_yml_keys.rb +15 -1
- data/lib/cheftacular/stateless_actions/chef_bootstrap.rb +9 -2
- data/lib/cheftacular/stateless_actions/chef_server.rb +5 -2
- data/lib/cheftacular/stateless_actions/cheftacular_config.rb +26 -4
- data/lib/cheftacular/stateless_actions/cheftacular_yml_help.rb +31 -0
- data/lib/cheftacular/stateless_actions/clean_cookbooks.rb +6 -37
- data/lib/cheftacular/stateless_actions/clear_caches.rb +9 -2
- data/lib/cheftacular/stateless_actions/client_list.rb +5 -2
- data/lib/cheftacular/stateless_actions/cloud.rb +4 -1
- data/lib/cheftacular/stateless_actions/cloud_bootstrap.rb +4 -1
- data/lib/cheftacular/stateless_actions/compile_audit_log.rb +4 -1
- data/lib/cheftacular/stateless_actions/compile_readme.rb +10 -1
- data/lib/cheftacular/stateless_actions/create_git_key.rb +4 -1
- data/lib/cheftacular/stateless_actions/disk_report.rb +5 -2
- data/lib/cheftacular/stateless_actions/environment.rb +5 -2
- data/lib/cheftacular/stateless_actions/file.rb +5 -2
- data/lib/cheftacular/stateless_actions/fix_known_hosts.rb +5 -2
- data/lib/cheftacular/stateless_actions/full_bootstrap.rb +10 -2
- data/lib/cheftacular/stateless_actions/get_active_ssh_connections.rb +3 -2
- data/lib/cheftacular/stateless_actions/get_haproxy_log.rb +5 -2
- data/lib/cheftacular/stateless_actions/get_log_from_bag.rb +5 -2
- data/lib/cheftacular/stateless_actions/get_pg_pass.rb +5 -2
- data/lib/cheftacular/stateless_actions/get_shorewall_allowed_connections.rb +2 -1
- data/lib/cheftacular/stateless_actions/help.rb +28 -16
- data/lib/cheftacular/stateless_actions/initialize_cheftacular_yml.rb +4 -1
- data/lib/cheftacular/stateless_actions/initialize_data_bag_contents.rb +4 -1
- data/lib/cheftacular/stateless_actions/knife_upload.rb +4 -1
- data/lib/cheftacular/stateless_actions/list_toggleable_roles.rb +5 -2
- data/lib/cheftacular/stateless_actions/location_aliases.rb +5 -2
- data/lib/cheftacular/stateless_actions/pass.rb +5 -2
- data/lib/cheftacular/stateless_actions/reinitialize.rb +4 -1
- data/lib/cheftacular/stateless_actions/remove_client.rb +9 -2
- data/lib/cheftacular/stateless_actions/replication_status.rb +4 -1
- data/lib/cheftacular/stateless_actions/reset_bag.rb +4 -1
- data/lib/cheftacular/stateless_actions/restart_swap.rb +4 -1
- data/lib/cheftacular/stateless_actions/role_toggle.rb +7 -4
- data/lib/cheftacular/stateless_actions/rvm.rb +4 -1
- data/lib/cheftacular/stateless_actions/server_update.rb +5 -2
- data/lib/cheftacular/stateless_actions/service.rb +4 -1
- data/lib/cheftacular/stateless_actions/slack.rb +4 -1
- data/lib/cheftacular/stateless_actions/test_env.rb +4 -1
- data/lib/cheftacular/stateless_actions/update_chef_client.rb +2 -1
- data/lib/cheftacular/stateless_actions/update_cloudflare_dns_from_cloud.rb +4 -1
- data/lib/cheftacular/stateless_actions/update_split_branches.rb +4 -1
- data/lib/cheftacular/stateless_actions/update_thecheftacularcookbook.rb +38 -0
- data/lib/cheftacular/stateless_actions/update_tld.rb +4 -1
- data/lib/cheftacular/stateless_actions/upload_nodes.rb +6 -3
- data/lib/cheftacular/stateless_actions/upload_roles.rb +4 -1
- data/lib/cheftacular/version.rb +1 -1
- data/lib/cloud_interactor/authentication.rb +3 -4
- data/lib/cloud_interactor/flavor.rb +7 -2
- data/lib/cloud_interactor/helpers.rb +5 -1
- data/lib/cloud_interactor/server/create.rb +7 -2
- data/lib/sshkit/actions/start_task.rb +9 -1
- metadata +6 -7
- data/bin/client-list +0 -4
- data/lib/cheftacular/stateless_actions/clean_sensu_plugins.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b1bb4e3a17332ec3d6ef16155fb05e3add6faee
|
4
|
+
data.tar.gz: f65a33df3faab5ae464235f6dfcadeaf8a895c7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d3f1ed8e987374de14157a03c3f84baa6c5130e09a8746c4b5f706e4f1b60ab6cfba360e5c4b581d77fb0dc941947efa9a3a53ff3319509142aff2070337d55
|
7
|
+
data.tar.gz: f3383ec66560070ff978cd5fd28ae837a725b53d8feb29a1da298491ed11c9e0842ce5292bd4a32f40a2bf8082c4c9996760f177e6ad8fb3b388d0b497c7a316
|
data/lib/cheftacular/README.md
CHANGED
@@ -51,18 +51,20 @@
|
|
51
51
|
|
52
52
|
1. `-e|--except-role ROLE_NAME` will *prevent* any server with this role from being *deployed to* for the deploy command. Other commands will ignore this argument.
|
53
53
|
|
54
|
-
2. `-z|--unset-
|
54
|
+
2. `-z|--unset-github-deploy-args` will unset a custom revision specified in the arg below and make the codebase utilize the default.
|
55
55
|
|
56
56
|
3. `-Z|--revision REVISION` will force the role you're deploying to to utilize the revision specified here. This can be a specific commit, a branch name or even a tag.
|
57
57
|
|
58
58
|
1. Note: The system does not check if the revision exists, if you pass a non-existent revision no one will be able to deploy to that role until -Z with a correction revision or -z is passed.
|
59
59
|
|
60
|
+
4. The `-O ORGANIZATION` flag can be used with TheCheftacularCookbook to set an *organization* your app can try deploying from, your git user needs access to these forks / organization(s).
|
60
61
|
|
61
|
-
|
62
|
+
3. The `-z|--unset-github-deploy-args` option will clear your current `-Z` and `-O` flags.
|
62
63
|
|
63
|
-
1. [NYI]`cft get_active_ssh_connections` will fetch the active ssh connections from every server and output it into your log directory.
|
64
64
|
|
65
|
-
|
65
|
+
## Commands that can be run in the application context
|
66
|
+
|
67
|
+
1. `cft backups [activate|deactivate|load|restore]` this command sets the fetch_backups and restore_backups flags in your config data bag for an environment. These can be used to give application developers a way to trigger / untrigger restores in an environment
|
66
68
|
|
67
69
|
1. `activate` will turn on automated backup running (turns on the flag for the env in the config bag).
|
68
70
|
|
@@ -70,11 +72,13 @@
|
|
70
72
|
|
71
73
|
3. `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.
|
72
74
|
|
73
|
-
4. `
|
75
|
+
4. `restore` will simply just run the _backup loading command_ to load the latest backup onto the server.
|
76
|
+
|
77
|
+
2. `cft check` Checks the commits for all servers for a repository (for an environment) and returns them in a simple chart. Also shows when these commits were deployed to the server.
|
74
78
|
|
75
|
-
|
79
|
+
1. If the node has special repository based keys from TheCheftacularCookbook, this command will also display information about the branch and organization currently deployed to the node(s).
|
76
80
|
|
77
|
-
|
81
|
+
3. `cft chef_server [restart|processes|memory]` this command can be used to query the chef server for stats if the cheftacular.yml has the chef_server key filled out. Useful for low resource chef-servers.
|
78
82
|
|
79
83
|
1. `restart` restarts all chef processes on the chef server which may alleviate slow cheftacular load times for some users. (NOTE) do not run this command while the chef-server is performing actions or instability may result! Not tested for high volume chef servers.
|
80
84
|
|
@@ -86,15 +90,17 @@
|
|
86
90
|
|
87
91
|
5. NOTE 2! Cheftacular does not (and will not) support accessing your chef server over ssh with password auth. If you have done this, you should feel bad and immediately switch ssh access to key authentication...
|
88
92
|
|
89
|
-
|
93
|
+
4. `cft cheftacular_config [display|sync|overwrite]` this command Allows you to interact with your complete cheftacular configuration, the union of all repository's cheftacular.ymls.
|
90
94
|
|
91
95
|
1. `display` will show the current overall configuration for cheftacular.
|
92
96
|
|
93
97
|
2. `sync` will sync your local cheftacular yaml keys ONTO the server's keys. This happens automatically whenever a difference is detected between the local keys and the remote keys but can be run manually. Will send a slack notification if slack is configured (the slack notification contains the diffed keys). The sync only occurs if there are CHANGES to the file.
|
94
98
|
|
95
|
-
|
99
|
+
5. `cft clear_caches` this command allows you to clear all of your local caches.
|
96
100
|
|
97
|
-
|
101
|
+
1. This command will force you to refetch all previously cached chef server data on the next `cft` run.
|
102
|
+
|
103
|
+
6. `cft client_list` Allows you check the basic information for all the servers setup via chef. Shows the server's short name, its public ip address and roles (run_list) by default.
|
98
104
|
|
99
105
|
1. `-v` option will make this command display the server's domain name, whether its password is stored on the chef server and what that password is.
|
100
106
|
|
@@ -102,23 +108,31 @@
|
|
102
108
|
|
103
109
|
3. This command is aliased to `client-list` with no arguments or cft prefix.
|
104
110
|
|
105
|
-
|
111
|
+
7. `cft console` will create a console session on the first node found for a repository.
|
112
|
+
|
113
|
+
1. Attempts to setup a console for the unique stack, stacks currently supported for console is only Rails.
|
106
114
|
|
107
|
-
|
115
|
+
8. `cft db_console` will create a database console session on the first node found for a database stack in the current environment.
|
108
116
|
|
109
117
|
1. This command is aliased to psql, typing `cft psql` will drop you into a rails stack database psql session.
|
110
118
|
|
111
|
-
|
119
|
+
2. This command is also aliased to mongo, typing `cft mongo` will drop you into a mongodb mongo session.
|
120
|
+
|
121
|
+
9. `cft deploy` will do a simple chef-client run on the servers for a role. Logs of the run itself will be sent to the local log directory in the application (or chef-repo) where the run was conducted.
|
122
|
+
|
123
|
+
1. The `-Z REVISION` flag can be used with TheCheftacularCookbook to set a revision your app will run.
|
112
124
|
|
113
|
-
|
125
|
+
2. The `-O ORGANIZATION` flag can be used with TheCheftacularCookbook to set an *organization* your app can try deploying from, your git user needs access to these forks / organization(s).
|
114
126
|
|
115
|
-
|
127
|
+
3. The `-z|--unset-github-deploy-args` option will clear your current `-Z` and `-O` flags.
|
116
128
|
|
117
|
-
|
129
|
+
4. This command will also run migrations on both an role's normal servers and its split servers if certain conditions are met (such as the role having a database, etc).
|
118
130
|
|
119
|
-
|
131
|
+
5. The `-v|--verbose` option will cause failed deploys to output to the terminal window and to their normal log file. Useful for debugging.
|
120
132
|
|
121
|
-
|
133
|
+
10. `cft disk_report` will fetch useful statistics from every server for every environment and output it into your log directory.
|
134
|
+
|
135
|
+
11. `cft environment boot|destroy` will boot / destroy the current environment
|
122
136
|
|
123
137
|
1. `boot` will spin up servers and bring them to a stable state. This includes setting up their subdomains for the target environment.
|
124
138
|
|
@@ -126,7 +140,7 @@
|
|
126
140
|
|
127
141
|
3. This command will prompt when attempting to destroy servers in staging or production
|
128
142
|
|
129
|
-
|
143
|
+
12. `cft file NODE_NAME LOCATION_ALIAS MODE FILE_NAME` interacts with a file on the remote server
|
130
144
|
|
131
145
|
1. `LOCATION_ALIAS` will be parsed as a path if it has backslash characters. Otherwise it will be parsed from your location_aliases hash in your cheftacular.yml
|
132
146
|
|
@@ -156,25 +170,25 @@
|
|
156
170
|
|
157
171
|
1. `--save-to-file FILE_PATH` can also be used in the `fetch` context to specify where exactly to save the file and what to name it as.
|
158
172
|
|
159
|
-
|
173
|
+
13. `cft fix_known_hosts [HOSTNAME]` this command will delete entries in your known_hosts file for all the servers that are in our system (ip addresses AND dns names)
|
160
174
|
|
161
175
|
1. Passing in a hostname will make the command only remove entries with that hostname / ip specifically
|
162
176
|
|
163
|
-
|
177
|
+
14. `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.
|
164
178
|
|
165
179
|
1. In devops mode, this command will not do anything without the -R repository passed.
|
166
180
|
|
167
|
-
|
181
|
+
15. `cft get_log_from_bag <NODE_NAME-COMMAND_TYPE>` this command grabs the latest command run log from the data bags and saves it to your log directory. There are different types of logs saved per server depending on command.
|
168
182
|
|
169
|
-
|
183
|
+
16. `cft get_pg_pass ['clip']` command will output the current environment's pg_password to your terminal. Optionally you can pass in clip like `cft get_pg_pass clip` to have it also copy the pass to your clipboard.
|
170
184
|
|
171
|
-
|
185
|
+
17. `cft help COMMAND|MODE` this command returns the documentation for a specific command if COMMAND matches the name of a command. Alternatively, it can be passed `action|arguments|application|current|devops|stateless_action` to fetch the commands for a specific mode.Misspellings of commands will display near hits.
|
172
186
|
|
173
|
-
|
187
|
+
18. `cft list_toggleable_roles NODE_NAME` This command will allow you to see all toggleable roles for a node
|
174
188
|
|
175
|
-
|
189
|
+
19. `cft location_aliases` will list all location aliases listed in your cheftacular.yml. These aliases can be used in the `cft file` command.
|
176
190
|
|
177
|
-
|
191
|
+
20. `cft log` this command will output the last 500 lines of logs from every server set for the repository (can be given additional args to specify) to the log directory
|
178
192
|
|
179
193
|
1. `--nginx` will fetch the nginx logs as well as the application logs
|
180
194
|
|
@@ -186,13 +200,13 @@
|
|
186
200
|
|
187
201
|
4. `--fetch-backup` If doing a pg_data log, this will fetch the latest logs from the pg_data log directory for each database.
|
188
202
|
|
189
|
-
|
203
|
+
21. `cft migrate` this command will grab the first alphabetical node for a repository and run a migration that will hit the database primary server.
|
190
204
|
|
191
|
-
|
205
|
+
1. Currently only supports rails stacks.
|
192
206
|
|
193
|
-
|
207
|
+
22. `cft pass NODE_NAME` will drop the server's sudo password into your clipboard. Useful for when you need to ssh into the server itself and try advanced linux commands
|
194
208
|
|
195
|
-
|
209
|
+
23. `cft role_toggle NODE_NAME ROLE_NAME activate|deactivate` This command will allow you to **toggle** roles on nodes without using `cft upload_nodes`
|
196
210
|
|
197
211
|
1. This command uses your *role_toggling:deactivated_role_suffix* attribute set in your cheftacular.yml to toggle the role, it checks to see if the toggled name exists then sets the node's run_list to include the toggled role
|
198
212
|
|
@@ -204,7 +218,7 @@
|
|
204
218
|
|
205
219
|
1. Please run `cft list_toggleable_roles NODE_NAME` to get a list of your org's toggleable roles for a node.
|
206
220
|
|
207
|
-
|
221
|
+
24. `cft run COMMAND [--all]` will trigger the command on the first server in the role. Can be used to run rake commands or anything else.
|
208
222
|
|
209
223
|
1. `--all` will make the command run against all servers in a role rather than the first server it comes across. Don't do this if you're modifying the database with the command.
|
210
224
|
|
@@ -214,11 +228,11 @@
|
|
214
228
|
|
215
229
|
4. IMPORTANT NOTE: You cannot run `cft run rake -T` as is, you have to enclose any command that uses command line dash arguments in quotes like `cft run "rake -T"`
|
216
230
|
|
217
|
-
|
231
|
+
25. `cft scale up|down [NUM_TO_SCALE]` will add (or remove) NUM_TO_SCALE servers from the server array. This command will not let you scale down below 1 server.
|
218
232
|
|
219
233
|
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.
|
220
234
|
|
221
|
-
|
235
|
+
26. `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
|
222
236
|
|
223
237
|
1. pass `-n NODE_NAME` to grab the output of a node other than the first.
|
224
238
|
|
@@ -229,17 +243,15 @@
|
|
229
243
|
|
230
244
|
## Commands that can ONLY be run in the devops context
|
231
245
|
|
232
|
-
1. [NYI]`cft
|
233
|
-
|
234
|
-
2. [NYI]`cft get_active_ssh_connections` will fetch the active ssh connections from every server and output it into your log directory.
|
246
|
+
1. [NYI]`cft get_active_ssh_connections` will fetch the active ssh connections from every server and output it into your log directory.
|
235
247
|
|
236
|
-
|
248
|
+
2. [NYI]`cft update_chef_client` attempts to update the chef-client of all nodes to the latest version. Should be done with caution and with the chef_server's version in mind.
|
237
249
|
|
238
|
-
|
250
|
+
3. `cft add_ssh_key_to_bag "<NEW SSH PUB KEY>" [SPECIFIC_REPOSITORY]` this command will add the given ssh key to the default authentication data bag. After this your server recipes should read the contents of the 'default' 'authentication' bag for the authorized_keys array.
|
239
251
|
|
240
252
|
1. `SPECIFIC_REPOSITORY` is a special argument, if left blank the key will be placed in the authorized_keys array in the bag, otherwise it will be placed in the specific_authorized_keys hash under a key named for the repository that is passed. The script will error if SPECIFIC_REPOSITORY does not exist in the cheftacular.yml respositories hash. You can then use this data to give users selective ssh access to certain servers.
|
241
253
|
|
242
|
-
|
254
|
+
4. `cft backups [activate|deactivate|load|restore]` this command sets the fetch_backups and restore_backups flags in your config data bag for an environment. These can be used to give application developers a way to trigger / untrigger restores in an environment
|
243
255
|
|
244
256
|
1. `activate` will turn on automated backup running (turns on the flag for the env in the config bag).
|
245
257
|
|
@@ -247,13 +259,15 @@
|
|
247
259
|
|
248
260
|
3. `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.
|
249
261
|
|
250
|
-
4. `
|
262
|
+
4. `restore` will simply just run the _backup loading command_ to load the latest backup onto the server.
|
263
|
+
|
264
|
+
5. `cft check_cheftacular_yml_keys` allows you to check to see if your cheftacular yml keys are valid to the current version of cheftacular. It will also set your missing keys to their likely default and let you know to update the cheftacular.yml file.
|
251
265
|
|
252
|
-
6. `cft
|
266
|
+
6. `cft chef_bootstrap ADDRESS NODE_NAME` allows you to register a node in the chef system, remove any lingering data that may be associated with it and update the node's runlist if it has an entry in nodes_dir for its NODE_NAME.
|
253
267
|
|
254
|
-
|
268
|
+
1. This command is part of the `cft full_bootstrap` command
|
255
269
|
|
256
|
-
|
270
|
+
7. `cft chef_server [restart|processes|memory]` this command can be used to query the chef server for stats if the cheftacular.yml has the chef_server key filled out. Useful for low resource chef-servers.
|
257
271
|
|
258
272
|
1. `restart` restarts all chef processes on the chef server which may alleviate slow cheftacular load times for some users. (NOTE) do not run this command while the chef-server is performing actions or instability may result! Not tested for high volume chef servers.
|
259
273
|
|
@@ -265,21 +279,23 @@
|
|
265
279
|
|
266
280
|
5. NOTE 2! Cheftacular does not (and will not) support accessing your chef server over ssh with password auth. If you have done this, you should feel bad and immediately switch ssh access to key authentication...
|
267
281
|
|
268
|
-
|
282
|
+
8. `cft cheftacular_config [display|sync|overwrite]` this command Allows you to interact with your complete cheftacular configuration, the union of all repository's cheftacular.ymls.
|
269
283
|
|
270
284
|
1. `display` will show the current overall configuration for cheftacular.
|
271
285
|
|
272
286
|
2. `sync` will sync your local cheftacular yaml keys ONTO the server's keys. This happens automatically whenever a difference is detected between the local keys and the remote keys but can be run manually. Will send a slack notification if slack is configured (the slack notification contains the diffed keys). The sync only occurs if there are CHANGES to the file.
|
273
287
|
|
274
|
-
|
288
|
+
9. `cft clean_cookbooks [force] [remove_cookbooks]` allows you to update the internal chef-repo's cookbooks easily. By default this script will force you to decide what to do with each cookbook individually (shows version numbers and whether to overwrite it to cookbooks or not).
|
275
289
|
|
276
290
|
1. `force` argument will cause the downloaded cookbooks to *always* overwrite the chef-repo's cookbooks as long as the downloaded cookbook has a higher version number.
|
277
291
|
|
278
292
|
2. If you would like to remove all the cookbooks on the chef server, run `knife cookbook bulk delete '.*' -p -c ~/.chef/knife.rb`
|
279
293
|
|
280
|
-
|
294
|
+
10. `cft clear_caches` this command allows you to clear all of your local caches.
|
281
295
|
|
282
|
-
|
296
|
+
1. This command will force you to refetch all previously cached chef server data on the next `cft` run.
|
297
|
+
|
298
|
+
11. `cft client_list` Allows you check the basic information for all the servers setup via chef. Shows the server's short name, its public ip address and roles (run_list) by default.
|
283
299
|
|
284
300
|
1. `-v` option will make this command display the server's domain name, whether its password is stored on the chef server and what that password is.
|
285
301
|
|
@@ -287,7 +303,7 @@
|
|
287
303
|
|
288
304
|
3. This command is aliased to `client-list` with no arguments or cft prefix.
|
289
305
|
|
290
|
-
|
306
|
+
12. `cft cloud <FIRST_LEVEL_ARG> [<SECOND_LEVEL_ARG>[:<SECOND_LEVEL_ARG_QUERY>]*] ` this command handles talking to various cloud APIs. If no args are passed nothing will happen.
|
291
307
|
|
292
308
|
1. `domain` first level argument for interacting with cloud domains
|
293
309
|
|
@@ -383,7 +399,7 @@
|
|
383
399
|
|
384
400
|
5. `bootstrap` captures the current computer's hostname and checks to see if a key matching this hostname exists on the cloud service. If the key does not exist, the command attempts to read the contents of the ~/.ssh/id_rsa.pub file and create a new key with that data and the hostname of the current computer. Run automatically when creating DigitalOcean servers. It's worth noting that if the computer's key already exists on DigitalOcean under a different name, this specific command will fail with a generic error. Please check your keys.
|
385
401
|
|
386
|
-
|
402
|
+
13. `cft cloud_bootstrap NODE_NAME FLAVOR_NAME [DESCRIPTOR] [--with-dn DOMAIN]` uses a cloud api to create a server and attaches its DOMAIN_NAME to the TLD specified for that environment (IE: example-staging.com for staging)
|
387
403
|
|
388
404
|
1. If no DOMAIN_NAME is supplied it will use the node's NODE_NAME (IE: api01.example-staging.com)
|
389
405
|
|
@@ -393,11 +409,11 @@
|
|
393
409
|
|
394
410
|
4. DESCRIPTOR is used as an internal tag for the node, if left blank it will become the name of the node. It is recommended to enter a custom repository-dependent tag here to make nodes easier to load-balance like "lb:[CODEBASE_NAME]"
|
395
411
|
|
396
|
-
|
412
|
+
14. `cft compile_audit_log [clean]` compiles the audit logs in each environment's audit data bag a audit-log-CURRENTDAY.md file in the log folder of the application. Bear in mind that the bag can only hold 100K bytes and will need to have that data removed to store more than that.
|
397
413
|
|
398
|
-
|
414
|
+
15. `cft compile_readme` compiles all documentation methods and creates a README.md file in the log folder of the application.
|
399
415
|
|
400
|
-
|
416
|
+
16. `cft create_git_key ID_RSA_FILE [OAUTH_TOKEN]` This command will update the default/authentication data bag with new credentials. The [ID_RSA_FILE](https://help.github.com/articles/generating-ssh-keys) needs to exist beforehand.
|
401
417
|
|
402
418
|
1. This command will upload both the private and public key to the data bag. The public key should be the one that matches the github user for your deployment github user.
|
403
419
|
|
@@ -405,9 +421,9 @@
|
|
405
421
|
|
406
422
|
3. NOTE! The ID_RSA_FILE should be in your .chef folder in the root of your home directory!
|
407
423
|
|
408
|
-
|
424
|
+
17. `cft disk_report` will fetch useful statistics from every server for every environment and output it into your log directory.
|
409
425
|
|
410
|
-
|
426
|
+
18. `cft environment boot|destroy` will boot / destroy the current environment
|
411
427
|
|
412
428
|
1. `boot` will spin up servers and bring them to a stable state. This includes setting up their subdomains for the target environment.
|
413
429
|
|
@@ -415,7 +431,7 @@
|
|
415
431
|
|
416
432
|
3. This command will prompt when attempting to destroy servers in staging or production
|
417
433
|
|
418
|
-
|
434
|
+
19. `cft file NODE_NAME LOCATION_ALIAS MODE FILE_NAME` interacts with a file on the remote server
|
419
435
|
|
420
436
|
1. `LOCATION_ALIAS` will be parsed as a path if it has backslash characters. Otherwise it will be parsed from your location_aliases hash in your cheftacular.yml
|
421
437
|
|
@@ -445,21 +461,23 @@
|
|
445
461
|
|
446
462
|
1. `--save-to-file FILE_PATH` can also be used in the `fetch` context to specify where exactly to save the file and what to name it as.
|
447
463
|
|
448
|
-
|
464
|
+
20. `cft fix_known_hosts [HOSTNAME]` this command will delete entries in your known_hosts file for all the servers that are in our system (ip addresses AND dns names)
|
449
465
|
|
450
466
|
1. Passing in a hostname will make the command only remove entries with that hostname / ip specifically
|
451
467
|
|
452
|
-
|
468
|
+
21. `cft full_bootstrap ADDRESS ROOT_PASS NODE_NAME` This command performs both ubuntu_bootstrap and chef_bootstrap.
|
469
|
+
|
470
|
+
1. This command is run by `cft cloud_bootstrap` and should not be run on its own unless the target server is already created and not initialized.
|
453
471
|
|
454
|
-
|
472
|
+
22. `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.
|
455
473
|
|
456
474
|
1. In devops mode, this command will not do anything without the -R repository passed.
|
457
475
|
|
458
|
-
|
476
|
+
23. `cft get_log_from_bag <NODE_NAME-COMMAND_TYPE>` this command grabs the latest command run log from the data bags and saves it to your log directory. There are different types of logs saved per server depending on command.
|
459
477
|
|
460
|
-
|
478
|
+
24. `cft get_pg_pass ['clip']` command will output the current environment's pg_password to your terminal. Optionally you can pass in clip like `cft get_pg_pass clip` to have it also copy the pass to your clipboard.
|
461
479
|
|
462
|
-
|
480
|
+
25. `cft get_shorewall_allowed_connections [PATH_TO_LOCAL_FILE] -n NODE_NAME` command will query a single server and return all of its ACCEPT connections from shorewall in it's syslog and return the results in a CSV format. Useful for tracking IP activity.
|
463
481
|
|
464
482
|
1. You must pass in a node name to query with `-n NODE_NAME`
|
465
483
|
|
@@ -467,28 +485,32 @@
|
|
467
485
|
|
468
486
|
3. If `PATH_TO_LOCAL_FILE` is not blank, the command will use that file instead of building a file on the remote server
|
469
487
|
|
470
|
-
|
488
|
+
26. `cft help COMMAND|MODE` this command returns the documentation for a specific command if COMMAND matches the name of a command. Alternatively, it can be passed `action|arguments|application|current|devops|stateless_action` to fetch the commands for a specific mode.Misspellings of commands will display near hits.
|
471
489
|
|
472
|
-
|
490
|
+
27. `cft initialize_cheftacular_yml [application|TheCheftacularCookbook]` will create a cheftacular.yml file in your config folder (and create the config folder if it does not exist). If you already have a cheftacular.yml file in the config folder, it will create a cheftacular.example.yml file that will contain the new changes / keys in the latest cheftacular version.
|
473
491
|
|
474
492
|
1. If `TheCheftacularCookbook` is passed, the generated cheftacular.yml file will include the additional TheCheftacularCookbook keys.
|
475
493
|
|
476
494
|
2. If `application` is passed, the generated cheftacular.yml file will look like one you could use in an application directory.
|
477
495
|
|
478
|
-
|
496
|
+
28. `cft initialize_data_bag_contents ENVIRONMENT_NAME` will ensure the data bags always have the correct structure before each run. This command is run every time the gem is started and if called directly, will exit after completion.
|
479
497
|
|
480
|
-
|
498
|
+
29. `cft knife_upload` will resync the chef-server with the local chef-repo code. This command is analog for `knife upload /`
|
481
499
|
|
482
|
-
|
500
|
+
30. `cft list_toggleable_roles NODE_NAME` This command will allow you to see all toggleable roles for a node
|
483
501
|
|
484
|
-
|
502
|
+
31. `cft location_aliases` will list all location aliases listed in your cheftacular.yml. These aliases can be used in the `cft file` command.
|
485
503
|
|
486
|
-
|
504
|
+
32. `cft pass NODE_NAME` will drop the server's sudo password into your clipboard. Useful for when you need to ssh into the server itself and try advanced linux commands
|
505
|
+
|
506
|
+
33. `cft reinitialize IP_ADDRESS NODE_NAME` will reconnect a server previously managed by chef to a new chef server. The node name MUST MATCH THE NODE'S ORIGINAL NODE NAME for the roles to be setup correctly.
|
487
507
|
|
488
508
|
34. `cft remove_client NODE_NAME [destroy]` removes a client (and its node data) from the chef-server. It also removes its dns records from the cloud service (if possible). This should not be done lightly as you will have to wipe the server and trigger another chef-client run to get it to register again. Alternatively, you can run `cft reinitialize IP_ADDRESS NODE_NAME as well.
|
489
509
|
|
490
510
|
1. `destroy` deletes the server as well as removing it from the chef environment.
|
491
511
|
|
512
|
+
2. This command is aliased to `cft remove_node`
|
513
|
+
|
492
514
|
35. `cft replication_status` will check the status of the database master and slaves in every environment. Also lists how far behind the slaves are from the master in milliseconds.
|
493
515
|
|
494
516
|
36. `cft reset_bag BAG_NAME` this command allows you to reset a data bag item to an empty state. Run this on full data bags to clear them out.
|
@@ -527,7 +549,7 @@
|
|
527
549
|
|
528
550
|
40. `cft server_update [restart]` allows you to force update all nodes' packages for a specific environment. This should be done with caution as this *might* break something.
|
529
551
|
|
530
|
-
1. `cft
|
552
|
+
1. `cft server_update restart` will prompt to ask if you also want to restart all servers in a rolling restart. This should be done with extreme caution and only in a worst-case scenario.
|
531
553
|
|
532
554
|
41. `cft service [COMMAND] [SERVICE]` will run service commands on remote servers. This command only runs on the first server it comes across. Specify others with -n NODE_NAME.
|
533
555
|
|
@@ -1,15 +1,16 @@
|
|
1
1
|
class Cheftacular
|
2
2
|
class ActionDocumentation
|
3
3
|
def check
|
4
|
-
@config['documentation']['action']
|
4
|
+
@config['documentation']['action'][__method__] ||= {}
|
5
|
+
@config['documentation']['action'][__method__]['long_description'] = [
|
5
6
|
"`cft check` Checks the commits for all servers for a repository (for an environment) and returns them in a simple chart. " +
|
6
7
|
"Also shows when these commits were deployed to the server.",
|
7
|
-
|
8
8
|
[
|
9
9
|
" 1. If the node has special repository based keys from TheCheftacularCookbook, this command will also display information " +
|
10
10
|
"about the branch and organization currently deployed to the node(s)."
|
11
11
|
]
|
12
12
|
]
|
13
|
+
@config['documentation']['action'][__method__]['short_description'] = "Checks the branches currently deployed to an env for your repo"
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
@@ -1,9 +1,15 @@
|
|
1
1
|
class Cheftacular
|
2
2
|
class ActionDocumentation
|
3
3
|
def console
|
4
|
-
@config['documentation']['action']
|
5
|
-
|
4
|
+
@config['documentation']['action'][__method__] ||= {}
|
5
|
+
@config['documentation']['action'][__method__]['long_description'] = [
|
6
|
+
"`cft console` will create a console session on the first node found for a repository.",
|
7
|
+
[
|
8
|
+
" 1. Attempts to setup a console for the unique stack, stacks currently supported for console is only Rails."
|
9
|
+
]
|
6
10
|
]
|
11
|
+
|
12
|
+
@config['documentation']['action'][__method__]['short_description'] = 'Create a remote console for the current repository'
|
7
13
|
end
|
8
14
|
end
|
9
15
|
|
@@ -1,14 +1,19 @@
|
|
1
1
|
class Cheftacular
|
2
2
|
class ActionDocumentation
|
3
3
|
def db_console
|
4
|
-
@config['documentation']['action']
|
4
|
+
@config['documentation']['action'][__method__] ||= {}
|
5
|
+
@config['documentation']['action'][__method__]['long_description'] = [
|
5
6
|
"`cft db_console` " +
|
6
7
|
"will create a database console session on the first node found for a database stack in the current environment.",
|
7
8
|
|
8
9
|
[
|
9
|
-
" 1. This command is aliased to psql, typing `cft psql` will drop you into a rails stack database psql session."
|
10
|
+
" 1. This command is aliased to psql, typing `cft psql` will drop you into a rails stack database psql session.",
|
11
|
+
|
12
|
+
" 2. This command is also aliased to mongo, typing `cft mongo` will drop you into a mongodb mongo session."
|
10
13
|
]
|
11
14
|
]
|
15
|
+
|
16
|
+
@config['documentation']['action'][__method__]['short_description'] = 'Creates a remote database console session for the current repository'
|
12
17
|
end
|
13
18
|
end
|
14
19
|
|
@@ -34,6 +39,19 @@ class Cheftacular
|
|
34
39
|
end
|
35
40
|
end
|
36
41
|
|
42
|
+
def db_console_mongodb
|
43
|
+
nodes = @config['getter'].get_true_node_objects(true)
|
44
|
+
|
45
|
+
#must have mongo db, only want ONE node
|
46
|
+
mongoable_nodes = @config['parser'].exclude_nodes( nodes, [{ unless: "role[#{ @options['role'] }]" }, { if: { not_env: @options['env'] } }], true )
|
47
|
+
|
48
|
+
mongoable_nodes.each do |n|
|
49
|
+
puts("Beginning database console run for #{ n.name } (#{ n.public_ipaddress }) on role #{ @options['role'] }") unless @options['quiet']
|
50
|
+
|
51
|
+
start_console_mongodb(n.public_ipaddress)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
37
55
|
def db_console_mysql
|
38
56
|
raise "Not yet implemented"
|
39
57
|
end
|
@@ -49,7 +67,7 @@ class Cheftacular
|
|
49
67
|
end
|
50
68
|
|
51
69
|
alias_method :psql, :db_console_postgresql
|
52
|
-
|
70
|
+
alias_method :mongo, :db_console_mongodb
|
53
71
|
private
|
54
72
|
|
55
73
|
def start_console_postgresql ip_address, database_host
|
@@ -63,7 +81,13 @@ class Cheftacular
|
|
63
81
|
end
|
64
82
|
|
65
83
|
#the >/dev/tty after the ssh block redirects the full output to stdout, not /dev/null where it normally goes
|
66
|
-
`ssh -oStrictHostKeyChecking=no -tt #{ @config['cheftacular']['deploy_user'] }@#{ ip_address } "PGPASSWORD=#{ pg_pass } psql -U #{ db_user } -h #{ database_host }
|
84
|
+
`ssh -oStrictHostKeyChecking=no -tt #{ @config['cheftacular']['deploy_user'] }@#{ ip_address } "PGPASSWORD=#{ pg_pass } psql -U #{ db_user } -h #{ database_host } -d #{ db_name }" > /dev/tty`
|
85
|
+
end
|
86
|
+
|
87
|
+
def start_console_mongodb ip_address
|
88
|
+
#the >/dev/tty after the ssh block redirects the full output to stdout, not /dev/null where it normally goes
|
89
|
+
#TODO refactor to more general solution (path / port)
|
90
|
+
`ssh -oStrictHostKeyChecking=no -tt #{ @config['cheftacular']['deploy_user'] }@#{ ip_address } "mongo localhost:27017/mongodb" > /dev/tty`
|
67
91
|
end
|
68
92
|
|
69
93
|
def start_console_mysql
|
@@ -1,7 +1,8 @@
|
|
1
1
|
class Cheftacular
|
2
2
|
class ActionDocumentation
|
3
3
|
def deploy
|
4
|
-
@config['documentation']['action']
|
4
|
+
@config['documentation']['action'][__method__] ||= {}
|
5
|
+
@config['documentation']['action'][__method__]['long_description'] = [
|
5
6
|
"`cft deploy` will do a simple chef-client run on the servers for a role. " +
|
6
7
|
"Logs of the run itself will be sent to the local log directory in the application (or chef-repo) where the run was conducted.",
|
7
8
|
|
@@ -19,6 +20,8 @@ class Cheftacular
|
|
19
20
|
" 5. The `-v|--verbose` option will cause failed deploys to output to the terminal window and to their normal log file. Useful for debugging."
|
20
21
|
]
|
21
22
|
]
|
23
|
+
|
24
|
+
@config['documentation']['action'][__method__]['short_description'] = "Deploys the current code in the repository (runs chef-client)"
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
@@ -39,15 +42,10 @@ class Cheftacular
|
|
39
42
|
|
40
43
|
log_data, timestamp, exit_status = start_deploy( n.name, n.public_ipaddress, options, locs, passwords)
|
41
44
|
|
42
|
-
logs_bag_hash["#{ n.name }
|
45
|
+
logs_bag_hash["#{ n.name }-#{ __method__ }"] = { "text" => log_data.scrub_pretty_text, "timestamp" => timestamp, "exit_status" => exit_status }
|
43
46
|
end
|
44
47
|
|
45
|
-
|
46
|
-
if @config['cheftacular']['slack']['webhook']
|
47
|
-
logs_bag_hash.each_pair do |key, hash|
|
48
|
-
@config['stateless_action'].slack(hash['text'].prepend('```').insert(-1, '```')) if hash['exit_status'] && hash['exit_status'] == 1
|
49
|
-
end
|
50
|
-
end
|
48
|
+
@config['helper'].send_log_bag_hash_slack_notification(logs_bag_hash, __method__)
|
51
49
|
|
52
50
|
@config['ChefDataBag'].save_logs_bag unless @options['debug'] #We don't really need to store entire chef runs in the logs bag
|
53
51
|
|
@@ -1,9 +1,10 @@
|
|
1
1
|
class Cheftacular
|
2
2
|
class ActionDocumentation
|
3
3
|
def log
|
4
|
-
@config['documentation']['action']
|
4
|
+
@config['documentation']['action'][__method__] ||= {}
|
5
|
+
@config['documentation']['action'][__method__]['long_description'] = [
|
5
6
|
"`cft log` this command will output the last 500 lines of logs " +
|
6
|
-
"from every server set for
|
7
|
+
"from every server set for the repository (can be given additional args to specify) to the log directory",
|
7
8
|
|
8
9
|
[
|
9
10
|
" 1. `--nginx` will fetch the nginx logs as well as the application logs",
|
@@ -17,6 +18,8 @@ class Cheftacular
|
|
17
18
|
" 4. `--fetch-backup` If doing a pg_data log, this will fetch the latest logs from the pg_data log directory for each database."
|
18
19
|
]
|
19
20
|
]
|
21
|
+
|
22
|
+
@config['documentation']['action'][__method__]['short_description'] = 'Fetches logs from the remote servers'
|
20
23
|
end
|
21
24
|
end
|
22
25
|
|
@@ -26,6 +29,8 @@ class Cheftacular
|
|
26
29
|
|
27
30
|
nodes = @config['parser'].exclude_nodes( nodes, [{ unless: "role[#{ @options['role'] }]" }] )
|
28
31
|
|
32
|
+
nodes = @config['parser'].exclude_nodes( nodes, [{ if: "role[#{ @options['negative_role'] }]" }]) if @options['negative_role']
|
33
|
+
|
29
34
|
#this must always precede on () calls so they have the instance variables they need
|
30
35
|
options, locs, ridley, logs_bag_hash, pass_bag_hash, bundle_command, cheftacular, passwords = @config['helper'].set_local_instance_vars
|
31
36
|
|