diff options
-rw-r--r-- | Bugzilla/DaemonControl.pm | 32 | ||||
-rw-r--r-- | docker-compose.yml | 1 | ||||
-rwxr-xr-x | scripts/entrypoint.pl | 1 |
3 files changed, 20 insertions, 14 deletions
diff --git a/Bugzilla/DaemonControl.pm b/Bugzilla/DaemonControl.pm index ce57c4e8a..d0d6af8f7 100644 --- a/Bugzilla/DaemonControl.pm +++ b/Bugzilla/DaemonControl.pm @@ -41,14 +41,17 @@ our %EXPORT_TAGS = ( utils => [qw(catch_signal on_exception on_finish)], ); -use constant BUGZILLA_DIR => realpath(bz_locations->{cgi_path}); - -use constant { - JOBQUEUE_BIN => catfile( BUGZILLA_DIR, 'jobqueue.pl' ), - CEREAL_BIN => catfile( BUGZILLA_DIR, 'scripts', 'cereal.pl' ), - HYPNOTOAD_BIN => catfile( BUGZILLA_DIR, 'local', 'bin', 'hypnotoad' ), - PERL5LIB => join(':', BUGZILLA_DIR, catdir(BUGZILLA_DIR, 'lib'), catdir(BUGZILLA_DIR, 'local', 'lib', 'perl5')), -}; +my $BUGZILLA_DIR = realpath(bz_locations->{cgi_path}); +my $JOBQUEUE_BIN = catfile( $BUGZILLA_DIR, 'jobqueue.pl' ); +my $CEREAL_BIN = catfile( $BUGZILLA_DIR, 'scripts', 'cereal.pl' ); +my $BUGZILLA_BIN = catfile( $BUGZILLA_DIR, 'bugzilla.pl' ); +my $HYPNOTOAD_BIN = catfile( $BUGZILLA_DIR, 'local', 'bin', 'hypnotoad' ); +my @PERL5LIB = ( $BUGZILLA_DIR, catdir($BUGZILLA_DIR, 'lib'), catdir($BUGZILLA_DIR, 'local', 'lib', 'perl5') ); + +my %HTTP_COMMAND = ( + hypnotoad => [ $HYPNOTOAD_BIN, $BUGZILLA_BIN, '-f' ], + simple => [ $BUGZILLA_BIN, 'daemon' ], +); sub catch_signal { my ($name, @done) = @_; @@ -79,7 +82,7 @@ sub run_cereal { my $loop = IO::Async::Loop->new; my $exit_f = $loop->new_future; my $cereal = IO::Async::Process->new( - command => [CEREAL_BIN], + command => [$CEREAL_BIN], on_finish => on_finish($exit_f), on_exception => on_exception( 'cereal', $exit_f ), ); @@ -103,10 +106,11 @@ sub run_httpd { my $httpd = IO::Async::Process->new( code => sub { $ENV{BUGZILLA_HTTPD_ARGS} = encode_json(\@args); - $ENV{PERL5LIB} = PERL5LIB; - my @command = ( HYPNOTOAD_BIN, catfile(BUGZILLA_DIR, 'bugzilla.pl'), '-f' ); - exec @command - or die "failed to exec $command[0] $!"; + $ENV{PERL5LIB} = join(':', @PERL5LIB); + my $backend = $ENV{HTTP_BACKEND} // 'hypnotoad'; + my $command = $HTTP_COMMAND{ $backend }; + exec @$command + or die "failed to exec $command->[0] $!"; }, on_finish => on_finish($exit_f), on_exception => on_exception( 'httpd', $exit_f ), @@ -123,7 +127,7 @@ sub run_jobqueue { my $loop = IO::Async::Loop->new; my $exit_f = $loop->new_future; my $jobqueue = IO::Async::Process->new( - command => [ JOBQUEUE_BIN, 'start', '-f', '-d', @args ], + command => [ $JOBQUEUE_BIN, 'start', '-f', '-d', @args ], on_finish => on_finish($exit_f), on_exception => on_exception( 'httpd', $exit_f ), ); diff --git a/docker-compose.yml b/docker-compose.yml index 1ca6f5c90..b00c6bc03 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,6 +19,7 @@ services: - LOCALCONFIG_ENV=1 - LOG4PERL_CONFIG_FILE=log4perl-docker.conf - BUGZILLA_UNSAFE_AUTH_DELEGATION=1 + - HTTP_BACKEND=simple - PORT=80 - BMO_db_host=bmo-db.vm - BMO_db_name=bugs diff --git a/scripts/entrypoint.pl b/scripts/entrypoint.pl index ce1cc795b..e5ecc4324 100755 --- a/scripts/entrypoint.pl +++ b/scripts/entrypoint.pl @@ -156,6 +156,7 @@ sub cmd_test_webservices { sub cmd_test_selenium { my $conf = require $ENV{BZ_QA_CONF_FILE}; + $ENV{HTTP_BACKEND} = 'simple'; check_data_dir(); copy_qa_extension(); |