The My Andrew web publishing workflow is a little strange. Once you get everything setup, maintenance is a pain. Once you copy the updated files to ~/www, you must visit a webpage to “publish” those files. Presumably the script that copies the files from ~/www to somewhere else in the infrastructure does some security checking or something.
Visiting a webform is a pain. Luckily, it is unauthenticated and uses GET so it is simplicity itself to “publish” from the command line. A quick script:
#!/bin/sh
#Change these to where your local copy of www sits and your username
SOURCE=/home/nathanvan/winhome/workspace/www/
USER=nmv
rsync -rv $SOURCE $USER@unix.andrew.cmu.edu:www
#Since I'm triggering an event, I'm not worried about certificate integrity.
wget --no-check-certificate 'https://www.andrew.cmu.edu/cgi-bin/publish?FLAG=0&NAME='$USER
#Clean up what wget left behind.
rm 'publish@FLAG=0&NAME='$USER
Clearly there are other ways to do this, but this is simple and compatible with my workflow. Since I don’t do this often, I’m okay with typing my password. I could use ssh-agent and such, but I haven’t got that setup on this machine yet and doubtfully ever will.
Hey Nathan! I googled to see if Andrew supports rsync and your page was the top hit. Small world. 😉
Thanks for writing up the shell commands. Here’s a version that uses `curl` to save the `rm`: https://gist.github.com/1221003
Oh, and I just discovered that if you use http://www.contrib.andrew.cmu.edu you don’t have to publish at all. The CMU Computer Club serves it directly from the Andrew AFS: http://www.club.cc.cmu.edu/services
Plus they execute CGI and PHP scripts:
http://www.contrib.andrew.cmu.edu/~taleahma/info.php
That makes total sense about curl. Thanks for cleaning up the script and putting it on github.
The problem with contrib is that it is *really* slow and can’t handle any kind of load. When I tried to use it for my Amazon Mechanical Turk experiments, even just a few Turkers hitting my page simultaneously dropped the response to a crawl. It was enough to get me to keep using the weird andrew publishing workflow.
Oh thanks for the warning!