2013-02-02 17:42:20 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use FindBin qw($Bin);
|
|
|
|
|
|
|
|
my $logdir = "$Bin/../logs";
|
|
|
|
|
|
|
|
unless (-d $logdir) {
|
|
|
|
mkdir $logdir, 0700 or die "mkdir: $!";
|
|
|
|
}
|
|
|
|
|
|
|
|
my $HOME = $ENV{HOME};
|
|
|
|
chdir $Bin or die;
|
|
|
|
|
|
|
|
print STDERR "Running camweb in $Bin on port 8080\n";
|
|
|
|
|
|
|
|
my $in_prod = -e "$HOME/etc/ssl.key"; # heuristic. good enough.
|
|
|
|
|
|
|
|
my @args;
|
2013-08-23 04:33:23 +00:00
|
|
|
push @args, "go", "run", "camweb.go", "logging.go", "godoc.go", "format.go", "dirtrees.go", "email.go";
|
2013-02-02 17:42:20 +00:00
|
|
|
push @args, "--root=$Bin";
|
|
|
|
push @args, "--logdir=$logdir";
|
|
|
|
push @args, "--buildbot_host=build.camlistore.org";
|
|
|
|
push @args, "--buildbot_backend=http://c1.danga.com:8080";
|
2013-06-24 22:50:49 +00:00
|
|
|
push @args, "--also_run=$Bin/scripts/run-blobserver";
|
2013-02-02 17:42:20 +00:00
|
|
|
if ($in_prod) {
|
2013-08-23 04:41:49 +00:00
|
|
|
push @args, "--email_dest=camlistore-commits\@googlegroups.com";
|
2013-06-12 09:23:08 +00:00
|
|
|
push @args, "--http=:8080";
|
2013-02-02 17:42:20 +00:00
|
|
|
push @args, "--https=:4430";
|
|
|
|
push @args, "--gerrithost=ec2-107-22-182-135.compute-1.amazonaws.com";
|
|
|
|
push @args, "--tlscert=$HOME/etc/ssl.crt";
|
|
|
|
push @args, "--tlskey=$HOME/etc/ssl.key";
|
|
|
|
while (1) {
|
|
|
|
system(@args);
|
|
|
|
print STDERR "Exit: $?; sleeping/restarting...\n";
|
|
|
|
sleep 5;
|
|
|
|
}
|
|
|
|
} else {
|
2013-07-08 10:24:10 +00:00
|
|
|
my $pass_file = "$ENV{HOME}/.config/camlistore/camorg-blobserver.pass";
|
|
|
|
unless (-s $pass_file) {
|
|
|
|
`mkdir -p $ENV{HOME}/.config/camlistore/`;
|
|
|
|
open (my $fh, ">$pass_file");
|
|
|
|
print $fh "foo\n";
|
|
|
|
close($fh);
|
|
|
|
}
|
2013-06-12 09:23:08 +00:00
|
|
|
push @args, "--http=127.0.0.1:8080"; # localhost avoids Mac firewall warning
|
2013-08-23 04:33:23 +00:00
|
|
|
push @args, @ARGV;
|
2013-02-02 17:42:20 +00:00
|
|
|
exec(@args);
|
|
|
|
die "Failed to exec: $!";
|
|
|
|
}
|