summaryrefslogtreecommitdiffstats
path: root/docker_files
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-07-03 21:09:44 +0200
committerDylan William Hardison <dylan@hardison.net>2017-07-07 00:19:20 +0200
commite3e2c7c0273499f832ee692ca63620cd8aa8bda1 (patch)
treeeda6812f189ae6a6e682ceb30181d902a9ddc2b1 /docker_files
parent5eab2f4864c28ab945f92800c3294e968dd01428 (diff)
downloadbugzilla-e3e2c7c0273499f832ee692ca63620cd8aa8bda1.tar.gz
bugzilla-e3e2c7c0273499f832ee692ca63620cd8aa8bda1.tar.xz
Bug 1361439 - Create dockerflow-compliant container that runs a BMO web head
Diffstat (limited to 'docker_files')
-rw-r--r--docker_files/httpd.conf98
-rwxr-xr-xdocker_files/init.pl81
2 files changed, 179 insertions, 0 deletions
diff --git a/docker_files/httpd.conf b/docker_files/httpd.conf
new file mode 100644
index 000000000..b8c779052
--- /dev/null
+++ b/docker_files/httpd.conf
@@ -0,0 +1,98 @@
+ServerTokens Prod
+ServerRoot "/opt/bmo/httpd"
+PidFile /tmp/httpd.pid
+Timeout 60
+KeepAlive Off
+MaxKeepAliveRequests 100
+KeepAliveTimeout 15
+<IfModule prefork.c>
+StartServers 8
+MinSpareServers 5
+MaxSpareServers 20
+ServerLimit 256
+MaxClients 256
+MaxRequestsPerChild 4000
+</IfModule>
+<IfModule worker.c>
+StartServers 4
+MaxClients 300
+MinSpareThreads 25
+MaxSpareThreads 75
+ThreadsPerChild 25
+MaxRequestsPerChild 0
+</IfModule>
+Listen ${PORT}
+LoadModule authz_host_module modules/mod_authz_host.so
+LoadModule include_module modules/mod_include.so
+LoadModule log_config_module modules/mod_log_config.so
+LoadModule logio_module modules/mod_logio.so
+LoadModule env_module modules/mod_env.so
+LoadModule ext_filter_module modules/mod_ext_filter.so
+LoadModule mime_magic_module modules/mod_mime_magic.so
+LoadModule expires_module modules/mod_expires.so
+LoadModule deflate_module modules/mod_deflate.so
+LoadModule headers_module modules/mod_headers.so
+LoadModule usertrack_module modules/mod_usertrack.so
+LoadModule setenvif_module modules/mod_setenvif.so
+LoadModule mime_module modules/mod_mime.so
+LoadModule dav_module modules/mod_dav.so
+LoadModule status_module modules/mod_status.so
+LoadModule autoindex_module modules/mod_autoindex.so
+LoadModule info_module modules/mod_info.so
+LoadModule dav_fs_module modules/mod_dav_fs.so
+LoadModule vhost_alias_module modules/mod_vhost_alias.so
+LoadModule negotiation_module modules/mod_negotiation.so
+LoadModule dir_module modules/mod_dir.so
+LoadModule actions_module modules/mod_actions.so
+LoadModule speling_module modules/mod_speling.so
+LoadModule alias_module modules/mod_alias.so
+LoadModule substitute_module modules/mod_substitute.so
+LoadModule rewrite_module modules/mod_rewrite.so
+LoadModule cache_module modules/mod_cache.so
+LoadModule disk_cache_module modules/mod_disk_cache.so
+LoadModule version_module modules/mod_version.so
+LoadModule perl_module modules/mod_perl.so
+User app
+Group app
+ServerAdmin root@localhost
+UseCanonicalName Off
+<Directory />
+ Options FollowSymLinks
+ AllowOverride None
+</Directory>
+AccessFileName .htaccess
+<Files ~ "^\.ht">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Files>
+TypesConfig /etc/mime.types
+DefaultType text/plain
+<IfModule mod_mime_magic.c>
+ MIMEMagicFile magic
+</IfModule>
+HostnameLookups Off
+ErrorLog /dev/stderr
+LogLevel warn
+LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat "%h %l %u %t \"%r\" %>s %b" common
+LogFormat "%{Referer}i -> %U" referer
+LogFormat "%{User-agent}i" agent
+CustomLog /dev/stdout combined
+ServerSignature Off
+AddDefaultCharset UTF-8
+AddType application/x-compress .Z
+AddType application/x-gzip .gz .tgz
+AddType application/x-x509-ca-cert .crt
+AddType application/x-pkcs7-crl .crl
+
+PerlSwitches -wT
+PerlRequire /app/mod_perl.pl
+DirectoryIndex index.cgi
+DocumentRoot "/app"
+<Directory "/app">
+ Options -Indexes -FollowSymLinks
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+</Directory>
diff --git a/docker_files/init.pl b/docker_files/init.pl
new file mode 100755
index 000000000..6e7a8920b
--- /dev/null
+++ b/docker_files/init.pl
@@ -0,0 +1,81 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use lib qw(/app /opt/bmo/local/lib/perl5);
+use Getopt::Long qw(:config gnu_getopt);
+use Data::Dumper;
+use Bugzilla::Install::Localconfig ();
+use Bugzilla::Install::Util qw(install_string);
+
+my %localconfig = (webservergroup => 'app');
+
+my %override = (
+ 'inbound_proxies' => 1,
+ 'memcached_namespace' => 1,
+ 'memcached_servers' => 1,
+ 'shadowdb' => 1,
+ 'shadowdbhost' => 1,
+ 'shadowdbport' => 1,
+ 'shadowdbsock' => 1
+);
+
+# clean env.
+foreach my $key (keys %ENV) {
+ if ($key =~ /^BMO_(.+)$/) {
+ my $name = $1;
+ if ($override{$name}) {
+ $localconfig{param_override}{$name} = delete $ENV{$key};
+ }
+ else {
+ $localconfig{$name} = delete $ENV{$key};
+ }
+ }
+}
+
+write_localconfig(\%localconfig);
+system("perl", "checksetup.pl", "--no-templates", "--no-permissions", '--no-assets');
+
+my $cmd = shift @ARGV or die "usage: init.pl CMD";
+my $method = "run_$cmd";
+__PACKAGE__->$method();
+
+sub run_httpd {
+ exec("/usr/sbin/httpd", "-DFOREGROUND", "-f", "/opt/bmo/httpd/httpd.conf");
+}
+
+sub run_shell {
+ exec("/bin/bash", "-l");
+}
+
+sub write_localconfig {
+ my ($localconfig) = @_;
+ no warnings 'once';
+
+ foreach my $var (Bugzilla::Install::Localconfig::LOCALCONFIG_VARS) {
+ my $name = $var->{name};
+ my $value = $localconfig->{$name};
+ if (!defined $value) {
+ $var->{default} = &{$var->{default}} if ref($var->{default}) eq 'CODE';
+ $localconfig->{$name} = $var->{default};
+ }
+ }
+
+ my $filename = "/app/localconfig";
+
+ # Ensure output is sorted and deterministic
+ local $Data::Dumper::Sortkeys = 1;
+
+ # Re-write localconfig
+ open my $fh, ">:utf8", $filename or die "$filename: $!";
+ foreach my $var (Bugzilla::Install::Localconfig::LOCALCONFIG_VARS) {
+ my $name = $var->{name};
+ my $desc = install_string("localconfig_$name", { root => Bugzilla::Install::Localconfig::ROOT_USER });
+ chomp($desc);
+ # Make the description into a comment.
+ $desc =~ s/^/# /mg;
+ print $fh $desc, "\n",
+ Data::Dumper->Dump([$localconfig->{$name}],
+ ["*$name"]), "\n";
+ }
+ close $fh;
+}