Changeset 1414 for branches/locker-dev


Ignore:
Timestamp:
Jan 12, 2010, 11:55:27 PM (12 years ago)
Author:
ezyang
Message:
Merged in changes from trunk

--- Merging r1262 through r1413 into 'deploy/bin':
U    deploy/bin/django
   C deploy/bin/rails
   > Resolved by accepting working copy
--- Merging r1221 through r1413 into '.':
U    sql/bin/get-password
U    sql/bin/save-password
U    doc/tickets/rt.txt
U    doc/tickets/cnames.txt
U    bin/fix-php-ini
   C bin/scripts-rails
   > Resolved by accepting working copy
Skipped 'bin/for-each-server'
 U   bin
U    sbin/parallel-find.pl
U    sbin/commit-email.pl
U    sbin/commit-zephyr
Summary of conflicts:
  Tree conflicts: 2
  Skipped paths: 1

Location:
branches/locker-dev/locker
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/locker-dev/locker

  • branches/locker-dev/locker/bin

  • branches/locker-dev/locker/bin/fix-php-ini

    r1083 r1414  
    88if [ -f php.ini ]; then
    99        echo "Creating php.ini symlinks in child directories..."
    10         athrun scripts gfind . -mindepth 1 -type d -exec sh -c 'ln -sf "`echo "$1" | sed '\''s,[^/],,g; s,/,../,g'\''`php.ini" "$1/"' -- {} \;
     10        athrun scripts gfind . -mindepth 1 -type d \( -not -name .svn -not -name .git -or -not -prune \) -exec sh -c 'ln -sf "`echo "$1" | sed '\''s,[^/],,g; s,/,../,g'\''`php.ini" "$1/"' -- {} \;
    1111        echo "Done!"
    1212else
  • branches/locker-dev/locker/deploy/bin

    • Property svn:mergeinfo deleted
  • branches/locker-dev/locker/deploy/bin/django

    r1223 r1414  
    1616print FASTCGI <<EOF;
    1717#!/usr/bin/env python
    18 import sys, os
     18import sys, os, time, threading, django.utils.autoreload
    1919sys.path.insert(0, "/mit/$USER/Scripts/django")
    2020os.chdir("/mit/$USER/Scripts/django/$name")
    2121os.environ['DJANGO_SETTINGS_MODULE'] = "$name.settings"
     22
     23def reloader_thread():
     24  while True:
     25    if django.utils.autoreload.code_changed():
     26      os._exit(3)
     27    time.sleep(1)
     28t = threading.Thread(target=reloader_thread)
     29t.daemon = True
     30t.start()
    2231
    2332from django.core.servers.fastcgi import runfastcgi
     
    3847
    3948chdir "/mit/$USER/Scripts/django/";
    40 system qw{django-admin.py startproject}, $name;
     49system qw{django-admin startproject}, $name;
    4150chdir "$name";
    4251
     
    6574    while (<SETTINGS>) {
    6675      if (/^\)/) {
    67         print NEWSETTINGS "    'django.contrib.admin',\n";
    68         print NEWSETTINGS "    'django.contrib.admindocs',\n";
     76        print NEWSETTINGS "    'django.contrib.admin',\n";
     77        print NEWSETTINGS "    'django.contrib.admindocs',\n";
    6978      }
    7079      print NEWSETTINGS $_;
     
    114123print "  /mit/$USER/Scripts/django/$name/\n";
    115124print "To access manage.py, run 'ssh -k $USER\@scripts' and cd to the above directory.\n\n";
    116 print "When you edit your code, run the command\n";
    117 print "  touch /mit/$USER/web_scripts/$addrend/index.fcgi\n";
    118 print "before testing, to cause your site to reload the new code.\n";
    119125press_enter;
    120126
  • branches/locker-dev/locker/doc/tickets/cnames.txt

    r1026 r1414  
    2323   reap it; they should do so quickly. If it belongs to an FSILG, e-mail
    2424   ht-$ILG-acl (ht-et-acl, ht-pika-acl, etc.) and ask nicely. If it belongs
    25    to an academic network, they're not getting the name back unless they can
    26    negotiate with the current owner of the name
     25   to an academic network, they're not getting even deleted names back unless
     26   they can negotiate with the current owner of the name.
    2727
    28282. Check that they're requesting a scripts.mit.edu path that they control
     
    3636   before proceeding.
    3737
     38   Confirm that they're signed up for scripts. http://locker.scripts.mit.edu/
     39   should give something that isn't the "Account unknown" page.
     40
    38413. E-mail jweiss.
    3942   * Open the ticket in RT
    4043   * Click 'Comment' to the right of the body of the e-mail they sent
    4144   * CC: jweiss@mit.edu (Don't use "To:", there's a bug)
    42    * Write something nice. I typically use
     45   * Write something nice, preferably including the stella command line.
     46   I typically use
    4347   Subject: scripts CNAME request: foo.mit.edu
    4448
    45    At your convenience, please make foo.mit.edu an alias of scripts.mit.edu.
     49   At your convenience, please make foo.mit.edu an alias of scripts-vhosts.mit.edu.
     50
     51   stella scripts-vhosts -a foo
    4652       (or)
    4753   At your convenience, please move the alias foo.mit.edu from bar.mit.edu to
    48      scripts.mit.edu.
     54     scripts-vhosts.mit.edu.
     55
     56   stella bar -d foo
     57   stella scripts-vhosts -a foo
    4958       (or)
    5059   At your convenience, please rename the current host foo.mit.edu to
    51      foo-old.mit.edu and make foo.mit.edu an alias of scripts.mit.edu.
     60   foo-old.mit.edu and mark it as deleted, and make foo.mit.edu an
     61   alias of scripts-vhosts.mit.edu.
     62
     63   stella foo -S 3 -R foo-old
     64   stella scripts-vhosts -a foo
    5265       (or)
    5366   If the request below is sufficient authorization, please remove....
     
    5568   * Set Status => Waiting and Blocking On => Moira
    5669
    57    Occasionally jweiss is on vacation; check /mit/ops/Pager.Schedule for
    58    "!jweiss" entries. It's worth asking him ahead of time if he's around. If
     70   Occasionally jweiss is on vacation; generally he sets an auto-responder,
     71   so you can just try emailing him and hoping, or ask him if he's around. If
    5972   not, see if zacheiss or cfox or computing-help will handle the requests.
    6073   (zacheiss has been willing to do them in the past.)
     
    7285   or RewriteRules if they're having trouble.
    7386
    74 --geofft, last updated 2008-08-02
     87--geofft with minor edits by adehnert, last updated 2009-12-01
  • branches/locker-dev/locker/doc/tickets/rt.txt

    r1026 r1414  
    1010yourself of own updates" is on. You can also set the "Default Working Queue"
    1111to Scripts, and give yourself a signature referring to scripts@mit.edu.
    12 Another useful option here is to set a password, so you don't need certs to
    13 log in (and so you can use the zephyrbot).
    1412
    15 The zephyrbot (currently down) will take commands to -c scripts -i [ticket
    16 number] of the form /set status=resolved or /set owner=geofft.
     13Another useful option here is to set an RT passwordfor your account, so you
     14don't need certs to log in (though it sometimes will keep asking you for
     15your password on each page load if you don't have certs) and so you can use
     16the zephyrbot).  The zephyrbot will take commands to
     17-c scripts -i [ticket number] of the form /set status=resolved or
     18/set owner=geofft.  You need to drop a file in
     19/mit/geofft/web_scripts/rt/rt-passwords by your username with the format:
     20
     21"username" "yourawesomepassword"
     22
     23And then ask geofft (zwrite geofft) to restart the RT bot.
     24
     25Note that in the event that Geoff's account is compromised, it is possible
     26for an attacker to use this password do manipulate tickets in *any*
     27queue you have bits on, not just the Scripts one.
     28
     29The RT bot will post ticket notifications as -c scripts -i nnn.  If you are
     30responding to a ticket, it is conventional to post "lock" to the appropriate
     31instance, so others know not to pre-empt you.  You should post "unlock" once
     32you are done handling the ticket.
    1733
    1834You can also place these commands on a line by themselves inside e-mail; they
    1935will be acted upon and removed before the e-mail gets sent back out.
    2036
    21 Don't use the To field, it doesn't work. If you want to send the ticket somewhere else, use CC.
     37If you're adding a *comment* (such as when you're forwarding a cname request
     38on to IS&T), don't use the 'To:' field, because it'll be clobbered by our
     39RT scrips and the mail won't actually go to the destination you added.
     40Instead, you should use the 'Cc:' field.  Similarly, if you're adding
     41*correspondence*, the 'Cc:' field will be clobbered and you need to use
     42the 'To:' field.
    2243
    2344Don't CC other RT queues, it doesn't work. If you really need to, use your
  • branches/locker-dev/locker/sbin/commit-email.pl

    r719 r1414  
    11#!/usr/bin/env perl
     2
     3# ====================================================================
     4# This script is deprecated.  The Subversion developers recommend
     5# using mailer.py for post-commit and post-revprop change
     6# notifications.  If you wish to improve or add features to a
     7# post-commit notification script, please do that work on mailer.py.
     8# See http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/mailer .
     9# ====================================================================
    210
    311# ====================================================================
     
    1018# This script requires Subversion 1.2.0 or later.
    1119#
    12 # $HeadURL: http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/commit-email.pl.in $
    13 # $LastChangedDate: 2008-04-01 13:19:34 -0400 (Tue, 01 Apr 2008) $
    14 # $LastChangedBy: glasser $
    15 # $LastChangedRevision: 30158 $
     20# $HeadURL: http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/commit-email.pl.in $
     21# $LastChangedDate: 2009-05-12 13:25:35 -0400 (Tue, 12 May 2009) $
     22# $LastChangedBy: blair $
     23# $LastChangedRevision: 37715 $
    1624#
    1725# ====================================================================
     
    4452######################################################################
    4553# Configuration section.
     54
     55$ENV{'LC_ALL'} = 'en_US.UTF-8';
    4656
    4757# Sendmail path, or SMTP server address.
     
    558568    my @head;
    559569    my $formatted_date;
    560     if (defined $stdout)
     570    if ($stdout)
    561571      {
    562572        $formatted_date = strftime('%a %b %e %X %Y', localtime());
     
    753763    }
    754764
    755   my $openfork_available = $^O ne "MSWin32"; 
     765  my $openfork_available = $^O ne "MSWin32";
    756766  if ($openfork_available) # We can fork on this system.
    757767    {
     
    769779        }
    770780    }
    771   else  # Running on Windows.  No fork. 
     781  else  # Running on Windows.  No fork.
    772782    {
    773783      my @commandline = ();
    774784      my $arg;
    775      
     785
    776786      while ($arg = shift)
    777787        {
     
    780790          push(@commandline, $arg);
    781791        }
    782        
     792
    783793      # Now do the pipe.
    784794      open(SAFE_READ, "@commandline |")
  • branches/locker-dev/locker/sbin/commit-zephyr

    r748 r1414  
    1 #!/bin/sh
     1#!/bin/bash
     2#
     3# This is a script that can be called from a Subversion post-commit hook
     4# to zephyr a summary of the commit or the full commit.
     5#
     6# Use by putting something like the following in hooks/post-commit:
     7# REPOS="$1"
     8# REV="$2"
     9# /mit/snippets/svn-hooks/commit-zephyr "$REPOS" "$REV" -c scripts
     10# /mit/snippets/svn-hooks/commit-zephyr "$REPOS" "$REV" --full -c scripts-auto -i commits
    211
    3 CLASS=scripts
     12export LC_ALL=en_US.UTF-8
     13
     14CLASS=test
    415INSTANCE=@
    516FULL=0
     
    3950        echo svnlook diff "$REPOS" -r "$REV"
    4051    fi
    41 ) | zwrite -d -c "$CLASS" -i "$INSTANCE" -s "r$REV - $dirs"
     52) | zwrite -d -c "$CLASS" -i "$INSTANCE" -O "auto" -s "SVN: r$REV"
  • branches/locker-dev/locker/sbin/parallel-find.pl

    r730 r1414  
    22
    33# Script to help generate find the .scripts-version files
     4
     5use LockFile::Simple qw(trylock unlock);
     6use File::stat;
    47
    58use lib '/mit/scripts/sec-tools/perl';
     
    710open(FILE, "</mit/scripts/sec-tools/store/scriptslist");
    811my $dump = "/mit/scripts/sec-tools/store/versions";
     12my $dumpbackup = "/mit/scripts/sec-tools/store/versions-backup";
    913
    10 (! -e $dump) || die "Output directory exists: $dump";
    11 system("mkdir", $dump) && die;
     14# try to grab a lock on the version directory
     15trylock($dump) || die "Can't acquire lock; lockfile already exists at <$dump.lock>.  Another parallel-find may be running.  If you are SURE there is not, remove the lock file and retry.";
     16
     17sub unlock_and_die ($) {
     18    my $msg = shift;
     19    unlock($dump);
     20    die $msg;
     21}
     22
     23# if the versions directory exists, move it to versions-backup
     24# (removing the backup directory if necessary).  Then make a new copy.
     25if (-e $dump){
     26    if (-e $dumpbackup){
     27        system("rm -rf $dumpbackup") && unlock_and_die "Can't remove old backup directory $dumpbackup";
     28    }
     29    system("mv", $dump, $dumpbackup) && unlock_and_die "Unable to back up current directory $dump";
     30}
     31system("mkdir", $dump) && unlock_and_die "mkdir failed to create $dump";
    1232
    1333use Proc::Queue size => 40, debug => 0, trace => 0;
     
    2848}
    2949
     50sub old_version ($) {
     51    my $dirname = shift;
     52    open my $h, "$dirname/.scripts-version";
     53    chomp (my $v = (<$h>)[-1]);
     54    return $v;
     55}
     56
    3057sub version ($) {
    3158    my $dirname = shift;
    32     open my $h, "$dirname/.scripts-version";
    33     return (<$h>)[-1];
     59    $uid = stat($dirname)->uid;
     60    open my $h, "sudo -u#$uid git --git-dir=$dirname/.git describe --tags --always 2>/dev/null |";
     61    chomp($val = <$h>);
     62    if (! $val) {
     63        print "Failed to read value for $dirname\n"
     64    }
     65    return $val;
    3466}
    3567
     
    3870    my $homedir = shift;
    3971
    40     open my $files, "find $homedir/web_scripts -xdev -name .scripts-version 2>/dev/null |";
     72    open my $files, "find $homedir/web_scripts -xdev -name .scripts-version -o -name .scripts 2>/dev/null |";
    4173    open my $out, ">$dump/$user";
    4274    while (my $f = <$files>) {
    4375        chomp $f;
    44         $f =~ s!/\.scripts-version$!!;
     76        my $new_style;
     77        $new_style = ($f =~ s!/\.scripts$!!);
     78        if (! $new_style) {
     79            $f =~ s!/\.scripts-version$!!;
     80            # Don't use .scripts-version of .scripts is around!
     81            if (-d "$f/.scripts") {
     82                next;
     83            }
     84        }
    4585        if (! updatable($f)) {
    4686            print STDERR "not updatable: $f";
    4787            next;
    4888        }
    49         $v = version($f);
    50         print $out "$f:$v";
     89        $v = $new_style ? version($f) : old_version($f);
     90        print $out "$f:$v\n";
    5191    }
    5292    return 0;
     
    5797    my $f=fork;
    5898    if(defined ($f) and $f==0) {
    59         if ($homedir !~ m|^/afs/athena|) {
    60             print "ignoring non-athena-cell $user $homedir\n";
     99        if ($homedir !~ m|^/afs/athena| && $homedir !~ m|^/afs/sipb| && $homedir !~ m|^/afs/zone|) {
     100            print "ignoring foreign-cell $user $homedir\n";
    61101            exit(0);
    62102        }
    63         print "$user\n";
     103        print "$user\n";
    64104        $ret = find($user, $homedir);
    65         sleep rand 1;
    66         exit($ret);
     105        sleep rand 1;
     106        exit($ret);
    67107    }
    68108    1 while waitpid(-1, WNOHANG)>0; # avoids memory leaks in Proc::Queue
    69109}
     110
     111unlock($dump);
     1121;
  • branches/locker-dev/locker/sql/bin/get-password

    r1049 r1414  
    4848        case 1:
    4949                $myPassword = `/usr/bin/sql-signup`;
    50         file_put_contents($cnfPath, "[mysql]\nhost=$host\nuser=$env_user\npassword=$myPassword\n");
     50        file_put_contents($cnfPath, "[client]\nhost=$host\nuser=$env_user\npassword=$myPassword\n");
    5151        $cnfinfo = getMyCnfInfo($cnfPath);
    5252        if (is_array($cnfinfo)) {
  • branches/locker-dev/locker/sql/bin/save-password

    r382 r1414  
    88rm -f $lroot/.sql/my.cnf $lroot/.my.cnf
    99
    10 echo "[mysql]
     10echo "[client]
    1111host=sql.mit.edu
    1212user=$sqluser
Note: See TracChangeset for help on using the changeset viewer.