You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Backport windows/Deployers/Script: Difference between revisions

From Wikitech-static
Jump to navigation Jump to search
imported>Lucas Werkmeister (WMDE)
m (fix mwlog1001 datacenter)
imported>Lucas Werkmeister (WMDE)
m (update link anchor)
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The following Bash script automates the steps in [[Backport windows/Deployers#SSH Connections and Error Logs]]:
The following Bash script automates the steps in [[Backport windows/Deployers#SSH Connections and Error Logs: Set up before deploying]]:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 7: Line 7:
         https://wikitech.wikimedia.org/wiki/Deployments#!/deploycal/current \
         https://wikitech.wikimedia.org/wiki/Deployments#!/deploycal/current \
         https://wikitech.wikimedia.org/wiki/Backport_windows/Deployers \
         https://wikitech.wikimedia.org/wiki/Backport_windows/Deployers \
         https://logstash.wikimedia.org/app/kibana#/dashboard/mediawiki-errors \
         https://logstash.wikimedia.org/app/dashboards#/view/mediawiki-errors \
         https://logstash.wikimedia.org/app/kibana#/dashboard/mwdebug1002 \
         https://logstash.wikimedia.org/app/dashboards#/view/mwdebug1002 \
         https://integration.wikimedia.org/zuul/ \
         https://integration.wikimedia.org/zuul/ \
         https://versions.toolforge.org/
         https://versions.toolforge.org/
     # ensure the ssh key is in the agent and the ControlMaster connection is alive
     # ensure the ssh key is in the agent and the ControlMaster connection is alive
     ssh mwdebug1001.eqiad.wmnet true
     ssh mwdebug1002.eqiad.wmnet true
     # ensure the new tmux session will still be able to connect to the agent
     # 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)
     # (in case the tmux server was started before the agent was set up)
Line 18: Line 18:
     # set up the backport/config terminal window:
     # set up the backport/config terminal window:
     # logspam-watch deployment
     # logspam-watch deployment
     # mwdebug2001   mwmaint2001
     # mwdebug1002   mwmaint1002
     gnome-terminal --maximize \
     gnome-terminal --maximize \
         tmux \
         tmux \
         new-session -s backport ssh mwlog1001.eqiad.wmnet \; \
         new-session -s backport ssh mwlog1002.eqiad.wmnet \; \
         split-window -h ssh deployment.eqiad.wmnet \; \
         split-window -h ssh deployment.eqiad.wmnet \; \
         split-window -t {left} -v ssh mwdebug2001.codfw.wmnet \; \
         split-window -t {left} -v ssh mwdebug1002.eqiad.wmnet \; \
         split-window -t {right} -v ssh mwmaint2001.codfw.wmnet \; \
         split-window -t {right} -v ssh mwmaint1002.eqiad.wmnet \; \
         send-keys -t {top-left} "exec logspam-watch" Enter \; \
         send-keys -t {top-left} "exec logspam-watch" Enter \; \
         send-keys -t {top-right} "cd /srv/mediawiki-staging" Enter \; \
         send-keys -t {top-right} "cd /srv/mediawiki-staging" Enter \; \
Line 34: Line 34:
and a GNOME Terminal window with four SSH sessions arranged like this:
and a GNOME Terminal window with four SSH sessions arranged like this:
{|class="wikitable" style="width: 40em; height: 30ch;"
{|class="wikitable" style="width: 40em; height: 30ch;"
| style="width: 50%; height: 50%;" | logspam-watch on [[mwlog1001]], keep an eye on this
| style="width: 50%; height: 50%;" | logspam-watch on [[mwlog1002]], keep an eye on this
| style="width: 50%; height: 50%;" | [[deployment.eqiad.wmnet|deployment]], run <code>git fetch</code>, <code>scap sync-file</code> etc. here
| style="width: 50%; height: 50%;" | [[deployment.eqiad.wmnet|deployment]], run <code>git fetch</code>, <code>scap sync-file</code> etc. here
|-
|-
| style="width: 50%; height: 50%;" | [[mwdebug1001]], run <code>scap pull</code> here
| style="width: 50%; height: 50%;" | [[mwdebug1002]], run <code>scap pull</code> here
| style="width: 50%; height: 50%;" | [[mwmaint1002]], run <code>mwscript</code> here if necessary
| style="width: 50%; height: 50%;" | [[mwmaint1002]], run <code>mwscript</code> here if necessary
|}
|}
[[Category:Deployment]]

Latest revision as of 15:28, 13 December 2021

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

function backport {
    # open browser window
    firefox \
        https://wikitech.wikimedia.org/wiki/Deployments#!/deploycal/current \
        https://wikitech.wikimedia.org/wiki/Backport_windows/Deployers \
        https://logstash.wikimedia.org/app/dashboards#/view/mediawiki-errors \
        https://logstash.wikimedia.org/app/dashboards#/view/mwdebug1002 \
        https://integration.wikimedia.org/zuul/ \
        https://versions.toolforge.org/
    # ensure the ssh key is in the agent and the ControlMaster connection is alive
    ssh mwdebug1002.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
    # mwdebug1002   mwmaint1002
    gnome-terminal --maximize \
        tmux \
        new-session -s backport ssh mwlog1002.eqiad.wmnet \; \
        split-window -h ssh deployment.eqiad.wmnet \; \
        split-window -t {left} -v ssh mwdebug1002.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 mwlog1002, keep an eye on this deployment, run git fetch, scap sync-file etc. here
mwdebug1002, run scap pull here mwmaint1002, run mwscript here if necessary