diff --git a/website/camweb.go b/website/camweb.go index fdd48c0ba..658e039a9 100644 --- a/website/camweb.go +++ b/website/camweb.go @@ -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 } diff --git a/website/run-prod.sh b/website/run-prod.sh deleted file mode 100755 index 14492848b..000000000 --- a/website/run-prod.sh +++ /dev/null @@ -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 diff --git a/website/run.pl b/website/run.pl new file mode 100755 index 000000000..f024213f7 --- /dev/null +++ b/website/run.pl @@ -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: $!"; +} diff --git a/website/run.sh b/website/run.sh deleted file mode 100755 index 344eb8efb..000000000 --- a/website/run.sh +++ /dev/null @@ -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 \ No newline at end of file