Go to content Go to menu

die 503 error, die!

Dec 5, 01:39 PM

For the longest time, I’ve just lived with a bad situation with how we’ve set up our DSpace instance. We reverse proxy from Apache to Tomcat, so we can run the DSpace webapps on port 80, which is handy for all sorts of reason we won’t get into here. But, the weird thing about it is, whenever I restarted all the services related to our repository, if I didn’t wait long enough, the first time I would visit the repository to confirm it was up, I’d get a 503 “Service Unavailable” error. Like I said, I’d just live with it, and usually I’d restart a few times before I’d garner the patience to just wait the appointed time (never could figure out exactly how long). Last night, I got sick of it, and googled for a fix, found a good clue here but the suggested value for retry (retry=0) made the 503 error permanent. The magic number for retry appears to be retry=1. This sets the retry timeout to 1 second, down from the default of 60 seconds. After a restart, a timeout will get triggered when Apache first tries to connect to Tomcat, because of course it’s not ready for connections yet, it’s still taking forever to boot up. So, if you visit a proxied link during the initial timeout, you just end up lengthening the timeout by a minute. Hence the very angry spirit scenario. But now, restarting our repository just works. Today is a very good day. If you’re curious, check to ProxyPass docs to see for yourself .


I just blundered across this github help article on how to check out a pull request locally. Now, while their syntax mentions “origin” I don’t see any reason why this wouldn’t work with “upstream.” I’m testing it now. If it works, I will update this article. Ideally, I’d like to figure out a one-line git command to add this to any upstream configuration, without having to munge the .git/config file by hand.

Confirmed, it works with upstream. AND there’s a simple command to enable this:

git config —add remote.upstream.fetch +refs/pull/*/head:refs/remotes/upstream/pr/*

Then all you have to do to try out a pull request is change to your clone of the repository, and check out the pull request:

git checkout pr/289 (I’m supposed to be testing that one, so I used it as an example)

This is WICKED COOL.

UPDATE: 2015-02-20

So, as cool as this all is, you have to be careful, as you’re checking out the branch as-is, you’re not rebasing it on top of master, or whatever branch into which you might want to actually merge this PR. No big deal, just, after you check out the pr branch, be sure to run:

git rebase -i master

or, you know, whatever branch you want to rebase upon.