]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Add docker-compose setup for local development
authorDylan William Hardison <dylan@hardison.net>
Mon, 12 Feb 2018 17:25:45 +0000 (12:25 -0500)
committerDylan William Hardison <dylan@hardison.net>
Sun, 18 Feb 2018 21:04:39 +0000 (16:04 -0500)
README.rst
docker-compose.yml [new file with mode: 0755]
docker_support/checksetup_answers.txt [new file with mode: 0644]
scripts/entrypoint.pl

index 555d5f951bbdce1cbb92dbc020f59d183e649919..2a7006fd6c319b01c4d2e52432d5f7a4536c275f 100644 (file)
@@ -14,16 +14,14 @@ BMO is Mozilla's highly customized version of Bugzilla.
       1.2  Making Changes and Seeing them
       1.3  Technical Details
       1.4  Perl Shell (re.pl, repl)
-    2  Docker Container
-      2.1  Container Arguments
-      2.2  Environmental Variables
-      2.3  Persistent Data Volume
-
-If you are looking to run Bugzilla, you should see
-https://github.com/bugzilla/bugzilla.
+    2  Using Docker Compose (For Development)
+    3  Docker Container
+      3.1  Container Arguments
+      3.2  Environmental Variables
+      3.3  Persistent Data Volume
 
 If you want to contribute to BMO, you can fork this repo and get a local copy
-of BMO running in a few minutes using Vagrant.
+of BMO running in a few minutes using Vagrant or Docker.
 
 Using Vagrant (For Development)
 ===============================
@@ -148,6 +146,31 @@ You can use the 'p' command (provided by `Data::Printer`_) to inspect variables
 .. _`Devel::REPL`: https://metacpan.org/pod/Devel::REPL
 .. _`Data::Printer`: https://metacpan.org/pod/Data::Printer
 
+
+Using Docker (For Development)
+==============================
+
+While not yet as featureful or complete as the vagrant setup, this repository now contains a
+docker-compose file that will create a local bugzilla for testing.
+
+To use docker-compose, ensure you have the latest Docker install for your environemnt
+(Linux, Windows, or Mac OS).
+
+.. code-block:: bash
+
+    docker-compose up --build
+
+
+Then, you must configure your browser to use http://localhost:1091 as an HTTP proxy.
+For setting a proxy in Firefox, see `Firefox Connection Settings`_.
+The procecure should be similar for other browsers.
+
+.. _`Firefox Connection Settings`: https://support.mozilla.org/en-US/kb/connection-settings-firefox
+
+After that, you should be able to visit http://bmo-web.vm/ from your browser.
+You can login as vagrant@bmo-web.vm with the password "vagrant01!" (without
+quotes).
+
 Docker Container
 ================
 
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100755 (executable)
index 0000000..4e50a88
--- /dev/null
@@ -0,0 +1,57 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+version: '2'
+
+services:
+  bmo-web.vm:
+    build: &bmo_build
+      context: .
+      dockerfile: Dockerfile
+    command: dev_httpd
+    volumes:
+      - bmo-data-dir:/app/data
+    tmpfs:
+      - /tmp
+      - /run
+    environment: &bmo_env
+      - LOCALCONFIG_ENV=1
+      - BUGZILLA_UNSAFE_AUTH_DELEGATION=1
+      - PORT=80
+      - BMO_db_host=bmo-db.vm
+      - BMO_db_name=bugs
+      - BMO_db_user=bugs
+      - BMO_db_pass=bugs
+      - BMO_urlbase=http://bmo-web.vm/
+      - BMO_memcached_namespace=bugzilla
+      - BMO_memcached_servers=memcached:11211
+      - 'BMO_inbound_proxies=*'
+      - BZ_ANSWERS_FILE=/app/docker_support/checksetup_answers.txt
+    depends_on:
+      - bmo-db.vm
+      - memcached
+
+  bmo-db.vm:
+    image: mozillabteam/bmo-mysql:5.6
+    volumes:
+      - bmo-mysql-db:/var/lib/mysql
+    logging:
+      driver: "none"
+    environment:
+      - MYSQL_DATABASE=bugs
+      - MYSQL_USER=bugs
+      - MYSQL_PASSWORD=bugs
+      - MYSQL_ALLOW_EMPTY_PASSWORD=1
+
+  memcached:
+    image: memcached:latest
+
+  tinyproxy:
+    image: mozillabteam/tinyproxy
+    ports:
+      - "1091:1090"
+
+volumes:
+  bmo-mysql-db:
+  bmo-data-dir:
diff --git a/docker_support/checksetup_answers.txt b/docker_support/checksetup_answers.txt
new file mode 100644 (file)
index 0000000..a1913ac
--- /dev/null
@@ -0,0 +1,28 @@
+$answer{'ADMIN_EMAIL'}          = 'vagrant@bmo-web.vm';
+$answer{'ADMIN_OK'}             = 'Y';
+$answer{'ADMIN_PASSWORD'}       = 'vagrant01!';
+$answer{'passwdqc_min'}         = '8, 8, 8, 8, 8';
+$answer{'ADMIN_REALNAME'}       = 'Vagrant User';
+$answer{'NO_PAUSE'}             = 1;
+$answer{'apache_size_limit'}    = 700000;
+$answer{'bugzilla_version'}     = '1';
+$answer{'create_htaccess'}      = '1';
+$answer{'db_check'}             = 1;
+$answer{'diffpath'}             = '/usr/bin';
+$answer{'index_html'}           = 0;
+$answer{'interdiffbin'}         = '/usr/bin/interdiff';
+$answer{'user_info_class'}      = 'GitHubAuth,CGI';
+$answer{'user_verify_class'}    = 'GitHubAuth,DB';
+$answer{'use_mailer_queue'}     = 1;
+$answer{'useclassification'}    = 1;
+$answer{'usebugaliases'}        = 1;
+$answer{'upgrade_notification'} = 0;
+$answer{'usestatuswhiteboard'}  = 1;
+$answer{'usetargetmilestone'}   = 1;
+$answer{'webdotbase'}           = '/usr/bin/dot';
+$answer{'auth_delegation'}      = 1;
+$answer{'insidergroup'}         = 'admin';
+$answer{'defaultpriority'}      = '--';
+$answer{'defaultseverity'}      = 'normal';
+$answer{'skin'}                 = 'Mozilla';
+$answer{'docs_urlbase'}         = 'https://bmo.readthedocs.org/en/latest/';
index a9ed4ee8c5d847db53fc451758effd18edb5e6de..83576d559902a30486213baa22fe004cf9b26ff1 100755 (executable)
@@ -78,6 +78,10 @@ sub cmd_httpd  {
     check_data_dir();
     wait_for_db();
     check_httpd_env();
+    httpd();
+}
+
+sub httpd {
     my @httpd_args = (
         '-DFOREGROUND',
         '-f' => '/app/httpd/httpd.conf',
@@ -91,6 +95,16 @@ sub cmd_httpd  {
     run( '/usr/sbin/httpd', @httpd_args );
 }
 
+sub cmd_dev_httpd {
+    wait_for_db();
+    my $have_params = -f "/app/data/params";
+    run( 'perl', 'checksetup.pl', '--no-template', $ENV{BZ_ANSWERS_FILE} );
+    if ( not $have_params ) {
+        run( 'perl', 'scripts/generate_bmo_data.pl', '--param' => 'use_mailer_queue=0', 'vagrant@bmo-web.vm' );
+    }
+    httpd();
+}
+
 sub cmd_load_test_data {
     wait_for_db();