mirror of https://github.com/perkeep/perkeep.git
website: unify run shell scripts, make it run on OS X (so rewrite in Perl)
Change-Id: I0b0d91935a988cdc9b66bfc4eaba4ee3c16cb407
This commit is contained in:
parent
ed40fc89f7
commit
66e216ae4e
|
@ -52,7 +52,7 @@ var (
|
|||
tlsKeyFile = flag.String("tlskey", "", "TLS private key file")
|
||||
gerritUser = flag.String("gerrituser", "ubuntu", "Gerrit host's username")
|
||||
gerritHost = flag.String("gerrithost", "", "Gerrit host, or empty.")
|
||||
buildbotBackend = flag.String("buildbot_backend", "", "Build bot status backend.")
|
||||
buildbotBackend = flag.String("buildbot_backend", "", "Build bot status backend URL")
|
||||
buildbotHost = flag.String("buildbot_host", "", "Hostname to map to the buildbot_backend. If an HTTP request with this hostname is received, it proxies to buildbot_backend.")
|
||||
pageHtml, errorHtml *template.Template
|
||||
)
|
||||
|
@ -343,8 +343,8 @@ func main() {
|
|||
httpServer := &http.Server{
|
||||
Addr: *httpAddr,
|
||||
Handler: handler,
|
||||
ReadTimeout: connTimeoutNanos,
|
||||
WriteTimeout: connTimeoutNanos,
|
||||
ReadTimeout: 5 * time.Minute,
|
||||
WriteTimeout: 30 * time.Minute,
|
||||
}
|
||||
go func() {
|
||||
errch <- httpServer.ListenAndServe()
|
||||
|
@ -363,8 +363,6 @@ func main() {
|
|||
log.Fatalf("Serve error: %v", <-errch)
|
||||
}
|
||||
|
||||
const connTimeoutNanos = 15e9
|
||||
|
||||
type fixUpGitwebUrls struct {
|
||||
handler http.Handler
|
||||
}
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
Bin=$(dirname $( readlink -f $0))
|
||||
|
||||
LOGDIR=$Bin/../logs
|
||||
mkdir -p $LOGDIR
|
||||
|
||||
cd $Bin
|
||||
echo "Running camweb in $Bin"
|
||||
../build.pl website && ./camweb --http=:8080 --https=:4430 --root=$Bin --logdir=$LOGDIR \
|
||||
--tlscert=$HOME/etc/ssl.crt \
|
||||
--tlskey=$HOME/etc/ssl.key \
|
||||
--gerrithost=ec2-107-22-182-135.compute-1.amazonaws.com
|
|
@ -0,0 +1,39 @@
|
|||
#!/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;
|
||||
push @args, "go", "run", "camweb.go", "logging.go";
|
||||
push @args, "--http=:8080";
|
||||
push @args, "--root=$Bin";
|
||||
push @args, "--logdir=$logdir";
|
||||
push @args, "--buildbot_host=build.camlistore.org";
|
||||
push @args, "--buildbot_backend=http://c1.danga.com:8080";
|
||||
if ($in_prod) {
|
||||
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 {
|
||||
exec(@args);
|
||||
die "Failed to exec: $!";
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
Bin=$(dirname $( readlink -f $0))
|
||||
Port=8081
|
||||
|
||||
LOGDIR=$Bin/../logs
|
||||
mkdir -p $LOGDIR
|
||||
|
||||
cd $Bin
|
||||
echo "Running camweb in $Bin on port $Port"
|
||||
../build.pl website && ./camweb --http=:$Port --root=$Bin --logdir=$LOGDIR
|
Loading…
Reference in New Issue