From: Dylan William Hardison Date: Fri, 1 Feb 2019 22:26:50 +0000 (-0500) Subject: no bug - make start_morbo smarter X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0625bc2453367d7b0d54532ba2a766afa705d275;p=thirdparty%2Fbugzilla.git no bug - make start_morbo smarter --- diff --git a/scripts/start_morbo b/scripts/start_morbo new file mode 100755 index 000000000..805b82c32 --- /dev/null +++ b/scripts/start_morbo @@ -0,0 +1,37 @@ +#!/usr/bin/env perl + +use File::Basename qw(basename dirname); +use File::Spec::Functions qw(catfile catdir); +use Cwd qw(realpath); +our $BUGZILLA_DIR; + +BEGIN { + require lib; + $BUGZILLA_DIR = dirname(dirname(realpath(__FILE__))); + lib->import( + $BUGZILLA_DIR, + catdir($BUGZILLA_DIR, 'lib'), + catdir($BUGZILLA_DIR, qw(local lib perl5)) + ); +} +use Env qw(@PATH @PERL5LIB $MOJO_LISTEN $BUGZILLA_ALLOW_INSECURE_HTTP MOJO_REVERSE_PROXY); + +chdir $BUGZILLA_DIR; + +my $cert_file = catfile($BUGZILLA_DIR, 'bmo-web.vm.pem'); +my $key_file = catfile($BUGZILLA_DIR, 'bmo-web.vm-key.pem'); + +if ($MOJO_LISTEN && -f $cert_file && -f $key_file) { + $MOJO_LISTEN .= ",https://*:443?cert=$cert_file&key=$key_file"; +} + +push @PERL5LIB, catdir($BUGZILLA_DIR, qw(local lib perl5)); +unshift @PATH, catdir($BUGZILLA_DIR, qw(local bin)); +$BUGZILLA_ALLOW_INSECURE_HTTP //= 1; +$MOJO_REVERSE_PROXY //= $BUGZILLA_DIR ne '/vagrant'; + +my @files + = ('Bugzilla.pm', 'Bugzilla', glob("*.cgi"), 'extensions', 'template'); +my @watch = map { ('-w' => $_) } (@files); + +exec morbo => @watch, '-v', 'bugzilla.pl'; diff --git a/vagrant_support/devtools.yml b/vagrant_support/devtools.yml index e44a00dd7..0034c9371 100644 --- a/vagrant_support/devtools.yml +++ b/vagrant_support/devtools.yml @@ -19,7 +19,7 @@ copy: src=re.pl dest=/usr/local/bin/re.pl mode=0755 - name: copy start_morbo - copy: src=start_morbo dest=/usr/local/bin/start_morbo mode=0755 + file: path=/usr/local/bin/start_morbo src=/vagrant/scripts/start_morbo state=link force=true - name: copy use-nytprof copy: src=use-nytprof dest=/usr/local/bin/use-nytprof mode=0755 diff --git a/vagrant_support/playbook.yml b/vagrant_support/playbook.yml index 3dd320f0b..cb97512f0 100644 --- a/vagrant_support/playbook.yml +++ b/vagrant_support/playbook.yml @@ -59,6 +59,15 @@ group: root mode: 0644 + - name: 'add MOJO_LISTEN' + lineinfile: + dest: /etc/environment + regexp: 'MOJO_LISTEN=' + line: 'MOJO_LISTEN=http://*::80' + owner: root + group: root + mode: 0644 + - name: copy ntp.conf copy: src: ntp.conf diff --git a/vagrant_support/start_morbo b/vagrant_support/start_morbo deleted file mode 100644 index cb065845d..000000000 --- a/vagrant_support/start_morbo +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl - -my $cert_file = '/vagrant/bmo-web.vm.pem'; -my $key_file = '/vagrant/bmo-web.vm-key.pem'; -my $listen = 'http://*:80'; - -if (-f $cert_file && -f $key_file) { - $listen .= ",https://*:443?cert=$cert_file&key=$key_file"; -} - -$ENV{PERL5LIB} = '/vagrant/local/lib/perl5'; -$ENV{PATH} = "/vagrant/local/bin:$ENV{PATH}"; -$ENV{MOJO_LISTEN} = $listen; -$ENV{BUGZILLA_ALLOW_INSECURE_HTTP} = 1; - -my @files - = ('Bugzilla.pm', 'Bugzilla', glob("*.cgi"), 'extensions', 'template'); -my @watch = map { ('-w' => $_) } (@files); - -system morbo => @watch, '-v', 'bugzilla.pl';