Backport windows/Deployers/Script

From Wikitech
Jump to navigation Jump to search

The following Bash script automates the steps in Backport windows/Deployers#SSH Connections and Error Logs:

function backport {
    # open browser window
    firefox \!/deploycal/current \ \ \ \ \
    # ensure the ssh key is in the agent and the ControlMaster connection is alive
    ssh mwdebug1001.eqiad.wmnet true
    # ensure the new tmux session will still be able to connect to the agent
    # (in case the tmux server was started before the agent was set up)
    tmux set-environment -g SSH_AUTH_SOCK "$SSH_AUTH_SOCK"
    # set up the backport/config terminal window:
    # logspam-watch deployment
    # mwdebug1001   mwmaint1002
    gnome-terminal --maximize \
        tmux \
        new-session -s backport ssh mwlog1001.eqiad.wmnet \; \
        split-window -h ssh deployment.eqiad.wmnet \; \
        split-window -t {left} -v ssh mwdebug1001.eqiad.wmnet \; \
        split-window -t {right} -v ssh mwmaint1002.eqiad.wmnet \; \
        send-keys -t {top-left} "exec logspam-watch" Enter \; \
        send-keys -t {top-right} "cd /srv/mediawiki-staging" Enter \; \
        select-pane -t {top-right} \;

It will open a new Firefox window with some relevant tabs, and a GNOME Terminal window with four SSH sessions arranged like this:

logspam-watch on mwlog1001, keep an eye on this deployment, run git fetch, scap sync-file etc. here
mwdebug1001, run scap pull here mwmaint1002, run mwscript here if necessary