Deploy commands¶
scap deploy¶
The deploy command handles deployment of various wikimedia projects from the deployment server to a staging or production environment.
Tags the current revision in the current git directory
Runs git update-server-info for the current git directory (as well as for any submodules)
SSHs into each server in the dsh_targets file
Runs git fetch in the /srv/deployment/{repo} directory of each target (running checkout if it does not exist)
Checks out the tag created in step 1 on each of the target machines
If a service_name is specified, the service is restarted. Multiple services may be specified by separating them with commas, e.g.,
service1, service2
. A service can be reloaded by appending=reload
to the service’s name, e.g.,service1, service2 = reload
.If a service_port is specified, make sure that it is accepting connections, waiting up to service_timeout (120 seconds by default)
usage: scap deploy [-h] [--conf CONF_FILE] [--no-shared-authsock]
[-D <name>:<value>] [--verbose] [--environment ENVIRONMENT]
[--no-log-message] [--no-local-config] [-r REV]
[-s {fetch,config_deploy,promote}] [-l LIMIT_HOSTS] [-f]
[--dry-run] [--service-restart] [-i]
[message [message ...]]
Sync new service code across cluster.
positional arguments:
message Log message for SAL
optional arguments:
-h, --help show this help message and exit
-r REV, --rev REV Specify the revision to deploy
-s {fetch,config_deploy,promote}, --stages {fetch,config_deploy,promote}
Execute specific deployment stages (For testing)
-l LIMIT_HOSTS, --limit-hosts LIMIT_HOSTS
Limit actions to hosts matching expression
-f, --force Force fetch and checkout even if nothing changed.
--dry-run Compile and deploy config files to a temp location and
output a diff against the previously deployed config
files.
--service-restart Skip deployment, just restart the service.
-i, --init Setup a repo for initial deployment
global arguments:
Although these arguments can be passed to all scap (sub-)commands, not all
commands are affected by every global argument.
--conf CONF_FILE Path to configuration file
--no-shared-authsock Ignore any shared ssh-auth configuration
-D <name>:<value>, --define <name>:<value>
Set a configuration value
--verbose Verbose output
--environment ENVIRONMENT
environment in which to execute scap
--no-log-message Do not log messages to the public (IRC)
--no-local-config Do not load configuration from the ./scap directory
See also
scap.Deploy
scap deploy-log¶
The scap deploy-log command provides powerful filters for the scap deploy logs.
The main deploy application sends all structured log output to a file under
scap/log/git-tag.log
. deploy-log is meant to run during or after a
deploy, potentially in a separate terminal. Log entries can be filtered on
one or more fields using a given free-form expression. By default
scap deploy-log will periodically scan the scap/log directory for new
files and immediately begin tailing any newly discovered log file.
As an alternative to the default behavior, you can either specify the log file
to parse via the scap deploy-log --file
option or choose the newest log file by using
scap deploy-log --latest
; in this case, it will simply filter the entire file for
matching records and exit, rather than watching for more log files to be
created.
The default behavior is convenient for monitoring an ongoing deployment from a separate terminal. Simply start scap deploy-log in a separate terminal prior to running scap deploy. Once your deployment starts, scap deploy-log will discover the new log file and immediately begin displaying relevant log messages
Usage¶
scap deploy-log [--file <file>] [--latest] [-v] [expr]
scap deploy-log [--file <file>] [--latest] [-v] [expr]
- -f <file>, --file <file>¶
Used to explicitly specify the log file to be parsed. If no file is specified then deploy-log will automatically open any newly created log files and immediately begin outputting any matching log messages.
- -l, --latest¶
Parse and filter the latest log file, exiting once the entire file has been processed.
- -v, --verbose¶
Produce verbose output
- expr¶
Optional filter expression which is used to match log entries in <file>
Examples¶
# show verbose output:
scap deploy-log -v
# tail the most recent log file:
scap deploy-log --latest
# show log messages for the host named scap-target-01
scap deploy-log 'host == scap-target-01'
# show log messages matching a regex pattern:
scap deploy-log 'msg ~ "some important (message|msg)"'
# show WARNING messages for hosts whose name begins with "scap-target-"
scap deploy-log 'levelno >= WARNING host == scap-target-*'
See also
scap.DeployLog()