Closed Bug 557049 Opened 15 years ago Closed 15 years ago

[amo] monitor zamboni wsgi in prod

Categories

(Infrastructure & Operations Graveyard :: WebOps: Other, task)

All
Other
task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jbalogh, Assigned: oremj)

References

()

Details

(Whiteboard: Waiting until /services/loaded is in production.)

We updated to 5.8.3 on Thursday, but I left out touching the .wsgi file from the upgrade script. It appears that the code got updated but apache is still running the old code. We're getting tracebacks that shouldn't be possible anymore, and the line numbers are all wrong. `touch /data/amo_python/www/services.prod/zamboni/wsgi/zamboni.wsgi` will force mod_wsgi to reload. `rm **/*.pyc` for extra paranoia.
Jeff wrote a short script to check if wsgi is older than the git update: > from datetime import datetime > import os > import subprocess > import sys > > GIT = "git log -1 --date=local | grep Date: | sed 's/Date: *//'" > > wsgi = datetime.fromtimestamp(os.stat('wsgi/zamboni.wsgi').st_mtime) > git_ = subprocess.Popen(GIT, stdout=subprocess.PIPE, shell=True).communicate()[0] > git = datetime.strptime(git_.strip(), '%a %b %d %H:%M:%S %Y') > > if wsgi > git: > print "ok" > sys.exit(0) > else: > print "wsgi is too old" > sys.exit(2) We could add that to nagios to make sure this doesn't happen again.
Assignee: server-ops → thardcastle
Assignee: thardcastle → jeremy.orem+bugs
Apache was restarted after the updated. Even if it isn't updated I have MaxRequestsPerChild set at 100, so the processes should refresh fairly quickly. Looks like no .pyc files. /data/bin/issue-multi-command.py -c 1 amo 'find /data/amo_python/www/prod | grep pyc' ===pm-app-amo02=== ===pm-app-amo03=== ===pm-app-amo04=== ===pm-app-amo05=== ===pm-app-amo07=== ===pm-app-amo08=== ===pm-app-amo10=== ===pm-app-amo11=== ===pm-app-amo12=== ===pm-app-amo13=== ===pm-app-amo14=== ===pm-app-amo15=== ===pm-app-amo16=== ===pm-app-amo17=== ===pm-app-amo18=== ===pm-app-amo19=== ===pm-app-amo20=== ===pm-app-amo21=== ===pm-app-amo24=== ===pm-app-amo25=== ===pm-app-amo26===
Summary: [amo] touch zamboni.wsgi on prod → [amo] monitor zamboni wsgi in prod
Severity: major → normal
(In reply to comment #2) > Apache was restarted after the updated. Even if it isn't updated I have > MaxRequestsPerChild set at 100, so the processes should refresh fairly quickly. Hmm, it seemed like something was not right. I haven't seen any timeouts since April 3rd, so we'll see how it goes. With the MaxRequests, would that re-read the source or make a new fork from the parent mod_wsgi? > Looks like no .pyc files. That seems...unlikely. I don't know why Python wouldn't be creating .pyc files. Oh, maybe it doesn't have write perms on those files? > /data/bin/issue-multi-command.py -c 1 amo 'find /data/amo_python/www/prod | > grep pyc' Is the source for that available somewhere? I'm just curious.
(In reply to comment #3) > (In reply to comment #2) > > Apache was restarted after the updated. Even if it isn't updated I have > > MaxRequestsPerChild set at 100, so the processes should refresh fairly quickly. > > Hmm, it seemed like something was not right. I haven't seen any timeouts since > April 3rd, so we'll see how it goes. > > With the MaxRequests, would that re-read the source or make a new fork from the > parent mod_wsgi? Now that I think about it, this might not reload mod_wsgi at all since it is in daemon mode. > > > Looks like no .pyc files. > > That seems...unlikely. I don't know why Python wouldn't be creating .pyc > files. > > Oh, maybe it doesn't have write perms on those files? All the directories are owned by root, so it doesn't have write perms. > > > /data/bin/issue-multi-command.py -c 1 amo 'find /data/amo_python/www/prod | > > grep pyc' > > Is the source for that available somewhere? I'm just curious. http://gist.github.com/356796
I'm not sure this script will work. We don't sync out zamboni's .git. Any other ideas? (In reply to comment #1) > Jeff wrote a short script to check if wsgi is older than the git update: > > > from datetime import datetime > > import os > > import subprocess > > import sys > > > > GIT = "git log -1 --date=local | grep Date: | sed 's/Date: *//'" > > > > wsgi = datetime.fromtimestamp(os.stat('wsgi/zamboni.wsgi').st_mtime) > > git_ = subprocess.Popen(GIT, stdout=subprocess.PIPE, shell=True).communicate()[0] > > git = datetime.strptime(git_.strip(), '%a %b %d %H:%M:%S %Y') > > > > if wsgi > git: > > print "ok" > > sys.exit(0) > > else: > > print "wsgi is too old" > > sys.exit(2) > > We could add that to nagios to make sure this doesn't happen again.
We could check that zamboni.wsgi is newer than any other .py or .html files in the tree.
For production we typically restart apache instead of touching zamboni.wsgi. Should we start touching it instead or can you think of another way to do this?
We need to restart apache to pick up .mo changes at least until PHP goes away. I don't know how wsgi+.mo works, does it still need restarting?
14:05 < jbalogh> oremj: I just pushed /services/loaded
Whiteboard: Waiting until /services/loaded is in production.
This is expected to go to prod on 6/1.
Do we want to do something like this? http://gist.github.com/441263
Final monitor: http://gist.github.com/441263 Nagios is monitoring it now.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Can you add a comment to the top about what it does and add it to http://github.com/jbalogh/zamboni/tree/master/scripts/ ? Thanks.
Component: Server Operations: Web Operations → WebOps: Other
Product: mozilla.org → Infrastructure & Operations
Product: Infrastructure & Operations → Infrastructure & Operations Graveyard
You need to log in before you can comment on or make changes to this bug.