diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-02-12 18:25:45 +0100 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-02-18 22:04:39 +0100 |
commit | a8db810d24494137b58d207ea41e1569e943bd6f (patch) | |
tree | adadfbe070c0daab9a2abae2e1a3ce71dea744bf | |
parent | d010759a987a18ee44a515e5d1cc266f154e01a8 (diff) | |
download | bugzilla-a8db810d24494137b58d207ea41e1569e943bd6f.tar.gz bugzilla-a8db810d24494137b58d207ea41e1569e943bd6f.tar.xz |
Add docker-compose setup for local development
-rw-r--r-- | README.rst | 39 | ||||
-rwxr-xr-x | docker-compose.yml | 57 | ||||
-rw-r--r-- | docker_support/checksetup_answers.txt | 28 | ||||
-rwxr-xr-x | scripts/entrypoint.pl | 14 |
4 files changed, 130 insertions, 8 deletions
diff --git a/README.rst b/README.rst index 555d5f951..2a7006fd6 100644 --- a/README.rst +++ b/README.rst @@ -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 index 000000000..4e50a8807 --- /dev/null +++ b/docker-compose.yml @@ -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 index 000000000..a1913ac7b --- /dev/null +++ b/docker_support/checksetup_answers.txt @@ -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/'; diff --git a/scripts/entrypoint.pl b/scripts/entrypoint.pl index a9ed4ee8c..83576d559 100755 --- a/scripts/entrypoint.pl +++ b/scripts/entrypoint.pl @@ -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(); |