SRE/Clinic Duty

The SRE Clinic Duty was established to ensure that tickets (and thus requests and projects) are triaged and processed in a timely fashion, providing feedback and regular updates to SRE-supported projects/responsibilities.
This is a duty that is fulfilled by a member of the Wikimedia SRE team (each member changes on a rotating schedule).
== Expectations ==
;This should be an infrequent event for your team
:The same person should not go two weeks in a row, and no team should be affected two weeks in a row. The roster currently includes only members of the SRE team but this can eventually expand. People serve clinic duty at roughly equal frequencies
;The right people are conscripted
:If someone is doing their first clinic duty, they are backed up by a more experienced clinician, in a similar time zone. The roster excludes managers and directors.
;This is a routine affair
:The schedule runs from Monday to the end of your Friday
;Be available and ready to do gruntwork
:During SRE Clinic Duty the SRE on duty should remain available in IRC and email; This duty is fairly interrupt-driven, and will interrupt a person's normal workflow on the week they are on duty. The person on clinic duty is a first contact, including on IRC (timezone/availability permitting). However, This duty shouldn't normally require any adjustment to one's normal working schedule; if you work business hours in CET, then you wouldn't shift your hours on clinic duty for another time zone. Clinic duty is not expected to be performed during weekends and holidays.
:Follow up with ticket owners and requestors as needed on old tickets to resolve, re-assign, or escalate as needed. Folks will, in turn, follow up with you after your shift is done. As the person on clinic duty you are welcome to join #wikimedia-clinic for assistance while carrying out your shift
:Monitor the appropriate inboxes/mailing lists: Triage any mailing list requests for operations lists; Triage emails sent to root@ (if you don't receive them, you need to add your alias in the private repo). If you see a recurrent issue, please open a sub-task to T132324 and try to notify whoever you think can contribute to the task. Review the outstanding sub-tasks and follow up as needed.
==Handing off duties==
Ideally all phabricator tasks are replied/commented upon in the process of reviewing and triaging, so no actual handoff of duties is required between weeks. The topic in IRC channel #wikimedia-operations, section SRE Clinic Duty: is updated automatically and according to the Clinic Duty schedule on VictorOps.
==Responsibilities==
===Review incoming tasks===
All incoming Clinic Duty tasks in phabricator can be viewed on the SRE Clinic Duty Dashboard. Additionally, the Workboard Links panel provides links to boards of specific projects.
==== Access requests ====
Review, obtain approvals and grant appropriate access for requests on the SRE Access Requests and LDAP access requests panels. See SRE/Clinic Duty/Access requests for detailed steps.
The relevant Phabricator tags are:
* #sre-access-requests
* #ldap-access-requests
* #wmf-nda-requests (with #SRE tagged)
==== Task triage ====
Escalate, update, and follow up as needed for any incoming tasks to ensure they are worked upon.
*If the request is relatively quick and you know how to solve it, just do it yourself.
*Ask for more data from requester if needed in order to confirm the request, such as date it must be completed by, additional details, etc.
*Tag the task with all the relevant teams. Use the tag list as guidance. 
*If the task doesn't look like SRE work, mention that in the comment and remove the #SRE tag.
*If the task looks like SRE work but you cannot identify the correct team, tag it with #sre-unowned.
=== Maintain the maintenance calendar ===
Wikimedia maintains a calendar for Vendor Maintenance events. This calendar must be kept up-to-date so that the team knows when datacenter maintenance occurs.
As a prerequisite, one should have access either through individual membership or inherited permissions from being a member of the sre group. If not, ask an existing member to add you; they should have the permissions to do so even if not owner/manager of the group.
Presently, processing these messages is highly manual:
# Go to the Google group ops-maintenance and filter by "resolved status: unresolved"
#:
#Open the Ops vendor maintenance and contracts calendar in a second tab.
#Read each message and determine if the email needs action. If so, add an event to the Google calendar:
##Copy the important part of the subject line or the summary and use it as the event title.
##Switch the calendar from your personal calendar to the Vendor Maintenance calendar.
##Mark the event as Free instead of Busy.
##Copy the contents of the email into the description of the calendar event.
##Put the correct time from the message in, converting as necessary.
#Click "Mark as complete" on each mail that has been processed in one way or another.
#Repeat until there are no mails left that require action.
==== What needs to be added? ====
* Events that only reduce redundancy are not needed
===Handle incoming IRC requests===
If somebody asks SRE to do something via IRC, politely ask the requestor to turn their request into a Phabricator ticket and add the SRE tag to it.
If you suspect the issue could be related to a recent deployment or need further investigation by deployers or developers, on the Phabricator ticket, add the Wikimedia-production-error tag to it.
===Phabricator Administration===
If an SRE clinic duty person has to login, please do so by accessing the phabricator servers. These have role(phabricator) in site.pp, but are typically phab[12]001.
Once in the system, the admin account login can be generated via URL path, by running sudo /srv/phab/phabricator/bin/auth recover admin. The system will output a full url path for a one time login token as the Admin user. You can then navigate to the offending file or herald rule and delete it via the web ui.
===Mail aliases===
Go to the puppet master (puppetmaster1001), cd to /srv/private/modules/privateexim/files/ in the private repo, usually edit the file wikimedia.org (as root) and sudo git commit. This will create a mail to SRE about the commit, with your username automatically prepended to the commit message.
You can then run puppet on mx1001 and mx2001 to confirm your changes have been applied.
There are 3 types of domains:
a) domains that have their own alias file (wikimedia.org, wikipedia.org and a few others), you will find these files in /srv/private/modules/privateexim/files, just edit them there, sudo git commit, and presto!!!, as with any other change in the private repo.
b) domains that just link to wikimediafoundation.org. These are just symlinks and puppet generates them. If you need to add a new one or change links, go to /srv/private/modules/privateexim/manifests/mail.pp. You will find it in class exim::aliases::private and should be self-explanatory.
c) domains that link to another domain. currently just wikivoyage.de to .org, same as in b) but a separate definition in the puppet class.
It is nice to add the corresponding Phab ticket number in a comment near changed aliases. Experience shows that it can be quite handy to be able to quickly answer questions like when exactly something has been changed and who requested it. There is one file or symlink per domain name. 95% of the time the requests are just regarding the "wikimedia.org" file. In other cases make sure you check for possible symlinks and realize which domains you are actually changing when editing a specific file.
===Mailman mailing lists===
Public mailing lists should typically be requested through Phabricator tagged with "Wikimedia-Mailing-lists" (as part of Clinic Duty review the list creation/maintenance columns), and Phabricator-maintenance-bot will automatically add the SRE tag. Google mailing lists are managed by ITS. You know it's a mailman list if it's @lists.wikimedia.org. To check if an email address exists in Google you can do "exim4 -bt foo@wikimedia.org" on an MX server.
;Create a list
:Follow the normal procedure to create a Mailman mailing list.
;Disable a list
:When you get a request to disable a mailman list, you just have to run a shell script on the list server, see Mailman#Disable_or_re-enable_a_mailing_list. In addition it's nice if you login once using the master password and remove the former admins email addresses from the "list run by" field.
;Add/remove owners
:Login as administrator in lists.wikimedia.org (the password is in pwstore). Then go to the mailing list administrator page (e.g. here is for math@ then go to Users tab and adjust Owners accordingly.
=== Removing access ===
This typically isn't part of Clinic Duty, but if you need it you can find the relevant steps at SRE_Offboarding#All_Users.
===Server power cycling===
SRE clinic duty paging for reboots is usually due to hardware failure, or immediate concerns of exploits. Anything outside those issues would be handled by normal operations workflow, and would not necessarily fall to the SRE clinic duty person.
Power cycling requires a passing familiarity with the different out of band management options we use (based on vendor). Hardware type can be determined by looking up the hardware in question in Netbox; then you can determine the instructions from Platform-specific_documentation.
=== Maps external usage requests ===
The main thing to check is that the domain belongs to a project being supported by one of the Wikimedia movement affiliates. Usually the requester will belong to an affiliate or there will be a wiki page explaining the project and which affiliate is backing it.
If that all checks out, it should be fine to add the domain to the VCL regex.
Category:How-To