Class: Cheftacular::ActionDocumentation
- Inherits:
-
Object
- Object
- Cheftacular::ActionDocumentation
- Defined in:
- lib/cheftacular/action.rb,
lib/cheftacular/actions/log.rb,
lib/cheftacular/actions/run.rb,
lib/cheftacular/actions/tail.rb,
lib/cheftacular/actions/check.rb,
lib/cheftacular/actions/scale.rb,
lib/cheftacular/actions/deploy.rb,
lib/cheftacular/actions/verify.rb,
lib/cheftacular/actions/backups.rb,
lib/cheftacular/actions/console.rb,
lib/cheftacular/actions/migrate.rb,
lib/cheftacular/actions/db_console.rb
Instance Method Summary collapse
- #backups ⇒ Object
- #check ⇒ Object
- #console ⇒ Object
- #db_console ⇒ Object
- #deploy ⇒ Object
-
#initialize(options, config) ⇒ ActionDocumentation
constructor
A new instance of ActionDocumentation.
- #log ⇒ Object
- #migrate ⇒ Object
- #run ⇒ Object
- #scale ⇒ Object
- #tail ⇒ Object
- #verify ⇒ Object
Constructor Details
#initialize(options, config) ⇒ ActionDocumentation
Returns a new instance of ActionDocumentation.
4 5 6 |
# File 'lib/cheftacular/action.rb', line 4 def initialize , config , @config = , config end |
Instance Method Details
#backups ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cheftacular/actions/backups.rb', line 4 def backups @config['documentation']['action'][__method__] ||= {} @config['documentation']['action'][__method__]['long_description'] = [ "`cft backups [activate|deactivate|fetch|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", [ " 1. `activate` will turn on automated backup running (turns on the flag for the env in the config bag).", " 2. `deactivate` will turn off automated backup running.", " 3. `fetch` will fetch the latest backup and drop it onto your machine. This argument accepts the --save-to-file LOCATION flag.", " 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.", " 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.", " 6. `status` will display the current state of the backups", " 6. By default, the backups command will use the context of your current environment to trigger backup related commands." ] ] @config['documentation']['action'][__method__]['short_description'] = 'Runs various backup commands on your current environment' end |
#check ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cheftacular/actions/check.rb', line 3 def check @config['documentation']['action'][__method__] ||= {} @config['documentation']['action'][__method__]['long_description'] = [ "`cft check [all|verify]` 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.", [ " 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).", " 2. If the all argument is provided, all repositories will be checked for the current environment", " 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`", " 4. Aliased to `cft ch`" ] ] @config['documentation']['action'][__method__]['short_description'] = "Checks the branches currently deployed to an env for your repo" end |
#console ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/cheftacular/actions/console.rb', line 3 def console @config['documentation']['action'][__method__] ||= {} @config['documentation']['action'][__method__]['long_description'] = [ "`cft console` will create a console session on the first node found for a repository.", [ " 1. Attempts to setup a console for the unique stack, stacks currently supported for console is only Rails.", " 2. If there is a node in the repository set that has the role `preferred_console`, this node will come before others.", " 3. Aliased to `cft co`" ] ] @config['documentation']['action'][__method__]['short_description'] = 'Create a remote console for the current repository' end |
#db_console ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/cheftacular/actions/db_console.rb', line 3 def db_console @config['documentation']['action'][__method__] ||= {} @config['documentation']['action'][__method__]['long_description'] = [ "`cft db_console` " + "will create a database console session on the first node found for a database stack in the current environment.", [ " 1. This command is aliased to psql, typing `cft psql` will drop you into a rails stack database psql session.", " 2. This command is also aliased to mongo, typing `cft mongo` will drop you into a mongodb mongo session." ] ] @config['documentation']['action'][__method__]['short_description'] = 'Creates a remote database console session for the current repository' end |
#deploy ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/cheftacular/actions/deploy.rb', line 3 def deploy @config['documentation']['action'][__method__] ||= {} @config['documentation']['action'][__method__]['long_description'] = [ "`cft deploy [check|verify]` 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.", [ " 1. The `-Z REVISION` flag can be used with TheCheftacularCookbook to set a revision your app will run. ", " 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).", " 3. The `-z|--unset-github-deploy-args` option will clear your current `-Z` and `-O` flags.", " 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).", " 5. The `-v|--verbose` option will cause failed deploys to output to the terminal window and to their normal log file. Useful for debugging.", " 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`", " 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`", " 8. Deploy locks (if set in the cheftacular.yml for the repo(s)) can be bypassed with the `--override-deploy-locks` flag", " 9. Aliased to `cft d`" ] ] @config['documentation']['action'][__method__]['short_description'] = "Deploys the current code in the repository (runs chef-client)" end |
#log ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cheftacular/actions/log.rb', line 3 def log @config['documentation']['action'][__method__] ||= {} @config['documentation']['action'][__method__]['long_description'] = [ "`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", [ " 1. `--nginx` will fetch the nginx logs as well as the application logs", " 2. `--full` will fetch the entirety of the logs (will fetch the entire nginx log too if `--nginx` is specified)", " 3. `--num INTEGER` will fetch the last INTEGER lines of logs", " 1. `-l|--lines INTEGER` does the exact same thing as `--num INTEGER`.", " 4. `--fetch-backup` If doing a pg_data log, this will fetch the latest logs from the pg_data log directory for each database." ] ] @config['documentation']['action'][__method__]['short_description'] = 'Fetches logs from the remote servers' end |
#migrate ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/cheftacular/actions/migrate.rb', line 3 def migrate @config['documentation']['action'][__method__] ||= {} @config['documentation']['action'][__method__]['long_description'] = [ "`cft migrate` this command will grab the first alphabetical node for a repository " + "and run a migration that will hit the database primary server.", [ " 1. Currently only supports rails stacks." ] ] @config['documentation']['action'][__method__]['short_description'] = 'Creates a database migration on the current environment' end |
#run ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cheftacular/actions/run.rb', line 3 def run @config['documentation']['action'][__method__] ||= {} @config['documentation']['action'][__method__]['long_description'] = [ "`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.", [ " 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.", " 2. EX: `cft run rake routes`", " 3. EX: `cft run ruby lib/one_time_fix.rb staging 20140214` This command can be used to run anything, not just rake tasks. " + "It prepends bundle exec to your command for rails stack repositories", " 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"`', " 5. Can also be used to run meteor commands and is aliased to `cft meteor`" ] ] @config['documentation']['action'][__method__]['short_description'] = 'Runs a command on the current environment for the current repository' end |
#scale ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/cheftacular/actions/scale.rb', line 5 def scale @config['documentation']['action'][__method__] ||= {} @config['documentation']['action'][__method__]['long_description'] = [ "`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.", [ " 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." ] ] @config['documentation']['action'][__method__]['short_description'] = 'Scales an environment up or down (relies on roles)' end |
#tail ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cheftacular/actions/tail.rb', line 3 def tail @config['documentation']['action'][__method__] ||= {} @config['documentation']['action'][__method__]['long_description'] = [ "`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", [ " 1. pass `-n NODE_NAME` to grab the output of a node other than the first.", " 2. Workers and job servers change the output of this command heavily. " + "Worker and job servers should tail their log to the master log (/var/log/syslog) where <b>all</b> of the major processes on the server output to. " + "While the vast majority of this syslog will be relevant to application developers, some will not (usually firewall blocks and the like).", " 3. if the `PATTERN_TO_MATCH` argument exists, the tail will only return entries that have that pattern rather than everything written to the file." ] ] @config['documentation']['action'][__method__]['short_description'] = 'Tails the logs of the first node found for the current repository' end |
#verify ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/cheftacular/actions/verify.rb', line 3 def verify @config['documentation']['action'][__method__] ||= {} @config['documentation']['action'][__method__]['long_description'] = [ "`cft verify` Checks to see if the servers for the current state are running the latest commits. ", [ " 1. This command is functionally the same as `cft check verify`.", " 2. This command is aliased to `cft ve`" ] ] @config['documentation']['action'][__method__]['short_description'] = "Checks the commits currently deployed to an env for your repo" end |