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/console.rb,
lib/cheftacular/actions/migrate.rb,
lib/cheftacular/actions/db_console.rb
Instance Method Summary collapse
- #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
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 @options, @config = , config end |
Instance Method Details
#check ⇒ Object
3 4 5 6 7 8 |
# File 'lib/cheftacular/actions/check.rb', line 3 def check @config['documentation']['action'] << [ "`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." ] end |
#console ⇒ Object
3 4 5 6 7 |
# File 'lib/cheftacular/actions/console.rb', line 3 def console @config['documentation']['action'] << [ "`cft console` will create a pry session on the first node found for a codebase." ] end |
#db_console ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/cheftacular/actions/db_console.rb', line 3 def db_console @config['documentation']['action'] << [ "`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." ] ] end |
#deploy ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/cheftacular/actions/deploy.rb', line 3 def deploy @config['documentation']['action'] << [ "`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.", [ " 1. This command also restarts services on the server and updates the code. Changes behavior slightly with the `-z|-Z` args " + "but only if your cookbooks support switching revisions based on tags / branch names.", " 2. 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)." ] ] end |
#log ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cheftacular/actions/log.rb', line 3 def log @config['documentation']['action'] << [ "`cft log` this command will output the last 500 lines of logs " + "from every server set for CODEBASE (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." ] ] end |
#migrate ⇒ Object
3 4 5 6 7 8 |
# File 'lib/cheftacular/actions/migrate.rb', line 3 def migrate @config['documentation']['action'] << [ "`cft migrate` this command will grab the first alphabetical node for a repository " + "and run a migration that will hit the database primary server." ] end |
#run ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cheftacular/actions/run.rb', line 3 def run @config['documentation']['action'] << [ "`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"`' ] ] end |
#scale ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/cheftacular/actions/scale.rb', line 5 def scale @config['documentation']['action'] << [ "`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." ] ] end |
#tail ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/cheftacular/actions/tail.rb', line 3 def tail @config['documentation']['action'] << [ "`cft tail` 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)." ] ] end |