From 0f577e86e0beaa24257422e513a770cbf62b5b20 Mon Sep 17 00:00:00 2001 From: svicer Date: Tue, 26 Jan 2021 15:53:52 +0200 Subject: [PATCH 001/228] feat(SOLR): implement solr versions --- default.config.yml | 3 +++ tasks/solr-setup.yml | 27 +++++++++++++++++------ templates/docker-compose.yml.j2 | 2 +- templates/solr.Dockerfile.j2 | 6 +++++ templates/{solr4.core.j2 => solr.core.j2} | 0 5 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 templates/solr.Dockerfile.j2 rename templates/{solr4.core.j2 => solr.core.j2} (100%) diff --git a/default.config.yml b/default.config.yml index 8441d34..04e4edb 100644 --- a/default.config.yml +++ b/default.config.yml @@ -52,6 +52,9 @@ drush_commands: - 'cron' solr: false +# Look at available version here https://hub.docker.com/_/solr +solr_version: 4 +solr_configs_path: "{{ drupal_root_dir }}/docroot/modules/contrib/search_api_solr/solr-conf/4.x/" solr_core_name: drupal # Tom make `memcache` working `memcache` module should be enabled: `en memcache`. diff --git a/tasks/solr-setup.yml b/tasks/solr-setup.yml index e5b91a8..388b884 100644 --- a/tasks/solr-setup.yml +++ b/tasks/solr-setup.yml @@ -1,29 +1,42 @@ --- - name: Clone docker solr4 repository. + when: solr_version == 4 git: repo: https://github.com/docker-solr/docker-solr4 - dest: "{{ docker_runtime_dir }}/solr4" + dest: "{{ docker_runtime_dir }}/solr" version: master clone: yes update: yes force: yes +- name: Create solr directory + when: solr_version != 4 + file: + path: "{{ docker_runtime_dir }}/solr" + state: directory + +- name: Ensure Solr Dokcerfile is present. + when: solr_version != 4 + template: + src: templates/solr.Dockerfile.j2 + dest: "{{ docker_runtime_dir }}/solr/Dockerfile" + mode: '644' + - name: Ensure Solr Core file is present. template: - src: templates/solr4.core.j2 - dest: "{{ docker_runtime_dir }}/solr4/core.properties" + src: templates/solr.core.j2 + dest: "{{ docker_runtime_dir }}/solr/core.properties" mode: '644' - name: Copy drupal solr config. - copy: - src: "{{ drupal_root_dir }}/docroot/modules/contrib/search_api_solr/solr-conf/4.x/" - dest: "{{ docker_runtime_dir }}/solr4/conf" + command: cp -r "{{ solr_configs_path }}"/. "{{ docker_runtime_dir }}/solr/conf" - name: Solr Setup. + when: solr_version == 4 blockinfile: marker: 'RUN chown -R $SOLR_USER:$SOLR_GROUP /opt/docker-solr' - path: "{{ docker_runtime_dir }}/solr4/Dockerfile" + path: "{{ docker_runtime_dir }}/solr/Dockerfile" block: | RUN mkdir /opt/solr/example/solr/{{ solr_core_name }} COPY ./conf /opt/solr/example/solr/{{ solr_core_name }}/conf diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index f61578c..4831d4e 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -79,7 +79,7 @@ services: container_name: '{{ compose_project_name }}-solr' restart: 'always' build: - context: "./solr4" + context: "./solr" {% if advanced_networking %} networks: {{ compose_project_name }}-network: diff --git a/templates/solr.Dockerfile.j2 b/templates/solr.Dockerfile.j2 new file mode 100644 index 0000000..17e2106 --- /dev/null +++ b/templates/solr.Dockerfile.j2 @@ -0,0 +1,6 @@ +FROM solr:{{ solr_version }} + +# Case for solr version 5-7 +RUN mkdir -p /opt/solr/server/solr/{{ solr_core_name }} +COPY conf /opt/solr/server/solr/{{ solr_core_name }}/conf +COPY core.properties /opt/solr/server/solr/{{ solr_core_name }}/core.properties diff --git a/templates/solr4.core.j2 b/templates/solr.core.j2 similarity index 100% rename from templates/solr4.core.j2 rename to templates/solr.core.j2 From a90a8ce3308c537218a4fce974aaefe1c0d655c9 Mon Sep 17 00:00:00 2001 From: svicer Date: Tue, 2 Feb 2021 16:51:48 +0200 Subject: [PATCH 002/228] Optimize project remove dependency docker-compose-lamp --- README.md | 24 +- db.yml | 4 +- default.config.yml | 14 +- inventory | 4 +- main.yml | 19 +- reset.yml | 5 +- run-drush-commands.yml | 3 +- stop.yml | 21 + tasks/advanced-networking-setup.yml | 1 + tasks/docker-up.yml | 36 - tasks/drush-setup.yml | 19 - tasks/lamp-setup.yml | 31 - tasks/project-setup.yml | 29 - tasks/runtime-setup.yml | 74 + tasks/settings-setup.yml | 19 +- tasks/solr-setup.yml | 28 +- templates/apache.conf.j2 | 17 +- templates/docker-compose.yml.j2 | 13 +- templates/mysql.Dockerfile.j2 | 8 + templates/php.Dockerfile.j2 | 19 + templates/php.ini.j2 | 1933 --------------------------- templates/solr.Dockerfile.j2 | 12 +- 22 files changed, 200 insertions(+), 2133 deletions(-) create mode 100644 stop.yml delete mode 100644 tasks/drush-setup.yml delete mode 100644 tasks/lamp-setup.yml delete mode 100644 tasks/project-setup.yml create mode 100644 tasks/runtime-setup.yml create mode 100644 templates/mysql.Dockerfile.j2 create mode 100644 templates/php.Dockerfile.j2 delete mode 100644 templates/php.ini.j2 diff --git a/README.md b/README.md index 3a3ad2a..8b6e73d 100644 --- a/README.md +++ b/README.md @@ -23,27 +23,19 @@ cd drupal-dockerizer cp default.config.yml config.yml ``` - -### Start new local environment +### Start local environment ```bash cd drupal-dockerizer -sudo ansible-playbook -vvv main.yml --connection=local --extra-vars=init_project=true -``` - -### Start local environment for existing project - -```bash -cd drupal-dockerizer -sudo ansible-playbook -vvv main.yml --connection=local -sudo ansible-playbook -vvv run-drush-commands.yml --connection=local +ansible-playbook main.yml +ansible-playbook run-drush-commands.yml ``` ### Import database from dump ```bash cd drupal-dockerizer -sudo ansible-playbook -vvv db.yml --connection=local +sudo ansible-playbook db.yml ``` ### Xdebug setup @@ -107,7 +99,7 @@ Your `launch.json` should look like the next config: "max_depth": 2, "max_children": 100, } - + ``` How to use debugger with Drush commands? @@ -162,14 +154,14 @@ drush_commands: ### How to reset everything and start from scratch? ```bash -cd /docker -sudo ansible-playbook -vvv reset.yml --connection=local +cd drupal-dockerizer +ansible-playbook reset.yml ``` ### How to clear Docker cache? ```bash -docker system prune -a +docker system prune -a -f ``` ### How to enhance MacOS performance? diff --git a/db.yml b/db.yml index 8720a96..5176029 100644 --- a/db.yml +++ b/db.yml @@ -1,8 +1,6 @@ --- -- hosts: server - become: yes - +- hosts: all vars_files: - default.config.yml diff --git a/default.config.yml b/default.config.yml index 04e4edb..35b82d3 100644 --- a/default.config.yml +++ b/default.config.yml @@ -4,7 +4,7 @@ compose_project_name: my-project docker_runtime_dir: my-project docker_cached_volume: true -host_machine_user: myusername +user_uid: 1000 # Absolute Path to Drupal dir (`vendor` forlder should be there). drupal_root_dir: /var/data/drupal @@ -13,6 +13,8 @@ drupal_web_root: web # Absolute Path to Drupal files dir. drupal_files_dir: /var/data/drupal_files drupal_hash_salt: demo_site +# Absolute Path to Drupal config sync dir. +drupal_config_sync_folder: sites/default/sync apache_port: 80 apache_port_ssl: 443 @@ -20,8 +22,8 @@ ssl_enabled: false ssl_cert_path: /var/data/ssl/fullchain.pem ssl_key_path: /var/data/ssl/privkey.pem -# Look at available options here: https://github.com/jet-dev-team/docker-compose-lamp/tree/drupal/bin -phpversion: php74 +# Look at available options here: https://hub.docker.com/r/jetdevteam/drupal-php-apache/tags?page=1&ordering=last_updated +phpversion: 7.4-develop # Enviroment variable for php xdebug extensions xdebug_enviroment: remote_enable=1 remote_connect_back=1 remote_port=9008 remote_host=192.168.105.1 show_error_trace=0 show_local_vars=1 remote_autostart=1 show_exception_trace=0 idekey=VSCODE @@ -31,12 +33,6 @@ advanced_networking: false network_id: 105 domain_name: drupal.devel -init_project: false -composer_project: drupal/recommended-project -comoser_extras: - - drush/drush - - drupal/admin_toolbar - drush_install: true # Availible options: 8, 9, 10 drush_version: 10 diff --git a/inventory b/inventory index 135c6a6..3f09b90 100644 --- a/inventory +++ b/inventory @@ -1,5 +1,5 @@ -[server] -127.0.0.1 ansible_python_interpreter=/usr/bin/python3 +[local] +127.0.0.1 ansible_python_interpreter=/usr/bin/python3 ansible_connection=local # Comment the default localhost line above, and uncomment the line below # (replacing the IP with your Pi's IP address) if running the playbook from a diff --git a/main.yml b/main.yml index 6464013..85f9183 100644 --- a/main.yml +++ b/main.yml @@ -1,6 +1,6 @@ --- -- hosts: server +- hosts: all vars_files: - default.config.yml @@ -14,12 +14,9 @@ roles: [] tasks: - - name: include project setup tasks. - when: init_project - include: tasks/project-setup.yml - name: Include lamp setup tasks - include: tasks/lamp-setup.yml + include: tasks/runtime-setup.yml - name: Include solr setup tasks. when: solr @@ -29,24 +26,12 @@ when: advanced_networking include: tasks/advanced-networking-setup.yml - - name: Include Drush setup tasks - when: drush_install - include: tasks/drush-setup.yml - - name: Include Settings setup tasks include: tasks/settings-setup.yml - name: Include Docker up tasks include: tasks/docker-up.yml - - name: Wait docker containers (MySQL) to up. - pause: - seconds: 30 - - - name: Setup drupal task - when: drush_install and init_project - include: tasks/drush-command.yml - - name: Include Memcache setup tasks when: memcache include: tasks/memcache-setup.yml diff --git a/reset.yml b/reset.yml index 605f188..1e4faad 100644 --- a/reset.yml +++ b/reset.yml @@ -1,7 +1,6 @@ --- -- hosts: server - become: yes +- hosts: all vars_files: - default.config.yml @@ -26,11 +25,13 @@ chdir={{ docker_runtime_dir }} - name: Ensure runtime removed. + become: true file: path: "{{ docker_runtime_dir }}" state: absent - name: Remove Host name from /etc/hosts + become: true blockinfile: marker: "" state: absent diff --git a/run-drush-commands.yml b/run-drush-commands.yml index 25ebd19..636a736 100644 --- a/run-drush-commands.yml +++ b/run-drush-commands.yml @@ -1,7 +1,6 @@ --- -- hosts: server - become: yes +- hosts: all vars_files: - default.config.yml diff --git a/stop.yml b/stop.yml new file mode 100644 index 0000000..a7ba133 --- /dev/null +++ b/stop.yml @@ -0,0 +1,21 @@ +--- + +- hosts: all + + vars_files: + - default.config.yml + + pre_tasks: + - name: Include config override file, if it exists. + include_vars: "{{ item }}" + with_fileglob: + - config.yml + + roles: [] + + tasks: + + - name: Stop all Docker containers. + shell: | + docker-compose stop + chdir={{ docker_runtime_dir }} diff --git a/tasks/advanced-networking-setup.yml b/tasks/advanced-networking-setup.yml index c847257..a9756df 100644 --- a/tasks/advanced-networking-setup.yml +++ b/tasks/advanced-networking-setup.yml @@ -1,6 +1,7 @@ --- - name: Add Host name to /etc/hosts + become: true blockinfile: marker: "" path: /etc/hosts diff --git a/tasks/docker-up.yml b/tasks/docker-up.yml index 5e90fce..5dcbce3 100644 --- a/tasks/docker-up.yml +++ b/tasks/docker-up.yml @@ -1,41 +1,5 @@ --- -- name: Set owner for Docker runtime dir. - file: - path: "{{ docker_runtime_dir }}" - state: directory - recurse: yes - owner: "{{ host_machine_user }}" - -- name: Set owner for Drupal root dir. - file: - path: "{{ drupal_root_dir }}" - state: directory - recurse: yes - owner: "{{ host_machine_user }}" - -- name: Set owner for Drupal files dir. - file: - path: "{{ drupal_files_dir }}" - state: directory - recurse: yes - mode: 0777 - owner: "{{ host_machine_user }}" - -- name: Set owner for Drupal sync dir. - file: - path: "{{drupal_root_dir}}/{{drupal_web_root}}/sites/default/sync" - state: directory - recurse: yes - mode: 0755 - owner: "{{ host_machine_user }}" - -- name: Stop all Docker containers if docker-compose.yml has changed. - command: > - docker-compose stop - chdir={{ docker_runtime_dir }} - when: docker_compose_file_result.changed - - name: Bring up the Docker containers. command: > docker-compose up --build -d --remove-orphans diff --git a/tasks/drush-setup.yml b/tasks/drush-setup.yml deleted file mode 100644 index ae4677d..0000000 --- a/tasks/drush-setup.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- - -- name: Drush 8 Setup. - when: drush_version == 8 - blockinfile: - marker: 'RUN a2enmod rewrite headers' - path: "{{ docker_runtime_dir }}/bin/{{ phpversion }}/Dockerfile" - block: | - RUN curl -fsSL -o /usr/local/bin/drush "https://github.com/drush-ops/drush/releases/download/8.4.1/drush.phar" && \ - chmod +x /usr/local/bin/drush - -- name: Drush Launcher Setup. - when: drush_version > 8 - blockinfile: - marker: 'RUN a2enmod rewrite headers' - path: "{{ docker_runtime_dir }}/bin/{{ phpversion }}/Dockerfile" - block: | - RUN curl -fsSL -o /usr/local/bin/drush "https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar" && \ - chmod +x /usr/local/bin/drush diff --git a/tasks/lamp-setup.yml b/tasks/lamp-setup.yml deleted file mode 100644 index 3d56c2a..0000000 --- a/tasks/lamp-setup.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- - -- name: Clone docker drupal lamp repository. - git: - repo: https://github.com/jet-dev-team/docker-compose-lamp.git - dest: "{{ docker_runtime_dir }}" - version: drupal - clone: yes - update: yes - force: yes - -- name: Ensure Apache2 config is present. - template: - src: templates/apache.conf.j2 - dest: "{{ docker_runtime_dir }}/config/vhosts/default.conf" - mode: '644' - register: docker_compose_file_result - -- name: Ensure PHP config is present. - template: - src: templates/php.ini.j2 - dest: "{{ docker_runtime_dir }}/config/php/php.ini" - mode: '644' - register: docker_compose_file_result - -- name: Ensure Docker Compose file is present. - template: - src: templates/docker-compose.yml.j2 - dest: "{{ docker_runtime_dir }}/docker-compose.yml" - mode: '644' - register: docker_compose_file_result diff --git a/tasks/project-setup.yml b/tasks/project-setup.yml deleted file mode 100644 index a247153..0000000 --- a/tasks/project-setup.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- - -- name: Install drupal project - ignore_errors: yes - become: no - composer: - command: create-project - ignore_platform_reqs: yes - arguments: "{{composer_project}} {{ drupal_root_dir }}" - working_dir: "./" - prefer_dist: yes - -- name: Require extra packages. - become: no - loop: "{{ comoser_extras }}" - composer: - command: require - ignore_platform_reqs: yes - arguments: "{{ item }} --no-update" - working_dir: "{{ drupal_root_dir }}" - -- name: Update project. - become: no - composer: - command: update - ignore_platform_reqs: yes - working_dir: "{{ drupal_root_dir }}" - prefer_dist: yes - diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml new file mode 100644 index 0000000..72145fa --- /dev/null +++ b/tasks/runtime-setup.yml @@ -0,0 +1,74 @@ +--- + +- name: Ensure that runtime dir exist. + file: + path: "{{ docker_runtime_dir }}" + state: directory + recurse: yes + mode: 0755 + +- name: Ensure bin dir is present. + file: + state: directory + recurse: yes + path: "{{ docker_runtime_dir }}/bin" + mode: 0755 + +- name: Ensure log dir is present. + file: + state: directory + recurse: yes + path: "{{ docker_runtime_dir }}/logs/apache2" + mode: 0755 + +- name: Ensure data dir is present. + file: + state: directory + recurse: yes + path: "{{ docker_runtime_dir }}/data" + mode: 0755 + +- name: Ensure apache dir is present. + file: + state: directory + recurse: yes + path: "{{ docker_runtime_dir }}/apache" + mode: 0755 + +- name: Ensure php dir is present. + file: + state: directory + recurse: yes + path: "{{ docker_runtime_dir }}/bin/php" + mode: 0755 + +- name: Ensure database dir is present. + file: + state: directory + recurse: yes + path: "{{ docker_runtime_dir }}/bin/database" + mode: 0755 + +- name: Ensure Apache2 config is present. + template: + src: templates/apache.conf.j2 + dest: "{{ docker_runtime_dir }}/apache/default.conf" + mode: 0644 + +- name: Ensure php Dockerfile is present. + template: + src: templates/php.Dockerfile.j2 + dest: "{{ docker_runtime_dir }}/bin/php/Dockerfile" + mode: 0755 + +- name: Ensure mysql Dockerfile is present. + template: + src: "templates/{{ database }}.Dockerfile.j2" + dest: "{{ docker_runtime_dir }}/bin/database/Dockerfile" + mode: 0755 + +- name: Ensure Docker Compose file is present. + template: + src: templates/docker-compose.yml.j2 + dest: "{{ docker_runtime_dir }}/docker-compose.yml" + mode: 0755 diff --git a/tasks/settings-setup.yml b/tasks/settings-setup.yml index 5c560b1..2fc1915 100644 --- a/tasks/settings-setup.yml +++ b/tasks/settings-setup.yml @@ -6,16 +6,23 @@ state: directory recurse: yes mode: '1777' - owner: "{{ host_machine_user }}" -- name: Copy file with owner and permission, using symbolic representation +- name: Init settings.php + become: true copy: src: "{{ drupal_root_dir }}/{{ drupal_web_root }}/sites/default/default.settings.php" dest: "{{ drupal_root_dir }}/{{ drupal_web_root }}/sites/default/settings.php" - mode: '444' - owner: "{{ host_machine_user }}" + mode: '0444' + +- name: Make public Drupal sync dir. + file: + path: "{{drupal_root_dir}}/{{drupal_web_root}}/{{drupal_config_sync_folder}}" + state: directory + recurse: yes + mode: 0755 - name: Add DB connection to settings.php + become: true blockinfile: marker: "// {mark} {{ compose_project_name }} SETUP SETTINGS BLOCK." path: "{{ drupal_root_dir }}/{{ drupal_web_root }}/sites/default/settings.php" @@ -34,14 +41,16 @@ ], ]; $settings["file_temp_path"] = '/tmp'; - $settings['config_sync_directory'] = 'sites/default/sync'; + $settings['config_sync_directory'] = '{{drupal_config_sync_folder}}'; $settings['trusted_host_patterns'] = []; {% if solr %} $config['search_api.server.solr']['backend_config']['connector_config']['host'] = '{{ compose_project_name }}-solr'; + $config['search_api.server.solr']['backend_config']['connector_config']['core'] = '{{ solr_core_name }}'; {% endif %} $settings["hash_salt"] = '{{ drupal_hash_salt }}'; - name: Add custom settings to settings.php + become: true blockinfile: marker: "// {mark} {{ compose_project_name }} CUSTOM SETUP SETTINGS BLOCK." path: "{{ drupal_root_dir }}/{{ drupal_web_root }}/sites/default/settings.php" diff --git a/tasks/solr-setup.yml b/tasks/solr-setup.yml index 388b884..6e0f0a5 100644 --- a/tasks/solr-setup.yml +++ b/tasks/solr-setup.yml @@ -4,7 +4,7 @@ when: solr_version == 4 git: repo: https://github.com/docker-solr/docker-solr4 - dest: "{{ docker_runtime_dir }}/solr" + dest: "{{ docker_runtime_dir }}/bin/solr" version: master clone: yes update: yes @@ -13,32 +13,30 @@ - name: Create solr directory when: solr_version != 4 file: - path: "{{ docker_runtime_dir }}/solr" + recurse: yes + path: "{{ docker_runtime_dir }}/bin/solr" + state: directory + +- name: Create solr data directory + when: solr_version != 4 + file: + recurse: yes + path: "{{ docker_runtime_dir }}/data/solr" state: directory - name: Ensure Solr Dokcerfile is present. when: solr_version != 4 template: src: templates/solr.Dockerfile.j2 - dest: "{{ docker_runtime_dir }}/solr/Dockerfile" + dest: "{{ docker_runtime_dir }}/bin/solr/Dockerfile" mode: '644' - name: Ensure Solr Core file is present. template: src: templates/solr.core.j2 - dest: "{{ docker_runtime_dir }}/solr/core.properties" + dest: "{{ docker_runtime_dir }}/data/solr/core.properties" mode: '644' - name: Copy drupal solr config. - command: cp -r "{{ solr_configs_path }}"/. "{{ docker_runtime_dir }}/solr/conf" + command: cp -r "{{ solr_configs_path }}"/. "{{ docker_runtime_dir }}/data/solr/conf" -- name: Solr Setup. - when: solr_version == 4 - blockinfile: - marker: 'RUN chown -R $SOLR_USER:$SOLR_GROUP /opt/docker-solr' - path: "{{ docker_runtime_dir }}/solr/Dockerfile" - block: | - RUN mkdir /opt/solr/example/solr/{{ solr_core_name }} - COPY ./conf /opt/solr/example/solr/{{ solr_core_name }}/conf - COPY ./core.properties /opt/solr/example/solr/{{ solr_core_name }}/core.properties - RUN chown -R $SOLR_USER:$SOLR_GROUP /opt/solr/example/solr/{{ solr_core_name }} diff --git a/templates/apache.conf.j2 b/templates/apache.conf.j2 index 06e5306..a11fd96 100644 --- a/templates/apache.conf.j2 +++ b/templates/apache.conf.j2 @@ -1,13 +1,20 @@ - +{% if ssl_enabled %} + ServerAdmin webmaster@localhost DocumentRoot "/var/www/{{ drupal_web_root }}" ServerName {{ domain_name }} -{% if ssl_enabled %} - SSLEngine on - SSLCertificateFile /etc/apache2/cert.pem - SSLCertificateKeyFile /etc/apache2/pivate.key + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + {% endif %} + + ServerAdmin webmaster@localhost + DocumentRoot "/var/www/{{ drupal_web_root }}" + ServerName {{ domain_name }} Options Indexes FollowSymLinks diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 4831d4e..cf53217 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -14,7 +14,7 @@ services: webserver: build: - context: ./bin/{{ phpversion }} + context: ./bin/php/ container_name: '{{ compose_project_name }}-{{ phpversion }}' restart: 'always' working_dir: /var/www/{{ drupal_web_root }} @@ -39,8 +39,7 @@ services: volumes: - {{ drupal_root_dir }}:/var/www/{{ ":cached" if docker_cached_volume }} - {{ drupal_files_dir }}:/var/www/{{ drupal_web_root }}/sites/default/files/{{ ":cached" if docker_cached_volume }} - - ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/php.ini{{ ":cached" if docker_cached_volume }} - - ${VHOSTS_DIR-./config/vhosts}:/etc/apache2/sites-enabled{{ ":cached" if docker_cached_volume }} + - ${VHOSTS_DIR-./apache}:/etc/apache2/sites-enabled{{ ":cached" if docker_cached_volume }} {% if ssl_enabled %} - {{ ssl_cert_path }}:/etc/apache2/cert.pem{{ ":cached" if docker_cached_volume }} - {{ ssl_key_path }}:/etc/apache2/pivate.key{{ ":cached" if docker_cached_volume }} @@ -56,9 +55,11 @@ services: database: build: - context: "./bin/{{ database }}" + context: "./bin/database" container_name: '{{ compose_project_name }}-database' +{% if database == "mysql" %} command: --max_allowed_packet=1048576000 --skip-grant-tables +{% endif %} restart: 'always' volumes: - ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql{{ ":cached" if docker_cached_volume }} @@ -79,7 +80,9 @@ services: container_name: '{{ compose_project_name }}-solr' restart: 'always' build: - context: "./solr" + context: "./bin/solr" + volumes: + - ./data/solr:/opt/solr/server/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} {% if advanced_networking %} networks: {{ compose_project_name }}-network: diff --git a/templates/mysql.Dockerfile.j2 b/templates/mysql.Dockerfile.j2 new file mode 100644 index 0000000..5ad2dc4 --- /dev/null +++ b/templates/mysql.Dockerfile.j2 @@ -0,0 +1,8 @@ +FROM mysql:5.7 + +{% if user_uid != 0 %} +ARG USER_UID={{ user_uid }} +ARG USER_GID=$USER_UID +RUN groupmod --gid $USER_GID mysql && usermod --uid $USER_UID --gid $USER_GID mysql +{% endif %} + diff --git a/templates/php.Dockerfile.j2 b/templates/php.Dockerfile.j2 new file mode 100644 index 0000000..3069f2e --- /dev/null +++ b/templates/php.Dockerfile.j2 @@ -0,0 +1,19 @@ +FROM jetdevteam/drupal-php-apache:{{ phpversion }} + +{% if user_uid == 0 %} +USER root +{% else %} +USER root +ARG USER_UID={{ user_uid }} +ARG USER_GID=$USER_UID +RUN groupmod --gid $USER_GID dockerizer && usermod --uid $USER_UID --gid $USER_GID dockerizer +USER dockerizer +{% endif %} + +{% if drush_version == 8 %} +RUN sudo curl -fsSL -o /usr/local/bin/drush "https://github.com/drush-ops/drush/releases/download/8.4.1/drush.phar" && \ + sudo chmod +x /usr/local/bin/drush +{% else %} +RUN sudo curl -fsSL -o /usr/local/bin/drush "https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar" && \ + sudo chmod +x /usr/local/bin/drush +{% endif %} diff --git a/templates/php.ini.j2 b/templates/php.ini.j2 deleted file mode 100644 index 4c43df1..0000000 --- a/templates/php.ini.j2 +++ /dev/null @@ -1,1933 +0,0 @@ -[PHP] - -;;;;;;;;;;;;;;;;;;; -; About php.ini ; -;;;;;;;;;;;;;;;;;;; -; PHP's initialization file, generally called php.ini, is responsible for -; configuring many of the aspects of PHP's behavior. - -; PHP attempts to find and load this configuration from a number of locations. -; The following is a summary of its search order: -; 1. SAPI module specific location. -; 2. The PHPRC environment variable. (As of PHP 5.2.0) -; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0) -; 4. Current working directory (except CLI) -; 5. The web server's directory (for SAPI modules), or directory of PHP -; (otherwise in Windows) -; 6. The directory from the --with-config-file-path compile time option, or the -; Windows directory (C:\windows or C:\winnt) -; See the PHP docs for more specific information. -; http://php.net/configuration.file - -; The syntax of the file is extremely simple. Whitespace and lines -; beginning with a semicolon are silently ignored (as you probably guessed). -; Section headers (e.g. [Foo]) are also silently ignored, even though -; they might mean something in the future. - -; Directives following the section heading [PATH=/www/mysite] only -; apply to PHP files in the /www/mysite directory. Directives -; following the section heading [HOST=www.example.com] only apply to -; PHP files served from www.example.com. Directives set in these -; special sections cannot be overridden by user-defined INI files or -; at runtime. Currently, [PATH=] and [HOST=] sections only work under -; CGI/FastCGI. -; http://php.net/ini.sections - -; Directives are specified using the following syntax: -; directive = value -; Directive names are *case sensitive* - foo=bar is different from FOO=bar. -; Directives are variables used to configure PHP or PHP extensions. -; There is no name validation. If PHP can't find an expected -; directive because it is not set or is mistyped, a default value will be used. - -; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one -; of the INI constants (On, Off, True, False, Yes, No and None) or an expression -; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a -; previously set variable or directive (e.g. ${foo}) - -; Expressions in the INI file are limited to bitwise operators and parentheses: -; | bitwise OR -; ^ bitwise XOR -; & bitwise AND -; ~ bitwise NOT -; ! boolean NOT - -; Boolean flags can be turned on using the values 1, On, True or Yes. -; They can be turned off using the values 0, Off, False or No. - -; An empty string can be denoted by simply not writing anything after the equal -; sign, or by using the None keyword: - -; foo = ; sets foo to an empty string -; foo = None ; sets foo to an empty string -; foo = "None" ; sets foo to the string 'None' - -; If you use constants in your value, and these constants belong to a -; dynamically loaded extension (either a PHP extension or a Zend extension), -; you may only use these constants *after* the line that loads the extension. - -;;;;;;;;;;;;;;;;;;; -; About this file ; -;;;;;;;;;;;;;;;;;;; -; PHP comes packaged with two INI files. One that is recommended to be used -; in production environments and one that is recommended to be used in -; development environments. - -; php.ini-production contains settings which hold security, performance and -; best practices at its core. But please be aware, these settings may break -; compatibility with older or less security conscience applications. We -; recommending using the production ini in production and testing environments. - -; php.ini-development is very similar to its production variant, except it is -; much more verbose when it comes to errors. We recommend using the -; development version only in development environments, as errors shown to -; application users can inadvertently leak otherwise secure information. - -; This is php.ini-production INI file. - -;;;;;;;;;;;;;;;;;;; -; Quick Reference ; -;;;;;;;;;;;;;;;;;;; -; The following are all the settings which are different in either the production -; or development versions of the INIs with respect to PHP's default behavior. -; Please see the actual settings later in the document for more details as to why -; we recommend these changes in PHP's behavior. - -; display_errors -; Default Value: On -; Development Value: On -; Production Value: Off - -; display_startup_errors -; Default Value: Off -; Development Value: On -; Production Value: Off - -; error_reporting -; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED -; Development Value: E_ALL -; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT - -; html_errors -; Default Value: On -; Development Value: On -; Production value: On - -; log_errors -; Default Value: Off -; Development Value: On -; Production Value: On - -; max_input_time -; Default Value: -1 (Unlimited) -; Development Value: 60 (60 seconds) -; Production Value: 60 (60 seconds) - -; output_buffering -; Default Value: Off -; Development Value: 4096 -; Production Value: 4096 - -; register_argc_argv -; Default Value: On -; Development Value: Off -; Production Value: Off - -; request_order -; Default Value: None -; Development Value: "GP" -; Production Value: "GP" - -; session.gc_divisor -; Default Value: 100 -; Development Value: 1000 -; Production Value: 1000 - -; session.sid_bits_per_character -; Default Value: 4 -; Development Value: 5 -; Production Value: 5 - -; short_open_tag -; Default Value: On -; Development Value: Off -; Production Value: Off - -; variables_order -; Default Value: "EGPCS" -; Development Value: "GPCS" -; Production Value: "GPCS" - -;;;;;;;;;;;;;;;;;;;; -; php.ini Options ; -;;;;;;;;;;;;;;;;;;;; -; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini" -;user_ini.filename = ".user.ini" - -; To disable this feature set this option to empty value -;user_ini.filename = - -; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes) -;user_ini.cache_ttl = 300 - -;;;;;;;;;;;;;;;;;;;; -; Language Options ; -;;;;;;;;;;;;;;;;;;;; - -; Enable the PHP scripting language engine under Apache. -; http://php.net/engine -engine = On - -; This directive determines whether or not PHP will recognize code between -; tags as PHP source which should be processed as such. It is -; generally recommended that should be used and that this feature -; should be disabled, as enabling it may result in issues when generating XML -; documents, however this remains supported for backward compatibility reasons. -; Note that this directive does not control the would work. -; http://php.net/syntax-highlighting -;highlight.string = #DD0000 -;highlight.comment = #FF9900 -;highlight.keyword = #007700 -;highlight.default = #0000BB -;highlight.html = #000000 - -; If enabled, the request will be allowed to complete even if the user aborts -; the request. Consider enabling it if executing long requests, which may end up -; being interrupted by the user or a browser timing out. PHP's default behavior -; is to disable this feature. -; http://php.net/ignore-user-abort -;ignore_user_abort = On - -; Determines the size of the realpath cache to be used by PHP. This value should -; be increased on systems where PHP opens many files to reflect the quantity of -; the file operations performed. -; Note: if open_basedir is set, the cache is disabled -; http://php.net/realpath-cache-size -;realpath_cache_size = 4096k - -; Duration of time, in seconds for which to cache realpath information for a given -; file or directory. For systems with rarely changing files, consider increasing this -; value. -; http://php.net/realpath-cache-ttl -;realpath_cache_ttl = 120 - -; Enables or disables the circular reference collector. -; http://php.net/zend.enable-gc -zend.enable_gc = On - -; If enabled, scripts may be written in encodings that are incompatible with -; the scanner. CP936, Big5, CP949 and Shift_JIS are the examples of such -; encodings. To use this feature, mbstring extension must be enabled. -; Default: Off -;zend.multibyte = Off - -; Allows to set the default encoding for the scripts. This value will be used -; unless "declare(encoding=...)" directive appears at the top of the script. -; Only affects if zend.multibyte is set. -; Default: "" -;zend.script_encoding = - -;;;;;;;;;;;;;;;;; -; Miscellaneous ; -;;;;;;;;;;;;;;;;; - -; Decides whether PHP may expose the fact that it is installed on the server -; (e.g. by adding its signature to the Web server header). It is no security -; threat in any way, but it makes it possible to determine whether you use PHP -; on your server or not. -; http://php.net/expose-php -expose_php = On - -;;;;;;;;;;;;;;;;;;; -; Resource Limits ; -;;;;;;;;;;;;;;;;;;; - -; Maximum execution time of each script, in seconds -; http://php.net/max-execution-time -; Note: This directive is hardcoded to 0 for the CLI SAPI -max_execution_time = 300 - -; Maximum amount of time each script may spend parsing request data. It's a good -; idea to limit this time on productions servers in order to eliminate unexpectedly -; long running scripts. -; Note: This directive is hardcoded to -1 for the CLI SAPI -; Default Value: -1 (Unlimited) -; Development Value: 60 (60 seconds) -; Production Value: 60 (60 seconds) -; http://php.net/max-input-time -max_input_time = 600 - -; Maximum input variable nesting level -; http://php.net/max-input-nesting-level -;max_input_nesting_level = 64 - -; How many GET/POST/COOKIE input variables may be accepted -; max_input_vars = 1000 - -; Maximum amount of memory a script may consume (128MB) -; http://php.net/memory-limit -memory_limit = 1024M - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Error handling and logging ; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -; This directive informs PHP of which errors, warnings and notices you would like -; it to take action for. The recommended way of setting values for this -; directive is through the use of the error level constants and bitwise -; operators. The error level constants are below here for convenience as well as -; some common settings and their meanings. -; By default, PHP is set to take action on all errors, notices and warnings EXCEPT -; those related to E_NOTICE and E_STRICT, which together cover best practices and -; recommended coding standards in PHP. For performance reasons, this is the -; recommend error reporting setting. Your production server shouldn't be wasting -; resources complaining about best practices and coding standards. That's what -; development servers and development settings are for. -; Note: The php.ini-development file has this setting as E_ALL. This -; means it pretty much reports everything which is exactly what you want during -; development and early testing. -; -; Error Level Constants: -; E_ALL - All errors and warnings (includes E_STRICT as of PHP 5.4.0) -; E_ERROR - fatal run-time errors -; E_RECOVERABLE_ERROR - almost fatal run-time errors -; E_WARNING - run-time warnings (non-fatal errors) -; E_PARSE - compile-time parse errors -; E_NOTICE - run-time notices (these are warnings which often result -; from a bug in your code, but it's possible that it was -; intentional (e.g., using an uninitialized variable and -; relying on the fact it is automatically initialized to an -; empty string) -; E_STRICT - run-time notices, enable to have PHP suggest changes -; to your code which will ensure the best interoperability -; and forward compatibility of your code -; E_CORE_ERROR - fatal errors that occur during PHP's initial startup -; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's -; initial startup -; E_COMPILE_ERROR - fatal compile-time errors -; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) -; E_USER_ERROR - user-generated error message -; E_USER_WARNING - user-generated warning message -; E_USER_NOTICE - user-generated notice message -; E_DEPRECATED - warn about code that will not work in future versions -; of PHP -; E_USER_DEPRECATED - user-generated deprecation warnings -; -; Common Values: -; E_ALL (Show all errors, warnings and notices including coding standards.) -; E_ALL & ~E_NOTICE (Show all errors, except for notices) -; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.) -; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) -; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED -; Development Value: E_ALL -; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT -; http://php.net/error-reporting -error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT - -; This directive controls whether or not and where PHP will output errors, -; notices and warnings too. Error output is very useful during development, but -; it could be very dangerous in production environments. Depending on the code -; which is triggering the error, sensitive information could potentially leak -; out of your application such as database usernames and passwords or worse. -; For production environments, we recommend logging errors rather than -; sending them to STDOUT. -; Possible Values: -; Off = Do not display any errors -; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) -; On or stdout = Display errors to STDOUT -; Default Value: On -; Development Value: On -; Production Value: Off -; http://php.net/display-errors -display_errors = Off - -; The display of errors which occur during PHP's startup sequence are handled -; separately from display_errors. PHP's default behavior is to suppress those -; errors from clients. Turning the display of startup errors on can be useful in -; debugging configuration problems. We strongly recommend you -; set this to 'off' for production servers. -; Default Value: Off -; Development Value: On -; Production Value: Off -; http://php.net/display-startup-errors -display_startup_errors = Off - -; Besides displaying errors, PHP can also log errors to locations such as a -; server-specific log, STDERR, or a location specified by the error_log -; directive found below. While errors should not be displayed on productions -; servers they should still be monitored and logging is a great way to do that. -; Default Value: Off -; Development Value: On -; Production Value: On -; http://php.net/log-errors -log_errors = On - -; Set maximum length of log_errors. In error_log information about the source is -; added. The default is 1024 and 0 allows to not apply any maximum length at all. -; http://php.net/log-errors-max-len -log_errors_max_len = 1024 - -; Do not log repeated messages. Repeated errors must occur in same file on same -; line unless ignore_repeated_source is set true. -; http://php.net/ignore-repeated-errors -ignore_repeated_errors = Off - -; Ignore source of message when ignoring repeated messages. When this setting -; is On you will not log errors with repeated messages from different files or -; source lines. -; http://php.net/ignore-repeated-source -ignore_repeated_source = Off - -; If this parameter is set to Off, then memory leaks will not be shown (on -; stdout or in the log). This has only effect in a debug compile, and if -; error reporting includes E_WARNING in the allowed list -; http://php.net/report-memleaks -report_memleaks = On - -; This setting is on by default. -;report_zend_debug = 0 - -; Store the last error/warning message in $php_errormsg (boolean). Setting this value -; to On can assist in debugging and is appropriate for development servers. It should -; however be disabled on production servers. -; This directive is DEPRECATED. -; Default Value: Off -; Development Value: Off -; Production Value: Off -; http://php.net/track-errors -;track_errors = Off - -; Turn off normal error reporting and emit XML-RPC error XML -; http://php.net/xmlrpc-errors -;xmlrpc_errors = 0 - -; An XML-RPC faultCode -;xmlrpc_error_number = 0 - -; When PHP displays or logs an error, it has the capability of formatting the -; error message as HTML for easier reading. This directive controls whether -; the error message is formatted as HTML or not. -; Note: This directive is hardcoded to Off for the CLI SAPI -; Default Value: On -; Development Value: On -; Production value: On -; http://php.net/html-errors -html_errors = On - -; If html_errors is set to On *and* docref_root is not empty, then PHP -; produces clickable error messages that direct to a page describing the error -; or function causing the error in detail. -; You can download a copy of the PHP manual from http://php.net/docs -; and change docref_root to the base URL of your local copy including the -; leading '/'. You must also specify the file extension being used including -; the dot. PHP's default behavior is to leave these settings empty, in which -; case no links to documentation are generated. -; Note: Never use this feature for production boxes. -; http://php.net/docref-root -; Examples -;docref_root = "/phpmanual/" - -; http://php.net/docref-ext -;docref_ext = .html - -; String to output before an error message. PHP's default behavior is to leave -; this setting blank. -; http://php.net/error-prepend-string -; Example: -;error_prepend_string = "" - -; String to output after an error message. PHP's default behavior is to leave -; this setting blank. -; http://php.net/error-append-string -; Example: -;error_append_string = "" - -; Log errors to specified file. PHP's default behavior is to leave this value -; empty. -; http://php.net/error-log -; Example: -;error_log = php_errors.log -; Log errors to syslog (Event Log on Windows). -;error_log = syslog - -;windows.show_crt_warning -; Default value: 0 -; Development value: 0 -; Production value: 0 - -;;;;;;;;;;;;;;;;; -; Data Handling ; -;;;;;;;;;;;;;;;;; - -; The separator used in PHP generated URLs to separate arguments. -; PHP's default setting is "&". -; http://php.net/arg-separator.output -; Example: -;arg_separator.output = "&" - -; List of separator(s) used by PHP to parse input URLs into variables. -; PHP's default setting is "&". -; NOTE: Every character in this directive is considered as separator! -; http://php.net/arg-separator.input -; Example: -;arg_separator.input = ";&" - -; This directive determines which super global arrays are registered when PHP -; starts up. G,P,C,E & S are abbreviations for the following respective super -; globals: GET, POST, COOKIE, ENV and SERVER. There is a performance penalty -; paid for the registration of these arrays and because ENV is not as commonly -; used as the others, ENV is not recommended on productions servers. You -; can still get access to the environment variables through getenv() should you -; need to. -; Default Value: "EGPCS" -; Development Value: "GPCS" -; Production Value: "GPCS"; -; http://php.net/variables-order -variables_order = "GPCS" - -; This directive determines which super global data (G,P & C) should be -; registered into the super global array REQUEST. If so, it also determines -; the order in which that data is registered. The values for this directive -; are specified in the same manner as the variables_order directive, -; EXCEPT one. Leaving this value empty will cause PHP to use the value set -; in the variables_order directive. It does not mean it will leave the super -; globals array REQUEST empty. -; Default Value: None -; Development Value: "GP" -; Production Value: "GP" -; http://php.net/request-order -request_order = "GP" - -; This directive determines whether PHP registers $argv & $argc each time it -; runs. $argv contains an array of all the arguments passed to PHP when a script -; is invoked. $argc contains an integer representing the number of arguments -; that were passed when the script was invoked. These arrays are extremely -; useful when running scripts from the command line. When this directive is -; enabled, registering these variables consumes CPU cycles and memory each time -; a script is executed. For performance reasons, this feature should be disabled -; on production servers. -; Note: This directive is hardcoded to On for the CLI SAPI -; Default Value: On -; Development Value: Off -; Production Value: Off -; http://php.net/register-argc-argv -register_argc_argv = Off - -; When enabled, the ENV, REQUEST and SERVER variables are created when they're -; first used (Just In Time) instead of when the script starts. If these -; variables are not used within a script, having this directive on will result -; in a performance gain. The PHP directive register_argc_argv must be disabled -; for this directive to have any affect. -; http://php.net/auto-globals-jit -auto_globals_jit = On - -; Whether PHP will read the POST data. -; This option is enabled by default. -; Most likely, you won't want to disable this option globally. It causes $_POST -; and $_FILES to always be empty; the only way you will be able to read the -; POST data will be through the php://input stream wrapper. This can be useful -; to proxy requests or to process the POST data in a memory efficient fashion. -; http://php.net/enable-post-data-reading -;enable_post_data_reading = Off - -; Maximum size of POST data that PHP will accept. -; Its value may be 0 to disable the limit. It is ignored if POST data reading -; is disabled through enable_post_data_reading. -; http://php.net/post-max-size -post_max_size = 8M - -; Automatically add files before PHP document. -; http://php.net/auto-prepend-file -auto_prepend_file = - -; Automatically add files after PHP document. -; http://php.net/auto-append-file -auto_append_file = - -; By default, PHP will output a media type using the Content-Type header. To -; disable this, simply set it to be empty. -; -; PHP's built-in default media type is set to text/html. -; http://php.net/default-mimetype -default_mimetype = "text/html" - -; PHP's default character set is set to UTF-8. -; http://php.net/default-charset -default_charset = "UTF-8" - -; PHP internal character encoding is set to empty. -; If empty, default_charset is used. -; http://php.net/internal-encoding -;internal_encoding = - -; PHP input character encoding is set to empty. -; If empty, default_charset is used. -; http://php.net/input-encoding -;input_encoding = - -; PHP output character encoding is set to empty. -; If empty, default_charset is used. -; See also output_buffer. -; http://php.net/output-encoding -;output_encoding = - -;;;;;;;;;;;;;;;;;;;;;;;;; -; Paths and Directories ; -;;;;;;;;;;;;;;;;;;;;;;;;; - -; UNIX: "/path1:/path2" -;include_path = ".:/php/includes" -; -; Windows: "\path1;\path2" -;include_path = ".;c:\php\includes" -; -; PHP's default setting for include_path is ".;/path/to/php/pear" -; http://php.net/include-path - -; The root of the PHP pages, used only if nonempty. -; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root -; if you are running php as a CGI under any web server (other than IIS) -; see documentation for security issues. The alternate is to use the -; cgi.force_redirect configuration below -; http://php.net/doc-root -doc_root = - -; The directory under which PHP opens the script using /~username used only -; if nonempty. -; http://php.net/user-dir -user_dir = - -; Directory in which the loadable extensions (modules) reside. -; http://php.net/extension-dir -; extension_dir = "./" -; On windows: -; extension_dir = "ext" - -; Directory where the temporary files should be placed. -; Defaults to the system default (see sys_get_temp_dir) -; sys_temp_dir = "/tmp" - -; Whether or not to enable the dl() function. The dl() function does NOT work -; properly in multithreaded servers, such as IIS or Zeus, and is automatically -; disabled on them. -; http://php.net/enable-dl -enable_dl = Off - -; cgi.force_redirect is necessary to provide security running PHP as a CGI under -; most web servers. Left undefined, PHP turns this on by default. You can -; turn it off here AT YOUR OWN RISK -; **You CAN safely turn this off for IIS, in fact, you MUST.** -; http://php.net/cgi.force-redirect -;cgi.force_redirect = 1 - -; if cgi.nph is enabled it will force cgi to always sent Status: 200 with -; every request. PHP's default behavior is to disable this feature. -;cgi.nph = 1 - -; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape -; (iPlanet) web servers, you MAY need to set an environment variable name that PHP -; will look for to know it is OK to continue execution. Setting this variable MAY -; cause security issues, KNOW WHAT YOU ARE DOING FIRST. -; http://php.net/cgi.redirect-status-env -;cgi.redirect_status_env = - -; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's -; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok -; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting -; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting -; of zero causes PHP to behave as before. Default is 1. You should fix your scripts -; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. -; http://php.net/cgi.fix-pathinfo -;cgi.fix_pathinfo=1 - -; if cgi.discard_path is enabled, the PHP CGI binary can safely be placed outside -; of the web tree and people will not be able to circumvent .htaccess security. -; http://php.net/cgi.dicard-path -;cgi.discard_path=1 - -; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate -; security tokens of the calling client. This allows IIS to define the -; security context that the request runs under. mod_fastcgi under Apache -; does not currently support this feature (03/17/2002) -; Set to 1 if running under IIS. Default is zero. -; http://php.net/fastcgi.impersonate -;fastcgi.impersonate = 1 - -; Disable logging through FastCGI connection. PHP's default behavior is to enable -; this feature. -;fastcgi.logging = 0 - -; cgi.rfc2616_headers configuration option tells PHP what type of headers to -; use when sending HTTP response code. If set to 0, PHP sends Status: header that -; is supported by Apache. When this option is set to 1, PHP will send -; RFC2616 compliant header. -; Default is zero. -; http://php.net/cgi.rfc2616-headers -;cgi.rfc2616_headers = 0 - -; cgi.check_shebang_line controls whether CGI PHP checks for line starting with #! -; (shebang) at the top of the running script. This line might be needed if the -; script support running both as stand-alone script and via PHP CGI<. PHP in CGI -; mode skips this line and ignores its content if this directive is turned on. -; http://php.net/cgi.check-shebang-line -;cgi.check_shebang_line=1 - -;;;;;;;;;;;;;;;; -; File Uploads ; -;;;;;;;;;;;;;;;; - -; Whether to allow HTTP file uploads. -; http://php.net/file-uploads -file_uploads = On - -; Temporary directory for HTTP uploaded files (will use system default if not -; specified). -; http://php.net/upload-tmp-dir -;upload_tmp_dir = - -; Maximum allowed size for uploaded files. -; http://php.net/upload-max-filesize -upload_max_filesize = 2M - -; Maximum number of files that can be uploaded via a single request -max_file_uploads = 20 - -;;;;;;;;;;;;;;;;;; -; Fopen wrappers ; -;;;;;;;;;;;;;;;;;; - -; Whether to allow the treatment of URLs (like http:// or ftp://) as files. -; http://php.net/allow-url-fopen -allow_url_fopen = On - -; Whether to allow include/require to open URLs (like http:// or ftp://) as files. -; http://php.net/allow-url-include -allow_url_include = Off - -; Define the anonymous ftp password (your email address). PHP's default setting -; for this is empty. -; http://php.net/from -;from="john@doe.com" - -; Define the User-Agent string. PHP's default setting for this is empty. -; http://php.net/user-agent -;user_agent="PHP" - -; Default timeout for socket based streams (seconds) -; http://php.net/default-socket-timeout -default_socket_timeout = 60 - -; If your scripts have to deal with files from Macintosh systems, -; or you are running on a Mac and need to deal with files from -; unix or win32 systems, setting this flag will cause PHP to -; automatically detect the EOL character in those files so that -; fgets() and file() will work regardless of the source of the file. -; http://php.net/auto-detect-line-endings -;auto_detect_line_endings = Off - -;;;;;;;;;;;;;;;;;;;;;; -; Dynamic Extensions ; -;;;;;;;;;;;;;;;;;;;;;; - -; If you wish to have an extension loaded automatically, use the following -; syntax: -; -; extension=modulename -; -; For example: -; -; extension=mysqli -; -; When the extension library to load is not located in the default extension -; directory, You may specify an absolute path to the library file: -; -; extension=/path/to/extension/mysqli.so -; -; Note : The syntax used in previous PHP versions ('extension=.so' and -; 'extension='php_.dll') is supported for legacy reasons and may be -; deprecated in a future PHP major version. So, when it is possible, please -; move to the new ('extension=) syntax. -; -; Notes for Windows environments : -; -; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+) -; extension folders as well as the separate PECL DLL download (PHP 5+). -; Be sure to appropriately set the extension_dir directive. -; -;extension=bz2 -;extension=curl -;extension=fileinfo -;extension=gd2 -;extension=gettext -;extension=gmp -;extension=intl -;extension=imap -;extension=interbase -;extension=ldap -;extension=mbstring -;extension=exif ; Must be after mbstring as it depends on it -;extension=mysqli -;extension=oci8_12c ; Use with Oracle Database 12c Instant Client -;extension=odbc -;extension=openssl -;extension=pdo_firebird -;extension=pdo_mysql -;extension=pdo_oci -;extension=pdo_odbc -;extension=pdo_pgsql -;extension=pdo_sqlite -;extension=pgsql -;extension=shmop - -; The MIBS data available in the PHP distribution must be installed. -; See http://www.php.net/manual/en/snmp.installation.php -;extension=snmp - -;extension=soap -;extension=sockets -;extension=sqlite3 -;extension=tidy -;extension=xmlrpc -;extension=xsl - -;;;;;;;;;;;;;;;;;;; -; Module Settings ; -;;;;;;;;;;;;;;;;;;; - -[CLI Server] -; Whether the CLI web server uses ANSI color coding in its terminal output. -cli_server.color = On - -[Date] -; Defines the default timezone used by the date functions -; http://php.net/date.timezone -;date.timezone = - -; http://php.net/date.default-latitude -;date.default_latitude = 31.7667 - -; http://php.net/date.default-longitude -;date.default_longitude = 35.2333 - -; http://php.net/date.sunrise-zenith -;date.sunrise_zenith = 90.583333 - -; http://php.net/date.sunset-zenith -;date.sunset_zenith = 90.583333 - -[filter] -; http://php.net/filter.default -;filter.default = unsafe_raw - -; http://php.net/filter.default-flags -;filter.default_flags = - -[iconv] -; Use of this INI entry is deprecated, use global input_encoding instead. -; If empty, default_charset or input_encoding or iconv.input_encoding is used. -; The precedence is: default_charset < intput_encoding < iconv.input_encoding -;iconv.input_encoding = - -; Use of this INI entry is deprecated, use global internal_encoding instead. -; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. -; The precedence is: default_charset < internal_encoding < iconv.internal_encoding -;iconv.internal_encoding = - -; Use of this INI entry is deprecated, use global output_encoding instead. -; If empty, default_charset or output_encoding or iconv.output_encoding is used. -; The precedence is: default_charset < output_encoding < iconv.output_encoding -; To use an output encoding conversion, iconv's output handler must be set -; otherwise output encoding conversion cannot be performed. -;iconv.output_encoding = - -[imap] -; rsh/ssh logins are disabled by default. Use this INI entry if you want to -; enable them. Note that the IMAP library does not filter mailbox names before -; passing them to rsh/ssh command, thus passing untrusted data to this function -; with rsh/ssh enabled is insecure. -;imap.enable_insecure_rsh=0 - -[intl] -;intl.default_locale = -; This directive allows you to produce PHP errors when some error -; happens within intl functions. The value is the level of the error produced. -; Default is 0, which does not produce any errors. -;intl.error_level = E_WARNING -;intl.use_exceptions = 0 - -[sqlite3] -; Directory pointing to SQLite3 extensions -; http://php.net/sqlite3.extension-dir -;sqlite3.extension_dir = - -; SQLite defensive mode flag (only available from SQLite 3.26+) -; When the defensive flag is enabled, language features that allow ordinary -; SQL to deliberately corrupt the database file are disabled. This forbids -; writing directly to the schema, shadow tables (eg. FTS data tables), or -; the sqlite_dbpage virtual table. -; https://www.sqlite.org/c3ref/c_dbconfig_defensive.html -; (for older SQLite versions, this flag has no use) -;sqlite3.defensive = 1 - -[Pcre] -;PCRE library backtracking limit. -; http://php.net/pcre.backtrack-limit -;pcre.backtrack_limit=100000 - -;PCRE library recursion limit. -;Please note that if you set this value to a high number you may consume all -;the available process stack and eventually crash PHP (due to reaching the -;stack size limit imposed by the Operating System). -; http://php.net/pcre.recursion-limit -;pcre.recursion_limit=100000 - -;Enables or disables JIT compilation of patterns. This requires the PCRE -;library to be compiled with JIT support. -;pcre.jit=1 - -[Pdo] -; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off" -; http://php.net/pdo-odbc.connection-pooling -;pdo_odbc.connection_pooling=strict - -;pdo_odbc.db2_instance_name - -[Pdo_mysql] -; If mysqlnd is used: Number of cache slots for the internal result set cache -; http://php.net/pdo_mysql.cache_size -pdo_mysql.cache_size = 2000 - -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -; http://php.net/pdo_mysql.default-socket -pdo_mysql.default_socket= - -[Phar] -; http://php.net/phar.readonly -;phar.readonly = On - -; http://php.net/phar.require-hash -;phar.require_hash = On - -;phar.cache_list = - -[mail function] -; For Win32 only. -; http://php.net/smtp -SMTP = localhost -; http://php.net/smtp-port -smtp_port = 25 - -; For Win32 only. -; http://php.net/sendmail-from -;sendmail_from = me@example.com - -; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). -; http://php.net/sendmail-path -;sendmail_path = - -; Force the addition of the specified parameters to be passed as extra parameters -; to the sendmail binary. These parameters will always replace the value of -; the 5th parameter to mail(). -;mail.force_extra_parameters = - -; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename -mail.add_x_header = Off - -; The path to a log file that will log all mail() calls. Log entries include -; the full path of the script, line number, To address and headers. -;mail.log = -; Log mail to syslog (Event Log on Windows). -;mail.log = syslog - -[ODBC] -; http://php.net/odbc.default-db -;odbc.default_db = Not yet implemented - -; http://php.net/odbc.default-user -;odbc.default_user = Not yet implemented - -; http://php.net/odbc.default-pw -;odbc.default_pw = Not yet implemented - -; Controls the ODBC cursor model. -; Default: SQL_CURSOR_STATIC (default). -;odbc.default_cursortype - -; Allow or prevent persistent links. -; http://php.net/odbc.allow-persistent -odbc.allow_persistent = On - -; Check that a connection is still valid before reuse. -; http://php.net/odbc.check-persistent -odbc.check_persistent = On - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/odbc.max-persistent -odbc.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -; http://php.net/odbc.max-links -odbc.max_links = -1 - -; Handling of LONG fields. Returns number of bytes to variables. 0 means -; passthru. -; http://php.net/odbc.defaultlrl -odbc.defaultlrl = 4096 - -; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. -; See the documentation on odbc_binmode and odbc_longreadlen for an explanation -; of odbc.defaultlrl and odbc.defaultbinmode -; http://php.net/odbc.defaultbinmode -odbc.defaultbinmode = 1 - -;birdstep.max_links = -1 - -[Interbase] -; Allow or prevent persistent links. -ibase.allow_persistent = 1 - -; Maximum number of persistent links. -1 means no limit. -ibase.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -ibase.max_links = -1 - -; Default database name for ibase_connect(). -;ibase.default_db = - -; Default username for ibase_connect(). -;ibase.default_user = - -; Default password for ibase_connect(). -;ibase.default_password = - -; Default charset for ibase_connect(). -;ibase.default_charset = - -; Default timestamp format. -ibase.timestampformat = "%Y-%m-%d %H:%M:%S" - -; Default date format. -ibase.dateformat = "%Y-%m-%d" - -; Default time format. -ibase.timeformat = "%H:%M:%S" - -[MySQLi] - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/mysqli.max-persistent -mysqli.max_persistent = -1 - -; Allow accessing, from PHP's perspective, local files with LOAD DATA statements -; http://php.net/mysqli.allow_local_infile -;mysqli.allow_local_infile = On - -; Allow or prevent persistent links. -; http://php.net/mysqli.allow-persistent -mysqli.allow_persistent = On - -; Maximum number of links. -1 means no limit. -; http://php.net/mysqli.max-links -mysqli.max_links = -1 - -; If mysqlnd is used: Number of cache slots for the internal result set cache -; http://php.net/mysqli.cache_size -mysqli.cache_size = 2000 - -; Default port number for mysqli_connect(). If unset, mysqli_connect() will use -; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the -; compile-time value defined MYSQL_PORT (in that order). Win32 will only look -; at MYSQL_PORT. -; http://php.net/mysqli.default-port -mysqli.default_port = 3306 - -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -; http://php.net/mysqli.default-socket -mysqli.default_socket = - -; Default host for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysqli.default-host -mysqli.default_host = - -; Default user for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysqli.default-user -mysqli.default_user = - -; Default password for mysqli_connect() (doesn't apply in safe mode). -; Note that this is generally a *bad* idea to store passwords in this file. -; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") -; and reveal this password! And of course, any users with read access to this -; file will be able to reveal the password as well. -; http://php.net/mysqli.default-pw -mysqli.default_pw = - -; Allow or prevent reconnect -mysqli.reconnect = Off - -[mysqlnd] -; Enable / Disable collection of general statistics by mysqlnd which can be -; used to tune and monitor MySQL operations. -; http://php.net/mysqlnd.collect_statistics -mysqlnd.collect_statistics = On - -; Enable / Disable collection of memory usage statistics by mysqlnd which can be -; used to tune and monitor MySQL operations. -; http://php.net/mysqlnd.collect_memory_statistics -mysqlnd.collect_memory_statistics = Off - -; Records communication from all extensions using mysqlnd to the specified log -; file. -; http://php.net/mysqlnd.debug -;mysqlnd.debug = - -; Defines which queries will be logged. -; http://php.net/mysqlnd.log_mask -;mysqlnd.log_mask = 0 - -; Default size of the mysqlnd memory pool, which is used by result sets. -; http://php.net/mysqlnd.mempool_default_size -;mysqlnd.mempool_default_size = 16000 - -; Size of a pre-allocated buffer used when sending commands to MySQL in bytes. -; http://php.net/mysqlnd.net_cmd_buffer_size -;mysqlnd.net_cmd_buffer_size = 2048 - -; Size of a pre-allocated buffer used for reading data sent by the server in -; bytes. -; http://php.net/mysqlnd.net_read_buffer_size -;mysqlnd.net_read_buffer_size = 32768 - -; Timeout for network requests in seconds. -; http://php.net/mysqlnd.net_read_timeout -;mysqlnd.net_read_timeout = 31536000 - -; SHA-256 Authentication Plugin related. File with the MySQL server public RSA -; key. -; http://php.net/mysqlnd.sha256_server_public_key -;mysqlnd.sha256_server_public_key = - -[OCI8] - -; Connection: Enables privileged connections using external -; credentials (OCI_SYSOPER, OCI_SYSDBA) -; http://php.net/oci8.privileged-connect -;oci8.privileged_connect = Off - -; Connection: The maximum number of persistent OCI8 connections per -; process. Using -1 means no limit. -; http://php.net/oci8.max-persistent -;oci8.max_persistent = -1 - -; Connection: The maximum number of seconds a process is allowed to -; maintain an idle persistent connection. Using -1 means idle -; persistent connections will be maintained forever. -; http://php.net/oci8.persistent-timeout -;oci8.persistent_timeout = -1 - -; Connection: The number of seconds that must pass before issuing a -; ping during oci_pconnect() to check the connection validity. When -; set to 0, each oci_pconnect() will cause a ping. Using -1 disables -; pings completely. -; http://php.net/oci8.ping-interval -;oci8.ping_interval = 60 - -; Connection: Set this to a user chosen connection class to be used -; for all pooled server requests with Oracle 11g Database Resident -; Connection Pooling (DRCP). To use DRCP, this value should be set to -; the same string for all web servers running the same application, -; the database pool must be configured, and the connection string must -; specify to use a pooled server. -;oci8.connection_class = - -; High Availability: Using On lets PHP receive Fast Application -; Notification (FAN) events generated when a database node fails. The -; database must also be configured to post FAN events. -;oci8.events = Off - -; Tuning: This option enables statement caching, and specifies how -; many statements to cache. Using 0 disables statement caching. -; http://php.net/oci8.statement-cache-size -;oci8.statement_cache_size = 20 - -; Tuning: Enables statement prefetching and sets the default number of -; rows that will be fetched automatically after statement execution. -; http://php.net/oci8.default-prefetch -;oci8.default_prefetch = 100 - -; Compatibility. Using On means oci_close() will not close -; oci_connect() and oci_new_connect() connections. -; http://php.net/oci8.old-oci-close-semantics -;oci8.old_oci_close_semantics = Off - -[PostgreSQL] -; Allow or prevent persistent links. -; http://php.net/pgsql.allow-persistent -pgsql.allow_persistent = On - -; Detect broken persistent links always with pg_pconnect(). -; Auto reset feature requires a little overheads. -; http://php.net/pgsql.auto-reset-persistent -pgsql.auto_reset_persistent = Off - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/pgsql.max-persistent -pgsql.max_persistent = -1 - -; Maximum number of links (persistent+non persistent). -1 means no limit. -; http://php.net/pgsql.max-links -pgsql.max_links = -1 - -; Ignore PostgreSQL backends Notice message or not. -; Notice message logging require a little overheads. -; http://php.net/pgsql.ignore-notice -pgsql.ignore_notice = 0 - -; Log PostgreSQL backends Notice message or not. -; Unless pgsql.ignore_notice=0, module cannot log notice message. -; http://php.net/pgsql.log-notice -pgsql.log_notice = 0 - -[bcmath] -; Number of decimal digits for all bcmath functions. -; http://php.net/bcmath.scale -bcmath.scale = 0 - -[browscap] -; http://php.net/browscap -;browscap = extra/browscap.ini - -[Session] -; Handler used to store/retrieve data. -; http://php.net/session.save-handler -session.save_handler = files - -; Argument passed to save_handler. In the case of files, this is the path -; where data files are stored. Note: Windows users have to change this -; variable in order to use PHP's session functions. -; -; The path can be defined as: -; -; session.save_path = "N;/path" -; -; where N is an integer. Instead of storing all the session files in -; /path, what this will do is use subdirectories N-levels deep, and -; store the session data in those directories. This is useful if -; your OS has problems with many files in one directory, and is -; a more efficient layout for servers that handle many sessions. -; -; NOTE 1: PHP will not create this directory structure automatically. -; You can use the script in the ext/session dir for that purpose. -; NOTE 2: See the section on garbage collection below if you choose to -; use subdirectories for session storage -; -; The file storage module creates files using mode 600 by default. -; You can change that by using -; -; session.save_path = "N;MODE;/path" -; -; where MODE is the octal representation of the mode. Note that this -; does not overwrite the process's umask. -; http://php.net/session.save-path -;session.save_path = "/tmp" - -; Whether to use strict session mode. -; Strict session mode does not accept uninitialized session ID and regenerate -; session ID if browser sends uninitialized session ID. Strict mode protects -; applications from session fixation via session adoption vulnerability. It is -; disabled by default for maximum compatibility, but enabling it is encouraged. -; https://wiki.php.net/rfc/strict_sessions -session.use_strict_mode = 0 - -; Whether to use cookies. -; http://php.net/session.use-cookies -session.use_cookies = 1 - -; http://php.net/session.cookie-secure -;session.cookie_secure = - -; This option forces PHP to fetch and use a cookie for storing and maintaining -; the session id. We encourage this operation as it's very helpful in combating -; session hijacking when not specifying and managing your own session id. It is -; not the be-all and end-all of session hijacking defense, but it's a good start. -; http://php.net/session.use-only-cookies -session.use_only_cookies = 1 - -; Name of the session (used as cookie name). -; http://php.net/session.name -session.name = PHPSESSID - -; Initialize session on request startup. -; http://php.net/session.auto-start -session.auto_start = 0 - -; Lifetime in seconds of cookie or, if 0, until browser is restarted. -; http://php.net/session.cookie-lifetime -session.cookie_lifetime = 0 - -; The path for which the cookie is valid. -; http://php.net/session.cookie-path -session.cookie_path = / - -; The domain for which the cookie is valid. -; http://php.net/session.cookie-domain -session.cookie_domain = - -; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript. -; http://php.net/session.cookie-httponly -session.cookie_httponly = - -; Handler used to serialize data. php is the standard serializer of PHP. -; http://php.net/session.serialize-handler -session.serialize_handler = php - -; Defines the probability that the 'garbage collection' process is started -; on every session initialization. The probability is calculated by using -; gc_probability/gc_divisor. Where session.gc_probability is the numerator -; and gc_divisor is the denominator in the equation. Setting this value to 1 -; when the session.gc_divisor value is 100 will give you approximately a 1% chance -; the gc will run on any give request. -; Default Value: 1 -; Development Value: 1 -; Production Value: 1 -; http://php.net/session.gc-probability -session.gc_probability = 1 - -; Defines the probability that the 'garbage collection' process is started on every -; session initialization. The probability is calculated by using the following equation: -; gc_probability/gc_divisor. Where session.gc_probability is the numerator and -; session.gc_divisor is the denominator in the equation. Setting this value to 1 -; when the session.gc_divisor value is 100 will give you approximately a 1% chance -; the gc will run on any give request. Increasing this value to 1000 will give you -; a 0.1% chance the gc will run on any give request. For high volume production servers, -; this is a more efficient approach. -; Default Value: 100 -; Development Value: 1000 -; Production Value: 1000 -; http://php.net/session.gc-divisor -session.gc_divisor = 1000 - -; After this number of seconds, stored data will be seen as 'garbage' and -; cleaned up by the garbage collection process. -; http://php.net/session.gc-maxlifetime -session.gc_maxlifetime = 1440 - -; NOTE: If you are using the subdirectory option for storing session files -; (see session.save_path above), then garbage collection does *not* -; happen automatically. You will need to do your own garbage -; collection through a shell script, cron entry, or some other method. -; For example, the following script would is the equivalent of -; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): -; find /path/to/sessions -cmin +24 -type f | xargs rm - -; Check HTTP Referer to invalidate externally stored URLs containing ids. -; HTTP_REFERER has to contain this substring for the session to be -; considered as valid. -; http://php.net/session.referer-check -session.referer_check = - -; Set to {nocache,private,public,} to determine HTTP caching aspects -; or leave this empty to avoid sending anti-caching headers. -; http://php.net/session.cache-limiter -session.cache_limiter = nocache - -; Document expires after n minutes. -; http://php.net/session.cache-expire -session.cache_expire = 180 - -; trans sid support is disabled by default. -; Use of trans sid may risk your users' security. -; Use this option with caution. -; - User may send URL contains active session ID -; to other person via. email/irc/etc. -; - URL that contains active session ID may be stored -; in publicly accessible computer. -; - User may access your site with the same session ID -; always using URL stored in browser's history or bookmarks. -; http://php.net/session.use-trans-sid -session.use_trans_sid = 0 - -; Set session ID character length. This value could be between 22 to 256. -; Shorter length than default is supported only for compatibility reason. -; Users should use 32 or more chars. -; http://php.net/session.sid-length -; Default Value: 32 -; Development Value: 26 -; Production Value: 26 -session.sid_length = 26 - -; The URL rewriter will look for URLs in a defined set of HTML tags. -;
is special; if you include them here, the rewriter will -; add a hidden field with the info which is otherwise appended -; to URLs. tag's action attribute URL will not be modified -; unless it is specified. -; Note that all valid entries require a "=", even if no value follows. -; Default Value: "a=href,area=href,frame=src,form=" -; Development Value: "a=href,area=href,frame=src,form=" -; Production Value: "a=href,area=href,frame=src,form=" -; http://php.net/url-rewriter.tags -session.trans_sid_tags = "a=href,area=href,frame=src,form=" - -; URL rewriter does not rewrite absolute URLs by default. -; To enable rewrites for absolute pathes, target hosts must be specified -; at RUNTIME. i.e. use ini_set() -; tags is special. PHP will check action attribute's URL regardless -; of session.trans_sid_tags setting. -; If no host is defined, HTTP_HOST will be used for allowed host. -; Example value: php.net,www.php.net,wiki.php.net -; Use "," for multiple hosts. No spaces are allowed. -; Default Value: "" -; Development Value: "" -; Production Value: "" -;session.trans_sid_hosts="" - -; Define how many bits are stored in each character when converting -; the binary hash data to something readable. -; Possible values: -; 4 (4 bits: 0-9, a-f) -; 5 (5 bits: 0-9, a-v) -; 6 (6 bits: 0-9, a-z, A-Z, "-", ",") -; Default Value: 4 -; Development Value: 5 -; Production Value: 5 -; http://php.net/session.hash-bits-per-character -session.sid_bits_per_character = 5 - -; Enable upload progress tracking in $_SESSION -; Default Value: On -; Development Value: On -; Production Value: On -; http://php.net/session.upload-progress.enabled -;session.upload_progress.enabled = On - -; Cleanup the progress information as soon as all POST data has been read -; (i.e. upload completed). -; Default Value: On -; Development Value: On -; Production Value: On -; http://php.net/session.upload-progress.cleanup -;session.upload_progress.cleanup = On - -; A prefix used for the upload progress key in $_SESSION -; Default Value: "upload_progress_" -; Development Value: "upload_progress_" -; Production Value: "upload_progress_" -; http://php.net/session.upload-progress.prefix -;session.upload_progress.prefix = "upload_progress_" - -; The index name (concatenated with the prefix) in $_SESSION -; containing the upload progress information -; Default Value: "PHP_SESSION_UPLOAD_PROGRESS" -; Development Value: "PHP_SESSION_UPLOAD_PROGRESS" -; Production Value: "PHP_SESSION_UPLOAD_PROGRESS" -; http://php.net/session.upload-progress.name -;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS" - -; How frequently the upload progress should be updated. -; Given either in percentages (per-file), or in bytes -; Default Value: "1%" -; Development Value: "1%" -; Production Value: "1%" -; http://php.net/session.upload-progress.freq -;session.upload_progress.freq = "1%" - -; The minimum delay between updates, in seconds -; Default Value: 1 -; Development Value: 1 -; Production Value: 1 -; http://php.net/session.upload-progress.min-freq -;session.upload_progress.min_freq = "1" - -; Only write session data when session data is changed. Enabled by default. -; http://php.net/session.lazy-write -;session.lazy_write = On - -[Assertion] -; Switch whether to compile assertions at all (to have no overhead at run-time) -; -1: Do not compile at all -; 0: Jump over assertion at run-time -; 1: Execute assertions -; Changing from or to a negative value is only possible in php.ini! (For turning assertions on and off at run-time, see assert.active, when zend.assertions = 1) -; Default Value: 1 -; Development Value: 1 -; Production Value: -1 -; http://php.net/zend.assertions -zend.assertions = -1 - -; Assert(expr); active by default. -; http://php.net/assert.active -;assert.active = On - -; Throw an AssertationException on failed assertions -; http://php.net/assert.exception -;assert.exception = On - -; Issue a PHP warning for each failed assertion. (Overridden by assert.exception if active) -; http://php.net/assert.warning -;assert.warning = On - -; Don't bail out by default. -; http://php.net/assert.bail -;assert.bail = Off - -; User-function to be called if an assertion fails. -; http://php.net/assert.callback -;assert.callback = 0 - -; Eval the expression with current error_reporting(). Set to true if you want -; error_reporting(0) around the eval(). -; http://php.net/assert.quiet-eval -;assert.quiet_eval = 0 - -[COM] -; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs -; http://php.net/com.typelib-file -;com.typelib_file = - -; allow Distributed-COM calls -; http://php.net/com.allow-dcom -;com.allow_dcom = true - -; autoregister constants of a components typlib on com_load() -; http://php.net/com.autoregister-typelib -;com.autoregister_typelib = true - -; register constants casesensitive -; http://php.net/com.autoregister-casesensitive -;com.autoregister_casesensitive = false - -; show warnings on duplicate constant registrations -; http://php.net/com.autoregister-verbose -;com.autoregister_verbose = true - -; The default character set code-page to use when passing strings to and from COM objects. -; Default: system ANSI code page -;com.code_page= - -[mbstring] -; language for internal character representation. -; This affects mb_send_mail() and mbstring.detect_order. -; http://php.net/mbstring.language -;mbstring.language = Japanese - -; Use of this INI entry is deprecated, use global internal_encoding instead. -; internal/script encoding. -; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*) -; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. -; The precedence is: default_charset < internal_encoding < iconv.internal_encoding -;mbstring.internal_encoding = - -; Use of this INI entry is deprecated, use global input_encoding instead. -; http input encoding. -; mbstring.encoding_traslation = On is needed to use this setting. -; If empty, default_charset or input_encoding or mbstring.input is used. -; The precedence is: default_charset < intput_encoding < mbsting.http_input -; http://php.net/mbstring.http-input -;mbstring.http_input = - -; Use of this INI entry is deprecated, use global output_encoding instead. -; http output encoding. -; mb_output_handler must be registered as output buffer to function. -; If empty, default_charset or output_encoding or mbstring.http_output is used. -; The precedence is: default_charset < output_encoding < mbstring.http_output -; To use an output encoding conversion, mbstring's output handler must be set -; otherwise output encoding conversion cannot be performed. -; http://php.net/mbstring.http-output -;mbstring.http_output = - -; enable automatic encoding translation according to -; mbstring.internal_encoding setting. Input chars are -; converted to internal encoding by setting this to On. -; Note: Do _not_ use automatic encoding translation for -; portable libs/applications. -; http://php.net/mbstring.encoding-translation -;mbstring.encoding_translation = Off - -; automatic encoding detection order. -; "auto" detect order is changed according to mbstring.language -; http://php.net/mbstring.detect-order -;mbstring.detect_order = auto - -; substitute_character used when character cannot be converted -; one from another -; http://php.net/mbstring.substitute-character -;mbstring.substitute_character = none - -; overload(replace) single byte functions by mbstring functions. -; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), -; etc. Possible values are 0,1,2,4 or combination of them. -; For example, 7 for overload everything. -; 0: No overload -; 1: Overload mail() function -; 2: Overload str*() functions -; 4: Overload ereg*() functions -; http://php.net/mbstring.func-overload -;mbstring.func_overload = 0 - -; enable strict encoding detection. -; Default: Off -;mbstring.strict_detection = On - -; This directive specifies the regex pattern of content types for which mb_output_handler() -; is activated. -; Default: mbstring.http_output_conv_mimetype=^(text/|application/xhtml\+xml) -;mbstring.http_output_conv_mimetype= - -[gd] -; Tell the jpeg decode to ignore warnings and try to create -; a gd image. The warning will then be displayed as notices -; disabled by default -; http://php.net/gd.jpeg-ignore-warning -;gd.jpeg_ignore_warning = 1 - -[exif] -; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. -; With mbstring support this will automatically be converted into the encoding -; given by corresponding encode setting. When empty mbstring.internal_encoding -; is used. For the decode settings you can distinguish between motorola and -; intel byte order. A decode setting cannot be empty. -; http://php.net/exif.encode-unicode -;exif.encode_unicode = ISO-8859-15 - -; http://php.net/exif.decode-unicode-motorola -;exif.decode_unicode_motorola = UCS-2BE - -; http://php.net/exif.decode-unicode-intel -;exif.decode_unicode_intel = UCS-2LE - -; http://php.net/exif.encode-jis -;exif.encode_jis = - -; http://php.net/exif.decode-jis-motorola -;exif.decode_jis_motorola = JIS - -; http://php.net/exif.decode-jis-intel -;exif.decode_jis_intel = JIS - -[Tidy] -; The path to a default tidy configuration file to use when using tidy -; http://php.net/tidy.default-config -;tidy.default_config = /usr/local/lib/php/default.tcfg - -; Should tidy clean and repair output automatically? -; WARNING: Do not use this option if you are generating non-html content -; such as dynamic images -; http://php.net/tidy.clean-output -tidy.clean_output = Off - -[soap] -; Enables or disables WSDL caching feature. -; http://php.net/soap.wsdl-cache-enabled -soap.wsdl_cache_enabled=1 - -; Sets the directory name where SOAP extension will put cache files. -; http://php.net/soap.wsdl-cache-dir -soap.wsdl_cache_dir="/tmp" - -; (time to live) Sets the number of second while cached file will be used -; instead of original one. -; http://php.net/soap.wsdl-cache-ttl -soap.wsdl_cache_ttl=86400 - -; Sets the size of the cache limit. (Max. number of WSDL files to cache) -soap.wsdl_cache_limit = 5 - -[sysvshm] -; A default size of the shared memory segment -;sysvshm.init_mem = 10000 - -[ldap] -; Sets the maximum number of open links or -1 for unlimited. -ldap.max_links = -1 - -[dba] -;dba.default_handler= - -[opcache] -; Determines if Zend OPCache is enabled -;opcache.enable=1 - -; Determines if Zend OPCache is enabled for the CLI version of PHP -;opcache.enable_cli=0 - -; The OPcache shared memory storage size. -;opcache.memory_consumption=128 - -; The amount of memory for interned strings in Mbytes. -;opcache.interned_strings_buffer=8 - -; The maximum number of keys (scripts) in the OPcache hash table. -; Only numbers between 200 and 1000000 are allowed. -;opcache.max_accelerated_files=10000 - -; The maximum percentage of "wasted" memory until a restart is scheduled. -;opcache.max_wasted_percentage=5 - -; When this directive is enabled, the OPcache appends the current working -; directory to the script key, thus eliminating possible collisions between -; files with the same name (basename). Disabling the directive improves -; performance, but may break existing applications. -;opcache.use_cwd=1 - -; When disabled, you must reset the OPcache manually or restart the -; webserver for changes to the filesystem to take effect. -;opcache.validate_timestamps=1 - -; How often (in seconds) to check file timestamps for changes to the shared -; memory storage allocation. ("1" means validate once per second, but only -; once per request. "0" means always validate) -;opcache.revalidate_freq=2 - -; Enables or disables file search in include_path optimization -;opcache.revalidate_path=0 - -; If disabled, all PHPDoc comments are dropped from the code to reduce the -; size of the optimized code. -;opcache.save_comments=1 - -; Allow file existence override (file_exists, etc.) performance feature. -;opcache.enable_file_override=0 - -; A bitmask, where each bit enables or disables the appropriate OPcache -; passes -;opcache.optimization_level=0xffffffff - -;opcache.inherited_hack=1 -;opcache.dups_fix=0 - -; The location of the OPcache blacklist file (wildcards allowed). -; Each OPcache blacklist file is a text file that holds the names of files -; that should not be accelerated. The file format is to add each filename -; to a new line. The filename may be a full path or just a file prefix -; (i.e., /var/www/x blacklists all the files and directories in /var/www -; that start with 'x'). Line starting with a ; are ignored (comments). -;opcache.blacklist_filename= - -; Allows exclusion of large files from being cached. By default all files -; are cached. -;opcache.max_file_size=0 - -; Check the cache checksum each N requests. -; The default value of "0" means that the checks are disabled. -;opcache.consistency_checks=0 - -; How long to wait (in seconds) for a scheduled restart to begin if the cache -; is not being accessed. -;opcache.force_restart_timeout=180 - -; OPcache error_log file name. Empty string assumes "stderr". -;opcache.error_log= - -; All OPcache errors go to the Web server log. -; By default, only fatal errors (level 0) or errors (level 1) are logged. -; You can also enable warnings (level 2), info messages (level 3) or -; debug messages (level 4). -;opcache.log_verbosity_level=1 - -; Preferred Shared Memory back-end. Leave empty and let the system decide. -;opcache.preferred_memory_model= - -; Protect the shared memory from unexpected writing during script execution. -; Useful for internal debugging only. -;opcache.protect_memory=0 - -; Allows calling OPcache API functions only from PHP scripts which path is -; started from specified string. The default "" means no restriction -;opcache.restrict_api= - -; Mapping base of shared memory segments (for Windows only). All the PHP -; processes have to map shared memory into the same address space. This -; directive allows to manually fix the "Unable to reattach to base address" -; errors. -;opcache.mmap_base= - -; Enables and sets the second level cache directory. -; It should improve performance when SHM memory is full, at server restart or -; SHM reset. The default "" disables file based caching. -;opcache.file_cache= - -; Enables or disables opcode caching in shared memory. -;opcache.file_cache_only=0 - -; Enables or disables checksum validation when script loaded from file cache. -;opcache.file_cache_consistency_checks=1 - -; Implies opcache.file_cache_only=1 for a certain process that failed to -; reattach to the shared memory (for Windows only). Explicitly enabled file -; cache is required. -;opcache.file_cache_fallback=1 - -; Enables or disables copying of PHP code (text segment) into HUGE PAGES. -; This should improve performance, but requires appropriate OS configuration. -;opcache.huge_code_pages=1 - -; Validate cached file permissions. -;opcache.validate_permission=0 - -; Prevent name collisions in chroot'ed environment. -;opcache.validate_root=0 - -; If specified, it produces opcode dumps for debugging different stages of -; optimizations. -;opcache.opt_debug_level=0 - -[curl] -; A default value for the CURLOPT_CAINFO option. This is required to be an -; absolute path. -;curl.cainfo = - -[openssl] -; The location of a Certificate Authority (CA) file on the local filesystem -; to use when verifying the identity of SSL/TLS peers. Most users should -; not specify a value for this directive as PHP will attempt to use the -; OS-managed cert stores in its absence. If specified, this value may still -; be overridden on a per-stream basis via the "cafile" SSL stream context -; option. -;openssl.cafile= - -; If openssl.cafile is not specified or if the CA file is not found, the -; directory pointed to by openssl.capath is searched for a suitable -; certificate. This value must be a correctly hashed certificate directory. -; Most users should not specify a value for this directive as PHP will -; attempt to use the OS-managed cert stores in its absence. If specified, -; this value may still be overridden on a per-stream basis via the "capath" -; SSL stream context option. -;openssl.capath= - -; Local Variables: -; tab-width: 4 -; End: diff --git a/templates/solr.Dockerfile.j2 b/templates/solr.Dockerfile.j2 index 17e2106..3ee1a32 100644 --- a/templates/solr.Dockerfile.j2 +++ b/templates/solr.Dockerfile.j2 @@ -1,6 +1,10 @@ FROM solr:{{ solr_version }} -# Case for solr version 5-7 -RUN mkdir -p /opt/solr/server/solr/{{ solr_core_name }} -COPY conf /opt/solr/server/solr/{{ solr_core_name }}/conf -COPY core.properties /opt/solr/server/solr/{{ solr_core_name }}/core.properties +{% if user_uid != 0 %} +USER root +ARG USER_UID={{ user_uid }} +ARG USER_GID=$USER_UID +RUN chown -R $USER_UID:$USER_GID /opt/solr +RUN groupmod --gid $USER_GID solr && usermod --uid $USER_UID --gid $USER_GID solr +USER solr +{% endif %} From d1fa2bdd8478fd5b555a3048263a9f23b0a64cda Mon Sep 17 00:00:00 2001 From: svicer Date: Tue, 2 Feb 2021 17:01:37 +0200 Subject: [PATCH 003/228] Add --ask-become-pass to README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8b6e73d..f3c7e97 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ cp default.config.yml config.yml ```bash cd drupal-dockerizer -ansible-playbook main.yml +ansible-playbook main.yml --ask-become-pass ansible-playbook run-drush-commands.yml ``` @@ -155,7 +155,7 @@ drush_commands: ```bash cd drupal-dockerizer -ansible-playbook reset.yml +ansible-playbook reset.yml --ask-become-pass ``` ### How to clear Docker cache? From fe61a113af6b6e08ebe15324367775bada8d30cc Mon Sep 17 00:00:00 2001 From: svicer Date: Tue, 2 Feb 2021 19:06:48 +0200 Subject: [PATCH 004/228] Fix for solr 4 --- tasks/solr-setup.yml | 15 ++++++++++++++- templates/docker-compose.yml.j2 | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tasks/solr-setup.yml b/tasks/solr-setup.yml index 6e0f0a5..5ca2351 100644 --- a/tasks/solr-setup.yml +++ b/tasks/solr-setup.yml @@ -10,6 +10,20 @@ update: yes force: yes +- name: Solr 4 user configure. + blockinfile: + path: "{{ docker_runtime_dir }}/bin/solr/Dockerfile" + block: | + {% if user_uid != 0 %} + USER root + ARG USER_UID={{ user_uid }} + ARG USER_GID=$USER_UID + RUN chown -R $USER_UID:$USER_GID /opt/solr + RUN rm -rf /opt/solr/example/solr/collection1/ + RUN groupmod --gid $USER_GID solr && usermod --uid $USER_UID --gid $USER_GID solr + USER solr + {% endif %} + - name: Create solr directory when: solr_version != 4 file: @@ -18,7 +32,6 @@ state: directory - name: Create solr data directory - when: solr_version != 4 file: recurse: yes path: "{{ docker_runtime_dir }}/data/solr" diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index cf53217..5f95d8c 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -82,7 +82,11 @@ services: build: context: "./bin/solr" volumes: +{% if solr_version != 4%} - ./data/solr:/opt/solr/server/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} +{% else %} + - ./data/solr:/opt/solr/example/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} +{% endif %} {% if advanced_networking %} networks: {{ compose_project_name }}-network: From 07f95f85d9c07caafc817dbe32965eba0c34818f Mon Sep 17 00:00:00 2001 From: svicer Date: Tue, 2 Feb 2021 19:19:00 +0200 Subject: [PATCH 005/228] Fix command tasks --- reset.yml | 18 +++++++++--------- stop.yml | 6 +++--- tasks/docker-up.yml | 6 +++--- tasks/memcache-setup.yml | 3 +-- up.yml | 19 +++++++++++++++++++ 5 files changed, 35 insertions(+), 17 deletions(-) create mode 100644 up.yml diff --git a/reset.yml b/reset.yml index 1e4faad..a7352a0 100644 --- a/reset.yml +++ b/reset.yml @@ -14,15 +14,15 @@ roles: [] tasks: - - name: Stop all Docker containers if docker-compose.yml. - shell: | - docker-compose down - chdir={{ docker_runtime_dir }} - - - name: Kill all Docker containers if docker-compose.yml. - shell: | - docker-compose kill - chdir={{ docker_runtime_dir }} + - name: Stop all Docker containers. + command: docker-compose down + args: + chdir: "{{ docker_runtime_dir }}" + + - name: Kill all Docker containers. + command: docker-compose kill + args: + chdir: "{{ docker_runtime_dir }}" - name: Ensure runtime removed. become: true diff --git a/stop.yml b/stop.yml index a7ba133..dae3db2 100644 --- a/stop.yml +++ b/stop.yml @@ -16,6 +16,6 @@ tasks: - name: Stop all Docker containers. - shell: | - docker-compose stop - chdir={{ docker_runtime_dir }} + command: docker-compose stop + args: + chdir: "{{ docker_runtime_dir }}" diff --git a/tasks/docker-up.yml b/tasks/docker-up.yml index 5dcbce3..1a21576 100644 --- a/tasks/docker-up.yml +++ b/tasks/docker-up.yml @@ -1,6 +1,6 @@ --- - name: Bring up the Docker containers. - command: > - docker-compose up --build -d --remove-orphans - chdir={{ docker_runtime_dir }} + command: docker-compose up --build -d --remove-orphans + args: + chdir: "{{ docker_runtime_dir }}" diff --git a/tasks/memcache-setup.yml b/tasks/memcache-setup.yml index 98f89b0..ad97f86 100644 --- a/tasks/memcache-setup.yml +++ b/tasks/memcache-setup.yml @@ -1,6 +1,7 @@ --- - name: Add memcache connection to settings.php + become: true blockinfile: marker: "// {mark} {{ compose_project_name }} SETUP MEMCACHE BLOCK" path: "{{ drupal_root_dir }}/{{ drupal_web_root }}/sites/default/settings.php" @@ -10,5 +11,3 @@ $settings['cache']['default'] = 'cache.backend.memcache'; $settings['cache']['bins']['render'] = 'cache.backend.memcache'; $settings['memcache']['key_prefix'] = '{{ compose_project_name }}'; - - diff --git a/up.yml b/up.yml new file mode 100644 index 0000000..e527099 --- /dev/null +++ b/up.yml @@ -0,0 +1,19 @@ +--- + +- hosts: all + + vars_files: + - default.config.yml + + pre_tasks: + - name: Include config override file, if it exists. + include_vars: "{{ item }}" + with_fileglob: + - config.yml + + roles: [] + + tasks: + + - name: Include Docker up tasks + include: tasks/docker-up.yml From 0bcaf43bf4f71fc26180e6d7a94e3f88f4702ae2 Mon Sep 17 00:00:00 2001 From: svicer Date: Tue, 2 Feb 2021 19:42:27 +0200 Subject: [PATCH 006/228] Fix if owners for runnig from root --- tasks/runtime-setup.yml | 33 +++++++++++++++++++++++---------- tasks/settings-setup.yml | 6 ++++++ tasks/solr-setup.yml | 17 +++++++++++++++++ 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 72145fa..23d6586 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -1,74 +1,87 @@ --- - name: Ensure that runtime dir exist. + become: true file: path: "{{ docker_runtime_dir }}" + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" state: directory recurse: yes - mode: 0755 - name: Ensure bin dir is present. file: state: directory recurse: yes path: "{{ docker_runtime_dir }}/bin" - mode: 0755 + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure log dir is present. file: state: directory recurse: yes path: "{{ docker_runtime_dir }}/logs/apache2" - mode: 0755 + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure data dir is present. file: state: directory recurse: yes path: "{{ docker_runtime_dir }}/data" - mode: 0755 + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure apache dir is present. file: state: directory recurse: yes path: "{{ docker_runtime_dir }}/apache" - mode: 0755 + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure php dir is present. file: state: directory recurse: yes path: "{{ docker_runtime_dir }}/bin/php" - mode: 0755 + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure database dir is present. file: state: directory recurse: yes path: "{{ docker_runtime_dir }}/bin/database" - mode: 0755 + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure Apache2 config is present. template: src: templates/apache.conf.j2 dest: "{{ docker_runtime_dir }}/apache/default.conf" mode: 0644 + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure php Dockerfile is present. template: src: templates/php.Dockerfile.j2 dest: "{{ docker_runtime_dir }}/bin/php/Dockerfile" - mode: 0755 + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure mysql Dockerfile is present. template: src: "templates/{{ database }}.Dockerfile.j2" dest: "{{ docker_runtime_dir }}/bin/database/Dockerfile" - mode: 0755 + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure Docker Compose file is present. template: src: templates/docker-compose.yml.j2 dest: "{{ docker_runtime_dir }}/docker-compose.yml" - mode: 0755 + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" diff --git a/tasks/settings-setup.yml b/tasks/settings-setup.yml index 2fc1915..3694c7d 100644 --- a/tasks/settings-setup.yml +++ b/tasks/settings-setup.yml @@ -6,6 +6,8 @@ state: directory recurse: yes mode: '1777' + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Init settings.php become: true @@ -13,6 +15,8 @@ src: "{{ drupal_root_dir }}/{{ drupal_web_root }}/sites/default/default.settings.php" dest: "{{ drupal_root_dir }}/{{ drupal_web_root }}/sites/default/settings.php" mode: '0444' + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Make public Drupal sync dir. file: @@ -20,6 +24,8 @@ state: directory recurse: yes mode: 0755 + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Add DB connection to settings.php become: true diff --git a/tasks/solr-setup.yml b/tasks/solr-setup.yml index 5ca2351..6fb6855 100644 --- a/tasks/solr-setup.yml +++ b/tasks/solr-setup.yml @@ -9,6 +9,8 @@ clone: yes update: yes force: yes + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Solr 4 user configure. blockinfile: @@ -30,12 +32,16 @@ recurse: yes path: "{{ docker_runtime_dir }}/bin/solr" state: directory + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Create solr data directory file: recurse: yes path: "{{ docker_runtime_dir }}/data/solr" state: directory + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure Solr Dokcerfile is present. when: solr_version != 4 @@ -43,13 +49,24 @@ src: templates/solr.Dockerfile.j2 dest: "{{ docker_runtime_dir }}/bin/solr/Dockerfile" mode: '644' + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure Solr Core file is present. template: src: templates/solr.core.j2 dest: "{{ docker_runtime_dir }}/data/solr/core.properties" mode: '644' + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Copy drupal solr config. command: cp -r "{{ solr_configs_path }}"/. "{{ docker_runtime_dir }}/data/solr/conf" +- name: Check owner for conf dir. + file: + recurse: yes + path: "{{ docker_runtime_dir }}/data/solr/conf" + state: directory + owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" From 8462b8b4889147c073dbecda6f9688a4f55a8134 Mon Sep 17 00:00:00 2001 From: svicer Date: Tue, 2 Feb 2021 19:42:40 +0200 Subject: [PATCH 007/228] Add maridb database --- templates/mariadb.Dockerfile.j2 | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 templates/mariadb.Dockerfile.j2 diff --git a/templates/mariadb.Dockerfile.j2 b/templates/mariadb.Dockerfile.j2 new file mode 100644 index 0000000..3220994 --- /dev/null +++ b/templates/mariadb.Dockerfile.j2 @@ -0,0 +1,7 @@ +FROM mariadb + +{% if user_uid != 0 %} +ARG USER_UID={{ user_uid }} +ARG USER_GID=$USER_UID +RUN groupmod --gid $USER_GID mysql && usermod --uid $USER_UID --gid $USER_GID mysql +{% endif %} From a27c19f597d54b393613089c60713f2eeb0db344 Mon Sep 17 00:00:00 2001 From: svicer Date: Tue, 2 Feb 2021 20:19:33 +0200 Subject: [PATCH 008/228] Fix memcached version --- templates/docker-compose.yml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 5f95d8c..75ea4a3 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -3,7 +3,7 @@ version: '3.7' services: {% if memcache %} memcached: - image: memcached:1.6 + image: memcached restart: 'always' container_name: '{{ compose_project_name }}-memcached' {% if advanced_networking %} From 9af13ffa014a96c2c751e53ae18195d406163afe Mon Sep 17 00:00:00 2001 From: svicer Date: Tue, 2 Feb 2021 20:26:19 +0200 Subject: [PATCH 009/228] Fix solr4 --- tasks/solr-setup.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tasks/solr-setup.yml b/tasks/solr-setup.yml index 6fb6855..fa5584c 100644 --- a/tasks/solr-setup.yml +++ b/tasks/solr-setup.yml @@ -9,8 +9,6 @@ clone: yes update: yes force: yes - owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" - name: Solr 4 user configure. blockinfile: From 52b58add8586497d9c236d27a7d4b09b7ec6081a Mon Sep 17 00:00:00 2001 From: svicer Date: Tue, 2 Feb 2021 22:26:05 +0200 Subject: [PATCH 010/228] Implement project tasks --- main.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/main.yml b/main.yml index 85f9183..f224faf 100644 --- a/main.yml +++ b/main.yml @@ -35,3 +35,20 @@ - name: Include Memcache setup tasks when: memcache include: tasks/memcache-setup.yml + + - name: Wait docker containers (MySQL) to up. + pause: + seconds: 30 + + - name: Check project tasks. + stat: + path: "{{drupal_root_dir}}/.drupal_dockerizer/tasks.yml" + register: project_tasks + + - name: Include custom project tasks + include: "{{ item }}" + with_first_found: + - files: + - "{{drupal_root_dir}}/.drupal_dockerizer/tasks.yml" + skip: true + when: project_tasks From 051f4cbb019c221db8c652616adceed6a4809307 Mon Sep 17 00:00:00 2001 From: svicer Date: Wed, 3 Feb 2021 08:16:46 +0200 Subject: [PATCH 011/228] Implement pre and post tasks --- main.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/main.yml b/main.yml index f224faf..2d71df1 100644 --- a/main.yml +++ b/main.yml @@ -18,6 +18,19 @@ - name: Include lamp setup tasks include: tasks/runtime-setup.yml + - name: Check project tasks. + stat: + path: "{{drupal_root_dir}}/.drupal_dockerizer/pre-tasks.yml" + register: pre_tasks + + - name: Include custom project pre-tasks + include: "{{ item }}" + with_first_found: + - files: + - "{{drupal_root_dir}}/.drupal_dockerizer/pre-tasks.yml" + skip: true + when: pre_tasks + - name: Include solr setup tasks. when: solr include: tasks/solr-setup.yml @@ -42,13 +55,13 @@ - name: Check project tasks. stat: - path: "{{drupal_root_dir}}/.drupal_dockerizer/tasks.yml" - register: project_tasks + path: "{{drupal_root_dir}}/.drupal_dockerizer/post-tasks.yml" + register: post_tasks - - name: Include custom project tasks + - name: Include custom project post-tasks include: "{{ item }}" with_first_found: - files: - - "{{drupal_root_dir}}/.drupal_dockerizer/tasks.yml" + - "{{drupal_root_dir}}/.drupal_dockerizer/post-tasks.yml" skip: true - when: project_tasks + when: post_tasks From 1fcccc5ed342f9d35a675ce3681d94392b39bb36 Mon Sep 17 00:00:00 2001 From: svicer Date: Wed, 3 Feb 2021 09:43:05 +0200 Subject: [PATCH 012/228] fix import for mariadb --- db.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db.yml b/db.yml index 5176029..6111747 100644 --- a/db.yml +++ b/db.yml @@ -16,16 +16,16 @@ - name: Remove database. ignore_errors: yes - when: database == "mysql" + when: database == "mysql" or database == "mariadb" shell: | docker exec -i {{ compose_project_name }}-database sh -c 'exec mysql -uroot -p{{ mysql_root_password }} -e "DROP DATABASE {{ mysql_database }}"' - name: Create new database. - when: database == "mysql" + when: database == "mysql" or database == "mariadb" shell: | docker exec -i {{ compose_project_name }}-database sh -c 'exec mysql -uroot -p{{ mysql_root_password }} -e "CREATE DATABASE {{ mysql_database }} CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"' - name: Import database. - when: database == "mysql" + when: database == "mysql" or database == "mariadb" shell: | docker exec -i {{ compose_project_name }}-database sh -c 'exec mysql -uroot -p{{ mysql_root_password }} {{ mysql_database }}' < {{ db_dump_path }} From 03c3736c27dd982361a63f4a63db916f1e679ebd Mon Sep 17 00:00:00 2001 From: svicer Date: Wed, 3 Feb 2021 10:45:58 +0200 Subject: [PATCH 013/228] Fix import database playbook --- db.yml | 17 ++--------------- default.config.yml | 2 ++ main.yml | 6 +++++- tasks/import-database.yml | 17 +++++++++++++++++ 4 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 tasks/import-database.yml diff --git a/db.yml b/db.yml index 6111747..b239453 100644 --- a/db.yml +++ b/db.yml @@ -14,18 +14,5 @@ tasks: - - name: Remove database. - ignore_errors: yes - when: database == "mysql" or database == "mariadb" - shell: | - docker exec -i {{ compose_project_name }}-database sh -c 'exec mysql -uroot -p{{ mysql_root_password }} -e "DROP DATABASE {{ mysql_database }}"' - - - name: Create new database. - when: database == "mysql" or database == "mariadb" - shell: | - docker exec -i {{ compose_project_name }}-database sh -c 'exec mysql -uroot -p{{ mysql_root_password }} -e "CREATE DATABASE {{ mysql_database }} CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"' - - - name: Import database. - when: database == "mysql" or database == "mariadb" - shell: | - docker exec -i {{ compose_project_name }}-database sh -c 'exec mysql -uroot -p{{ mysql_root_password }} {{ mysql_database }}' < {{ db_dump_path }} + - name: Include import-database tasks. + include: tasks/import-database.yml diff --git a/default.config.yml b/default.config.yml index 35b82d3..6be4e50 100644 --- a/default.config.yml +++ b/default.config.yml @@ -59,11 +59,13 @@ memcache: false # Path to Drupal DB dump (will be imported by `db.yml` playbook). db_dump_path: /var/data/db/db.sql +# Availible options: mysql, mariadb database: mysql mysql_root_password: root mysql_user: docker mysql_password: docker mysql_database: docker +import_database: false install_adminer: false adminer_port: 8080 diff --git a/main.yml b/main.yml index 2d71df1..4409417 100644 --- a/main.yml +++ b/main.yml @@ -46,13 +46,17 @@ include: tasks/docker-up.yml - name: Include Memcache setup tasks - when: memcache include: tasks/memcache-setup.yml + when: memcache - name: Wait docker containers (MySQL) to up. pause: seconds: 30 + - name: Include import-database tasks. + include: tasks/import-database.yml + when: import_database + - name: Check project tasks. stat: path: "{{drupal_root_dir}}/.drupal_dockerizer/post-tasks.yml" diff --git a/tasks/import-database.yml b/tasks/import-database.yml new file mode 100644 index 0000000..d646e22 --- /dev/null +++ b/tasks/import-database.yml @@ -0,0 +1,17 @@ +--- + +- name: Remove database. + ignore_errors: yes + when: database == "mysql" or database == "mariadb" + shell: | + docker exec -i {{ compose_project_name }}-database sh -c 'exec mysql -uroot -p{{ mysql_root_password }} -e "DROP DATABASE {{ mysql_database }}"' + +- name: Create new database. + when: database == "mysql" or database == "mariadb" + shell: | + docker exec -i {{ compose_project_name }}-database sh -c 'exec mysql -uroot -p{{ mysql_root_password }} -e "CREATE DATABASE {{ mysql_database }} CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"' + +- name: Import database. + when: database == "mysql" or database == "mariadb" + shell: | + docker exec -i {{ compose_project_name }}-database sh -c 'exec mysql -uroot -p{{ mysql_root_password }} {{ mysql_database }}' < {{ db_dump_path }} From 133faf649a9baee23be1deeb084bfa5b1d642623 Mon Sep 17 00:00:00 2001 From: svicer Date: Wed, 3 Feb 2021 11:06:04 +0200 Subject: [PATCH 014/228] Improve drush commands --- default.config.yml | 4 ++++ main.yml | 4 ++++ run-drush-commands.yml | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/default.config.yml b/default.config.yml index 6be4e50..360e01b 100644 --- a/default.config.yml +++ b/default.config.yml @@ -47,6 +47,9 @@ drush_commands: - 'config-set system.theme admin claro' - 'cron' +# If set to true lanch drush commands in php-apache conteiner after up conteiner. +run_drush_commands: false + solr: false # Look at available version here https://hub.docker.com/_/solr solr_version: 4 @@ -65,6 +68,7 @@ mysql_root_password: root mysql_user: docker mysql_password: docker mysql_database: docker +# If set to true import database after up conteiners. import_database: false install_adminer: false diff --git a/main.yml b/main.yml index 4409417..65989b3 100644 --- a/main.yml +++ b/main.yml @@ -69,3 +69,7 @@ - "{{drupal_root_dir}}/.drupal_dockerizer/post-tasks.yml" skip: true when: post_tasks + + - name: Run Drush commands. + include: tasks/drush-command.yml + when: drush_install and run_drush_commands diff --git a/run-drush-commands.yml b/run-drush-commands.yml index 636a736..406252e 100644 --- a/run-drush-commands.yml +++ b/run-drush-commands.yml @@ -16,5 +16,5 @@ tasks: - name: Run Drush commands. - when: drush_install include: tasks/drush-command.yml + when: drush_install From 4c84a8ade4839b6d69af59f4c39984fa69f8d3e4 Mon Sep 17 00:00:00 2001 From: svicer Date: Wed, 3 Feb 2021 11:31:09 +0200 Subject: [PATCH 015/228] Fix for ssl port --- templates/docker-compose.yml.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 75ea4a3..874e402 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -26,7 +26,9 @@ services: {% if not advanced_networking %} ports: - "{{ apache_port }}:80" +{% if ssl_enabled %} - "{{ apache_port_ssl }}:443" +{% endif %} {% endif %} links: - database From 13a393ed9f5f40dec87cbebefb2c8f011fe09e53 Mon Sep 17 00:00:00 2001 From: svicer Date: Wed, 3 Feb 2021 12:02:57 +0200 Subject: [PATCH 016/228] Fix for solr 4 --- tasks/solr-setup.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/solr-setup.yml b/tasks/solr-setup.yml index fa5584c..cbc9491 100644 --- a/tasks/solr-setup.yml +++ b/tasks/solr-setup.yml @@ -11,6 +11,7 @@ force: yes - name: Solr 4 user configure. + when: solr_version == 4 blockinfile: path: "{{ docker_runtime_dir }}/bin/solr/Dockerfile" block: | From 419e240fc73a17e4c85acaa9416812c1819a4f65 Mon Sep 17 00:00:00 2001 From: svicer Date: Wed, 3 Feb 2021 12:20:35 +0200 Subject: [PATCH 017/228] Fix ssl --- templates/apache.conf.j2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/apache.conf.j2 b/templates/apache.conf.j2 index a11fd96..0fe9f66 100644 --- a/templates/apache.conf.j2 +++ b/templates/apache.conf.j2 @@ -3,7 +3,9 @@ ServerAdmin webmaster@localhost DocumentRoot "/var/www/{{ drupal_web_root }}" ServerName {{ domain_name }} - + SSLEngine on + SSLCertificateFile /etc/apache2/cert.pem + SSLCertificateKeyFile /etc/apache2/pivate.key Options Indexes FollowSymLinks AllowOverride All From 3bea5fcd28744d87b168941917a0baf5c9b17f12 Mon Sep 17 00:00:00 2001 From: svicer Date: Wed, 3 Feb 2021 12:25:26 +0200 Subject: [PATCH 018/228] Fix apache --- templates/apache.conf.j2 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/templates/apache.conf.j2 b/templates/apache.conf.j2 index 0fe9f66..b168d9c 100644 --- a/templates/apache.conf.j2 +++ b/templates/apache.conf.j2 @@ -1,5 +1,5 @@ {% if ssl_enabled %} - + ServerAdmin webmaster@localhost DocumentRoot "/var/www/{{ drupal_web_root }}" ServerName {{ domain_name }} @@ -12,8 +12,8 @@ Require all granted -{% endif %} - +{% else %} + ServerAdmin webmaster@localhost DocumentRoot "/var/www/{{ drupal_web_root }}" ServerName {{ domain_name }} @@ -24,3 +24,4 @@ Require all granted +{% endif %} From aaadc09671c12aa418febf8b62fcb1ebaa647130 Mon Sep 17 00:00:00 2001 From: svicer Date: Wed, 3 Feb 2021 14:34:15 +0200 Subject: [PATCH 019/228] Fix ports --- templates/docker-compose.yml.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 874e402..195c0fe 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -18,6 +18,8 @@ services: container_name: '{{ compose_project_name }}-{{ phpversion }}' restart: 'always' working_dir: /var/www/{{ drupal_web_root }} + sysctls: + - net.ipv4.ip_unprivileged_port_start=0 depends_on: {% if memcache %} - memcached From fd9364d53e6aa5d479b0707f856ab1e1fb8ea1ae Mon Sep 17 00:00:00 2001 From: svicer Date: Tue, 23 Feb 2021 08:43:37 +0200 Subject: [PATCH 020/228] Fix permissions for work with files --- tasks/runtime-setup.yml | 10 ++++++++++ tasks/settings-setup.yml | 2 ++ 2 files changed, 12 insertions(+) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 23d6586..3df5014 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -10,6 +10,7 @@ recurse: yes - name: Ensure bin dir is present. + become: true file: state: directory recurse: yes @@ -18,6 +19,7 @@ group: "{{user_uid|int}}" - name: Ensure log dir is present. + become: true file: state: directory recurse: yes @@ -26,6 +28,7 @@ group: "{{user_uid|int}}" - name: Ensure data dir is present. + become: true file: state: directory recurse: yes @@ -34,6 +37,7 @@ group: "{{user_uid|int}}" - name: Ensure apache dir is present. + become: true file: state: directory recurse: yes @@ -42,6 +46,7 @@ group: "{{user_uid|int}}" - name: Ensure php dir is present. + become: true file: state: directory recurse: yes @@ -50,6 +55,7 @@ group: "{{user_uid|int}}" - name: Ensure database dir is present. + become: true file: state: directory recurse: yes @@ -58,6 +64,7 @@ group: "{{user_uid|int}}" - name: Ensure Apache2 config is present. + become: true template: src: templates/apache.conf.j2 dest: "{{ docker_runtime_dir }}/apache/default.conf" @@ -66,6 +73,7 @@ group: "{{user_uid|int}}" - name: Ensure php Dockerfile is present. + become: true template: src: templates/php.Dockerfile.j2 dest: "{{ docker_runtime_dir }}/bin/php/Dockerfile" @@ -73,6 +81,7 @@ group: "{{user_uid|int}}" - name: Ensure mysql Dockerfile is present. + become: true template: src: "templates/{{ database }}.Dockerfile.j2" dest: "{{ docker_runtime_dir }}/bin/database/Dockerfile" @@ -80,6 +89,7 @@ group: "{{user_uid|int}}" - name: Ensure Docker Compose file is present. + become: true template: src: templates/docker-compose.yml.j2 dest: "{{ docker_runtime_dir }}/docker-compose.yml" diff --git a/tasks/settings-setup.yml b/tasks/settings-setup.yml index 3694c7d..157d8ad 100644 --- a/tasks/settings-setup.yml +++ b/tasks/settings-setup.yml @@ -1,6 +1,7 @@ --- - name: Make public files dir. + become: true file: path: '{{ drupal_files_dir }}' state: directory @@ -19,6 +20,7 @@ group: "{{user_uid|int}}" - name: Make public Drupal sync dir. + become: true file: path: "{{drupal_root_dir}}/{{drupal_web_root}}/{{drupal_config_sync_folder}}" state: directory From 45838b808d46bbfc3bd4f31144a59649e6a3df16 Mon Sep 17 00:00:00 2001 From: svicer Date: Tue, 23 Feb 2021 09:41:15 +0200 Subject: [PATCH 021/228] Add documentations for ansible-pull --- README.md | 83 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 65 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index f3c7e97..7970508 100644 --- a/README.md +++ b/README.md @@ -10,33 +10,51 @@ ## Quickstart -### Prepare project structure +You can use ansible-pull tool from standard package ansible for quick setup your project. -- `db`: create this directory and download database dump here if exists. -- `code`: clone your project files into this directory. -- `drupal-dockerizer`: clone drupal-dockerizer project in this directory. -- `files`: create the directory and pull Drupal assets here +For that create config yml file in any place your need(in drupal project directory or external folder). Ensure that all needed config options is setup. -### Prepare your config for Drupal Dockerizer +Minimum required options: +```yaml +--- + +compose_project_name: drupal-project +docker_runtime_dir: drupal-project +user_uid: 1000 +drupal_root_dir: /var/data/drupal +drupal_web_root: web +drupal_files_dir: /var/data/drupal/web/sites/default/files +``` +Remember: other options will settled by default from `default.config.yml` file + +For up your drupal project in docker containers run: -```bash -cd drupal-dockerizer -cp default.config.yml config.yml ``` -### Start local environment +ansible-pull --extra-vars @/ -U https://github.com/jet-dev-team/drupal-dockerizer.git main.yml --ask-become-pass +``` -```bash -cd drupal-dockerizer -ansible-playbook main.yml --ask-become-pass -ansible-playbook run-drush-commands.yml +After done you should have drupal project in docker containers with empty database. +Check containers status by run `docker ps` command. +If you use database dump you can set in config option `db_dump_path` to absolute path to you database dump. For import database run: +``` +ansible-pull --extra-vars @/ -U https://github.com/jet-dev-team/drupal-dockerizer.git db.yml ``` -### Import database from dump +For stop or up containers just replace `db.yml` in command to `stop.yml` or `up.yml` -```bash -cd drupal-dockerizer -sudo ansible-playbook db.yml +For fully remove all projects data you can run: +``` +ansible-pull --extra-vars @/ -U https://github.com/jet-dev-team/drupal-dockerizer.git reset.yml --ask-become-pass ``` +This command remove all projects containers, volumes with data in database and runtime directory. + +### Usage ansible-pull + +By default pulling data by ansible-pull placed in `~/.ansible/pull/` directory. You can change it by add to ansible-pull command destination option `-d ` or `--directory `. + +You can anchor version drupal-dockerizer by add to ansible-pull command option `-C ` or `--checkout ` + +For more information about ansible-pull see [documentations](https://docs.ansible.com/ansible/latest/cli/ansible-pull.html). ### Xdebug setup @@ -148,6 +166,35 @@ drush_commands: - '-v sapi-i' - ... ``` +## Development drupal-dockerizer + +### Prepare project structure + +- `db`: create this directory and download database dump here if exists. +- `code`: clone your project files into this directory. +- `drupal-dockerizer`: clone drupal-dockerizer project in this directory. +- `files`: create the directory and pull Drupal assets here + +### Prepare your config for Drupal Dockerizer + +```bash +cd drupal-dockerizer +cp default.config.yml config.yml +``` +### Start local environment + +```bash +cd drupal-dockerizer +ansible-playbook main.yml --ask-become-pass +ansible-playbook run-drush-commands.yml +``` + +### Import database from dump + +```bash +cd drupal-dockerizer +ansible-playbook db.yml +``` ## FAQ From e6d4a578722dd01342aa70f3ce834fce0a17371b Mon Sep 17 00:00:00 2001 From: svicer Date: Tue, 23 Feb 2021 11:16:26 +0200 Subject: [PATCH 022/228] Implement CONFIG.md --- CONFIG.md | 42 ++++++++++++++++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 43 insertions(+) create mode 100644 CONFIG.md diff --git a/CONFIG.md b/CONFIG.md new file mode 100644 index 0000000..236be2d --- /dev/null +++ b/CONFIG.md @@ -0,0 +1,42 @@ +# Availble options(vars) for durpal-dockerizer config + +| Option | Description | Example | +| ------------ | ------------ | ------------ | +| compose_project_name | Name of your project. Its prefix for docker containers | drupal-project | +| docker_runtime_dir | Name for drupal-dockerizer runtime directory. You can up many projects from drupal-dokerizer directory. Ensure that all you project have different name | drupal-project-runtime | +| docker_cached_volume | Set option :cached for docker volume. [more](http://docs.docker.oeynet.com/docker-for-mac/osxfs-caching/). | false | +| user_uid | uid your user in system. Run `id -u` for see you uid | 1000 | +| drupal_root_dir | Absоlute path to your drupal-project directory. | /var/data/drupal | +| drupal_web_root | Name directory where placed index.php file indside drupal project directory | web | +| drupal_files_dir | Absolute path to your drupal files directory | /var/data/drupal_files | +| drupal_hash_salt | Hash salt for drupal site. | demo_site | +| drupal_config_sync_folder | Relative path from drupal_web_root for you config sync directory | sites/default/sync | +| apache_port | Port where you up your drupal site by http protocol. No need if advanced_networking is true | 80 | +| apache_port_ssl | Port where you up your drupal site by https protocol you shoud set ssl_enabled to true | 443 | +| ssl_enabled | Enable https protocol for your project | true | +| ssl_cert_path | Absolute path to fullchain ssl certeficate | /var/data/ssl/fullchain.pem | +| ssl_key_path | Absolute path to ssl private key | /var/data/ssl/privkey.pem | +| phpversion | Name of php-apache drupal contфiner. `develop` in version name means that container have installed xdebug. You can see all version on [docker.hub](https://hub.docker.com/r/jetdevteam/drupal-php-apache/tags?page=1&ordering=last_updated) | 7.4-production | +| xdebug_enviroment | Parameters for xdebug | remote_enable=1 remote_port=9000 remote_host=192.168.105.1 remote_autostart=1 idekey=VSCODE | +| advanced_networking | Set docker network ip to static and add bind to domain name in your /etc/hosts file | false | +| network_id | Network id. its part of of static docker ip 192.168.{network_id}.10 | 105 | +| domain_name | Drupal site domain name | drupal.devel | +| drush_install | Flag for install drush launcher | true | +| drush_version | Drush launcher verions. For drush launcher > 9 you shoud have drush installed in you project | 10 | +| solr | Flag for setup solr docker container and bind it to settings.php | true | +| solr_version | Version of solr. Should be int | 7 | +| solr_configs_path | Absolute path to your solr config directory | /var/data/drupal/solr_config | +| solr_core_name | Name for solr core | drupal | +| memcache | Flag for setup memcache docker container and bind it to settings.php | false | +| db_dump_path | Absolute path to drupal sql database dump. Import by db.yml playbook | /var/data/db/db.sql | +| database | Type of database. Availible database: mysql, mariadb | mysql | +| mysql_root_password | mysql password for root user | root | +| mysql_user | mysql user name | docker | +| mysql_password | mysql password | docker | +| mysql_database | mysql databse name for drupal | drupal | +| import_database | import database immediately after up docker containers by main.yml playbook. Ensure you have right path to sql dump | false | +| install_adminer | Flag for setup adminer | false | +| adminer_port | http port for admniner | 8080 | +| run_drush_commands | run drush_commands immediately after up docker containers by main.yml playbook. | false | +| drush_commands | Drush commands that run by run-drush-commands.yml playbook | ['cr', 'cc', 'si'] | +| custom_drupal_settings | custom drupal settings. Inserting to end settings.php file | $settings['trusted_host_patterns'] = ['drupal.devel']; | diff --git a/README.md b/README.md index 7970508..b7d25fa 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ drupal_web_root: web drupal_files_dir: /var/data/drupal/web/sites/default/files ``` Remember: other options will settled by default from `default.config.yml` file +For more options see CONFIG.md For up your drupal project in docker containers run: From 0d2d4b420693187d0e528a6d1cb97ebb2d33024c Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 23 Feb 2021 11:22:16 +0200 Subject: [PATCH 023/228] Fix typo --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b7d25fa..3611e2d 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,9 @@ drupal_root_dir: /var/data/drupal drupal_web_root: web drupal_files_dir: /var/data/drupal/web/sites/default/files ``` -Remember: other options will settled by default from `default.config.yml` file -For more options see CONFIG.md +Remember: other options will setted by default from `default.config.yml` file. + +For more options [see](CONFIG.md) For up your drupal project in docker containers run: From 28edaf616d6a7af675ee98e56c68896bf2bc3fb8 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 23 Feb 2021 14:10:24 +0200 Subject: [PATCH 024/228] Update runtime-setup.yml --- tasks/runtime-setup.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 3df5014..123aeb3 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -7,13 +7,11 @@ owner: "{{user_uid|int}}" group: "{{user_uid|int}}" state: directory - recurse: yes - name: Ensure bin dir is present. become: true file: state: directory - recurse: yes path: "{{ docker_runtime_dir }}/bin" owner: "{{user_uid|int}}" group: "{{user_uid|int}}" @@ -31,7 +29,6 @@ become: true file: state: directory - recurse: yes path: "{{ docker_runtime_dir }}/data" owner: "{{user_uid|int}}" group: "{{user_uid|int}}" @@ -40,7 +37,6 @@ become: true file: state: directory - recurse: yes path: "{{ docker_runtime_dir }}/apache" owner: "{{user_uid|int}}" group: "{{user_uid|int}}" From 8855d78a74c38a6332c222d29c69a52637872abd Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 23 Feb 2021 14:11:11 +0200 Subject: [PATCH 025/228] Update runtime-setup.yml --- tasks/runtime-setup.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 123aeb3..b642437 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -1,7 +1,6 @@ --- - name: Ensure that runtime dir exist. - become: true file: path: "{{ docker_runtime_dir }}" owner: "{{user_uid|int}}" From 5ae4ef39485dfe73db9b428f907378f188ea010d Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 23 Feb 2021 14:17:34 +0200 Subject: [PATCH 026/228] Update runtime-setup.yml --- tasks/runtime-setup.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index b642437..6c7edc5 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -4,7 +4,6 @@ file: path: "{{ docker_runtime_dir }}" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" state: directory - name: Ensure bin dir is present. @@ -13,7 +12,6 @@ state: directory path: "{{ docker_runtime_dir }}/bin" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" - name: Ensure log dir is present. become: true From ffc6e3991f04c87fc8e7b19170076885e928f7a8 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 23 Feb 2021 14:19:23 +0200 Subject: [PATCH 027/228] Update runtime-setup.yml --- tasks/runtime-setup.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 6c7edc5..4c9804e 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -20,7 +20,6 @@ recurse: yes path: "{{ docker_runtime_dir }}/logs/apache2" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" - name: Ensure data dir is present. become: true @@ -28,7 +27,6 @@ state: directory path: "{{ docker_runtime_dir }}/data" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" - name: Ensure apache dir is present. become: true @@ -36,7 +34,6 @@ state: directory path: "{{ docker_runtime_dir }}/apache" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" - name: Ensure php dir is present. become: true @@ -45,7 +42,6 @@ recurse: yes path: "{{ docker_runtime_dir }}/bin/php" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" - name: Ensure database dir is present. become: true @@ -54,7 +50,6 @@ recurse: yes path: "{{ docker_runtime_dir }}/bin/database" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" - name: Ensure Apache2 config is present. become: true @@ -63,7 +58,6 @@ dest: "{{ docker_runtime_dir }}/apache/default.conf" mode: 0644 owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" - name: Ensure php Dockerfile is present. become: true @@ -71,7 +65,6 @@ src: templates/php.Dockerfile.j2 dest: "{{ docker_runtime_dir }}/bin/php/Dockerfile" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" - name: Ensure mysql Dockerfile is present. become: true @@ -79,7 +72,6 @@ src: "templates/{{ database }}.Dockerfile.j2" dest: "{{ docker_runtime_dir }}/bin/database/Dockerfile" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" - name: Ensure Docker Compose file is present. become: true @@ -87,4 +79,3 @@ src: templates/docker-compose.yml.j2 dest: "{{ docker_runtime_dir }}/docker-compose.yml" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" From 5e9e0dbffd66abc29407a13d63389413a9d49226 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 23 Feb 2021 14:20:07 +0200 Subject: [PATCH 028/228] Update settings-setup.yml --- tasks/settings-setup.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/tasks/settings-setup.yml b/tasks/settings-setup.yml index 157d8ad..1442504 100644 --- a/tasks/settings-setup.yml +++ b/tasks/settings-setup.yml @@ -8,7 +8,6 @@ recurse: yes mode: '1777' owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" - name: Init settings.php become: true @@ -17,7 +16,6 @@ dest: "{{ drupal_root_dir }}/{{ drupal_web_root }}/sites/default/settings.php" mode: '0444' owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" - name: Make public Drupal sync dir. become: true @@ -27,7 +25,6 @@ recurse: yes mode: 0755 owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" - name: Add DB connection to settings.php become: true From b355d42fa6819077d76980165e884d55c80fef8c Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 23 Feb 2021 14:23:13 +0200 Subject: [PATCH 029/228] Update runtime-setup.yml --- tasks/runtime-setup.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 4c9804e..46771e1 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -7,7 +7,6 @@ state: directory - name: Ensure bin dir is present. - become: true file: state: directory path: "{{ docker_runtime_dir }}/bin" From f08b75749d39212bcebb56de3472f5ee0df93249 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 23 Feb 2021 14:24:04 +0200 Subject: [PATCH 030/228] Update runtime-setup.yml --- tasks/runtime-setup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 46771e1..9f9857a 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -13,7 +13,7 @@ owner: "{{user_uid|int}}" - name: Ensure log dir is present. - become: true + become: yes file: state: directory recurse: yes From dacdcb70ded3c2f31e51d280c332486e22536d6e Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 23 Feb 2021 14:25:46 +0200 Subject: [PATCH 031/228] Update runtime-setup.yml --- tasks/runtime-setup.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 9f9857a..02401cf 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -14,6 +14,7 @@ - name: Ensure log dir is present. become: yes + become_method: sudo file: state: directory recurse: yes From 5813e517ee12473d3405a62c206c4d87d71d8ea8 Mon Sep 17 00:00:00 2001 From: svicer Date: Mon, 1 Mar 2021 08:19:09 +0200 Subject: [PATCH 032/228] Revert "Update runtime-setup.yml" This reverts commit dacdcb70ded3c2f31e51d280c332486e22536d6e. --- tasks/runtime-setup.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 02401cf..9f9857a 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -14,7 +14,6 @@ - name: Ensure log dir is present. become: yes - become_method: sudo file: state: directory recurse: yes From 2d3d467899df01c193f792147ca9e881c37ecd21 Mon Sep 17 00:00:00 2001 From: svicer Date: Mon, 1 Mar 2021 08:19:19 +0200 Subject: [PATCH 033/228] Revert "Update runtime-setup.yml" This reverts commit f08b75749d39212bcebb56de3472f5ee0df93249. --- tasks/runtime-setup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 9f9857a..46771e1 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -13,7 +13,7 @@ owner: "{{user_uid|int}}" - name: Ensure log dir is present. - become: yes + become: true file: state: directory recurse: yes From 32aa9c8e724866b28e7fa399ab1e9a8dc0247d5c Mon Sep 17 00:00:00 2001 From: svicer Date: Mon, 1 Mar 2021 08:19:25 +0200 Subject: [PATCH 034/228] Revert "Update runtime-setup.yml" This reverts commit b355d42fa6819077d76980165e884d55c80fef8c. --- tasks/runtime-setup.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 46771e1..4c9804e 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -7,6 +7,7 @@ state: directory - name: Ensure bin dir is present. + become: true file: state: directory path: "{{ docker_runtime_dir }}/bin" From ecaef06099a4c38583c1473f4b71d4df2d416230 Mon Sep 17 00:00:00 2001 From: svicer Date: Mon, 1 Mar 2021 08:19:33 +0200 Subject: [PATCH 035/228] Revert "Update settings-setup.yml" This reverts commit 5e9e0dbffd66abc29407a13d63389413a9d49226. --- tasks/settings-setup.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tasks/settings-setup.yml b/tasks/settings-setup.yml index 1442504..157d8ad 100644 --- a/tasks/settings-setup.yml +++ b/tasks/settings-setup.yml @@ -8,6 +8,7 @@ recurse: yes mode: '1777' owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Init settings.php become: true @@ -16,6 +17,7 @@ dest: "{{ drupal_root_dir }}/{{ drupal_web_root }}/sites/default/settings.php" mode: '0444' owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Make public Drupal sync dir. become: true @@ -25,6 +27,7 @@ recurse: yes mode: 0755 owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Add DB connection to settings.php become: true From f3149c0403cdd4503db923d1e45e1c4227168506 Mon Sep 17 00:00:00 2001 From: svicer Date: Mon, 1 Mar 2021 08:19:41 +0200 Subject: [PATCH 036/228] Revert "Update runtime-setup.yml" This reverts commit ffc6e3991f04c87fc8e7b19170076885e928f7a8. --- tasks/runtime-setup.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 4c9804e..6c7edc5 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -20,6 +20,7 @@ recurse: yes path: "{{ docker_runtime_dir }}/logs/apache2" owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure data dir is present. become: true @@ -27,6 +28,7 @@ state: directory path: "{{ docker_runtime_dir }}/data" owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure apache dir is present. become: true @@ -34,6 +36,7 @@ state: directory path: "{{ docker_runtime_dir }}/apache" owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure php dir is present. become: true @@ -42,6 +45,7 @@ recurse: yes path: "{{ docker_runtime_dir }}/bin/php" owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure database dir is present. become: true @@ -50,6 +54,7 @@ recurse: yes path: "{{ docker_runtime_dir }}/bin/database" owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure Apache2 config is present. become: true @@ -58,6 +63,7 @@ dest: "{{ docker_runtime_dir }}/apache/default.conf" mode: 0644 owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure php Dockerfile is present. become: true @@ -65,6 +71,7 @@ src: templates/php.Dockerfile.j2 dest: "{{ docker_runtime_dir }}/bin/php/Dockerfile" owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure mysql Dockerfile is present. become: true @@ -72,6 +79,7 @@ src: "templates/{{ database }}.Dockerfile.j2" dest: "{{ docker_runtime_dir }}/bin/database/Dockerfile" owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure Docker Compose file is present. become: true @@ -79,3 +87,4 @@ src: templates/docker-compose.yml.j2 dest: "{{ docker_runtime_dir }}/docker-compose.yml" owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" From d2867f474154e5b084d5e628ae4d51bdd22c4084 Mon Sep 17 00:00:00 2001 From: svicer Date: Mon, 1 Mar 2021 08:19:46 +0200 Subject: [PATCH 037/228] Revert "Update runtime-setup.yml" This reverts commit 5ae4ef39485dfe73db9b428f907378f188ea010d. --- tasks/runtime-setup.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 6c7edc5..b642437 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -4,6 +4,7 @@ file: path: "{{ docker_runtime_dir }}" owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" state: directory - name: Ensure bin dir is present. @@ -12,6 +13,7 @@ state: directory path: "{{ docker_runtime_dir }}/bin" owner: "{{user_uid|int}}" + group: "{{user_uid|int}}" - name: Ensure log dir is present. become: true From e060dd844a8a8ecb16f15c9ef4e8e7d3ef310a9b Mon Sep 17 00:00:00 2001 From: svicer Date: Mon, 1 Mar 2021 08:19:55 +0200 Subject: [PATCH 038/228] Revert "Update runtime-setup.yml" This reverts commit 8855d78a74c38a6332c222d29c69a52637872abd. --- tasks/runtime-setup.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index b642437..123aeb3 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -1,6 +1,7 @@ --- - name: Ensure that runtime dir exist. + become: true file: path: "{{ docker_runtime_dir }}" owner: "{{user_uid|int}}" From e4c47a978ec4f9259157f4ce0140f64b0e895d8d Mon Sep 17 00:00:00 2001 From: svicer Date: Mon, 1 Mar 2021 08:20:19 +0200 Subject: [PATCH 039/228] Revert "Update runtime-setup.yml" This reverts commit 28edaf616d6a7af675ee98e56c68896bf2bc3fb8. --- tasks/runtime-setup.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 123aeb3..3df5014 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -7,11 +7,13 @@ owner: "{{user_uid|int}}" group: "{{user_uid|int}}" state: directory + recurse: yes - name: Ensure bin dir is present. become: true file: state: directory + recurse: yes path: "{{ docker_runtime_dir }}/bin" owner: "{{user_uid|int}}" group: "{{user_uid|int}}" @@ -29,6 +31,7 @@ become: true file: state: directory + recurse: yes path: "{{ docker_runtime_dir }}/data" owner: "{{user_uid|int}}" group: "{{user_uid|int}}" @@ -37,6 +40,7 @@ become: true file: state: directory + recurse: yes path: "{{ docker_runtime_dir }}/apache" owner: "{{user_uid|int}}" group: "{{user_uid|int}}" From 6f1ffd11540d1743e6da839cc0fc6ec2c8bde4ee Mon Sep 17 00:00:00 2001 From: svicer Date: Mon, 1 Mar 2021 08:29:35 +0200 Subject: [PATCH 040/228] Small fix --- tasks/settings-setup.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/settings-setup.yml b/tasks/settings-setup.yml index 157d8ad..4c2bff6 100644 --- a/tasks/settings-setup.yml +++ b/tasks/settings-setup.yml @@ -6,7 +6,7 @@ path: '{{ drupal_files_dir }}' state: directory recurse: yes - mode: '1777' + mode: 1777 owner: "{{user_uid|int}}" group: "{{user_uid|int}}" @@ -15,7 +15,7 @@ copy: src: "{{ drupal_root_dir }}/{{ drupal_web_root }}/sites/default/default.settings.php" dest: "{{ drupal_root_dir }}/{{ drupal_web_root }}/sites/default/settings.php" - mode: '0444' + mode: 0444 owner: "{{user_uid|int}}" group: "{{user_uid|int}}" From bf4dfe6665eecabdeee188608e05b4b9a15b3492 Mon Sep 17 00:00:00 2001 From: svicer Date: Mon, 1 Mar 2021 10:02:33 +0200 Subject: [PATCH 041/228] Fix become --- ansible.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/ansible.cfg b/ansible.cfg index b2b1068..13d417e 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -5,5 +5,4 @@ retry_files_enabled = False inventory = inventory [ssh_connection] -pipelining = True control_path = /tmp/ansible-ssh-%%h-%%p-%%r From 551cde60352dc5f7cc8c08990640188e40fa8563 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 30 Mar 2021 09:55:21 +0300 Subject: [PATCH 042/228] Ad gid support and fix permissions --- tasks/runtime-setup.yml | 23 +++++++++++------------ tasks/settings-setup.yml | 12 ++++++------ tasks/solr-setup.yml | 12 ++++++------ templates/mariadb.Dockerfile.j2 | 2 +- templates/mysql.Dockerfile.j2 | 2 +- templates/php.Dockerfile.j2 | 2 +- templates/solr.Dockerfile.j2 | 2 +- 7 files changed, 27 insertions(+), 28 deletions(-) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 3df5014..f750ccb 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -5,7 +5,7 @@ file: path: "{{ docker_runtime_dir }}" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" state: directory recurse: yes @@ -16,7 +16,7 @@ recurse: yes path: "{{ docker_runtime_dir }}/bin" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Ensure log dir is present. become: true @@ -25,7 +25,7 @@ recurse: yes path: "{{ docker_runtime_dir }}/logs/apache2" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Ensure data dir is present. become: true @@ -34,7 +34,7 @@ recurse: yes path: "{{ docker_runtime_dir }}/data" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Ensure apache dir is present. become: true @@ -43,7 +43,7 @@ recurse: yes path: "{{ docker_runtime_dir }}/apache" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Ensure php dir is present. become: true @@ -52,7 +52,7 @@ recurse: yes path: "{{ docker_runtime_dir }}/bin/php" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Ensure database dir is present. become: true @@ -61,16 +61,15 @@ recurse: yes path: "{{ docker_runtime_dir }}/bin/database" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Ensure Apache2 config is present. become: true template: src: templates/apache.conf.j2 dest: "{{ docker_runtime_dir }}/apache/default.conf" - mode: 0644 owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Ensure php Dockerfile is present. become: true @@ -78,7 +77,7 @@ src: templates/php.Dockerfile.j2 dest: "{{ docker_runtime_dir }}/bin/php/Dockerfile" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Ensure mysql Dockerfile is present. become: true @@ -86,7 +85,7 @@ src: "templates/{{ database }}.Dockerfile.j2" dest: "{{ docker_runtime_dir }}/bin/database/Dockerfile" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Ensure Docker Compose file is present. become: true @@ -94,4 +93,4 @@ src: templates/docker-compose.yml.j2 dest: "{{ docker_runtime_dir }}/docker-compose.yml" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" diff --git a/tasks/settings-setup.yml b/tasks/settings-setup.yml index 4c2bff6..4164a64 100644 --- a/tasks/settings-setup.yml +++ b/tasks/settings-setup.yml @@ -6,18 +6,18 @@ path: '{{ drupal_files_dir }}' state: directory recurse: yes - mode: 1777 + mode: "u=rwx,og=rx" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Init settings.php become: true copy: src: "{{ drupal_root_dir }}/{{ drupal_web_root }}/sites/default/default.settings.php" dest: "{{ drupal_root_dir }}/{{ drupal_web_root }}/sites/default/settings.php" - mode: 0444 + mode: "ugo=r" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Make public Drupal sync dir. become: true @@ -25,9 +25,9 @@ path: "{{drupal_root_dir}}/{{drupal_web_root}}/{{drupal_config_sync_folder}}" state: directory recurse: yes - mode: 0755 + mode: "u=rwx,og=rx" owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Add DB connection to settings.php become: true diff --git a/tasks/solr-setup.yml b/tasks/solr-setup.yml index cbc9491..4dd6d64 100644 --- a/tasks/solr-setup.yml +++ b/tasks/solr-setup.yml @@ -18,7 +18,7 @@ {% if user_uid != 0 %} USER root ARG USER_UID={{ user_uid }} - ARG USER_GID=$USER_UID + ARG USER_GID={{ user_gid }} RUN chown -R $USER_UID:$USER_GID /opt/solr RUN rm -rf /opt/solr/example/solr/collection1/ RUN groupmod --gid $USER_GID solr && usermod --uid $USER_UID --gid $USER_GID solr @@ -32,7 +32,7 @@ path: "{{ docker_runtime_dir }}/bin/solr" state: directory owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Create solr data directory file: @@ -40,7 +40,7 @@ path: "{{ docker_runtime_dir }}/data/solr" state: directory owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Ensure Solr Dokcerfile is present. when: solr_version != 4 @@ -49,7 +49,7 @@ dest: "{{ docker_runtime_dir }}/bin/solr/Dockerfile" mode: '644' owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Ensure Solr Core file is present. template: @@ -57,7 +57,7 @@ dest: "{{ docker_runtime_dir }}/data/solr/core.properties" mode: '644' owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" - name: Copy drupal solr config. command: cp -r "{{ solr_configs_path }}"/. "{{ docker_runtime_dir }}/data/solr/conf" @@ -68,4 +68,4 @@ path: "{{ docker_runtime_dir }}/data/solr/conf" state: directory owner: "{{user_uid|int}}" - group: "{{user_uid|int}}" + group: "{{user_gid|int}}" diff --git a/templates/mariadb.Dockerfile.j2 b/templates/mariadb.Dockerfile.j2 index 3220994..998a7ac 100644 --- a/templates/mariadb.Dockerfile.j2 +++ b/templates/mariadb.Dockerfile.j2 @@ -2,6 +2,6 @@ FROM mariadb {% if user_uid != 0 %} ARG USER_UID={{ user_uid }} -ARG USER_GID=$USER_UID +ARG USER_GID={{ user_gid }} RUN groupmod --gid $USER_GID mysql && usermod --uid $USER_UID --gid $USER_GID mysql {% endif %} diff --git a/templates/mysql.Dockerfile.j2 b/templates/mysql.Dockerfile.j2 index 5ad2dc4..dd81df8 100644 --- a/templates/mysql.Dockerfile.j2 +++ b/templates/mysql.Dockerfile.j2 @@ -2,7 +2,7 @@ FROM mysql:5.7 {% if user_uid != 0 %} ARG USER_UID={{ user_uid }} -ARG USER_GID=$USER_UID +ARG USER_GID={{ user_gid }} RUN groupmod --gid $USER_GID mysql && usermod --uid $USER_UID --gid $USER_GID mysql {% endif %} diff --git a/templates/php.Dockerfile.j2 b/templates/php.Dockerfile.j2 index 3069f2e..dff4b7a 100644 --- a/templates/php.Dockerfile.j2 +++ b/templates/php.Dockerfile.j2 @@ -5,7 +5,7 @@ USER root {% else %} USER root ARG USER_UID={{ user_uid }} -ARG USER_GID=$USER_UID +ARG USER_GID={{ user_gid }} RUN groupmod --gid $USER_GID dockerizer && usermod --uid $USER_UID --gid $USER_GID dockerizer USER dockerizer {% endif %} diff --git a/templates/solr.Dockerfile.j2 b/templates/solr.Dockerfile.j2 index 3ee1a32..6c4be4e 100644 --- a/templates/solr.Dockerfile.j2 +++ b/templates/solr.Dockerfile.j2 @@ -3,7 +3,7 @@ FROM solr:{{ solr_version }} {% if user_uid != 0 %} USER root ARG USER_UID={{ user_uid }} -ARG USER_GID=$USER_UID +ARG USER_GID={{ user_gid }} RUN chown -R $USER_UID:$USER_GID /opt/solr RUN groupmod --gid $USER_GID solr && usermod --uid $USER_UID --gid $USER_GID solr USER solr From 340f04e7aa63f6efdae4584dc2244babc62f7b5e Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 30 Mar 2021 10:11:00 +0300 Subject: [PATCH 043/228] Small fix in readme --- CONFIG.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CONFIG.md b/CONFIG.md index 236be2d..1d439b0 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -6,6 +6,7 @@ | docker_runtime_dir | Name for drupal-dockerizer runtime directory. You can up many projects from drupal-dokerizer directory. Ensure that all you project have different name | drupal-project-runtime | | docker_cached_volume | Set option :cached for docker volume. [more](http://docs.docker.oeynet.com/docker-for-mac/osxfs-caching/). | false | | user_uid | uid your user in system. Run `id -u` for see you uid | 1000 | +| user_gid | uid your user in system. Run `id -g` for see you uid | 1000 | | drupal_root_dir | Absоlute path to your drupal-project directory. | /var/data/drupal | | drupal_web_root | Name directory where placed index.php file indside drupal project directory | web | | drupal_files_dir | Absolute path to your drupal files directory | /var/data/drupal_files | diff --git a/README.md b/README.md index 3611e2d..27c1e42 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Minimum required options: compose_project_name: drupal-project docker_runtime_dir: drupal-project user_uid: 1000 +user_gid: 1000 drupal_root_dir: /var/data/drupal drupal_web_root: web drupal_files_dir: /var/data/drupal/web/sites/default/files From 05f526c5c953fa14f9626592d217717c0bc709a6 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 30 Mar 2021 10:12:59 +0300 Subject: [PATCH 044/228] Fix requirements --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 27c1e42..4f50a34 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ ## Requirements -- Python >= 3.5 -- Docker -- Docker Compose -- Ansible >= 2.8 -- Git +- python [instruction](https://www.python.org/downloads/) +- git [instruction for install](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) +- ansible [instruction for install](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html) +- docker [instruction for install](https://docs.docker.com/get-docker/) +- docker-compose [instruction for install](https://docs.docker.com/compose/install/) ## Quickstart From f3eafc0626271300aac3eb337fecd6985b6d8136 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 30 Mar 2021 10:13:58 +0300 Subject: [PATCH 045/228] Fix requirements --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4f50a34..2c3637d 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ - docker [instruction for install](https://docs.docker.com/get-docker/) - docker-compose [instruction for install](https://docs.docker.com/compose/install/) +After install docker need add your user to docker group and logout/login to you system, see [instruction](https://docs.docker.com/engine/install/linux-postinstall/) ## Quickstart You can use ansible-pull tool from standard package ansible for quick setup your project. From 52a52c948699d25e2c8c3e0bff049fc6cf07b296 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 30 Mar 2021 10:17:43 +0300 Subject: [PATCH 046/228] Fix mardown styles --- README.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2c3637d..b547f35 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ - docker-compose [instruction for install](https://docs.docker.com/compose/install/) After install docker need add your user to docker group and logout/login to you system, see [instruction](https://docs.docker.com/engine/install/linux-postinstall/) + ## Quickstart You can use ansible-pull tool from standard package ansible for quick setup your project. @@ -16,6 +17,7 @@ You can use ansible-pull tool from standard package ansible for quick setup your For that create config yml file in any place your need(in drupal project directory or external folder). Ensure that all needed config options is setup. Minimum required options: + ```yaml --- @@ -27,29 +29,33 @@ drupal_root_dir: /var/data/drupal drupal_web_root: web drupal_files_dir: /var/data/drupal/web/sites/default/files ``` + Remember: other options will setted by default from `default.config.yml` file. For more options [see](CONFIG.md) For up your drupal project in docker containers run: -``` +```bash ansible-pull --extra-vars @/ -U https://github.com/jet-dev-team/drupal-dockerizer.git main.yml --ask-become-pass ``` After done you should have drupal project in docker containers with empty database. Check containers status by run `docker ps` command. If you use database dump you can set in config option `db_dump_path` to absolute path to you database dump. For import database run: -``` + +```bash ansible-pull --extra-vars @/ -U https://github.com/jet-dev-team/drupal-dockerizer.git db.yml ``` For stop or up containers just replace `db.yml` in command to `stop.yml` or `up.yml` -For fully remove all projects data you can run: -``` +For fully remove all projects data and down docker conteiners you can run: + +```bash ansible-pull --extra-vars @/ -U https://github.com/jet-dev-team/drupal-dockerizer.git reset.yml --ask-become-pass ``` + This command remove all projects containers, volumes with data in database and runtime directory. ### Usage ansible-pull @@ -121,7 +127,7 @@ Your `launch.json` should look like the next config: "max_depth": 2, "max_children": 100, } - + } ``` How to use debugger with Drush commands? @@ -170,6 +176,7 @@ drush_commands: - '-v sapi-i' - ... ``` + ## Development drupal-dockerizer ### Prepare project structure @@ -185,6 +192,7 @@ drush_commands: cd drupal-dockerizer cp default.config.yml config.yml ``` + ### Start local environment ```bash From 72704afdc96ddf7fbd2cb707b36176a5e600a9b9 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 30 Mar 2021 10:19:06 +0300 Subject: [PATCH 047/228] Fix default site instalation --- default.config.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/default.config.yml b/default.config.yml index 360e01b..efc2b77 100644 --- a/default.config.yml +++ b/default.config.yml @@ -40,11 +40,7 @@ drush_version: 10 # Drush commands to run (will be run by `run-drush-commands.yml` playbook or if init_project is true). drush_commands: - 'cc drush' - - 'site:install minimal --account-pass=admin --site-name="Drupal Dockerizer"' - - 'theme:enable bartik claro' - - 'en datetime toolbar rest jsonapi views views_ui ban automated_cron action admin_toolbar' - - 'config-set system.theme default bartik' - - 'config-set system.theme admin claro' + - 'si --account-pass=admin --site-name="Drupal Dockerizer"' - 'cron' # If set to true lanch drush commands in php-apache conteiner after up conteiner. From b5a6bb3c0303b2ad12ce0a00852177ba8039e5b8 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 30 Mar 2021 10:20:53 +0300 Subject: [PATCH 048/228] Fix typo --- CONFIG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONFIG.md b/CONFIG.md index 1d439b0..cf692d1 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -1,4 +1,4 @@ -# Availble options(vars) for durpal-dockerizer config +# Availble options(vars) for drupal-dockerizer config | Option | Description | Example | | ------------ | ------------ | ------------ | From cdf130ab932ba98a0cf92753823e244dba694db1 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 30 Mar 2021 13:41:15 +0300 Subject: [PATCH 049/228] Fix minimal config --- README.md | 3 --- default.config.yml | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b547f35..c159dbe 100644 --- a/README.md +++ b/README.md @@ -22,12 +22,9 @@ Minimum required options: --- compose_project_name: drupal-project -docker_runtime_dir: drupal-project user_uid: 1000 user_gid: 1000 drupal_root_dir: /var/data/drupal -drupal_web_root: web -drupal_files_dir: /var/data/drupal/web/sites/default/files ``` Remember: other options will setted by default from `default.config.yml` file. diff --git a/default.config.yml b/default.config.yml index efc2b77..c89a322 100644 --- a/default.config.yml +++ b/default.config.yml @@ -1,17 +1,18 @@ --- compose_project_name: my-project -docker_runtime_dir: my-project +docker_runtime_dir: "{{compose_project_name}}" docker_cached_volume: true user_uid: 1000 +user_gid: 1000 # Absolute Path to Drupal dir (`vendor` forlder should be there). drupal_root_dir: /var/data/drupal # Name of "web" folder inside `drupal_root_dir`. drupal_web_root: web # Absolute Path to Drupal files dir. -drupal_files_dir: /var/data/drupal_files +drupal_files_dir: "{{drupal_root_dir}}/{{drupal_web_root}}/sites/default/files" drupal_hash_salt: demo_site # Absolute Path to Drupal config sync dir. drupal_config_sync_folder: sites/default/sync From a16c0a1bb99f635ad337ee27c035a0d8c7543f1e Mon Sep 17 00:00:00 2001 From: Dima Danylevskyi Date: Tue, 30 Mar 2021 15:50:44 +0300 Subject: [PATCH 050/228] Update default.config.yml --- default.config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.config.yml b/default.config.yml index c89a322..8b65add 100644 --- a/default.config.yml +++ b/default.config.yml @@ -36,7 +36,7 @@ domain_name: drupal.devel drush_install: true # Availible options: 8, 9, 10 -drush_version: 10 +drush_version: 8 # Drush commands to run (will be run by `run-drush-commands.yml` playbook or if init_project is true). drush_commands: From df18e502265b67249e9f0275202605243d24d66c Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 31 Mar 2021 13:16:16 +0300 Subject: [PATCH 051/228] Add new variable for custom tasks --- default.config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/default.config.yml b/default.config.yml index c89a322..b813507 100644 --- a/default.config.yml +++ b/default.config.yml @@ -71,6 +71,9 @@ import_database: false install_adminer: false adminer_port: 8080 +pre_task_path: ../pre_task.yml +post_task_path: ../post_task.yml + custom_drupal_settings: | if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) { include $app_root . '/' . $site_path . '/settings.local.php'; From 8b56f2ac95f35580f8f118e0fb15523f1cb564ca Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 31 Mar 2021 13:21:27 +0300 Subject: [PATCH 052/228] Fix main playbook for new directory structure --- main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.yml b/main.yml index 65989b3..f1ae3fc 100644 --- a/main.yml +++ b/main.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - config.yml + - ../config.yml roles: [] @@ -20,14 +20,14 @@ - name: Check project tasks. stat: - path: "{{drupal_root_dir}}/.drupal_dockerizer/pre-tasks.yml" + path: "{{pre_task_path}}" register: pre_tasks - name: Include custom project pre-tasks include: "{{ item }}" with_first_found: - files: - - "{{drupal_root_dir}}/.drupal_dockerizer/pre-tasks.yml" + - "{{pre_task_path}}" skip: true when: pre_tasks @@ -59,14 +59,14 @@ - name: Check project tasks. stat: - path: "{{drupal_root_dir}}/.drupal_dockerizer/post-tasks.yml" + path: "{{post_task_path}}" register: post_tasks - name: Include custom project post-tasks include: "{{ item }}" with_first_found: - files: - - "{{drupal_root_dir}}/.drupal_dockerizer/post-tasks.yml" + - "{{post_task_path}}" skip: true when: post_tasks From 7446ad4e81151d879010b48a9a69e289f342b478 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 31 Mar 2021 13:29:39 +0300 Subject: [PATCH 053/228] Fix playbooks for new directory structure --- db.yml | 2 +- run-drush-commands.yml => drush-commands.yml | 2 +- reset.yml | 2 +- stop.yml | 2 +- up.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename run-drush-commands.yml => drush-commands.yml (92%) diff --git a/db.yml b/db.yml index b239453..06951f3 100644 --- a/db.yml +++ b/db.yml @@ -8,7 +8,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - config.yml + - ../config.yml roles: [] diff --git a/run-drush-commands.yml b/drush-commands.yml similarity index 92% rename from run-drush-commands.yml rename to drush-commands.yml index 406252e..70bda31 100644 --- a/run-drush-commands.yml +++ b/drush-commands.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - config.yml + - ../config.yml roles: [] diff --git a/reset.yml b/reset.yml index a7352a0..4bde661 100644 --- a/reset.yml +++ b/reset.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - config.yml + - ../config.yml roles: [] diff --git a/stop.yml b/stop.yml index dae3db2..f8fe65b 100644 --- a/stop.yml +++ b/stop.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - config.yml + - ../config.yml roles: [] diff --git a/up.yml b/up.yml index e527099..812b81d 100644 --- a/up.yml +++ b/up.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - config.yml + - ../config.yml roles: [] From 73965c645fa5d5bb9ac999eacecd2277f5fe0818 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 13 Apr 2021 15:15:41 +0300 Subject: [PATCH 054/228] Implement basic test for installing new Drupal --- .github/workflows/drupal-dockerizer.yml | 65 +++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/drupal-dockerizer.yml diff --git a/.github/workflows/drupal-dockerizer.yml b/.github/workflows/drupal-dockerizer.yml new file mode 100644 index 0000000..c625f83 --- /dev/null +++ b/.github/workflows/drupal-dockerizer.yml @@ -0,0 +1,65 @@ +name: Check Drupal Dockerizer basic functionality + +on: + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - name: Caching Composer dependencies for improve speed + uses: actions/cache@v2 + with: + path: /tmp/composer-cache + key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} + + - name: Get Drupal Project repository + uses: actions/checkout@v2 + with: + repository: 'drupal/recommended-project' + path: './' + + - name: Run composer install + uses: php-actions/composer@v5 + with: + command: install --ignore-platform-reqs + + - name: Run composer update + uses: php-actions/composer@v5 + with: + command: update --ignore-platform-reqs + + - name: Get Drupal Dockerizer repository + uses: actions/checkout@v2 + with: + path: '.drupal-dockerizer' + + - name: Create basic config.yml + run: | + echo "---" > config.yml + echo "" >> config.yml + echo "compose_project_name: drupal-project" >> config.yml + echo "user_uid: $(id -u)" >> config.yml + echo "user_gid: $(id -g)" >> config.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE" >> config.yml + + - name: Run main playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: main.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Run drush-commands playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: drush-commands.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Check drupal + run: curl http://localhost | grep "Drupal" From 07ac8828439bc3e5c637e9adf7e2d6320d7c0135 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 13 Apr 2021 15:44:35 +0300 Subject: [PATCH 055/228] Rename file --- .github/workflows/{drupal-dockerizer.yml => basic_test.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{drupal-dockerizer.yml => basic_test.yml} (97%) diff --git a/.github/workflows/drupal-dockerizer.yml b/.github/workflows/basic_test.yml similarity index 97% rename from .github/workflows/drupal-dockerizer.yml rename to .github/workflows/basic_test.yml index c625f83..c6b24df 100644 --- a/.github/workflows/drupal-dockerizer.yml +++ b/.github/workflows/basic_test.yml @@ -1,4 +1,4 @@ -name: Check Drupal Dockerizer basic functionality +name: Check basic functionality on: pull_request: From eb407c53bc07c6a9672e4aa71f3754e4ddd2ebbb Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 13 Apr 2021 16:07:42 +0300 Subject: [PATCH 056/228] Fix composer --- .github/workflows/basic_test.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index c6b24df..6e7df7b 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -20,17 +20,13 @@ jobs: with: repository: 'drupal/recommended-project' path: './' + ref: '9.2.x' - name: Run composer install uses: php-actions/composer@v5 with: command: install --ignore-platform-reqs - - name: Run composer update - uses: php-actions/composer@v5 - with: - command: update --ignore-platform-reqs - - name: Get Drupal Dockerizer repository uses: actions/checkout@v2 with: From 61e31a38d2e354a4541fa808a908826d20659904 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 13 Apr 2021 16:13:46 +0300 Subject: [PATCH 057/228] Rename job --- .github/workflows/basic_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index 6e7df7b..2038a85 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: jobs: - build: + test: runs-on: ubuntu-20.04 steps: - name: Caching Composer dependencies for improve speed From f354fb10ccc6fce11734d58457ab3af7477a9588 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 13 Apr 2021 16:19:21 +0300 Subject: [PATCH 058/228] Fix typos --- .github/workflows/basic_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index 2038a85..7c2ec27 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -9,7 +9,7 @@ jobs: test: runs-on: ubuntu-20.04 steps: - - name: Caching Composer dependencies for improve speed + - name: Cache Composer dependencies for improve speed uses: actions/cache@v2 with: path: /tmp/composer-cache @@ -22,7 +22,7 @@ jobs: path: './' ref: '9.2.x' - - name: Run composer install + - name: Run Composer install uses: php-actions/composer@v5 with: command: install --ignore-platform-reqs @@ -57,5 +57,5 @@ jobs: options: | --verbose - - name: Check drupal + - name: Check Drupal run: curl http://localhost | grep "Drupal" From cd4daddedc31eaf311206860dcec9b76fb2f7bdf Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 13 Apr 2021 16:39:33 +0300 Subject: [PATCH 059/228] Rename config.yml to .drupal_dockerizer.yml --- .github/workflows/basic_test.yml | 14 +++++++------- db.yml | 2 +- drush-commands.yml | 2 +- main.yml | 2 +- reset.yml | 2 +- stop.yml | 2 +- up.yml | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index 7c2ec27..1ba1a5f 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -32,14 +32,14 @@ jobs: with: path: '.drupal-dockerizer' - - name: Create basic config.yml + - name: Create basic .drupal_dockerizer.yml run: | - echo "---" > config.yml - echo "" >> config.yml - echo "compose_project_name: drupal-project" >> config.yml - echo "user_uid: $(id -u)" >> config.yml - echo "user_gid: $(id -g)" >> config.yml - echo "drupal_root_dir: $GITHUB_WORKSPACE" >> config.yml + echo "---" > .drupal_dockerizer.yml + echo "" >> .drupal_dockerizer.yml + echo "compose_project_name: drupal-project" >> .drupal_dockerizer.yml + echo "user_uid: $(id -u)" >> .drupal_dockerizer.yml + echo "user_gid: $(id -g)" >> .drupal_dockerizer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE" >> .drupal_dockerizer.yml - name: Run main playbook uses: dawidd6/action-ansible-playbook@v2 diff --git a/db.yml b/db.yml index 06951f3..1144f58 100644 --- a/db.yml +++ b/db.yml @@ -8,7 +8,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../config.yml + - ../.drupal_dockerizer.yml roles: [] diff --git a/drush-commands.yml b/drush-commands.yml index 70bda31..6b126d3 100644 --- a/drush-commands.yml +++ b/drush-commands.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../config.yml + - ../.drupal_dockerizer.yml roles: [] diff --git a/main.yml b/main.yml index f1ae3fc..38bfb6b 100644 --- a/main.yml +++ b/main.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../config.yml + - ../.drupal_dockerizer.yml roles: [] diff --git a/reset.yml b/reset.yml index 4bde661..c12917d 100644 --- a/reset.yml +++ b/reset.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../config.yml + - ../.drupal_dockerizer.yml roles: [] diff --git a/stop.yml b/stop.yml index f8fe65b..c40300b 100644 --- a/stop.yml +++ b/stop.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../config.yml + - ../.drupal_dockerizer.yml roles: [] diff --git a/up.yml b/up.yml index 812b81d..d5ceb99 100644 --- a/up.yml +++ b/up.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../config.yml + - ../.drupal_dockerizer.yml roles: [] From 615bac9f394572ee06251781f41fcee6bb13f987 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 10:31:35 +0300 Subject: [PATCH 060/228] rename to dockerizer.yml --- .github/workflows/basic_test.yml | 14 +++++++------- db.yml | 2 +- drush-commands.yml | 2 +- main.yml | 2 +- reset.yml | 2 +- stop.yml | 2 +- up.yml | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index 1ba1a5f..d8274f1 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -32,14 +32,14 @@ jobs: with: path: '.drupal-dockerizer' - - name: Create basic .drupal_dockerizer.yml + - name: Create basic dockerizer.yml run: | - echo "---" > .drupal_dockerizer.yml - echo "" >> .drupal_dockerizer.yml - echo "compose_project_name: drupal-project" >> .drupal_dockerizer.yml - echo "user_uid: $(id -u)" >> .drupal_dockerizer.yml - echo "user_gid: $(id -g)" >> .drupal_dockerizer.yml - echo "drupal_root_dir: $GITHUB_WORKSPACE" >> .drupal_dockerizer.yml + echo "---" > dockerizer.yml + echo "" >> dockerizer.yml + echo "compose_project_name: drupal-project" >> dockerizer.yml + echo "user_uid: $(id -u)" >> dockerizer.yml + echo "user_gid: $(id -g)" >> dockerizer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE" >> dockerizer.yml - name: Run main playbook uses: dawidd6/action-ansible-playbook@v2 diff --git a/db.yml b/db.yml index 1144f58..1b61eef 100644 --- a/db.yml +++ b/db.yml @@ -8,7 +8,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../.drupal_dockerizer.yml + - ../dockerizer.yml roles: [] diff --git a/drush-commands.yml b/drush-commands.yml index 6b126d3..a718f1a 100644 --- a/drush-commands.yml +++ b/drush-commands.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../.drupal_dockerizer.yml + - ../dockerizer.yml roles: [] diff --git a/main.yml b/main.yml index 38bfb6b..78b885d 100644 --- a/main.yml +++ b/main.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../.drupal_dockerizer.yml + - ../dockerizer.yml roles: [] diff --git a/reset.yml b/reset.yml index c12917d..4d3e505 100644 --- a/reset.yml +++ b/reset.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../.drupal_dockerizer.yml + - ../dockerizer.yml roles: [] diff --git a/stop.yml b/stop.yml index c40300b..cc6ee03 100644 --- a/stop.yml +++ b/stop.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../.drupal_dockerizer.yml + - ../dockerizer.yml roles: [] diff --git a/up.yml b/up.yml index d5ceb99..f564d96 100644 --- a/up.yml +++ b/up.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../.drupal_dockerizer.yml + - ../dockerizer.yml roles: [] From 690975a375850fc84c94556d8acd34d1c3f192ed Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 12:10:42 +0300 Subject: [PATCH 061/228] Implement test for import db --- .github/workflows/db_import_test.yml | 94 ++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .github/workflows/db_import_test.yml diff --git a/.github/workflows/db_import_test.yml b/.github/workflows/db_import_test.yml new file mode 100644 index 0000000..f1d9f5c --- /dev/null +++ b/.github/workflows/db_import_test.yml @@ -0,0 +1,94 @@ +name: Check database import functionality + +on: + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-20.04 + steps: + - name: Cache Composer dependencies for improve speed + uses: actions/cache@v2 + with: + path: /tmp/composer-cache + key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} + + - name: Get Drupal Project repository + uses: actions/checkout@v2 + with: + repository: 'drupal/recommended-project' + path: './' + ref: '9.2.x' + + - name: Run Composer install + uses: php-actions/composer@v5 + with: + command: install --ignore-platform-reqs + + - name: Get Drupal Dockerizer repository + uses: actions/checkout@v2 + with: + path: '.drupal-dockerizer' + + - name: Create basic dockerizer.yml + run: | + echo "---" > dockerizer.yml + echo "" >> dockerizer.yml + echo "compose_project_name: drupal-project" >> dockerizer.yml + echo "user_uid: $(id -u)" >> dockerizer.yml + echo "user_gid: $(id -g)" >> dockerizer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE" >> dockerizer.yml + echo "db_dump_path: $GITHUB_WORKSPACE/web/dump.sql" >> dockerizer.yml + + - name: Run main playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: main.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Run drush-commands playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: drush-commands.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Change site name by Drush + run: docker exec drupal-project-7.4-develop drush cset system.site name DrupalDump + + - name: Dump database from Drupal + run: docker exec drupal-project-7.4-develop drush sql:dump --result-file=dump.sql + + - name: Destroy containers and runtime + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: reset.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Run main playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: main.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Import DataBase + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: db.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Check that import is OK and site name is DrupalDump + run: | + result="`docker exec drupal-project-7.4-develop drush cget system.site name --format=string`" + if [[ "$result" == "DrupalDump" ]]; then echo "Import DB is OK"; exit 0; else echo "Import db not correct"; exit 1; fi From bcd96820b1dc2b91df77f1005af7d59ba90eede7 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 12:17:34 +0300 Subject: [PATCH 062/228] Small fix --- .github/workflows/db_import_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/db_import_test.yml b/.github/workflows/db_import_test.yml index f1d9f5c..1c5ee43 100644 --- a/.github/workflows/db_import_test.yml +++ b/.github/workflows/db_import_test.yml @@ -59,7 +59,7 @@ jobs: --verbose - name: Change site name by Drush - run: docker exec drupal-project-7.4-develop drush cset system.site name DrupalDump + run: docker exec drupal-project-7.4-develop drush cset system.site name DrupalDump -y - name: Dump database from Drupal run: docker exec drupal-project-7.4-develop drush sql:dump --result-file=dump.sql From 8baf642d671a8ecd9ee864f2262739d09ecc8bf3 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 12:24:51 +0300 Subject: [PATCH 063/228] Check permissions --- .github/workflows/db_import_test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/db_import_test.yml b/.github/workflows/db_import_test.yml index 1c5ee43..3261e23 100644 --- a/.github/workflows/db_import_test.yml +++ b/.github/workflows/db_import_test.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: jobs: - test: + test_import_db: runs-on: ubuntu-20.04 steps: - name: Cache Composer dependencies for improve speed @@ -61,6 +61,9 @@ jobs: - name: Change site name by Drush run: docker exec drupal-project-7.4-develop drush cset system.site name DrupalDump -y + - name: Check permissions + run: ls -lah web/ + - name: Dump database from Drupal run: docker exec drupal-project-7.4-develop drush sql:dump --result-file=dump.sql From d8f41b41b1c333e98c73336647e3bab6965e7f7e Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 12:25:20 +0300 Subject: [PATCH 064/228] Temp turn off basic test --- .github/workflows/basic_test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index d8274f1..8eb5395 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -1,8 +1,6 @@ name: Check basic functionality on: - pull_request: - branches: [main] workflow_dispatch: jobs: From abd9b287f7d7b82688f7b48c1f125ec3cf90e487 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 12:35:40 +0300 Subject: [PATCH 065/228] Fix permissions after composer install --- .github/workflows/basic_test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index 8eb5395..a47b33a 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -25,6 +25,9 @@ jobs: with: command: install --ignore-platform-reqs + - name: Fix files permission after php-actions/composer@v5 + run: sudo chown -R $(id -u):$(id -g) * + - name: Get Drupal Dockerizer repository uses: actions/checkout@v2 with: From 2be9caf15ab9b1b073af48d44cecd7efa82ad7fb Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 12:36:25 +0300 Subject: [PATCH 066/228] Fix permissions after composer install --- .github/workflows/db_import_test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/db_import_test.yml b/.github/workflows/db_import_test.yml index 3261e23..205d28b 100644 --- a/.github/workflows/db_import_test.yml +++ b/.github/workflows/db_import_test.yml @@ -27,6 +27,9 @@ jobs: with: command: install --ignore-platform-reqs + - name: Fix files permission after php-actions/composer@v5 + run: sudo chown -R $(id -u):$(id -g) * + - name: Get Drupal Dockerizer repository uses: actions/checkout@v2 with: From 222ec578b508e1c4e43f61038c7804bea3bd3ced Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 12:41:35 +0300 Subject: [PATCH 067/228] Revert "Temp turn off basic test" This reverts commit d8f41b41b1c333e98c73336647e3bab6965e7f7e. --- .github/workflows/basic_test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index a47b33a..b6613ef 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -1,6 +1,8 @@ name: Check basic functionality on: + pull_request: + branches: [main] workflow_dispatch: jobs: From 63bff7ee7cef47fa44443d7b71f469a570426c53 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 13:46:26 +0300 Subject: [PATCH 068/228] Check composer in ubuntu enviroment --- .github/workflows/db_import_test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/db_import_test.yml b/.github/workflows/db_import_test.yml index 205d28b..1aa3704 100644 --- a/.github/workflows/db_import_test.yml +++ b/.github/workflows/db_import_test.yml @@ -12,7 +12,7 @@ jobs: - name: Cache Composer dependencies for improve speed uses: actions/cache@v2 with: - path: /tmp/composer-cache + path: ~/.cache/composer key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} - name: Get Drupal Project repository @@ -23,9 +23,7 @@ jobs: ref: '9.2.x' - name: Run Composer install - uses: php-actions/composer@v5 - with: - command: install --ignore-platform-reqs + run: composer install --ignore-platform-reqs - name: Fix files permission after php-actions/composer@v5 run: sudo chown -R $(id -u):$(id -g) * From 95de43e782eff3871035c0878d2525d7b4e4640b Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 13:49:12 +0300 Subject: [PATCH 069/228] Fix composer --- .github/workflows/basic_test.yml | 7 +------ .github/workflows/db_import_test.yml | 6 ------ 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index b6613ef..557f18e 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -23,12 +23,7 @@ jobs: ref: '9.2.x' - name: Run Composer install - uses: php-actions/composer@v5 - with: - command: install --ignore-platform-reqs - - - name: Fix files permission after php-actions/composer@v5 - run: sudo chown -R $(id -u):$(id -g) * + run: composer install --ignore-platform-reqs - name: Get Drupal Dockerizer repository uses: actions/checkout@v2 diff --git a/.github/workflows/db_import_test.yml b/.github/workflows/db_import_test.yml index 1aa3704..78ccf07 100644 --- a/.github/workflows/db_import_test.yml +++ b/.github/workflows/db_import_test.yml @@ -25,9 +25,6 @@ jobs: - name: Run Composer install run: composer install --ignore-platform-reqs - - name: Fix files permission after php-actions/composer@v5 - run: sudo chown -R $(id -u):$(id -g) * - - name: Get Drupal Dockerizer repository uses: actions/checkout@v2 with: @@ -62,9 +59,6 @@ jobs: - name: Change site name by Drush run: docker exec drupal-project-7.4-develop drush cset system.site name DrupalDump -y - - name: Check permissions - run: ls -lah web/ - - name: Dump database from Drupal run: docker exec drupal-project-7.4-develop drush sql:dump --result-file=dump.sql From 026f3461d41470144da0d7c3b04fbfaa9c70876c Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 13:56:31 +0300 Subject: [PATCH 070/228] Fix cache --- .github/workflows/basic_test.yml | 4 ++-- .github/workflows/db_import_test.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index 557f18e..7db9af1 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -12,8 +12,8 @@ jobs: - name: Cache Composer dependencies for improve speed uses: actions/cache@v2 with: - path: /tmp/composer-cache - key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} + path: ~/.cache/composer + key: ${{ runner.os }}-drupal - name: Get Drupal Project repository uses: actions/checkout@v2 diff --git a/.github/workflows/db_import_test.yml b/.github/workflows/db_import_test.yml index 78ccf07..75e8e16 100644 --- a/.github/workflows/db_import_test.yml +++ b/.github/workflows/db_import_test.yml @@ -13,7 +13,7 @@ jobs: uses: actions/cache@v2 with: path: ~/.cache/composer - key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} + key: ${{ runner.os }}-drupal - name: Get Drupal Project repository uses: actions/checkout@v2 From c86551f7c6e08fba2b1619922220c6b29493a916 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 14:25:50 +0300 Subject: [PATCH 071/228] Temporary turn off other tests --- .github/workflows/basic_test.yml | 2 -- .github/workflows/db_import_test.yml | 2 -- 2 files changed, 4 deletions(-) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index 7db9af1..2a1c10c 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -1,8 +1,6 @@ name: Check basic functionality on: - pull_request: - branches: [main] workflow_dispatch: jobs: diff --git a/.github/workflows/db_import_test.yml b/.github/workflows/db_import_test.yml index 75e8e16..9f01673 100644 --- a/.github/workflows/db_import_test.yml +++ b/.github/workflows/db_import_test.yml @@ -1,8 +1,6 @@ name: Check database import functionality on: - pull_request: - branches: [main] workflow_dispatch: jobs: From 2d9a257ef871c1852482cdc5fb95294b6d9613af Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 14:28:48 +0300 Subject: [PATCH 072/228] Check advanced networking --- .github/workflows/ssl_test.yml | 62 ++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/ssl_test.yml diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml new file mode 100644 index 0000000..41fda11 --- /dev/null +++ b/.github/workflows/ssl_test.yml @@ -0,0 +1,62 @@ +name: Check ssl functionality + +on: + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + test_ssl: + runs-on: ubuntu-20.04 + steps: + - name: Cache Composer dependencies for improve speed + uses: actions/cache@v2 + with: + path: ~/.cache/composer + key: ${{ runner.os }}-drupal + + - name: Get Drupal Project repository + uses: actions/checkout@v2 + with: + repository: 'drupal/recommended-project' + path: './' + ref: '9.2.x' + + - name: Run Composer install + run: composer install --ignore-platform-reqs + + - name: Get Drupal Dockerizer repository + uses: actions/checkout@v2 + with: + path: '.drupal-dockerizer' + + - name: Create basic dockerizer.yml + run: | + echo "---" > dockerizer.yml + echo "" >> dockerizer.yml + echo "compose_project_name: drupal-project" >> dockerizer.yml + echo "user_uid: $(id -u)" >> dockerizer.yml + echo "user_gid: $(id -g)" >> dockerizer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE" >> dockerizer.yml + echo "advanced_networking: true >> dockerizer.yml + echo "network_id: 15 >> dockerizer.yml + echo "domain_name: drupal.devel >> dockerizer.yml + + - name: Run main playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: main.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Run drush-commands playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: drush-commands.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Check drupal.devel domain work + run: curl http://drupal.devel | grep "Drupal" From 941c13b4d227897943b03c8b987308d84b374fa0 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 14:30:31 +0300 Subject: [PATCH 073/228] Fix EOF --- .github/workflows/ssl_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index 41fda11..eecbc85 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -38,9 +38,9 @@ jobs: echo "user_uid: $(id -u)" >> dockerizer.yml echo "user_gid: $(id -g)" >> dockerizer.yml echo "drupal_root_dir: $GITHUB_WORKSPACE" >> dockerizer.yml - echo "advanced_networking: true >> dockerizer.yml - echo "network_id: 15 >> dockerizer.yml - echo "domain_name: drupal.devel >> dockerizer.yml + echo "advanced_networking: true" >> dockerizer.yml + echo "network_id: 15" >> dockerizer.yml + echo "domain_name: drupal.devel" >> dockerizer.yml - name: Run main playbook uses: dawidd6/action-ansible-playbook@v2 From adf90fcf6d6327112f18cf0d0ed97603343cb8d8 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 14:46:20 +0300 Subject: [PATCH 074/228] ADd check ssl functionality --- .github/workflows/ssl_test.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index eecbc85..e6bbe16 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -60,3 +60,27 @@ jobs: - name: Check drupal.devel domain work run: curl http://drupal.devel | grep "Drupal" + + - name: Generate certificates for next step + uses: kofemann/action-create-certificate@v0.0.4 + with: + hostcert: 'hostcert.pem' + hostkey: 'hostkey.pem' + cachain: 'ca-chain.pem' + + - name: Enable ssl in dockerizer.yml + run: | + echo "ssl_key_path: $GITHUB_WORKSPACE/hostkey.pem" >> dockerizer.yml + echo "ssl_cert_path: $GITHUB_WORKSPACE/hostkey.pem" >> dockerizer.yml + echo "ssl_enabled: true" >> dockerizer.yml + + - name: Run main playbook with ssl configuration + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: main.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Check drupal.devel domain work with ssl + run: curl https://drupal.devel | grep "Drupal" From d418413bf468f3c8ba6cee03a0bb35f6bfc840c9 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 14:52:37 +0300 Subject: [PATCH 075/228] Small fix --- .github/workflows/ssl_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index e6bbe16..77287ac 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -71,7 +71,7 @@ jobs: - name: Enable ssl in dockerizer.yml run: | echo "ssl_key_path: $GITHUB_WORKSPACE/hostkey.pem" >> dockerizer.yml - echo "ssl_cert_path: $GITHUB_WORKSPACE/hostkey.pem" >> dockerizer.yml + echo "ssl_cert_path: $GITHUB_WORKSPACE/hostcert.pem" >> dockerizer.yml echo "ssl_enabled: true" >> dockerizer.yml - name: Run main playbook with ssl configuration From 987321cba835fc6be6d51757b892548ffbc1b5f1 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 15:32:59 +0300 Subject: [PATCH 076/228] Chack apache log --- .github/workflows/ssl_test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index 77287ac..9616365 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -82,5 +82,8 @@ jobs: options: | --verbose + - name: Check apache logs + run: cat $GITHUB_WORKSPACE/.drupal-dockerizer/drupal-project/logs/apache2/error.log + - name: Check drupal.devel domain work with ssl run: curl https://drupal.devel | grep "Drupal" From 8ea6895320f4a65a6468f1207eb0f0926a450ec4 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 15:38:28 +0300 Subject: [PATCH 077/228] Check permissions --- .github/workflows/ssl_test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index 9616365..8e51120 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -68,6 +68,9 @@ jobs: hostkey: 'hostkey.pem' cachain: 'ca-chain.pem' + - name: Check permissions + run: ls -lha + - name: Enable ssl in dockerizer.yml run: | echo "ssl_key_path: $GITHUB_WORKSPACE/hostkey.pem" >> dockerizer.yml From 6172147a20af70aefc9e3736163fa76d75fb65ad Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 15:44:09 +0300 Subject: [PATCH 078/228] Fix permissions --- .github/workflows/ssl_test.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index 8e51120..acc26f9 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -64,17 +64,17 @@ jobs: - name: Generate certificates for next step uses: kofemann/action-create-certificate@v0.0.4 with: - hostcert: 'hostcert.pem' - hostkey: 'hostkey.pem' + hostcert: 'cert.pem' + hostkey: 'private.key' cachain: 'ca-chain.pem' - - name: Check permissions - run: ls -lha + - name: Fix ssl permissions + run: sudo chown -R $(id -u):$(id -g) * - name: Enable ssl in dockerizer.yml run: | - echo "ssl_key_path: $GITHUB_WORKSPACE/hostkey.pem" >> dockerizer.yml - echo "ssl_cert_path: $GITHUB_WORKSPACE/hostcert.pem" >> dockerizer.yml + echo "ssl_key_path: $GITHUB_WORKSPACE/private.key" >> dockerizer.yml + echo "ssl_cert_path: $GITHUB_WORKSPACE/cert.pem" >> dockerizer.yml echo "ssl_enabled: true" >> dockerizer.yml - name: Run main playbook with ssl configuration @@ -85,8 +85,5 @@ jobs: options: | --verbose - - name: Check apache logs - run: cat $GITHUB_WORKSPACE/.drupal-dockerizer/drupal-project/logs/apache2/error.log - - name: Check drupal.devel domain work with ssl run: curl https://drupal.devel | grep "Drupal" From d7bd02ff309c9a0dbfa3fae37838a8af81b945a0 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 15:49:58 +0300 Subject: [PATCH 079/228] Small fix --- .github/workflows/ssl_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index acc26f9..c52abaa 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -86,4 +86,4 @@ jobs: --verbose - name: Check drupal.devel domain work with ssl - run: curl https://drupal.devel | grep "Drupal" + run: curl --insecure -I https://drupal.devel From 486b877c0f30f017238b1ab4b3aa9a49dd64e082 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 15:56:31 +0300 Subject: [PATCH 080/228] Add CA --- .github/workflows/ssl_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index c52abaa..72822f1 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -86,4 +86,4 @@ jobs: --verbose - name: Check drupal.devel domain work with ssl - run: curl --insecure -I https://drupal.devel + run: curl --cacert ca-chain.pem -I https://drupal.devel From afcd2563470ac303c9f545e50dacf586eed138ef Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 16:04:25 +0300 Subject: [PATCH 081/228] Revert "Add CA" This reverts commit 486b877c0f30f017238b1ab4b3aa9a49dd64e082. --- .github/workflows/ssl_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index 72822f1..c52abaa 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -86,4 +86,4 @@ jobs: --verbose - name: Check drupal.devel domain work with ssl - run: curl --cacert ca-chain.pem -I https://drupal.devel + run: curl --insecure -I https://drupal.devel From d1474f6a4abb47ee6b4cae1c2ee774fad61b144a Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 14 Apr 2021 16:04:33 +0300 Subject: [PATCH 082/228] Revert "Temporary turn off other tests" This reverts commit c86551f7c6e08fba2b1619922220c6b29493a916. --- .github/workflows/basic_test.yml | 2 ++ .github/workflows/db_import_test.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index 2a1c10c..7db9af1 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -1,6 +1,8 @@ name: Check basic functionality on: + pull_request: + branches: [main] workflow_dispatch: jobs: diff --git a/.github/workflows/db_import_test.yml b/.github/workflows/db_import_test.yml index 9f01673..75e8e16 100644 --- a/.github/workflows/db_import_test.yml +++ b/.github/workflows/db_import_test.yml @@ -1,6 +1,8 @@ name: Check database import functionality on: + pull_request: + branches: [main] workflow_dispatch: jobs: From 6d52933294925acb1bc7e4393d0fd780c6764a60 Mon Sep 17 00:00:00 2001 From: Vlad Date: Wed, 14 Apr 2021 16:24:40 +0300 Subject: [PATCH 083/228] Update .github/workflows/ssl_test.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/ssl_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index c52abaa..7c9887c 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -85,5 +85,5 @@ jobs: options: | --verbose - - name: Check drupal.devel domain work with ssl + - name: Check if the site can be accessed via SSL run: curl --insecure -I https://drupal.devel From 2a8c18b63047dae00d64cd8c1d141f492a607b6f Mon Sep 17 00:00:00 2001 From: Vlad Date: Wed, 14 Apr 2021 16:24:53 +0300 Subject: [PATCH 084/228] Update .github/workflows/ssl_test.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/ssl_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index 7c9887c..ec8239c 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -58,7 +58,7 @@ jobs: options: | --verbose - - name: Check drupal.devel domain work + - name: Check if the site can be accessed without SSL run: curl http://drupal.devel | grep "Drupal" - name: Generate certificates for next step From 18e504f7eb349bb637eb1c992dcbe80ca4d1a723 Mon Sep 17 00:00:00 2001 From: Vlad Date: Wed, 14 Apr 2021 16:25:08 +0300 Subject: [PATCH 085/228] Update .github/workflows/ssl_test.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/ssl_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index ec8239c..7eff793 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -30,7 +30,7 @@ jobs: with: path: '.drupal-dockerizer' - - name: Create basic dockerizer.yml + - name: Create dockerizer.yml with advanced networking run: | echo "---" > dockerizer.yml echo "" >> dockerizer.yml From e0aa5697de983fd0671e5e4a4b8cda6c6a503ad3 Mon Sep 17 00:00:00 2001 From: Vlad Date: Wed, 14 Apr 2021 16:25:19 +0300 Subject: [PATCH 086/228] Update .github/workflows/ssl_test.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/ssl_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index 7eff793..05757e4 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -1,4 +1,4 @@ -name: Check ssl functionality +name: Check SSL connection on: pull_request: From 9ea228423db2aa93e9f852b9c5b0720cec7440d2 Mon Sep 17 00:00:00 2001 From: Vlad Date: Wed, 14 Apr 2021 16:25:27 +0300 Subject: [PATCH 087/228] Update .github/workflows/ssl_test.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/ssl_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index 05757e4..35a7fab 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -9,7 +9,7 @@ jobs: test_ssl: runs-on: ubuntu-20.04 steps: - - name: Cache Composer dependencies for improve speed + - name: Cache Composer dependencies to improve speed uses: actions/cache@v2 with: path: ~/.cache/composer From e9b319e28ed37cc587467e19361e5a7d50af8573 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Thu, 15 Apr 2021 08:43:55 +0300 Subject: [PATCH 088/228] Implement Check multiple environments functionality --- .github/workflows/test_multiple_env.yml | 97 +++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 .github/workflows/test_multiple_env.yml diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml new file mode 100644 index 0000000..9995554 --- /dev/null +++ b/.github/workflows/test_multiple_env.yml @@ -0,0 +1,97 @@ +name: Check multiple environments functionality + +on: + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + test_multiple_env: + runs-on: ubuntu-20.04 + env: + DRUPAL_VERSION: 9.1.6 + steps: + - name: Cache Composer dependencies for improve speed + uses: actions/cache@v2 + with: + path: ~/.cache/composer + key: ${{ runner.os }}-drupal + + + - name: Run Composer install + run: composer create-project drupal/recommended-project drupal-composer --ignore-platform-reqs + + - name: Get Drupal Dockerizer repository + uses: actions/checkout@v2 + with: + path: '.drupal-dockerizer' + + - name: Create config for drupal composer project + run: | + echo "---" > dockerizer-composer.yml + echo "" >> dockerizer-composer.yml + echo "compose_project_name: drupal-composer" >> dockerizer-composer.yml + echo "user_uid: $(id -u)" >> dockerizer-composer.yml + echo "user_gid: $(id -g)" >> dockerizer-composer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE/drupal-composer" >> dockerizer-composer.yml + echo "apache_port: 8080" >> dockerizer-composer.yml + + - name: Run main playbook for drupal composer project + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: main.yml --extra-vars @$GITHUB_WORKSPACE/dockerizer-composer.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Run drush-commands playbook for drupal composer project + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: drush-commands.yml --extra-vars @$GITHUB_WORKSPACE/dockerizer-composer.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Change site name by Drush + run: docker exec drupal-composer-7.4-develop drush cset system.site name DrupalComposer -y + + - name: Prepare Drupal tarball + run: | + wget https://ftp.drupal.org/files/projects/drupal-${{ env.DRUPAL_VERSION }}.tar.gz + tar xvf drupal-${{ env.DRUPAL_VERSION }}.tar.gz + mv drupal-${{ env.DRUPAL_VERSION }} drupal-tarball + + - name: Create config for drupal tarball + run: | + echo "---" > dockerizer-tarball.yml + echo "" >> dockerizer-tarball.yml + echo "compose_project_name: drupal-tarball" >> dockerizer-tarball.yml + echo "user_uid: $(id -u)" >> dockerizer-tarball.yml + echo "user_gid: $(id -g)" >> dockerizer-tarball.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE/drupal-tarball" >> dockerizer-tarball.yml + echo "apache_port: 8090" >> dockerizer-tarball.yml + + - name: Run main playbook for drupal composer project + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: main.yml --extra-vars @$GITHUB_WORKSPACE/dockerizer-tarball.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Run drush-commands playbook for drupal composer project + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: drush-commands.yml --extra-vars @$GITHUB_WORKSPACE/dockerizer-tarball.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Change site name by Drush + run: docker exec drupal-tarball-7.4-develop drush cset system.site name DrupalTarball -y + + - name: Check Drupal Composer project on 8080 port + run: curl http://localhost:8080 | grep "DrupalComposer" + + - name: Check Drupal Tarball project on 8090 port + run: curl http://localhost:8090 | grep "DrupalTarball" From f09d62ef7e76506f4d5d48827d0970259f761227 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Thu, 15 Apr 2021 08:45:32 +0300 Subject: [PATCH 089/228] Temp turn off others tests --- .github/workflows/basic_test.yml | 2 -- .github/workflows/db_import_test.yml | 2 -- .github/workflows/ssl_test.yml | 2 -- 3 files changed, 6 deletions(-) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index 7db9af1..2a1c10c 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -1,8 +1,6 @@ name: Check basic functionality on: - pull_request: - branches: [main] workflow_dispatch: jobs: diff --git a/.github/workflows/db_import_test.yml b/.github/workflows/db_import_test.yml index 75e8e16..9f01673 100644 --- a/.github/workflows/db_import_test.yml +++ b/.github/workflows/db_import_test.yml @@ -1,8 +1,6 @@ name: Check database import functionality on: - pull_request: - branches: [main] workflow_dispatch: jobs: diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index 35a7fab..81c1521 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -1,8 +1,6 @@ name: Check SSL connection on: - pull_request: - branches: [main] workflow_dispatch: jobs: From d28e9b769dab58ff1484b58f9d19fafe8bf0584e Mon Sep 17 00:00:00 2001 From: svicervlad Date: Thu, 15 Apr 2021 08:49:00 +0300 Subject: [PATCH 090/228] Fix extravars --- .github/workflows/test_multiple_env.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index 9995554..16e1312 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -39,7 +39,7 @@ jobs: - name: Run main playbook for drupal composer project uses: dawidd6/action-ansible-playbook@v2 with: - playbook: main.yml --extra-vars @$GITHUB_WORKSPACE/dockerizer-composer.yml + playbook: main.yml --extra-vars @/$GITHUB_WORKSPACE/dockerizer-composer.yml directory: .drupal-dockerizer options: | --verbose @@ -47,7 +47,7 @@ jobs: - name: Run drush-commands playbook for drupal composer project uses: dawidd6/action-ansible-playbook@v2 with: - playbook: drush-commands.yml --extra-vars @$GITHUB_WORKSPACE/dockerizer-composer.yml + playbook: drush-commands.yml --extra-vars @/$GITHUB_WORKSPACE/dockerizer-composer.yml directory: .drupal-dockerizer options: | --verbose @@ -74,7 +74,7 @@ jobs: - name: Run main playbook for drupal composer project uses: dawidd6/action-ansible-playbook@v2 with: - playbook: main.yml --extra-vars @$GITHUB_WORKSPACE/dockerizer-tarball.yml + playbook: main.yml --extra-vars @/$GITHUB_WORKSPACE/dockerizer-tarball.yml directory: .drupal-dockerizer options: | --verbose @@ -82,7 +82,7 @@ jobs: - name: Run drush-commands playbook for drupal composer project uses: dawidd6/action-ansible-playbook@v2 with: - playbook: drush-commands.yml --extra-vars @$GITHUB_WORKSPACE/dockerizer-tarball.yml + playbook: drush-commands.yml --extra-vars @/$GITHUB_WORKSPACE/dockerizer-tarball.yml directory: .drupal-dockerizer options: | --verbose From 5e4030f6bc5ea97599a696accceee84fe20c7aa4 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Thu, 15 Apr 2021 08:53:31 +0300 Subject: [PATCH 091/228] Fix web-root for tarball --- .github/workflows/test_multiple_env.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index 16e1312..19b1dd0 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -70,6 +70,8 @@ jobs: echo "user_gid: $(id -g)" >> dockerizer-tarball.yml echo "drupal_root_dir: $GITHUB_WORKSPACE/drupal-tarball" >> dockerizer-tarball.yml echo "apache_port: 8090" >> dockerizer-tarball.yml + echo "drupal_web_root: ./" >> dockerizer-tarball.yml + - name: Run main playbook for drupal composer project uses: dawidd6/action-ansible-playbook@v2 From 489d44f0cf8e059c8f8991df812df8fd0940e14f Mon Sep 17 00:00:00 2001 From: svicervlad Date: Thu, 15 Apr 2021 09:10:44 +0300 Subject: [PATCH 092/228] Fix ports in apache --- templates/apache.conf.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/apache.conf.j2 b/templates/apache.conf.j2 index b168d9c..ec4c1ae 100644 --- a/templates/apache.conf.j2 +++ b/templates/apache.conf.j2 @@ -1,5 +1,5 @@ {% if ssl_enabled %} - + ServerAdmin webmaster@localhost DocumentRoot "/var/www/{{ drupal_web_root }}" ServerName {{ domain_name }} @@ -13,7 +13,7 @@ {% else %} - + ServerAdmin webmaster@localhost DocumentRoot "/var/www/{{ drupal_web_root }}" ServerName {{ domain_name }} From 95ee9702df8237a22e1d4afe86d520c9c04320ec Mon Sep 17 00:00:00 2001 From: svicervlad Date: Thu, 15 Apr 2021 09:16:01 +0300 Subject: [PATCH 093/228] Revert "Temp turn off others tests" This reverts commit f09d62ef7e76506f4d5d48827d0970259f761227. --- .github/workflows/basic_test.yml | 2 ++ .github/workflows/db_import_test.yml | 2 ++ .github/workflows/ssl_test.yml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index 2a1c10c..7db9af1 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -1,6 +1,8 @@ name: Check basic functionality on: + pull_request: + branches: [main] workflow_dispatch: jobs: diff --git a/.github/workflows/db_import_test.yml b/.github/workflows/db_import_test.yml index 9f01673..75e8e16 100644 --- a/.github/workflows/db_import_test.yml +++ b/.github/workflows/db_import_test.yml @@ -1,6 +1,8 @@ name: Check database import functionality on: + pull_request: + branches: [main] workflow_dispatch: jobs: diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index 81c1521..35a7fab 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -1,6 +1,8 @@ name: Check SSL connection on: + pull_request: + branches: [main] workflow_dispatch: jobs: From ab1e99abce4e375b4dec252474c263c4a20ad5e2 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Thu, 15 Apr 2021 09:16:10 +0300 Subject: [PATCH 094/228] Small fix --- .github/workflows/test_multiple_env.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index 19b1dd0..40c6fe9 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -52,7 +52,7 @@ jobs: options: | --verbose - - name: Change site name by Drush + - name: Change site name by Drush for Drupal composer project run: docker exec drupal-composer-7.4-develop drush cset system.site name DrupalComposer -y - name: Prepare Drupal tarball @@ -89,7 +89,7 @@ jobs: options: | --verbose - - name: Change site name by Drush + - name: Change site name by Drush for Drupal tarball project run: docker exec drupal-tarball-7.4-develop drush cset system.site name DrupalTarball -y - name: Check Drupal Composer project on 8080 port From d8c0ed94d1971e0efe1e256968f2f59d6f7b0331 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 20 Apr 2021 11:14:03 +0300 Subject: [PATCH 095/228] Rename user config --- .github/workflows/basic_test.yml | 14 +++++++------- .github/workflows/db_import_test.yml | 16 ++++++++-------- .github/workflows/ssl_test.yml | 28 ++++++++++++++-------------- db.yml | 2 +- drush-commands.yml | 2 +- main.yml | 2 +- reset.yml | 2 +- stop.yml | 2 +- up.yml | 2 +- 9 files changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index 7db9af1..8e0fadb 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -30,14 +30,14 @@ jobs: with: path: '.drupal-dockerizer' - - name: Create basic dockerizer.yml + - name: Create basic drupal-dockerizer.yml run: | - echo "---" > dockerizer.yml - echo "" >> dockerizer.yml - echo "compose_project_name: drupal-project" >> dockerizer.yml - echo "user_uid: $(id -u)" >> dockerizer.yml - echo "user_gid: $(id -g)" >> dockerizer.yml - echo "drupal_root_dir: $GITHUB_WORKSPACE" >> dockerizer.yml + echo "---" > drupal-dockerizer.yml + echo "" >> drupal-dockerizer.yml + echo "compose_project_name: drupal-project" >> drupal-dockerizer.yml + echo "user_uid: $(id -u)" >> drupal-dockerizer.yml + echo "user_gid: $(id -g)" >> drupal-dockerizer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml - name: Run main playbook uses: dawidd6/action-ansible-playbook@v2 diff --git a/.github/workflows/db_import_test.yml b/.github/workflows/db_import_test.yml index 75e8e16..2b033cb 100644 --- a/.github/workflows/db_import_test.yml +++ b/.github/workflows/db_import_test.yml @@ -30,15 +30,15 @@ jobs: with: path: '.drupal-dockerizer' - - name: Create basic dockerizer.yml + - name: Create basic drupal-dockerizer.yml run: | - echo "---" > dockerizer.yml - echo "" >> dockerizer.yml - echo "compose_project_name: drupal-project" >> dockerizer.yml - echo "user_uid: $(id -u)" >> dockerizer.yml - echo "user_gid: $(id -g)" >> dockerizer.yml - echo "drupal_root_dir: $GITHUB_WORKSPACE" >> dockerizer.yml - echo "db_dump_path: $GITHUB_WORKSPACE/web/dump.sql" >> dockerizer.yml + echo "---" > drupal-dockerizer.yml + echo "" >> drupal-dockerizer.yml + echo "compose_project_name: drupal-project" >> drupal-dockerizer.yml + echo "user_uid: $(id -u)" >> drupal-dockerizer.yml + echo "user_gid: $(id -g)" >> drupal-dockerizer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml + echo "db_dump_path: $GITHUB_WORKSPACE/web/dump.sql" >> drupal-dockerizer.yml - name: Run main playbook uses: dawidd6/action-ansible-playbook@v2 diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index 35a7fab..b192933 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -30,17 +30,17 @@ jobs: with: path: '.drupal-dockerizer' - - name: Create dockerizer.yml with advanced networking + - name: Create drupal-dockerizer.yml with advanced networking run: | - echo "---" > dockerizer.yml - echo "" >> dockerizer.yml - echo "compose_project_name: drupal-project" >> dockerizer.yml - echo "user_uid: $(id -u)" >> dockerizer.yml - echo "user_gid: $(id -g)" >> dockerizer.yml - echo "drupal_root_dir: $GITHUB_WORKSPACE" >> dockerizer.yml - echo "advanced_networking: true" >> dockerizer.yml - echo "network_id: 15" >> dockerizer.yml - echo "domain_name: drupal.devel" >> dockerizer.yml + echo "---" > drupal-dockerizer.yml + echo "" >> drupal-dockerizer.yml + echo "compose_project_name: drupal-project" >> drupal-dockerizer.yml + echo "user_uid: $(id -u)" >> drupal-dockerizer.yml + echo "user_gid: $(id -g)" >> drupal-dockerizer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml + echo "advanced_networking: true" >> drupal-dockerizer.yml + echo "network_id: 15" >> drupal-dockerizer.yml + echo "domain_name: drupal.devel" >> drupal-dockerizer.yml - name: Run main playbook uses: dawidd6/action-ansible-playbook@v2 @@ -71,11 +71,11 @@ jobs: - name: Fix ssl permissions run: sudo chown -R $(id -u):$(id -g) * - - name: Enable ssl in dockerizer.yml + - name: Enable ssl in drupal-dockerizer.yml run: | - echo "ssl_key_path: $GITHUB_WORKSPACE/private.key" >> dockerizer.yml - echo "ssl_cert_path: $GITHUB_WORKSPACE/cert.pem" >> dockerizer.yml - echo "ssl_enabled: true" >> dockerizer.yml + echo "ssl_key_path: $GITHUB_WORKSPACE/private.key" >> drupal-dockerizer.yml + echo "ssl_cert_path: $GITHUB_WORKSPACE/cert.pem" >> drupal-dockerizer.yml + echo "ssl_enabled: true" >> drupal-dockerizer.yml - name: Run main playbook with ssl configuration uses: dawidd6/action-ansible-playbook@v2 diff --git a/db.yml b/db.yml index 1b61eef..b7e839e 100644 --- a/db.yml +++ b/db.yml @@ -8,7 +8,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../dockerizer.yml + - ../drupal-dockerizer.yml roles: [] diff --git a/drush-commands.yml b/drush-commands.yml index a718f1a..32fb356 100644 --- a/drush-commands.yml +++ b/drush-commands.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../dockerizer.yml + - ../drupal-dockerizer.yml roles: [] diff --git a/main.yml b/main.yml index 78b885d..d771bca 100644 --- a/main.yml +++ b/main.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../dockerizer.yml + - ../drupal-dockerizer.yml roles: [] diff --git a/reset.yml b/reset.yml index 4d3e505..cd164b1 100644 --- a/reset.yml +++ b/reset.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../dockerizer.yml + - ../drupal-dockerizer.yml roles: [] diff --git a/stop.yml b/stop.yml index cc6ee03..524e996 100644 --- a/stop.yml +++ b/stop.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../dockerizer.yml + - ../drupal-dockerizer.yml roles: [] diff --git a/up.yml b/up.yml index f564d96..726d1a8 100644 --- a/up.yml +++ b/up.yml @@ -9,7 +9,7 @@ - name: Include config override file, if it exists. include_vars: "{{ item }}" with_fileglob: - - ../dockerizer.yml + - ../drupal-dockerizer.yml roles: [] From f7bd22aed21b396298a9d07d1add0f169551540c Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 20 Apr 2021 12:50:44 +0300 Subject: [PATCH 096/228] Update .github/workflows/test_multiple_env.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/test_multiple_env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index 40c6fe9..f11be2a 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -11,7 +11,7 @@ jobs: env: DRUPAL_VERSION: 9.1.6 steps: - - name: Cache Composer dependencies for improve speed + - name: Cache Composer dependencies to improve speed uses: actions/cache@v2 with: path: ~/.cache/composer From 15757aae729bc02ac06b90a0abf763ed0fb78bb5 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 20 Apr 2021 12:50:55 +0300 Subject: [PATCH 097/228] Update .github/workflows/test_multiple_env.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/test_multiple_env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index f11be2a..dd01989 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -19,7 +19,7 @@ jobs: - name: Run Composer install - run: composer create-project drupal/recommended-project drupal-composer --ignore-platform-reqs + run: composer create-project drupal/recommended-project drupal-composer --ignore-platform-reqs --no-interaction - name: Get Drupal Dockerizer repository uses: actions/checkout@v2 From 71c0c4bb03ac0e82a3d9d0cb008de667978a3ca8 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 20 Apr 2021 13:28:46 +0300 Subject: [PATCH 098/228] Implement test for memcache --- .github/workflows/memcache_test.yml | 88 +++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/memcache_test.yml diff --git a/.github/workflows/memcache_test.yml b/.github/workflows/memcache_test.yml new file mode 100644 index 0000000..85637d0 --- /dev/null +++ b/.github/workflows/memcache_test.yml @@ -0,0 +1,88 @@ +name: Check memcache functionality + +on: + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + test_import_db: + runs-on: ubuntu-20.04 + steps: + - name: Cache Composer dependencies for improve speed + uses: actions/cache@v2 + with: + path: ~/.cache/composer + key: ${{ runner.os }}-drupal + + - name: Get Drupal Project repository + uses: actions/checkout@v2 + with: + repository: 'drupal/recommended-project' + path: './' + ref: '9.2.x' + + - name: Run Composer install + run: composer install --ignore-platform-reqs + + - name: Add memcache module to drupal + run: composer require drupal/memcache --ignore-platform-reqs + + - name: Get Drupal Dockerizer repository + uses: actions/checkout@v2 + with: + path: '.drupal-dockerizer' + + - name: Create basic drupal-dockerizer.yml + run: | + echo "---" > drupal-dockerizer.yml + echo "" >> drupal-dockerizer.yml + echo "compose_project_name: drupal-project" >> drupal-dockerizer.yml + echo "user_uid: $(id -u)" >> drupal-dockerizer.yml + echo "user_gid: $(id -g)" >> drupal-dockerizer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml + + - name: Run main playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: main.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Run drush-commands playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: drush-commands.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Enable memcache in database + run: docker exec drupal-project-7.4-develop drush en memcache memcache_admin -y + + - name: Stop containers + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: stop.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Enable memcache in drupal-dockerizer.yml + run: | + echo "memcache: true" >> drupal-dockerizer.yml + + - name: Run main playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: main.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: settings.php should have memcache config + run: cat web/sites/default/settings.php | grep "memcache" + + - name: Check Drupal + run: curl http://localhost | grep "Drupal" From a5e8b84b4dba9ee2466c308d7e6a1967bbbcbd32 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 20 Apr 2021 13:33:25 +0300 Subject: [PATCH 099/228] Fix job name --- .github/workflows/memcache_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/memcache_test.yml b/.github/workflows/memcache_test.yml index 85637d0..54abf2a 100644 --- a/.github/workflows/memcache_test.yml +++ b/.github/workflows/memcache_test.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: jobs: - test_import_db: + test_memcache: runs-on: ubuntu-20.04 steps: - name: Cache Composer dependencies for improve speed From db8d16086992ae0d08062c8fddf31199c8652a23 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 20 Apr 2021 13:36:03 +0300 Subject: [PATCH 100/228] Remove extalines --- .github/workflows/test_multiple_env.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index dd01989..2121945 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -17,7 +17,6 @@ jobs: path: ~/.cache/composer key: ${{ runner.os }}-drupal - - name: Run Composer install run: composer create-project drupal/recommended-project drupal-composer --ignore-platform-reqs --no-interaction From bf54d4519a761e814950ccf86bcf86b9b460c6a4 Mon Sep 17 00:00:00 2001 From: Dima Danylevskyi Date: Tue, 20 Apr 2021 14:49:23 +0300 Subject: [PATCH 101/228] docs: improve README.md --- .github/workflows/basic_test.yml | 2 + .github/workflows/db_import_test.yml | 2 + .github/workflows/ssl_test.yml | 2 + README.md | 281 +++++++++++++-------------- 4 files changed, 139 insertions(+), 148 deletions(-) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml index 7db9af1..90b9fa6 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/basic_test.yml @@ -3,6 +3,8 @@ name: Check basic functionality on: pull_request: branches: [main] + paths-ignore: + - '**.md' workflow_dispatch: jobs: diff --git a/.github/workflows/db_import_test.yml b/.github/workflows/db_import_test.yml index 75e8e16..0761e64 100644 --- a/.github/workflows/db_import_test.yml +++ b/.github/workflows/db_import_test.yml @@ -3,6 +3,8 @@ name: Check database import functionality on: pull_request: branches: [main] + paths-ignore: + - '**.md' workflow_dispatch: jobs: diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/ssl_test.yml index 35a7fab..8282487 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/ssl_test.yml @@ -3,6 +3,8 @@ name: Check SSL connection on: pull_request: branches: [main] + paths-ignore: + - '**.md' workflow_dispatch: jobs: diff --git a/README.md b/README.md index c159dbe..bc46fc7 100644 --- a/README.md +++ b/README.md @@ -1,227 +1,212 @@ # Drupal Dockerizer -## Requirements +A set of Ansible playbooks for spinning up Drupal projects with Docker Compose. -- python [instruction](https://www.python.org/downloads/) -- git [instruction for install](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) -- ansible [instruction for install](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html) -- docker [instruction for install](https://docs.docker.com/get-docker/) -- docker-compose [instruction for install](https://docs.docker.com/compose/install/) +Drupal Dockerizer is suitable for spinning up: -After install docker need add your user to docker group and logout/login to you system, see [instruction](https://docs.docker.com/engine/install/linux-postinstall/) +- Local development environments (with XDebug support) +- Automated CI builds +- Staging and testing servers -## Quickstart +YAY! You can spin up multiple environments on single machine! -You can use ansible-pull tool from standard package ansible for quick setup your project. +Drupal Dockerizer works best on Linux (deb-based distributions have been tested). -For that create config yml file in any place your need(in drupal project directory or external folder). Ensure that all needed config options is setup. +To spin up development environment with Drupal Dockerizer on MacOS and Windows you could use virtual machines or remote servers with Linux installed. Take a look at [Visual Studio Code Remote development](https://code.visualstudio.com/docs/remote/remote-overview). -Minimum required options: +In a nutshell Drupal Dockerizer is not more than an Ansible script which automates routine tasks for getting valid docker-compose file. -```yaml ---- - -compose_project_name: drupal-project -user_uid: 1000 -user_gid: 1000 -drupal_root_dir: /var/data/drupal -``` +## How to install Drupal 9 on fresh Ubuntu 20.04 with Drupal Dockerizer -Remember: other options will setted by default from `default.config.yml` file. +We just got fresh Ubuntu 20.04 server. Let's go through a quick tour about creating Drupal 9 fresh site installation. -For more options [see](CONFIG.md) +### Prepare your system -For up your drupal project in docker containers run: +Let’s create local user in order not to work under `root` account. ```bash -ansible-pull --extra-vars @/ -U https://github.com/jet-dev-team/drupal-dockerizer.git main.yml --ask-become-pass +groupadd docker + +export USERNAME= +useradd -m -G sudo,docker -s /bin/bash $USERNAME +passwd $USERNAME +mkdir /home/$USERNAME/.ssh +curl https://github.com/$USERNAME.keys | tee -a /home/$USERNAME/.ssh/authorized_keys +chown -R $USERNAME:$USERNAME /home/$USERNAME/ ``` -After done you should have drupal project in docker containers with empty database. -Check containers status by run `docker ps` command. -If you use database dump you can set in config option `db_dump_path` to absolute path to you database dump. For import database run: +Let’s install requirements. ```bash -ansible-pull --extra-vars @/ -U https://github.com/jet-dev-team/drupal-dockerizer.git db.yml -``` - -For stop or up containers just replace `db.yml` in command to `stop.yml` or `up.yml` +apt update +apt -y install ansible docker.io docker-compose composer git unzip -For fully remove all projects data and down docker conteiners you can run: - -```bash -ansible-pull --extra-vars @/ -U https://github.com/jet-dev-team/drupal-dockerizer.git reset.yml --ask-become-pass +systemctl enable --now docker.service ``` -This command remove all projects containers, volumes with data in database and runtime directory. +Now you are able to connect to your server with your SSH keys or just use `su $USERNAME` to log into your user account to start configuring Drupal Dockerizer. -### Usage ansible-pull +### Configure Drupal Dockerizer -By default pulling data by ansible-pull placed in `~/.ansible/pull/` directory. You can change it by add to ansible-pull command destination option `-d ` or `--directory `. +```bash +mkdir ~/Projects +composer create-project drupal/recommended-project ~/Projects/drupal9 --ignore-platform-reqs --no-interaction +git clone https://github.com/jet-dev-team/drupal-dockerizer.git ~/Projects/drupal9/drupal-dockerizer -You can anchor version drupal-dockerizer by add to ansible-pull command option `-C ` or `--checkout ` +cat < ~/Projects/drupal9/drupal-dockerizer.yml +--- -For more information about ansible-pull see [documentations](https://docs.ansible.com/ansible/latest/cli/ansible-pull.html). +compose_project_name: drupal9 +user_uid: `id -u` +user_gid: `id -g` +drupal_root_dir: $HOME/Projects/drupal9 +EOT -### Xdebug setup +cd ~/Projects/drupal9/drupal-dockerizer +ansible-playbook main.yml --ask-become-pass +ansible-playbook drush-commands.yml +``` -For advanced network setup set in `config.yml` variable `xdebug_enviroment` like this +As a result you should receive the next directory structure: ```bash -remote_enable=1 remote_connect_back=1 remote_port=9008 remote_host=192.168.{network_id}.1 show_error_trace=0 show_local_vars=1 remote_autostart=1 show_exception_trace=0 idekey=VSCODE +. +├── composer.json +├── composer.lock +├── drupal-dockerizer +│ ├── CONFIG.md +│ ├── LICENSE +│ ├── README.md +│ ├── ansible.cfg +│ ├── db.yml +│ ├── default.config.yml +│ ├── drupal9 +│ ├── drush-commands.yml +│ ├── inventory +│ ├── main.yml +│ ├── requirements.yml +│ ├── reset.yml +│ ├── stop.yml +│ ├── tasks +│ ├── templates +│ └── up.yml +├── drupal-dockerizer.yml +├── vendor +│ └── ... +└── web + ├── index.php + └── ... ``` -For work Xdebug with advanced networking in vscode add to your launcher.json file in project next lines: - -```json - { - "name": "XDebug Docker", - "type": "php", - "request": "launch", - "hostname" : "192.168.{network_id}.1", - "port": 9008, - "pathMappings": { - "/var/www": "${workspaceRoot}/" - }, - "xdebugSettings": { - "show_hidden": 1, - "max_data": -1, - "max_depth": 2, - "max_children": 100, - } - }, -``` +You are done. You can access your fresh Drupal 9 site by visiting your IP address on port 80. -#### For MacOs the next config should be used +### How it works internally? -Make sure your `config.yml` contains the next config: +There is no any magic! It is just a `docker-compose.yml` file. You can find it inside `drupal-dockerizer` directory. ```bash -# Enviroment variable for php xdebug extensions -xdebug_enviroment: remote_enable=1 remote_connect_back=0 remote_port=9000 remote_host=10.254.254.254 show_error_trace=0 show_local_vars=1 remote_autostart=1 show_exception_trace=0 idekey=VSCODE +. +├── drupal-dockerizer +│ ├── drupal9 +│ │ └── docker-compose.yml ← +│ └── ... +├── drupal-dockerizer.yml +├── vendor +│ └── ... +└── web + ├── index.php + └── ... ``` -Make sure you've created Host address alias on MacOS: - ```bash -sudo ifconfig lo0 alias 10.254.254.254 +cat ~/Projects/drupal9/drupal-dockerizer/drupal9/docker-compose.yml ``` -Your `launch.json` should look like the next config: - -```json - { - "name": "XDebug Docker", - "type": "php", - "request": "launch", - "port": 9000, - "pathMappings": { - "/var/www": "${workspaceRoot}/" - }, - "xdebugSettings": { - "show_hidden": 1, - "max_data": -1, - "max_depth": 2, - "max_children": 100, - } - } -``` +Now you can use standard Docker Compose to manage your installation. -How to use debugger with Drush commands? +All the configuration is done via `drupal-dockerizer.yml` config file. You can find a lot of examples by exploing tests. Take a look at [.github/workflows](.github/workflows). -1. Get the name of web server container using command: `docker ps | grep webserver` -2. SSH into the container by name. Example: `docker exec -it yourproject-php72-develop bash` -3. Set your breakpoint and run Drush command as usual +### Playbooks for controlling your projects -### Advanced Networking +Drupal Dockerizer is shipped with additional Ansible playbooks to help you automate your routine tasks. Make sure you are running that playbooks inside `drupal-dockerizer` directory. The place where playbook files actually live. -You can use an advanced docker network to be able to conveniently host multiple Drupal projects on one computer. +Each new project should start with running `main.yml` playbook which prepares configuration. -Set in config.yml `advanced_networking: true`. +### Stop containers -You can change the ip address of the project using the variable `network_id` in `config.yml` file +To stop your containers and save the data you can use `stop.yml` playbook. It's an equivalent of `docker-compose stop` command. -You can change doamin name by variable `domain_name` in `config.yml` file - -#### Advanced Networking Limitation - -The advanced network only works on a machine with a Linux distribution. +```bash +ansible-playbook stop.yml +``` -#### Advanced Networking project structure +### Up containers -- `Adminer` placed on domain name and on 8080 port. -- Solr 4 placed on domain name and on 8983 port and /solr path. `http://drupal.devel:8983/solr` for examle. -- Data Base placed on 192.168.<>.13 and on 3306 port. You can connect to DB by vscode [extension](https://marketplace.visualstudio.com/items?itemName=formulahendry.vscode-mysql) or from `Adminer` +To spin up your containers you can use `up.yml` playbook. It's an equivalent of `docker-compose up` command. -### Drush usage +```bash +ansible-playbook up.yml +``` -Run in terminal: `docker exec my-project-php74 drush ` for run drush command. -If you change compose project name or php version in config replace `my-project-php74` to `-`. +### Remove containers and their data -Use the next command in order to ran multiple Drush commands. +To remove everytying and start from scratch you can use `reset.yml` playbook. It's an equivalent of `docker-compose down` command. This command will not remove your code. Please, note this command requires `sudoers` permissions. ```bash -sudo ansible-playbook -vvv run-drush-commands.yml --connection=local -```` +ansible-playbook reset.yml --ask-become-pass +``` -Change `drush_commands` variable in your `config.yml` file like this: +After reseting your environment you have to run `main.yml` playbook again to spin up your environment. -```yaml -drush_commands: - - 'updb' - - '-v sapi-r' - - '-v sapi-i' - - ... -``` +### How to run commands inside containers -## Development drupal-dockerizer +Plese, run `docker ps` to see your Docker container names. -### Prepare project structure +```bash +docker exec drupal9-7.4-develop drush status +``` -- `db`: create this directory and download database dump here if exists. -- `code`: clone your project files into this directory. -- `drupal-dockerizer`: clone drupal-dockerizer project in this directory. -- `files`: create the directory and pull Drupal assets here +### How to access log files -### Prepare your config for Drupal Dockerizer +Apache2 and MySQL log files are exposed as volumes, so you can access them by +reading the files on your host machine. ```bash -cd drupal-dockerizer -cp default.config.yml config.yml +cat drupal9/logs/apache2/error.log ``` -### Start local environment +### Import MySQL database from dump + +There is a playbook which automates database import into database container. +By default it just picks up `dump.sql` file from Drupal root directory. ```bash -cd drupal-dockerizer -ansible-playbook main.yml --ask-become-pass -ansible-playbook run-drush-commands.yml +. +├── drupal-dockerizer.yml +├── dump.sql ← +└── ... ``` -### Import database from dump - ```bash -cd drupal-dockerizer ansible-playbook db.yml ``` -## FAQ +If your database dump was placed somewhere in other directory you can change configuration by adding the line to `drupal-dockerizer.yml` file. -### How to reset everything and start from scratch? - -```bash -cd drupal-dockerizer -ansible-playbook reset.yml --ask-become-pass +```yml +db_dump_path: /path/to/your/dump.sql ``` -### How to clear Docker cache? +### Automate this with Drush commands -```bash -docker system prune -a -f +There is `drush-commands.yml` playbook which will execute all the Drush commands which are described in `drupal-dockerizer.yml` file. Each new command should go to the new line. + +```yml +drush_commands: + - cr + - status ``` -### How to enhance MacOS performance? +## Credits -- make sure your `config.yml` contains `docker_cached_volume: true` -- make sure you add more resources to Docker via Preferences -> Recources -- make sure you set `debug` to `false` in Docker Engine preferences +Drupal Dockerizer was created and is maintained by [Jet.Dev](https://jet.dev/) team. From cdec35ccc1bc217eaa872e69c1d043d0ecdb2a0e Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 20 Apr 2021 15:04:46 +0300 Subject: [PATCH 102/228] fix: default db_dump_path --- default.config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.config.yml b/default.config.yml index cc9b942..fc90ced 100644 --- a/default.config.yml +++ b/default.config.yml @@ -57,7 +57,7 @@ solr_core_name: drupal memcache: false # Path to Drupal DB dump (will be imported by `db.yml` playbook). -db_dump_path: /var/data/db/db.sql +db_dump_path: "{{drupal_root_dir}}/dump.sql" # Availible options: mysql, mariadb database: mysql From c025b31525482d73427a3fc7ae88c4ea5d4e3d42 Mon Sep 17 00:00:00 2001 From: Dima Danylevskyi Date: Tue, 20 Apr 2021 15:07:38 +0300 Subject: [PATCH 103/228] docs: fix typos for README.md --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index bc46fc7..2c5a09d 100644 --- a/README.md +++ b/README.md @@ -8,21 +8,21 @@ Drupal Dockerizer is suitable for spinning up: - Automated CI builds - Staging and testing servers -YAY! You can spin up multiple environments on single machine! +YAY! You can spin up multiple environments on a single machine! Drupal Dockerizer works best on Linux (deb-based distributions have been tested). -To spin up development environment with Drupal Dockerizer on MacOS and Windows you could use virtual machines or remote servers with Linux installed. Take a look at [Visual Studio Code Remote development](https://code.visualstudio.com/docs/remote/remote-overview). +To spin up a development environment with Drupal Dockerizer on MacOS and Windows you could use virtual machines or remote servers with Linux installed. Take a look at [Visual Studio Code Remote development](https://code.visualstudio.com/docs/remote/remote-overview). -In a nutshell Drupal Dockerizer is not more than an Ansible script which automates routine tasks for getting valid docker-compose file. +In a nutshell Drupal Dockerizer is not more than an Ansible script which automates routine tasks for getting valid `docker-compose.yml` files. ## How to install Drupal 9 on fresh Ubuntu 20.04 with Drupal Dockerizer -We just got fresh Ubuntu 20.04 server. Let's go through a quick tour about creating Drupal 9 fresh site installation. +We just got a fresh Ubuntu 20.04 server. Let's go through a quick tour about creating new Drupal 9 site installation. ### Prepare your system -Let’s create local user in order not to work under `root` account. +Let’s create a local user in order to avoid work under a `root` account. ```bash groupadd docker @@ -100,9 +100,9 @@ As a result you should receive the next directory structure: You are done. You can access your fresh Drupal 9 site by visiting your IP address on port 80. -### How it works internally? +### How does it work internally? -There is no any magic! It is just a `docker-compose.yml` file. You can find it inside `drupal-dockerizer` directory. +There is no magic! It is just a `docker-compose.yml` file. You can find it inside the `drupal-dockerizer` directory. ```bash . @@ -124,17 +124,17 @@ cat ~/Projects/drupal9/drupal-dockerizer/drupal9/docker-compose.yml Now you can use standard Docker Compose to manage your installation. -All the configuration is done via `drupal-dockerizer.yml` config file. You can find a lot of examples by exploing tests. Take a look at [.github/workflows](.github/workflows). +All the configuration is done via `drupal-dockerizer.yml` config file. You can find a lot of examples by exploring tests. Take a look at [.github/workflows](.github/workflows). ### Playbooks for controlling your projects -Drupal Dockerizer is shipped with additional Ansible playbooks to help you automate your routine tasks. Make sure you are running that playbooks inside `drupal-dockerizer` directory. The place where playbook files actually live. +Drupal Dockerizer is shipped with additional Ansible playbooks to help you automate your routine tasks. Make sure you are running those playbooks inside the `drupal-dockerizer` directory. The place where playbook files actually live. Each new project should start with running `main.yml` playbook which prepares configuration. ### Stop containers -To stop your containers and save the data you can use `stop.yml` playbook. It's an equivalent of `docker-compose stop` command. +To stop your containers and save the data you can use the `stop.yml` playbook. It's an equivalent of `docker-compose stop` command. ```bash ansible-playbook stop.yml @@ -142,7 +142,7 @@ ansible-playbook stop.yml ### Up containers -To spin up your containers you can use `up.yml` playbook. It's an equivalent of `docker-compose up` command. +To spin up your containers you can use the `up.yml` playbook. It's an equivalent of `docker-compose up` command. ```bash ansible-playbook up.yml @@ -150,13 +150,13 @@ ansible-playbook up.yml ### Remove containers and their data -To remove everytying and start from scratch you can use `reset.yml` playbook. It's an equivalent of `docker-compose down` command. This command will not remove your code. Please, note this command requires `sudoers` permissions. +To remove everything and start from scratch you can use `reset.yml` playbook. It's an equivalent of `docker-compose down` command. This command will not remove your code. Please, note this command requires `sudoers` permissions. ```bash ansible-playbook reset.yml --ask-become-pass ``` -After reseting your environment you have to run `main.yml` playbook again to spin up your environment. +After resetting your environment you have to run `main.yml` playbook again to spin up your environment. ### How to run commands inside containers @@ -178,7 +178,7 @@ cat drupal9/logs/apache2/error.log ### Import MySQL database from dump There is a playbook which automates database import into database container. -By default it just picks up `dump.sql` file from Drupal root directory. +By default it just picks up the `dump.sql` file from the Drupal root directory. ```bash . @@ -191,7 +191,7 @@ By default it just picks up `dump.sql` file from Drupal root directory. ansible-playbook db.yml ``` -If your database dump was placed somewhere in other directory you can change configuration by adding the line to `drupal-dockerizer.yml` file. +If your database dump was placed somewhere in another directory you can change configuration by adding the line to `drupal-dockerizer.yml` file. ```yml db_dump_path: /path/to/your/dump.sql From 7ff8594d6227d0fbbd0ec01002ea34211c3a9dfd Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 20 Apr 2021 15:19:17 +0300 Subject: [PATCH 104/228] Update .github/workflows/test_multiple_env.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/test_multiple_env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index 2121945..659cebb 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -54,7 +54,7 @@ jobs: - name: Change site name by Drush for Drupal composer project run: docker exec drupal-composer-7.4-develop drush cset system.site name DrupalComposer -y - - name: Prepare Drupal tarball + - name: Use Drupal tarball to prepare the second environment run: | wget https://ftp.drupal.org/files/projects/drupal-${{ env.DRUPAL_VERSION }}.tar.gz tar xvf drupal-${{ env.DRUPAL_VERSION }}.tar.gz From 05caee43af7ce75954157c8438b9556f86a4154b Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 20 Apr 2021 15:19:26 +0300 Subject: [PATCH 105/228] Update .github/workflows/test_multiple_env.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/test_multiple_env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index 659cebb..8bd23b7 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -25,7 +25,7 @@ jobs: with: path: '.drupal-dockerizer' - - name: Create config for drupal composer project + - name: Create config for the first environment run: | echo "---" > dockerizer-composer.yml echo "" >> dockerizer-composer.yml From e73dab95b07f76af60af666f69beb1e7c751dd68 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 20 Apr 2021 15:19:33 +0300 Subject: [PATCH 106/228] Update .github/workflows/test_multiple_env.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/test_multiple_env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index 8bd23b7..2b8d944 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -35,7 +35,7 @@ jobs: echo "drupal_root_dir: $GITHUB_WORKSPACE/drupal-composer" >> dockerizer-composer.yml echo "apache_port: 8080" >> dockerizer-composer.yml - - name: Run main playbook for drupal composer project + - name: Run the main playbook for the first environment uses: dawidd6/action-ansible-playbook@v2 with: playbook: main.yml --extra-vars @/$GITHUB_WORKSPACE/dockerizer-composer.yml From e1cd4e40da742ad16d0d0af3cd58f5b6f267a0e1 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 20 Apr 2021 15:19:39 +0300 Subject: [PATCH 107/228] Update .github/workflows/test_multiple_env.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/test_multiple_env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index 2b8d944..05316b4 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -43,7 +43,7 @@ jobs: options: | --verbose - - name: Run drush-commands playbook for drupal composer project + - name: Run Drush commands playbook for the first environment uses: dawidd6/action-ansible-playbook@v2 with: playbook: drush-commands.yml --extra-vars @/$GITHUB_WORKSPACE/dockerizer-composer.yml From 0d2a2bb1b232daacf31587d3c9ab72dae06689de Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 20 Apr 2021 15:19:45 +0300 Subject: [PATCH 108/228] Update .github/workflows/test_multiple_env.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/test_multiple_env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index 05316b4..ee2ba32 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -51,7 +51,7 @@ jobs: options: | --verbose - - name: Change site name by Drush for Drupal composer project + - name: Change site name by Drush for the first environment run: docker exec drupal-composer-7.4-develop drush cset system.site name DrupalComposer -y - name: Use Drupal tarball to prepare the second environment From 3bd57b42ed54d1dbd59281a0a714a33f520b744a Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 20 Apr 2021 15:19:50 +0300 Subject: [PATCH 109/228] Update .github/workflows/test_multiple_env.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/test_multiple_env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index ee2ba32..3c01f63 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -72,7 +72,7 @@ jobs: echo "drupal_web_root: ./" >> dockerizer-tarball.yml - - name: Run main playbook for drupal composer project + - name: Run the main playbook for the second environment uses: dawidd6/action-ansible-playbook@v2 with: playbook: main.yml --extra-vars @/$GITHUB_WORKSPACE/dockerizer-tarball.yml From 595802eda4fc9c5c3153a74be892150b4614358c Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 20 Apr 2021 15:19:57 +0300 Subject: [PATCH 110/228] Update .github/workflows/test_multiple_env.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/test_multiple_env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index 3c01f63..996e84c 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -80,7 +80,7 @@ jobs: options: | --verbose - - name: Run drush-commands playbook for drupal composer project + - name: Run Drush commands playbook for the second environment uses: dawidd6/action-ansible-playbook@v2 with: playbook: drush-commands.yml --extra-vars @/$GITHUB_WORKSPACE/dockerizer-tarball.yml From 38dcf7c5a565a7eade95cc6be75078adb8aeef30 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 20 Apr 2021 15:20:03 +0300 Subject: [PATCH 111/228] Update .github/workflows/test_multiple_env.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/test_multiple_env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index 996e84c..12aec83 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -88,7 +88,7 @@ jobs: options: | --verbose - - name: Change site name by Drush for Drupal tarball project + - name: Change site name by Drush for the second environment run: docker exec drupal-tarball-7.4-develop drush cset system.site name DrupalTarball -y - name: Check Drupal Composer project on 8080 port From c5b31342e174b05cecba108f4bdcf46e2f69a5d3 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 20 Apr 2021 15:20:10 +0300 Subject: [PATCH 112/228] Update .github/workflows/test_multiple_env.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/test_multiple_env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index 12aec83..0b9bcc3 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -91,7 +91,7 @@ jobs: - name: Change site name by Drush for the second environment run: docker exec drupal-tarball-7.4-develop drush cset system.site name DrupalTarball -y - - name: Check Drupal Composer project on 8080 port + - name: Check Drupal whether the first environment is up on 8080 port run: curl http://localhost:8080 | grep "DrupalComposer" - name: Check Drupal Tarball project on 8090 port From 038b8e271d6ecaf563bc038d886f4c18caa60e41 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 20 Apr 2021 15:20:15 +0300 Subject: [PATCH 113/228] Update .github/workflows/test_multiple_env.yml Co-authored-by: Dima Danylevskyi --- .github/workflows/test_multiple_env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index 0b9bcc3..cb9b0b3 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -94,5 +94,5 @@ jobs: - name: Check Drupal whether the first environment is up on 8080 port run: curl http://localhost:8080 | grep "DrupalComposer" - - name: Check Drupal Tarball project on 8090 port + - name: Check whether the second environment is up on 8090 port run: curl http://localhost:8090 | grep "DrupalTarball" From 15b8b2ef7d2f771b34bd5245e8ec8b9e26316e3f Mon Sep 17 00:00:00 2001 From: Dima Danylevskyi Date: Tue, 20 Apr 2021 15:36:05 +0300 Subject: [PATCH 114/228] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 128 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..809ef7e --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +hello@jet.dev. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. From 136c5b8d1bb2a6ffd1510d02526d08f481eba9a5 Mon Sep 17 00:00:00 2001 From: Dima Danylevskyi Date: Tue, 20 Apr 2021 15:42:58 +0300 Subject: [PATCH 115/228] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c5a09d..6f04624 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Drupal Dockerizer is suitable for spinning up: - Automated CI builds - Staging and testing servers -YAY! You can spin up multiple environments on a single machine! +YAY! :boom: You can spin up multiple environments on a single machine! Drupal Dockerizer works best on Linux (deb-based distributions have been tested). From d09333faf17a03a8d68941c8840c55db0c06bf3a Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 20 Apr 2021 16:26:03 +0300 Subject: [PATCH 116/228] Add issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 38 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..c35f408 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Configuration** +Add your drupal-dockerizer.yml file or vars. + +**Environment (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Docker version + - Docker compose version + - Ansible version + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. From 2762975a19344c4e78f78374d81fd38c3de2e6eb Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 21 Apr 2021 10:15:28 +0300 Subject: [PATCH 117/228] fix: vars naming for ports --- .github/workflows/test_multiple_env.yml | 8 ++++---- CONFIG.md | 4 ++-- default.config.yml | 4 ++-- templates/docker-compose.yml.j2 | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index cb9b0b3..c7aef09 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -33,7 +33,7 @@ jobs: echo "user_uid: $(id -u)" >> dockerizer-composer.yml echo "user_gid: $(id -g)" >> dockerizer-composer.yml echo "drupal_root_dir: $GITHUB_WORKSPACE/drupal-composer" >> dockerizer-composer.yml - echo "apache_port: 8080" >> dockerizer-composer.yml + echo "port: 8080" >> dockerizer-composer.yml - name: Run the main playbook for the first environment uses: dawidd6/action-ansible-playbook@v2 @@ -68,11 +68,11 @@ jobs: echo "user_uid: $(id -u)" >> dockerizer-tarball.yml echo "user_gid: $(id -g)" >> dockerizer-tarball.yml echo "drupal_root_dir: $GITHUB_WORKSPACE/drupal-tarball" >> dockerizer-tarball.yml - echo "apache_port: 8090" >> dockerizer-tarball.yml + echo "port: 8090" >> dockerizer-tarball.yml echo "drupal_web_root: ./" >> dockerizer-tarball.yml - - name: Run the main playbook for the second environment + - name: Run the main playbook for the second environment uses: dawidd6/action-ansible-playbook@v2 with: playbook: main.yml --extra-vars @/$GITHUB_WORKSPACE/dockerizer-tarball.yml @@ -80,7 +80,7 @@ jobs: options: | --verbose - - name: Run Drush commands playbook for the second environment + - name: Run Drush commands playbook for the second environment uses: dawidd6/action-ansible-playbook@v2 with: playbook: drush-commands.yml --extra-vars @/$GITHUB_WORKSPACE/dockerizer-tarball.yml diff --git a/CONFIG.md b/CONFIG.md index cf692d1..3eedb78 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -12,8 +12,8 @@ | drupal_files_dir | Absolute path to your drupal files directory | /var/data/drupal_files | | drupal_hash_salt | Hash salt for drupal site. | demo_site | | drupal_config_sync_folder | Relative path from drupal_web_root for you config sync directory | sites/default/sync | -| apache_port | Port where you up your drupal site by http protocol. No need if advanced_networking is true | 80 | -| apache_port_ssl | Port where you up your drupal site by https protocol you shoud set ssl_enabled to true | 443 | +| port | Port where you up your drupal site by http protocol. No need if advanced_networking is true | 80 | +| ssl_port | Port where you up your drupal site by https protocol you shoud set ssl_enabled to true | 443 | | ssl_enabled | Enable https protocol for your project | true | | ssl_cert_path | Absolute path to fullchain ssl certeficate | /var/data/ssl/fullchain.pem | | ssl_key_path | Absolute path to ssl private key | /var/data/ssl/privkey.pem | diff --git a/default.config.yml b/default.config.yml index fc90ced..9ea6516 100644 --- a/default.config.yml +++ b/default.config.yml @@ -17,8 +17,8 @@ drupal_hash_salt: demo_site # Absolute Path to Drupal config sync dir. drupal_config_sync_folder: sites/default/sync -apache_port: 80 -apache_port_ssl: 443 +port: 80 +ssl_port: 443 ssl_enabled: false ssl_cert_path: /var/data/ssl/fullchain.pem ssl_key_path: /var/data/ssl/privkey.pem diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 195c0fe..04aa89f 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -27,9 +27,9 @@ services: - database {% if not advanced_networking %} ports: - - "{{ apache_port }}:80" + - "{{ port }}:80" {% if ssl_enabled %} - - "{{ apache_port_ssl }}:443" + - "{{ ssl_port }}:443" {% endif %} {% endif %} links: From f93e5590b8bd8ca4ba81393570cafccf140b1b8d Mon Sep 17 00:00:00 2001 From: Dima Danylevskyi Date: Wed, 21 Apr 2021 10:25:20 +0300 Subject: [PATCH 118/228] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c35f408..455c432 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -11,28 +11,24 @@ assignees: '' A clear and concise description of what the bug is. **To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error +Steps to reproduce the behavior. **Expected behavior** A clear and concise description of what you expected to happen. -**Screenshots** -If applicable, add screenshots to help explain your problem. +**Terminal Output or Screenshots** +If applicable, add terminal output and. screenshots to help explain your problem. **Configuration** Add your drupal-dockerizer.yml file or vars. **Environment (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] + - OS: [e.g. Ubuntu 20.04] + - Drupal Dockerizer version [e.g. 2.0.1] - Docker version - Docker compose version - Ansible version - - Version [e.g. 22] + - Browser [e.g. chrome, safari] **Additional context** Add any other context about the problem here. From 96686c32933c7b3366cf52153338a1183f27a5ce Mon Sep 17 00:00:00 2001 From: Dima Danylevskyi Date: Wed, 21 Apr 2021 10:43:40 +0300 Subject: [PATCH 119/228] docs: add port description --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c5a09d..97e172a 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ compose_project_name: drupal9 user_uid: `id -u` user_gid: `id -g` drupal_root_dir: $HOME/Projects/drupal9 +port: 8090 EOT cd ~/Projects/drupal9/drupal-dockerizer @@ -98,7 +99,7 @@ As a result you should receive the next directory structure: └── ... ``` -You are done. You can access your fresh Drupal 9 site by visiting your IP address on port 80. +You are done. You can access your fresh Drupal 9 site by visiting your IP address on port 8090. ### How does it work internally? From 42f55be2fdba5f8f88f0448527bc9cc406ca4245 Mon Sep 17 00:00:00 2001 From: Vlad Date: Wed, 21 Apr 2021 10:57:17 +0300 Subject: [PATCH 120/228] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 455c432..441791c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,7 +2,7 @@ name: Bug report about: Create a report to help us improve title: '' -labels: '' +labels: 'bug' assignees: '' --- From 5296b42bde97bf4b77c36d5c4de47a06da217ae3 Mon Sep 17 00:00:00 2001 From: Dima Danylevskyi Date: Wed, 21 Apr 2021 11:21:05 +0300 Subject: [PATCH 121/228] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7d161eb..10bbedc 100644 --- a/README.md +++ b/README.md @@ -210,4 +210,4 @@ drush_commands: ## Credits -Drupal Dockerizer was created and is maintained by [Jet.Dev](https://jet.dev/) team. +Drupal Dockerizer was created and is maintained with :heart: by Drupal Dockerizer team and [Jet.Dev](https://jet.dev/). From 486c5f59ba456ea7efbbf5e3c2e9b59f5e7a9509 Mon Sep 17 00:00:00 2001 From: Dima Danylevskyi Date: Wed, 21 Apr 2021 11:33:34 +0300 Subject: [PATCH 122/228] docs: add CONTRIBUTING.md --- CONTRIBUTING.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..411d4c4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,29 @@ +# How to contribute to Drupal Dockerizer + +## Did you find a bug? + +* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/jet-dev-team/drupal-dockerizer/labels/bug). + +* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/jet-dev-team/drupal-dockerizer/issues/new?template=bug_report.md&labels=bug). Be sure to include as much relevant information as possible. + +## Did you write a patch that fixes a bug? + +* Make sure there is an issue for the bug you are trying to fix by searching on GitHub under [Issues](https://github.com/jet-dev-team/drupal-dockerizer/labels/bug). + +* Please, create fork of Drupal Dockerizer repository. Create pull request on upstream repository from your fork. + +* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable. + +## Did you fix whitespace, format code, or make a purely cosmetic patch? + +We are happy to include your changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability. Please, create pull request with such kind of changes to `main` branch. + +## Do you intend to add a new feature or change an existing one? + +* Suggest your change by submitting [feature request issue](https://github.com/jet-dev-team/drupal-dockerizer/issues/new?template=feature_request.md&labels=enhancement). + +* Pull requests with features should go into `main` branch. + +Thanks! :heart: :heart: :heart: + +Drupal Dockerizer Team From a1e4b9fa4593bca37282b570b2ca7100c6977c5b Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 21 Apr 2021 12:26:45 +0300 Subject: [PATCH 123/228] fix: test naming and ignore md files --- .github/workflows/{basic_test.yml => test_basic.yml} | 2 ++ .github/workflows/{db_import_test.yml => test_db_import.yml} | 2 ++ .github/workflows/{memcache_test.yml => test_memcache.yml} | 2 ++ .github/workflows/test_multiple_env.yml | 2 ++ .github/workflows/{ssl_test.yml => test_ssl.yml} | 2 ++ 5 files changed, 10 insertions(+) rename .github/workflows/{basic_test.yml => test_basic.yml} (97%) rename .github/workflows/{db_import_test.yml => test_db_import.yml} (98%) rename .github/workflows/{memcache_test.yml => test_memcache.yml} (98%) rename .github/workflows/{ssl_test.yml => test_ssl.yml} (98%) diff --git a/.github/workflows/basic_test.yml b/.github/workflows/test_basic.yml similarity index 97% rename from .github/workflows/basic_test.yml rename to .github/workflows/test_basic.yml index 8e0fadb..5572ec2 100644 --- a/.github/workflows/basic_test.yml +++ b/.github/workflows/test_basic.yml @@ -3,6 +3,8 @@ name: Check basic functionality on: pull_request: branches: [main] + paths-ignore: + - '**.md' workflow_dispatch: jobs: diff --git a/.github/workflows/db_import_test.yml b/.github/workflows/test_db_import.yml similarity index 98% rename from .github/workflows/db_import_test.yml rename to .github/workflows/test_db_import.yml index 2b033cb..ec282c7 100644 --- a/.github/workflows/db_import_test.yml +++ b/.github/workflows/test_db_import.yml @@ -3,6 +3,8 @@ name: Check database import functionality on: pull_request: branches: [main] + paths-ignore: + - '**.md' workflow_dispatch: jobs: diff --git a/.github/workflows/memcache_test.yml b/.github/workflows/test_memcache.yml similarity index 98% rename from .github/workflows/memcache_test.yml rename to .github/workflows/test_memcache.yml index 54abf2a..c0bedf4 100644 --- a/.github/workflows/memcache_test.yml +++ b/.github/workflows/test_memcache.yml @@ -3,6 +3,8 @@ name: Check memcache functionality on: pull_request: branches: [main] + paths-ignore: + - '**.md' workflow_dispatch: jobs: diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index c7aef09..2966e95 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -3,6 +3,8 @@ name: Check multiple environments functionality on: pull_request: branches: [main] + paths-ignore: + - '**.md' workflow_dispatch: jobs: diff --git a/.github/workflows/ssl_test.yml b/.github/workflows/test_ssl.yml similarity index 98% rename from .github/workflows/ssl_test.yml rename to .github/workflows/test_ssl.yml index b192933..881cffa 100644 --- a/.github/workflows/ssl_test.yml +++ b/.github/workflows/test_ssl.yml @@ -3,6 +3,8 @@ name: Check SSL connection on: pull_request: branches: [main] + paths-ignore: + - '**.md' workflow_dispatch: jobs: From 350885592482d7af0f9735cb2f356b7cf6af314b Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 21 Apr 2021 15:32:06 +0300 Subject: [PATCH 124/228] Temp disable tests --- .github/workflows/test_basic.yml | 4 ---- .github/workflows/test_db_import.yml | 4 ---- .github/workflows/test_memcache.yml | 4 ---- .github/workflows/test_multiple_env.yml | 4 ---- .github/workflows/test_ssl.yml | 4 ---- 5 files changed, 20 deletions(-) diff --git a/.github/workflows/test_basic.yml b/.github/workflows/test_basic.yml index 5572ec2..36055d6 100644 --- a/.github/workflows/test_basic.yml +++ b/.github/workflows/test_basic.yml @@ -1,10 +1,6 @@ name: Check basic functionality on: - pull_request: - branches: [main] - paths-ignore: - - '**.md' workflow_dispatch: jobs: diff --git a/.github/workflows/test_db_import.yml b/.github/workflows/test_db_import.yml index ec282c7..4524782 100644 --- a/.github/workflows/test_db_import.yml +++ b/.github/workflows/test_db_import.yml @@ -1,10 +1,6 @@ name: Check database import functionality on: - pull_request: - branches: [main] - paths-ignore: - - '**.md' workflow_dispatch: jobs: diff --git a/.github/workflows/test_memcache.yml b/.github/workflows/test_memcache.yml index c0bedf4..81b1b2f 100644 --- a/.github/workflows/test_memcache.yml +++ b/.github/workflows/test_memcache.yml @@ -1,10 +1,6 @@ name: Check memcache functionality on: - pull_request: - branches: [main] - paths-ignore: - - '**.md' workflow_dispatch: jobs: diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index 2966e95..a7addcd 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -1,10 +1,6 @@ name: Check multiple environments functionality on: - pull_request: - branches: [main] - paths-ignore: - - '**.md' workflow_dispatch: jobs: diff --git a/.github/workflows/test_ssl.yml b/.github/workflows/test_ssl.yml index 881cffa..1b28a74 100644 --- a/.github/workflows/test_ssl.yml +++ b/.github/workflows/test_ssl.yml @@ -1,10 +1,6 @@ name: Check SSL connection on: - pull_request: - branches: [main] - paths-ignore: - - '**.md' workflow_dispatch: jobs: From 598ec269b5497016153187e289274630127f86aa Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 21 Apr 2021 15:59:36 +0300 Subject: [PATCH 125/228] Implement test for solr --- .../search_api.index.node.yml | 94 ++++++++++++++++ .../search_api.server.solr.yml | 68 ++++++++++++ .github/workflows/test_solr.yml | 105 ++++++++++++++++++ 3 files changed, 267 insertions(+) create mode 100644 .github/data/solr_drupal_configs/search_api.index.node.yml create mode 100644 .github/data/solr_drupal_configs/search_api.server.solr.yml create mode 100644 .github/workflows/test_solr.yml diff --git a/.github/data/solr_drupal_configs/search_api.index.node.yml b/.github/data/solr_drupal_configs/search_api.index.node.yml new file mode 100644 index 0000000..a02f94d --- /dev/null +++ b/.github/data/solr_drupal_configs/search_api.index.node.yml @@ -0,0 +1,94 @@ +uuid: 6a69e9a2-0d4e-473b-a90f-6a6609210f88 +langcode: en +status: true +dependencies: + module: + - search_api_solr + - node + - search_api + config: + - field.storage.node.body + - search_api.server.solr +third_party_settings: + search_api_solr: + finalize: false + commit_before_finalize: false + commit_after_finalize: false + multilingual: + limit_to_content_language: false + include_language_independent: true + highlighter: + maxAnalyzedChars: 51200 + fragmenter: gap + regex: + slop: 0.5 + pattern: blank + maxAnalyzedChars: 10000 + usePhraseHighlighter: true + highlightMultiTerm: true + preserveMulti: false + highlight: + mergeContiguous: false + requireFieldMatch: false + snippets: 3 + fragsize: 0 + mlt: + mintf: 1 + mindf: 1 + maxdf: 0 + maxdfpct: 0 + minwl: 0 + maxwl: 0 + maxqt: 100 + maxntp: 2000 + boost: false + interestingTerms: none + term_modifiers: + slop: 3 + fuzzy: 1 + advanced: + index_prefix: '' + collection: '' + timezone: '' +id: node +name: node +description: '' +read_only: false +field_settings: + body: + label: Body + datasource_id: 'entity:node' + property_path: body + type: text + dependencies: + config: + - field.storage.node.body + title: + label: Title + datasource_id: 'entity:node' + property_path: title + type: string + dependencies: + module: + - node +datasource_settings: + 'entity:node': + bundles: + default: true + selected: { } + languages: + default: true + selected: { } +processor_settings: + add_url: { } + aggregated_field: { } + language_with_fallback: { } + rendered_item: { } + solr_date_range: { } +tracker_settings: + default: + indexing_order: fifo +options: + index_directly: true + cron_limit: 50 +server: solr diff --git a/.github/data/solr_drupal_configs/search_api.server.solr.yml b/.github/data/solr_drupal_configs/search_api.server.solr.yml new file mode 100644 index 0000000..e9eb5d2 --- /dev/null +++ b/.github/data/solr_drupal_configs/search_api.server.solr.yml @@ -0,0 +1,68 @@ +uuid: 3a2b9f5a-c416-4df4-98e3-eab8b3df81ef +langcode: en +status: true +dependencies: + config: + - search_api_solr.solr_cache.cache_document_default_7_0_0 + - search_api_solr.solr_cache.cache_fieldvalue_default_7_0_0 + - search_api_solr.solr_cache.cache_filter_default_7_0_0 + - search_api_solr.solr_cache.cache_persegfilter_default_7_0_0 + - search_api_solr.solr_cache.cache_queryresult_default_7_0_0 + - search_api_solr.solr_field_type.text_edge_und_6_0_0 + - search_api_solr.solr_field_type.text_edgestring_und_6_0_0 + - search_api_solr.solr_field_type.text_en_6_0_0 + - search_api_solr.solr_field_type.text_ngram_und_6_0_0 + - search_api_solr.solr_field_type.text_ngramstring_und_6_0_0 + - search_api_solr.solr_field_type.text_phonetic_en_7_0_0 + - search_api_solr.solr_field_type.text_phonetic_und_7_0_0 + - search_api_solr.solr_field_type.text_und_6_0_0 + - search_api_solr.solr_request_dispatcher.request_dispatcher_httpcachingnever_default_7_0_0 + - search_api_solr.solr_request_handler.request_handler_autocomplete_default_7_0_0 + - search_api_solr.solr_request_handler.request_handler_extract_default_7_0_0 + - search_api_solr.solr_request_handler.request_handler_mlt_default_7_0_0 + - search_api_solr.solr_request_handler.request_handler_select_default_7_0_0 + - search_api_solr.solr_request_handler.request_handler_spell_default_7_0_0 + - search_api_solr.solr_request_handler.request_handler_suggest_default_7_0_0 + - search_api_solr.solr_request_handler.request_handler_tvrh_default_7_0_0 + module: + - search_api_solr +id: solr +name: solr +description: '' +backend: search_api_solr +backend_config: + connector: standard + connector_config: + scheme: http + host: localhost + port: 8983 + path: / + core: drupal + timeout: 5 + index_timeout: 5 + optimize_timeout: 10 + finalize_timeout: 30 + commit_within: 1000 + solr_version: '' + http_method: AUTO + skip_schema_check: false + jmx: false + solr_install_dir: '' + disabled_field_types: { } + disabled_caches: { } + disabled_request_handlers: + - request_handler_elevate_default_7_0_0 + - request_handler_replicationmaster_default_7_0_0 + - request_handler_replicationslave_default_7_0_0 + disabled_request_dispatchers: + - request_dispatcher_httpcaching_default_7_0_0 + rows: 10 + index_single_documents_fallback_count: 10 + retrieve_data: false + highlight_data: false + fallback_multiple: false + server_prefix: '' + domain: generic + environment: default + optimize: false + site_hash: false diff --git a/.github/workflows/test_solr.yml b/.github/workflows/test_solr.yml new file mode 100644 index 0000000..ad8555d --- /dev/null +++ b/.github/workflows/test_solr.yml @@ -0,0 +1,105 @@ +name: Check solr functionality + +on: + pull_request: + branches: [main] + paths-ignore: + - '**.md' + workflow_dispatch: + +jobs: + test_solr: + runs-on: ubuntu-20.04 + steps: + - name: Cache Composer dependencies for improve speed + uses: actions/cache@v2 + with: + path: ~/.cache/composer + key: ${{ runner.os }}-drupal + + - name: Get Drupal Project repository + uses: actions/checkout@v2 + with: + repository: 'drupal/recommended-project' + path: './' + ref: '9.2.x' + + - name: Run Composer install + run: composer install --ignore-platform-reqs + + - name: Add required modules to Drupal + run: composer require drupal/search_api_solr drupal/devel drush/drush--ignore-platform-reqs + + - name: Get Drupal Dockerizer repository + uses: actions/checkout@v2 + with: + path: '.drupal-dockerizer' + + - name: Create basic drupal-dockerizer.yml + run: | + echo "---" > drupal-dockerizer.yml + echo "" >> drupal-dockerizer.yml + echo "compose_project_name: drupal-project" >> drupal-dockerizer.yml + echo "user_uid: $(id -u)" >> drupal-dockerizer.yml + echo "user_gid: $(id -g)" >> drupal-dockerizer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml + echo "solr_configs_path: $GITHUB_WORKSPACE/solr_configuration" >> drupal-dockerizer.yml + echo "solr_version: 8" >> drupal-dockerizer.yml + + - name: Run main playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: main.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Run drush-commands playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: drush-commands.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Enable search_api and devel_generator in database + run: docker exec drupal-project-7.4-develop drush en devel_generate search_api_solr -y + + - name: Copy Drupal configs for solr + run: cp -R .drupal-dockerizer/.github/data/solr_drupal_configs/* web/solr/ + + - name: Import Drupal configs for solr + run: docker exec drupal-project-7.4-develop drush config:import --diff --partial --source=solr + + - name: Generate solr config + run: docker exec drupal-project-7.4-develop drush solr-gsc solr config.zip 8.8 + + - name: Unzip solr configuration. + run: unzip config.zip -d solr_configuration + + - name: Enable solr in drupal-dockerizer.yml + run: | + echo "solr: true" >> drupal-dockerizer.yml + + - name: Run main playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: main.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Generate random nodes + run: docker exec drupal-project-7.4-develop drush devel-generate:content -y + + - name: Index nodes + run: docker exec drupal-project-7.4-develop drush devel-generate:content -y + + - name: Check search indexes works. + run: docker exec drupal-project-7.4-develop drush sapi-search node Dolore + + - name: settings.php should have solr config + run: cat web/sites/default/settings.php | grep "solr" + + - name: Check Drupal + run: curl http://localhost | grep "Drupal" From 36530e27f68f18e99b96a8643fc304caeb7fe76f Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 21 Apr 2021 16:01:15 +0300 Subject: [PATCH 126/228] Fix for solr 8 --- tasks/solr-setup.yml | 8 ++++++++ templates/docker-compose.yml.j2 | 2 ++ 2 files changed, 10 insertions(+) diff --git a/tasks/solr-setup.yml b/tasks/solr-setup.yml index 4dd6d64..194911f 100644 --- a/tasks/solr-setup.yml +++ b/tasks/solr-setup.yml @@ -69,3 +69,11 @@ state: directory owner: "{{user_uid|int}}" group: "{{user_gid|int}}" + +- name: Check owner for solr data dir. + file: + recurse: yes + path: "{{ docker_runtime_dir }}/data/solr_data" + state: directory + owner: "{{user_uid|int}}" + group: "{{user_gid|int}}" diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 04aa89f..90412e7 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -88,6 +88,8 @@ services: volumes: {% if solr_version != 4%} - ./data/solr:/opt/solr/server/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} + - ./data/solr_data:/var/solr + - ./data/solr:/var/solr/data/{{ solr_core_name }} {% else %} - ./data/solr:/opt/solr/example/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} {% endif %} From 16b60df246386fad9a6e3848338246ab49a1e014 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 21 Apr 2021 16:29:17 +0300 Subject: [PATCH 127/228] fix: typo --- .github/workflows/test_solr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_solr.yml b/.github/workflows/test_solr.yml index ad8555d..c1a8c00 100644 --- a/.github/workflows/test_solr.yml +++ b/.github/workflows/test_solr.yml @@ -28,7 +28,7 @@ jobs: run: composer install --ignore-platform-reqs - name: Add required modules to Drupal - run: composer require drupal/search_api_solr drupal/devel drush/drush--ignore-platform-reqs + run: composer require drupal/search_api_solr drupal/devel drush/drush --ignore-platform-reqs - name: Get Drupal Dockerizer repository uses: actions/checkout@v2 From f38fbb3bdef7c4825f8d527f66fd6d41cbdf7795 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 21 Apr 2021 16:35:54 +0300 Subject: [PATCH 128/228] fi: solr conf dir --- .github/workflows/test_solr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_solr.yml b/.github/workflows/test_solr.yml index c1a8c00..9e9db55 100644 --- a/.github/workflows/test_solr.yml +++ b/.github/workflows/test_solr.yml @@ -66,10 +66,10 @@ jobs: run: docker exec drupal-project-7.4-develop drush en devel_generate search_api_solr -y - name: Copy Drupal configs for solr - run: cp -R .drupal-dockerizer/.github/data/solr_drupal_configs/* web/solr/ + run: mkdir web/solr_drupal_configs && cp -R .drupal-dockerizer/.github/data/solr_drupal_configs/* web/solr_drupal_configs/ - name: Import Drupal configs for solr - run: docker exec drupal-project-7.4-develop drush config:import --diff --partial --source=solr + run: docker exec drupal-project-7.4-develop drush config:import --diff --partial --source=solr_drupal_configs - name: Generate solr config run: docker exec drupal-project-7.4-develop drush solr-gsc solr config.zip 8.8 From 5f5ba2ca116b8042e2b1e957df449d996310bef7 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 21 Apr 2021 16:41:08 +0300 Subject: [PATCH 129/228] Fix unzip --- .github/workflows/test_solr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_solr.yml b/.github/workflows/test_solr.yml index 9e9db55..dfc97d9 100644 --- a/.github/workflows/test_solr.yml +++ b/.github/workflows/test_solr.yml @@ -75,7 +75,7 @@ jobs: run: docker exec drupal-project-7.4-develop drush solr-gsc solr config.zip 8.8 - name: Unzip solr configuration. - run: unzip config.zip -d solr_configuration + run: unzip web/config.zip -d solr_configuration - name: Enable solr in drupal-dockerizer.yml run: | From 167c6265a474890d561b9b2d5b699c52a14d9c4f Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 21 Apr 2021 17:17:09 +0300 Subject: [PATCH 130/228] Fix indexing --- .github/workflows/test_solr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_solr.yml b/.github/workflows/test_solr.yml index dfc97d9..cfc03b6 100644 --- a/.github/workflows/test_solr.yml +++ b/.github/workflows/test_solr.yml @@ -93,7 +93,7 @@ jobs: run: docker exec drupal-project-7.4-develop drush devel-generate:content -y - name: Index nodes - run: docker exec drupal-project-7.4-develop drush devel-generate:content -y + run: docker exec drupal-project-7.4-develop drush -vv sapi-i - name: Check search indexes works. run: docker exec drupal-project-7.4-develop drush sapi-search node Dolore From fb70dfa509b0c9e7926d504c99826e4531aa14c2 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 21 Apr 2021 17:30:36 +0300 Subject: [PATCH 131/228] Get logs --- .github/workflows/test_solr.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test_solr.yml b/.github/workflows/test_solr.yml index cfc03b6..5aca65a 100644 --- a/.github/workflows/test_solr.yml +++ b/.github/workflows/test_solr.yml @@ -89,6 +89,9 @@ jobs: options: | --verbose + - name: Get solr logs + run: docker docker logs drupal-project-solr + - name: Generate random nodes run: docker exec drupal-project-7.4-develop drush devel-generate:content -y From 19f882a61544311efc3c5cd97064d1febfd3befa Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 21 Apr 2021 17:35:12 +0300 Subject: [PATCH 132/228] Fix typo --- .github/workflows/test_solr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_solr.yml b/.github/workflows/test_solr.yml index 5aca65a..6115ff5 100644 --- a/.github/workflows/test_solr.yml +++ b/.github/workflows/test_solr.yml @@ -90,7 +90,7 @@ jobs: --verbose - name: Get solr logs - run: docker docker logs drupal-project-solr + run: docker logs drupal-project-solr - name: Generate random nodes run: docker exec drupal-project-7.4-develop drush devel-generate:content -y From c7e116fc79be2dba551118de7817eb901f8f8878 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Thu, 22 Apr 2021 10:09:53 +0300 Subject: [PATCH 133/228] Check permission --- templates/docker-compose.yml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 90412e7..a812f35 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -87,7 +87,7 @@ services: context: "./bin/solr" volumes: {% if solr_version != 4%} - - ./data/solr:/opt/solr/server/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} + {# - ./data/solr:/opt/solr/server/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} #} - ./data/solr_data:/var/solr - ./data/solr:/var/solr/data/{{ solr_core_name }} {% else %} From 1369d534271e02aa1f1544b7e17abc22c9f2feb4 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Thu, 22 Apr 2021 10:14:43 +0300 Subject: [PATCH 134/228] Small fix --- templates/docker-compose.yml.j2 | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index a812f35..a3fbe9d 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -87,7 +87,6 @@ services: context: "./bin/solr" volumes: {% if solr_version != 4%} - {# - ./data/solr:/opt/solr/server/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} #} - ./data/solr_data:/var/solr - ./data/solr:/var/solr/data/{{ solr_core_name }} {% else %} From 065e4aaa2f86f48dd8dd257eb28d731b71828dc3 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Thu, 22 Apr 2021 11:10:28 +0300 Subject: [PATCH 135/228] Add copy core setup --- main.yml | 4 ++++ tasks/solr-core-setup.yml | 7 +++++++ templates/docker-compose.yml.j2 | 1 - 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 tasks/solr-core-setup.yml diff --git a/main.yml b/main.yml index d771bca..1015cc1 100644 --- a/main.yml +++ b/main.yml @@ -45,6 +45,10 @@ - name: Include Docker up tasks include: tasks/docker-up.yml + - name: Include Solr copy core task + include: tasks/solr-core-setup.yml + when: solr + - name: Include Memcache setup tasks include: tasks/memcache-setup.yml when: memcache diff --git a/tasks/solr-core-setup.yml b/tasks/solr-core-setup.yml new file mode 100644 index 0000000..14915e2 --- /dev/null +++ b/tasks/solr-core-setup.yml @@ -0,0 +1,7 @@ +--- + + +- name: Copy solr core setup. + command: docker cp /data/solr {{ compose_project_name }}-solr:/var/solr/data/{{ solr_core_name }} + args: + chdir: "{{ docker_runtime_dir }}" diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index a3fbe9d..6477241 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -88,7 +88,6 @@ services: volumes: {% if solr_version != 4%} - ./data/solr_data:/var/solr - - ./data/solr:/var/solr/data/{{ solr_core_name }} {% else %} - ./data/solr:/opt/solr/example/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} {% endif %} From 3aa1f125aafe887047e588a2b261e6ba42763519 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Thu, 22 Apr 2021 11:16:07 +0300 Subject: [PATCH 136/228] Small fix --- tasks/solr-core-setup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/solr-core-setup.yml b/tasks/solr-core-setup.yml index 14915e2..a451fa4 100644 --- a/tasks/solr-core-setup.yml +++ b/tasks/solr-core-setup.yml @@ -2,6 +2,6 @@ - name: Copy solr core setup. - command: docker cp /data/solr {{ compose_project_name }}-solr:/var/solr/data/{{ solr_core_name }} + command: docker cp data/solr {{ compose_project_name }}-solr:/var/solr/data/{{ solr_core_name }} args: chdir: "{{ docker_runtime_dir }}" From 2a2433c6c169a4d3d08abddb20ba5ae36d690e71 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Fri, 23 Apr 2021 10:39:25 +0300 Subject: [PATCH 137/228] Fix for others version --- tasks/solr-setup.yml | 1 + templates/docker-compose.yml.j2 | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tasks/solr-setup.yml b/tasks/solr-setup.yml index 194911f..9648637 100644 --- a/tasks/solr-setup.yml +++ b/tasks/solr-setup.yml @@ -71,6 +71,7 @@ group: "{{user_gid|int}}" - name: Check owner for solr data dir. + when: solr_version == 8 file: recurse: yes path: "{{ docker_runtime_dir }}/data/solr_data" diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 6477241..760c05a 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -86,8 +86,10 @@ services: build: context: "./bin/solr" volumes: -{% if solr_version != 4%} +{% if solr_version == 8 %} - ./data/solr_data:/var/solr +{% else if solr_version != 4 %} + - ./data/solr:/opt/solr/server/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} {% else %} - ./data/solr:/opt/solr/example/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} {% endif %} From 3326fe3e4c73a4ef56785cd937306e61150ae875 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Fri, 23 Apr 2021 10:42:33 +0300 Subject: [PATCH 138/228] Small fix --- templates/docker-compose.yml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 760c05a..e9688c6 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -88,7 +88,7 @@ services: volumes: {% if solr_version == 8 %} - ./data/solr_data:/var/solr -{% else if solr_version != 4 %} +{% elif solr_version != 4 %} - ./data/solr:/opt/solr/server/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} {% else %} - ./data/solr:/opt/solr/example/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} From 5a2754f00766355d1702344e16f13028e3563f96 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Fri, 23 Apr 2021 12:08:22 +0300 Subject: [PATCH 139/228] Revert "Temp disable tests" This reverts commit 350885592482d7af0f9735cb2f356b7cf6af314b. --- .github/workflows/test_basic.yml | 4 ++++ .github/workflows/test_db_import.yml | 4 ++++ .github/workflows/test_memcache.yml | 4 ++++ .github/workflows/test_multiple_env.yml | 4 ++++ .github/workflows/test_ssl.yml | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/.github/workflows/test_basic.yml b/.github/workflows/test_basic.yml index 36055d6..5572ec2 100644 --- a/.github/workflows/test_basic.yml +++ b/.github/workflows/test_basic.yml @@ -1,6 +1,10 @@ name: Check basic functionality on: + pull_request: + branches: [main] + paths-ignore: + - '**.md' workflow_dispatch: jobs: diff --git a/.github/workflows/test_db_import.yml b/.github/workflows/test_db_import.yml index 4524782..ec282c7 100644 --- a/.github/workflows/test_db_import.yml +++ b/.github/workflows/test_db_import.yml @@ -1,6 +1,10 @@ name: Check database import functionality on: + pull_request: + branches: [main] + paths-ignore: + - '**.md' workflow_dispatch: jobs: diff --git a/.github/workflows/test_memcache.yml b/.github/workflows/test_memcache.yml index 81b1b2f..c0bedf4 100644 --- a/.github/workflows/test_memcache.yml +++ b/.github/workflows/test_memcache.yml @@ -1,6 +1,10 @@ name: Check memcache functionality on: + pull_request: + branches: [main] + paths-ignore: + - '**.md' workflow_dispatch: jobs: diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index a7addcd..2966e95 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -1,6 +1,10 @@ name: Check multiple environments functionality on: + pull_request: + branches: [main] + paths-ignore: + - '**.md' workflow_dispatch: jobs: diff --git a/.github/workflows/test_ssl.yml b/.github/workflows/test_ssl.yml index 1b28a74..881cffa 100644 --- a/.github/workflows/test_ssl.yml +++ b/.github/workflows/test_ssl.yml @@ -1,6 +1,10 @@ name: Check SSL connection on: + pull_request: + branches: [main] + paths-ignore: + - '**.md' workflow_dispatch: jobs: From 9fe8358707aca433d8b8bb986ffb739c78ac4b62 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Fri, 23 Apr 2021 14:27:27 +0300 Subject: [PATCH 140/228] Add php7.4 --- containers/php-apache/7.4/Dockerfile | 106 +++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 containers/php-apache/7.4/Dockerfile diff --git a/containers/php-apache/7.4/Dockerfile b/containers/php-apache/7.4/Dockerfile new file mode 100644 index 0000000..b092d63 --- /dev/null +++ b/containers/php-apache/7.4/Dockerfile @@ -0,0 +1,106 @@ +FROM php:7.4-apache + +# Surpresses debconf complaints of trying to install apt packages interactively +# https://github.com/moby/moby/issues/4032#issuecomment-192327844 + +ARG DEBIAN_FRONTEND=noninteractive + +# Install useful tools and install important libaries +RUN apt-get -y update && \ + apt-get -y --no-install-recommends --fix-missing install zsh git vim nano wget sudo\ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + libmagickwand-dev \ + dialog \ + libsqlite3-dev \ + libsqlite3-0 \ + default-mysql-client \ + zlib1g-dev \ + libzip-dev \ + libicu-dev \ + apt-utils \ + build-essential \ + git \ + curl \ + libmemcached-dev \ + libonig-dev \ + libcurl4 \ + libcurl4-openssl-dev \ + zip \ + openssl \ + libxml2-dev + +# Clear Apt +RUN rm -rf /var/lib/apt/lists/* + +# Opcache enviroment +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ + PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \ + PHP_OPCACHE_MEMORY_CONSUMPTION="192" \ + PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" + +# Update pecl +RUN pecl channel-update pecl.php.net + +# Install pecl modules +RUN pecl install \ + imagick \ + memcached \ + apcu-5.1.19 + +# Configure uploadprogress +RUN git clone https://github.com/php/pecl-php-uploadprogress/ /usr/src/php/ext/uploadprogress/ && \ + docker-php-ext-configure uploadprogress + +# Enable php modules +RUN docker-php-ext-enable memcached && \ + docker-php-ext-enable imagick && \ + docker-php-ext-enable apcu + +# Install php modulues +RUN docker-php-ext-install pdo_mysql && \ + docker-php-ext-install opcache && \ + docker-php-ext-install uploadprogress && \ + docker-php-ext-install pdo_sqlite && \ + docker-php-ext-install soap && \ + docker-php-ext-install mysqli && \ + docker-php-ext-install curl && \ + docker-php-ext-install tokenizer && \ + docker-php-ext-install json && \ + docker-php-ext-install zip && \ + docker-php-ext-install -j$(nproc) intl && \ + docker-php-ext-install mbstring && \ + docker-php-ext-install gettext && \ + docker-php-ext-install exif + +# Install Freetype +RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg && \ + docker-php-ext-install gd + +# Enable apache modules +RUN a2enmod rewrite headers +RUN a2enmod ssl + +# Install composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +# Set memory limit +RUN echo "memory_limit = 512M" >> /usr/local/etc/php/conf.d/memory_limit.ini + +# Cleanup +RUN rm -rf /usr/src/* + +# Create dockerizer user +RUN useradd -ms /bin/bash dockerizer +RUN groupmod --gid 1000 dockerizer && usermod --uid 1000 --gid 1000 dockerizer + +RUN chmod +x /usr/local/bin/docker-php-entrypoint + +RUN chown -R dockerizer:dockerizer /var/www + +RUN echo dockerizer ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/dockerizer +RUN chmod 0440 /etc/sudoers.d/dockerizer + +ENV APACHE_RUN_USER dockerizer +ENV APACHE_RUN_GROUP dockerizer From af559c13ed57a7f2f5a2dfd07f37d80d2fa25192 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Fri, 23 Apr 2021 14:37:26 +0300 Subject: [PATCH 141/228] Add php7.1 --- containers/php-apache/7.1.Dockerfile | 109 ++++++++++++++++++ .../{7.4/Dockerfile => 7.4.Dockerfile} | 0 2 files changed, 109 insertions(+) create mode 100644 containers/php-apache/7.1.Dockerfile rename containers/php-apache/{7.4/Dockerfile => 7.4.Dockerfile} (100%) diff --git a/containers/php-apache/7.1.Dockerfile b/containers/php-apache/7.1.Dockerfile new file mode 100644 index 0000000..aa042bc --- /dev/null +++ b/containers/php-apache/7.1.Dockerfile @@ -0,0 +1,109 @@ +FROM php:7.1-apache + +# Surpresses debconf complaints of trying to install apt packages interactively +# https://github.com/moby/moby/issues/4032#issuecomment-192327844 + +ARG DEBIAN_FRONTEND=noninteractive + +# Install useful tools and install important libaries +RUN apt-get -y update && \ + apt-get -y --no-install-recommends --fix-missing install zsh git vim nano wget sudo\ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + libmagickwand-dev \ + dialog \ + libsqlite3-dev \ + libsqlite3-0 \ + default-mysql-client \ + zlib1g-dev \ + libzip-dev \ + libicu-dev \ + apt-utils \ + build-essential \ + git \ + curl \ + libmemcached-dev \ + libonig-dev \ + libcurl4 \ + libcurl4-openssl-dev \ + zip \ + openssl \ + libxml2-dev + +# Clear Apt +RUN rm -rf /var/lib/apt/lists/* + +# Opcache enviroment +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ + PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \ + PHP_OPCACHE_MEMORY_CONSUMPTION="192" \ + PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" + +# Update pecl +RUN pecl channel-update pecl.php.net + +# Install pecl modules +RUN pecl install \ + imagick \ + memcached \ + apcu-5.1.19 + +# Configure uploadprogress +RUN git clone https://github.com/php/pecl-php-uploadprogress/ /usr/src/php/ext/uploadprogress/ && \ + docker-php-ext-configure uploadprogress + +# Enable php modules +RUN docker-php-ext-enable memcached && \ + docker-php-ext-enable imagick && \ + docker-php-ext-enable apcu + +# Install php modulues +RUN docker-php-ext-install pdo_mysql && \ + docker-php-ext-install opcache && \ + docker-php-ext-install uploadprogress && \ + docker-php-ext-install pdo_sqlite && \ + docker-php-ext-install soap && \ + docker-php-ext-install mysqli && \ + docker-php-ext-install curl && \ + docker-php-ext-install tokenizer && \ + docker-php-ext-install json && \ + docker-php-ext-install zip && \ + docker-php-ext-install -j$(nproc) intl && \ + docker-php-ext-install mbstring && \ + docker-php-ext-install gettext && \ + docker-php-ext-install exif + +# Install Freetype +RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ + docker-php-ext-install -j$(nproc) gd + +# Enable apache modules +RUN a2enmod rewrite headers +RUN a2enmod ssl + +# Install composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +# Set memory limit +RUN echo "memory_limit = 512M" >> /usr/local/etc/php/conf.d/memory_limit.ini + +# Enable apcu in cofig +RUN echo "apc.enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini + +# Cleanup +RUN rm -rf /usr/src/* + +# Create dockerizer user +RUN useradd -ms /bin/bash dockerizer +RUN groupmod --gid 1000 dockerizer && usermod --uid 1000 --gid 1000 dockerizer + +RUN chmod +x /usr/local/bin/docker-php-entrypoint + +RUN chown -R dockerizer:dockerizer /var/www + +RUN echo dockerizer ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/dockerizer +RUN chmod 0440 /etc/sudoers.d/dockerizer + +ENV APACHE_RUN_USER dockerizer +ENV APACHE_RUN_GROUP dockerizer diff --git a/containers/php-apache/7.4/Dockerfile b/containers/php-apache/7.4.Dockerfile similarity index 100% rename from containers/php-apache/7.4/Dockerfile rename to containers/php-apache/7.4.Dockerfile From 789e34a1ee1178f53407ef3ae2cc3029154caff0 Mon Sep 17 00:00:00 2001 From: Dima Danylevskyi Date: Wed, 28 Apr 2021 08:45:34 +0000 Subject: [PATCH 142/228] feat: add preflight checks --- main.yml | 3 +++ tasks/preflight.yml | 11 +++++++++++ tasks/preflight/docker-group.yml | 13 +++++++++++++ tasks/preflight/end_play.yml | 6 ++++++ 4 files changed, 33 insertions(+) create mode 100644 tasks/preflight.yml create mode 100644 tasks/preflight/docker-group.yml create mode 100644 tasks/preflight/end_play.yml diff --git a/main.yml b/main.yml index d771bca..b9066ca 100644 --- a/main.yml +++ b/main.yml @@ -11,6 +11,9 @@ with_fileglob: - ../drupal-dockerizer.yml + - name: Include prefilight tasks + include: tasks/preflight.yml + roles: [] tasks: diff --git a/tasks/preflight.yml b/tasks/preflight.yml new file mode 100644 index 0000000..217ad10 --- /dev/null +++ b/tasks/preflight.yml @@ -0,0 +1,11 @@ + +--- + +- name: Welcome onboard! + debug: + msg: Hey {{ ansible_user }}! We are about to start configuring Drupal Dockerizer on {{ ansible_host }}. Now will start checking if everything is OK. + +- name: Set default failed message + set_fact: preflight__failed_message="" + +- include: preflight/docker-group.yml diff --git a/tasks/preflight/docker-group.yml b/tasks/preflight/docker-group.yml new file mode 100644 index 0000000..2c4413a --- /dev/null +++ b/tasks/preflight/docker-group.yml @@ -0,0 +1,13 @@ +--- + +- name: Check if user in docker group + shell: groups | grep docker || true + register: preflight__docker_group + +- name: Set failed message + set_fact: preflight__failed_message="In order to manage Docker the user should be in 'docker' group. Please, add your user to docker group." + when: preflight__docker_group.stdout|string|length == 0 + +- name: Include end_play + include: ./end_play.yml + diff --git a/tasks/preflight/end_play.yml b/tasks/preflight/end_play.yml new file mode 100644 index 0000000..b48feae --- /dev/null +++ b/tasks/preflight/end_play.yml @@ -0,0 +1,6 @@ +--- + +- name: Print message why the start is failing + failed_when: preflight__failed_message|string|length > 0 + debug: + msg: "The run has been aborted due to the next reason: {{ preflight__failed_message }}" From fd60ad6d8c3c4849ad174aa785df5637bcd3762f Mon Sep 17 00:00:00 2001 From: Dima Danylevskyi Date: Wed, 28 Apr 2021 08:52:56 +0000 Subject: [PATCH 143/228] fix: run ansible without action --- .github/workflows/test_basic.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_basic.yml b/.github/workflows/test_basic.yml index 5572ec2..695a8d4 100644 --- a/.github/workflows/test_basic.yml +++ b/.github/workflows/test_basic.yml @@ -42,12 +42,8 @@ jobs: echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml - name: Run main playbook - uses: dawidd6/action-ansible-playbook@v2 - with: - playbook: main.yml - directory: .drupal-dockerizer - options: | - --verbose + run: ansible-playbook -vv main.yml + working-directory: .drupal-dockerizer - name: Run drush-commands playbook uses: dawidd6/action-ansible-playbook@v2 From 64e8de3849cc1353a3a41ffe15cc4ce22eced467 Mon Sep 17 00:00:00 2001 From: Dima Danylevskyi Date: Wed, 28 Apr 2021 08:59:00 +0000 Subject: [PATCH 144/228] Revert "fix: run ansible without action" This reverts commit fd60ad6d8c3c4849ad174aa785df5637bcd3762f. --- .github/workflows/test_basic.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_basic.yml b/.github/workflows/test_basic.yml index 695a8d4..5572ec2 100644 --- a/.github/workflows/test_basic.yml +++ b/.github/workflows/test_basic.yml @@ -42,8 +42,12 @@ jobs: echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml - name: Run main playbook - run: ansible-playbook -vv main.yml - working-directory: .drupal-dockerizer + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: main.yml + directory: .drupal-dockerizer + options: | + --verbose - name: Run drush-commands playbook uses: dawidd6/action-ansible-playbook@v2 From 1864687a313c4276a4d1380dcdfd2093135a1dc7 Mon Sep 17 00:00:00 2001 From: Dima Danylevskyi Date: Wed, 28 Apr 2021 08:59:36 +0000 Subject: [PATCH 145/228] fix: remove ansible_user variable usage --- tasks/preflight.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/preflight.yml b/tasks/preflight.yml index 217ad10..abe8457 100644 --- a/tasks/preflight.yml +++ b/tasks/preflight.yml @@ -3,7 +3,7 @@ - name: Welcome onboard! debug: - msg: Hey {{ ansible_user }}! We are about to start configuring Drupal Dockerizer on {{ ansible_host }}. Now will start checking if everything is OK. + msg: We are about to start configuring Drupal Dockerizer on {{ ansible_host }}. Now will start checking if everything is OK. - name: Set default failed message set_fact: preflight__failed_message="" From 1491c02eabc7e71805fea4a5a522eb010547c040 Mon Sep 17 00:00:00 2001 From: Dima Koltovych Date: Wed, 28 Apr 2021 13:27:37 +0300 Subject: [PATCH 146/228] Update tasks/preflight.yml --- tasks/preflight.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tasks/preflight.yml b/tasks/preflight.yml index abe8457..8e2b594 100644 --- a/tasks/preflight.yml +++ b/tasks/preflight.yml @@ -1,4 +1,3 @@ - --- - name: Welcome onboard! From b21eaf9aefdbdeb503b04523729f723037db2faf Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 28 Apr 2021 13:37:15 +0300 Subject: [PATCH 147/228] refactor: network configuration logic --- .github/workflows/test_basic.yml | 1 + .github/workflows/test_db_import.yml | 1 + .github/workflows/test_memcache.yml | 1 + .github/workflows/test_multiple_env.yml | 4 +-- .github/workflows/test_ssl.yml | 3 +-- .gitignore | 1 + default.config.yml | 25 +++++++++++------- main.yml | 6 ++--- tasks/advanced-networking-setup.yml | 14 ---------- tasks/docker-up.yml | 2 +- tasks/local-hosts-setup.yml | 15 +++++++++++ templates/apache.conf.j2 | 4 +-- templates/docker-compose.yml.j2 | 35 ++++++++++++++----------- 13 files changed, 63 insertions(+), 49 deletions(-) delete mode 100644 tasks/advanced-networking-setup.yml create mode 100644 tasks/local-hosts-setup.yml diff --git a/.github/workflows/test_basic.yml b/.github/workflows/test_basic.yml index 5572ec2..3cc87b6 100644 --- a/.github/workflows/test_basic.yml +++ b/.github/workflows/test_basic.yml @@ -40,6 +40,7 @@ jobs: echo "user_uid: $(id -u)" >> drupal-dockerizer.yml echo "user_gid: $(id -g)" >> drupal-dockerizer.yml echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml + echo "expose_http_port: 80" >> drupal-dockerizer.yml - name: Run main playbook uses: dawidd6/action-ansible-playbook@v2 diff --git a/.github/workflows/test_db_import.yml b/.github/workflows/test_db_import.yml index ec282c7..27e9bf8 100644 --- a/.github/workflows/test_db_import.yml +++ b/.github/workflows/test_db_import.yml @@ -40,6 +40,7 @@ jobs: echo "user_uid: $(id -u)" >> drupal-dockerizer.yml echo "user_gid: $(id -g)" >> drupal-dockerizer.yml echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml + echo "expose_http_port: 80" >> drupal-dockerizer.yml echo "db_dump_path: $GITHUB_WORKSPACE/web/dump.sql" >> drupal-dockerizer.yml - name: Run main playbook diff --git a/.github/workflows/test_memcache.yml b/.github/workflows/test_memcache.yml index c0bedf4..1749b15 100644 --- a/.github/workflows/test_memcache.yml +++ b/.github/workflows/test_memcache.yml @@ -42,6 +42,7 @@ jobs: echo "compose_project_name: drupal-project" >> drupal-dockerizer.yml echo "user_uid: $(id -u)" >> drupal-dockerizer.yml echo "user_gid: $(id -g)" >> drupal-dockerizer.yml + echo "expose_http_port: 80" >> drupal-dockerizer.yml echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml - name: Run main playbook diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index 2966e95..e4dbfa0 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -35,7 +35,7 @@ jobs: echo "user_uid: $(id -u)" >> dockerizer-composer.yml echo "user_gid: $(id -g)" >> dockerizer-composer.yml echo "drupal_root_dir: $GITHUB_WORKSPACE/drupal-composer" >> dockerizer-composer.yml - echo "port: 8080" >> dockerizer-composer.yml + echo "expose_http_port: 8080" >> drupal-dockerizer.yml - name: Run the main playbook for the first environment uses: dawidd6/action-ansible-playbook@v2 @@ -70,7 +70,7 @@ jobs: echo "user_uid: $(id -u)" >> dockerizer-tarball.yml echo "user_gid: $(id -g)" >> dockerizer-tarball.yml echo "drupal_root_dir: $GITHUB_WORKSPACE/drupal-tarball" >> dockerizer-tarball.yml - echo "port: 8090" >> dockerizer-tarball.yml + echo "expose_http_port: 8090" >> drupal-dockerizer.yml echo "drupal_web_root: ./" >> dockerizer-tarball.yml diff --git a/.github/workflows/test_ssl.yml b/.github/workflows/test_ssl.yml index 881cffa..9626171 100644 --- a/.github/workflows/test_ssl.yml +++ b/.github/workflows/test_ssl.yml @@ -40,8 +40,7 @@ jobs: echo "user_uid: $(id -u)" >> drupal-dockerizer.yml echo "user_gid: $(id -g)" >> drupal-dockerizer.yml echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml - echo "advanced_networking: true" >> drupal-dockerizer.yml - echo "network_id: 15" >> drupal-dockerizer.yml + echo "static_docker_ip: 192.167.22.1" >> drupal-dockerizer.yml echo "domain_name: drupal.devel" >> drupal-dockerizer.yml - name: Run main playbook diff --git a/.gitignore b/.gitignore index 1d3ed4c..a8939e4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ config.yml +runtime-*/ diff --git a/default.config.yml b/default.config.yml index 9ea6516..4014c4c 100644 --- a/default.config.yml +++ b/default.config.yml @@ -1,7 +1,7 @@ --- compose_project_name: my-project -docker_runtime_dir: "{{compose_project_name}}" +docker_runtime_dir: "runtime-{{compose_project_name}}" docker_cached_volume: true user_uid: 1000 @@ -17,8 +17,8 @@ drupal_hash_salt: demo_site # Absolute Path to Drupal config sync dir. drupal_config_sync_folder: sites/default/sync -port: 80 -ssl_port: 443 +expose_http_port: +expose_https_port: ssl_enabled: false ssl_cert_path: /var/data/ssl/fullchain.pem ssl_key_path: /var/data/ssl/privkey.pem @@ -26,14 +26,21 @@ ssl_key_path: /var/data/ssl/privkey.pem # Look at available options here: https://hub.docker.com/r/jetdevteam/drupal-php-apache/tags?page=1&ordering=last_updated phpversion: 7.4-develop -# Enviroment variable for php xdebug extensions -xdebug_enviroment: remote_enable=1 remote_connect_back=1 remote_port=9008 remote_host=192.168.105.1 show_error_trace=0 show_local_vars=1 remote_autostart=1 show_exception_trace=0 idekey=VSCODE - -# Setup additional networking. -advanced_networking: false -network_id: 105 +static_docker_ip: domain_name: drupal.devel +# Enviroment variable for php xdebug extensions +xdebug_enviroment: > + remote_enable=1 + remote_connect_back=1 + remote_port=9008 + remote_host={{ static_docker_ip }} + show_error_trace=0 + show_local_vars=1 + remote_autostart=1 + show_exception_trace=0 + idekey=VSCODE + drush_install: true # Availible options: 8, 9, 10 drush_version: 8 diff --git a/main.yml b/main.yml index d771bca..f248b6d 100644 --- a/main.yml +++ b/main.yml @@ -35,9 +35,9 @@ when: solr include: tasks/solr-setup.yml - - name: Include Advanced Networking setup tasks - when: advanced_networking - include: tasks/advanced-networking-setup.yml + - name: Include Local hosts setup tasks + when: static_docker_ip|string|length > 0 and domain_name|string|length > 0 + include: tasks/local-hosts-setup.yml - name: Include Settings setup tasks include: tasks/settings-setup.yml diff --git a/tasks/advanced-networking-setup.yml b/tasks/advanced-networking-setup.yml deleted file mode 100644 index 871dc9f..0000000 --- a/tasks/advanced-networking-setup.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- - -- name: Add Host name to /etc/hosts - become: true - blockinfile: - marker: "" - path: /etc/hosts - block: | - 192.168.{{ network_id }}.10 {{ domain_name }} - 192.168.{{ network_id }}.11 adminer.{{ domain_name }} - {% if solr %} - 192.168.{{ network_id }}.12 solr.{{ domain_name }} - {% endif %} - 192.168.{{ network_id }}.13 db.{{ domain_name }} diff --git a/tasks/docker-up.yml b/tasks/docker-up.yml index 1a21576..e5e9aef 100644 --- a/tasks/docker-up.yml +++ b/tasks/docker-up.yml @@ -1,6 +1,6 @@ --- - name: Bring up the Docker containers. - command: docker-compose up --build -d --remove-orphans + command: docker-compose -p {{ compose_project_name }} up --build -d --remove-orphans args: chdir: "{{ docker_runtime_dir }}" diff --git a/tasks/local-hosts-setup.yml b/tasks/local-hosts-setup.yml new file mode 100644 index 0000000..cf017ce --- /dev/null +++ b/tasks/local-hosts-setup.yml @@ -0,0 +1,15 @@ +--- + +- name: Add Host name to /etc/hosts + become: true + blockinfile: + marker: "" + path: /etc/hosts + block: | + {% set ip_part = '.'.join(static_docker_ip.split('.')[:3]) %} + {{ ip_part }}.10 {{ domain_name }} + {{ ip_part }}.11 adminer.{{ domain_name }} + {% if solr %} + {{ ip_part }}.12 solr.{{ domain_name }} + {% endif %} + {{ ip_part }}.13 db.{{ domain_name }} diff --git a/templates/apache.conf.j2 b/templates/apache.conf.j2 index ec4c1ae..aad6093 100644 --- a/templates/apache.conf.j2 +++ b/templates/apache.conf.j2 @@ -12,7 +12,7 @@ Require all granted -{% else %} +{% endif %} ServerAdmin webmaster@localhost DocumentRoot "/var/www/{{ drupal_web_root }}" @@ -24,4 +24,4 @@ Require all granted -{% endif %} + diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 04aa89f..5041e9d 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -1,4 +1,7 @@ version: '3.7' +{% if static_docker_ip|string|length > 0 %} +{% set ip_part = '.'.join(static_docker_ip.split('.')[:3]) %} +{% endif %} services: {% if memcache %} @@ -6,7 +9,7 @@ services: image: memcached restart: 'always' container_name: '{{ compose_project_name }}-memcached' -{% if advanced_networking %} +{% if static_docker_ip|string|length > 0 %} networks: - {{ compose_project_name }}-network {% endif %} @@ -25,11 +28,11 @@ services: - memcached {% endif %} - database -{% if not advanced_networking %} +{% if expose_http_port|string|length > 0 %} ports: - - "{{ port }}:80" -{% if ssl_enabled %} - - "{{ ssl_port }}:443" + - "{{ expose_http_port }}:80" +{% if ssl_enabled and expose_https_port|string|length > 0 %} + - "{{ expose_https_port }}:443" {% endif %} {% endif %} links: @@ -51,10 +54,10 @@ services: - ${LOG_DIR-./logs/apache2}:/var/log/apache2{{ ":cached" if docker_cached_volume }} environment: XDEBUG_CONFIG: "{{ xdebug_enviroment }}" -{% if advanced_networking %} +{% if static_docker_ip|string|length > 0 %} networks: {{ compose_project_name }}-network: - ipv4_address: 192.168.{{ network_id }}.10 + ipv4_address: {{ ip_part }}.10 {% endif %} database: @@ -73,10 +76,10 @@ services: MYSQL_DATABASE: {{ mysql_database }} MYSQL_USER: {{ mysql_user }} MYSQL_PASSWORD: {{ mysql_password }} -{% if advanced_networking %} +{% if static_docker_ip|string|length > 0 %} networks: {{ compose_project_name }}-network: - ipv4_address: 192.168.{{ network_id }}.13 + ipv4_address: {{ ip_part }}.13 {% endif %} {% if solr %} @@ -91,10 +94,10 @@ services: {% else %} - ./data/solr:/opt/solr/example/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} {% endif %} -{% if advanced_networking %} +{% if static_docker_ip|string|length > 0 %} networks: {{ compose_project_name }}-network: - ipv4_address: 192.168.{{ network_id }}.12 + ipv4_address: {{ ip_part }}.12 {% endif %} {% endif %} @@ -103,12 +106,12 @@ services: image: adminer container_name: '{{ compose_project_name }}-adminer' restart: always -{% if advanced_networking %} +{% if static_docker_ip|string|length > 0 %} networks: {{ compose_project_name }}-network: - ipv4_address: 192.168.{{ network_id }}.11 + ipv4_address: {{ ip_part }}.11 {% endif %} -{% if not advanced_networking %} +{% if not static_docker_ip|string|length > 0 %} ports: - "{{ adminer_port }}:8080" {% endif %} @@ -116,12 +119,12 @@ services: - database {% endif %} -{% if advanced_networking %} +{% if static_docker_ip|string|length > 0 %} networks: {{ compose_project_name }}-network: driver: bridge ipam: driver: default config: - - subnet: 192.168.{{ network_id }}.0/28 + - subnet: {{ ip_part }}.0/28 {% endif %} From 612cb1c2694f13e7c4432cfbe5179d1eab3cf5f4 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 28 Apr 2021 15:02:20 +0300 Subject: [PATCH 148/228] fix: reset and stop tasks use project name --- reset.yml | 4 ++-- stop.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/reset.yml b/reset.yml index cd164b1..808b26c 100644 --- a/reset.yml +++ b/reset.yml @@ -15,12 +15,12 @@ tasks: - name: Stop all Docker containers. - command: docker-compose down + command: docker-compose -p {{ compose_project_name }} down args: chdir: "{{ docker_runtime_dir }}" - name: Kill all Docker containers. - command: docker-compose kill + command: docker-compose -p {{ compose_project_name }} kill args: chdir: "{{ docker_runtime_dir }}" diff --git a/stop.yml b/stop.yml index 524e996..d31fad8 100644 --- a/stop.yml +++ b/stop.yml @@ -16,6 +16,6 @@ tasks: - name: Stop all Docker containers. - command: docker-compose stop + command: docker-compose -p {{ compose_project_name }} stop args: chdir: "{{ docker_runtime_dir }}" From 95bbb447bc48f2437a0b0c9459555cea233922a8 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 28 Apr 2021 15:02:53 +0300 Subject: [PATCH 149/228] fiix: check network before start containers --- tasks/preflight.yml | 1 + tasks/preflight/network.yml | 38 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 tasks/preflight/network.yml diff --git a/tasks/preflight.yml b/tasks/preflight.yml index 8e2b594..22ad596 100644 --- a/tasks/preflight.yml +++ b/tasks/preflight.yml @@ -8,3 +8,4 @@ set_fact: preflight__failed_message="" - include: preflight/docker-group.yml +- include: preflight/network.yml diff --git a/tasks/preflight/network.yml b/tasks/preflight/network.yml new file mode 100644 index 0000000..79e7c7d --- /dev/null +++ b/tasks/preflight/network.yml @@ -0,0 +1,38 @@ +--- + +- name: Check if project is up + shell: > + docker ps + --filter "label=com.docker.compose.project" -q | + xargs docker inspect --format={% raw %}'{{index .Config.Labels "com.docker.compose.project"}}'{% endraw %} | + sort | + uniq | + grep {{ compose_project_name }} || true + register: preflight__composer_project + +- name: Check static ip is open + wait_for: + host: "{{ static_docker_ip }}" + port: 80 + state: stopped + timeout: 3 + msg: "IP address is already in use. Please, set another address in your config." + when: preflight__composer_project.stdout|string|length == 0 and static_docker_ip|string|length > 0 + +- name: Check http port is open + wait_for: + host: localhost + port: "{{ expose_http_port|int|string }}" + state: stopped + timeout: 3 + msg: "Port {{ expose_http_port|int|string }} is already in use. Please, set another port in your config." + when: preflight__composer_project.stdout|string|length == 0 and expose_http_port|int > 0 + +- name: Check https port is open + wait_for: + host: localhost + port: "{{ expose_https_port|int|string }}" + state: stopped + timeout: 3 + msg: "Port {{ expose_https_port|int|string }} is already in use. Please, set another port in your config." + when: preflight__composer_project.stdout|string|length == 0 and expose_https_port|int > 0 From 7212edb66bb9806524e78c943d4eaedf68499ef0 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 28 Apr 2021 15:08:17 +0300 Subject: [PATCH 150/228] fix: staic ip failed msg --- tasks/preflight/network.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/preflight/network.yml b/tasks/preflight/network.yml index 79e7c7d..28ff6f1 100644 --- a/tasks/preflight/network.yml +++ b/tasks/preflight/network.yml @@ -16,7 +16,7 @@ port: 80 state: stopped timeout: 3 - msg: "IP address is already in use. Please, set another address in your config." + msg: "IP address {{ static_docker_ip } is already in use. Please, set another address in your config." when: preflight__composer_project.stdout|string|length == 0 and static_docker_ip|string|length > 0 - name: Check http port is open From 1fcde0166d419a157f5e8d61184f4b4253a417ef Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 28 Apr 2021 16:01:20 +0300 Subject: [PATCH 151/228] fix: Check database to up --- main.yml | 4 ---- tasks/preflight/network.yml | 2 +- templates/docker-compose.yml.j2 | 11 +++++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/main.yml b/main.yml index 732f0ec..c75c8ea 100644 --- a/main.yml +++ b/main.yml @@ -52,10 +52,6 @@ include: tasks/memcache-setup.yml when: memcache - - name: Wait docker containers (MySQL) to up. - pause: - seconds: 30 - - name: Include import-database tasks. include: tasks/import-database.yml when: import_database diff --git a/tasks/preflight/network.yml b/tasks/preflight/network.yml index 28ff6f1..4b0b68f 100644 --- a/tasks/preflight/network.yml +++ b/tasks/preflight/network.yml @@ -16,7 +16,7 @@ port: 80 state: stopped timeout: 3 - msg: "IP address {{ static_docker_ip } is already in use. Please, set another address in your config." + msg: "IP address {{ static_docker_ip }} is already in use. Please, set another address in your config." when: preflight__composer_project.stdout|string|length == 0 and static_docker_ip|string|length > 0 - name: Check http port is open diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 5041e9d..d00482c 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -24,10 +24,8 @@ services: sysctls: - net.ipv4.ip_unprivileged_port_start=0 depends_on: -{% if memcache %} - - memcached -{% endif %} - - database + database: + condition: service_healthy {% if expose_http_port|string|length > 0 %} ports: - "{{ expose_http_port }}:80" @@ -66,6 +64,11 @@ services: container_name: '{{ compose_project_name }}-database' {% if database == "mysql" %} command: --max_allowed_packet=1048576000 --skip-grant-tables + healthcheck: + test: ["CMD-SHELL", 'mysql --database=mysql --password={{ mysql_root_password }} --execute="SELECT count(table_name) > 0 FROM information_schema.tables;" --skip-column-names -B'] + interval: 3s + timeout: 30s + retries: 10 {% endif %} restart: 'always' volumes: From 2d334229f0b30c160ce4949c385a47aa7acd2268 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 28 Apr 2021 16:15:16 +0300 Subject: [PATCH 152/228] fix: conditional logic --- main.yml | 2 +- templates/docker-compose.yml.j2 | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/main.yml b/main.yml index c75c8ea..a969af0 100644 --- a/main.yml +++ b/main.yml @@ -39,7 +39,7 @@ include: tasks/solr-setup.yml - name: Include Local hosts setup tasks - when: static_docker_ip|string|length > 0 and domain_name|string|length > 0 + when: static_docker_ip is not none and domain_name is not none include: tasks/local-hosts-setup.yml - name: Include Settings setup tasks diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index d00482c..2c62c7b 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -1,5 +1,5 @@ version: '3.7' -{% if static_docker_ip|string|length > 0 %} +{% if static_docker_ip is not none %} {% set ip_part = '.'.join(static_docker_ip.split('.')[:3]) %} {% endif %} @@ -9,7 +9,7 @@ services: image: memcached restart: 'always' container_name: '{{ compose_project_name }}-memcached' -{% if static_docker_ip|string|length > 0 %} +{% if static_docker_ip is not none %} networks: - {{ compose_project_name }}-network {% endif %} @@ -26,10 +26,10 @@ services: depends_on: database: condition: service_healthy -{% if expose_http_port|string|length > 0 %} +{% if expose_http_port|int > 0 %} ports: - "{{ expose_http_port }}:80" -{% if ssl_enabled and expose_https_port|string|length > 0 %} +{% if ssl_enabled and expose_https_port|int > 0 %} - "{{ expose_https_port }}:443" {% endif %} {% endif %} @@ -52,7 +52,7 @@ services: - ${LOG_DIR-./logs/apache2}:/var/log/apache2{{ ":cached" if docker_cached_volume }} environment: XDEBUG_CONFIG: "{{ xdebug_enviroment }}" -{% if static_docker_ip|string|length > 0 %} +{% if static_docker_ip is not none %} networks: {{ compose_project_name }}-network: ipv4_address: {{ ip_part }}.10 @@ -79,7 +79,7 @@ services: MYSQL_DATABASE: {{ mysql_database }} MYSQL_USER: {{ mysql_user }} MYSQL_PASSWORD: {{ mysql_password }} -{% if static_docker_ip|string|length > 0 %} +{% if static_docker_ip is not none %} networks: {{ compose_project_name }}-network: ipv4_address: {{ ip_part }}.13 @@ -97,7 +97,7 @@ services: {% else %} - ./data/solr:/opt/solr/example/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} {% endif %} -{% if static_docker_ip|string|length > 0 %} +{% if static_docker_ip is not none %} networks: {{ compose_project_name }}-network: ipv4_address: {{ ip_part }}.12 @@ -109,12 +109,12 @@ services: image: adminer container_name: '{{ compose_project_name }}-adminer' restart: always -{% if static_docker_ip|string|length > 0 %} +{% if static_docker_ip is not none %} networks: {{ compose_project_name }}-network: ipv4_address: {{ ip_part }}.11 {% endif %} -{% if not static_docker_ip|string|length > 0 %} +{% if static_docker_ip is none %} ports: - "{{ adminer_port }}:8080" {% endif %} @@ -122,7 +122,7 @@ services: - database {% endif %} -{% if static_docker_ip|string|length > 0 %} +{% if static_docker_ip is not none %} networks: {{ compose_project_name }}-network: driver: bridge From c3deb08aba702e92e8e1bc0edc9f11aab8ac2e54 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 28 Apr 2021 16:41:04 +0300 Subject: [PATCH 153/228] fix: conditional in network --- tasks/preflight/network.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/preflight/network.yml b/tasks/preflight/network.yml index 4b0b68f..e4a7f41 100644 --- a/tasks/preflight/network.yml +++ b/tasks/preflight/network.yml @@ -17,7 +17,7 @@ state: stopped timeout: 3 msg: "IP address {{ static_docker_ip }} is already in use. Please, set another address in your config." - when: preflight__composer_project.stdout|string|length == 0 and static_docker_ip|string|length > 0 + when: preflight__composer_project.stdout|string|length == 0 and static_docker_ip is not none - name: Check http port is open wait_for: From 974bcb78080610b12c419de18bf2402fefe10c93 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 28 Apr 2021 17:07:53 +0300 Subject: [PATCH 154/228] fix: rename ip --- .github/workflows/test_ssl.yml | 2 +- default.config.yml | 4 ++-- main.yml | 2 +- tasks/local-hosts-setup.yml | 2 +- tasks/preflight/network.yml | 6 +++--- templates/docker-compose.yml.j2 | 18 +++++++++--------- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test_ssl.yml b/.github/workflows/test_ssl.yml index 9626171..9fe2504 100644 --- a/.github/workflows/test_ssl.yml +++ b/.github/workflows/test_ssl.yml @@ -40,7 +40,7 @@ jobs: echo "user_uid: $(id -u)" >> drupal-dockerizer.yml echo "user_gid: $(id -g)" >> drupal-dockerizer.yml echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml - echo "static_docker_ip: 192.167.22.1" >> drupal-dockerizer.yml + echo "docker_network_gateway_ip: 192.167.22.1" >> drupal-dockerizer.yml echo "domain_name: drupal.devel" >> drupal-dockerizer.yml - name: Run main playbook diff --git a/default.config.yml b/default.config.yml index 4014c4c..4ab8fd8 100644 --- a/default.config.yml +++ b/default.config.yml @@ -26,7 +26,7 @@ ssl_key_path: /var/data/ssl/privkey.pem # Look at available options here: https://hub.docker.com/r/jetdevteam/drupal-php-apache/tags?page=1&ordering=last_updated phpversion: 7.4-develop -static_docker_ip: +docker_network_gateway_ip: domain_name: drupal.devel # Enviroment variable for php xdebug extensions @@ -34,7 +34,7 @@ xdebug_enviroment: > remote_enable=1 remote_connect_back=1 remote_port=9008 - remote_host={{ static_docker_ip }} + remote_host={{ docker_network_gateway_ip }} show_error_trace=0 show_local_vars=1 remote_autostart=1 diff --git a/main.yml b/main.yml index a969af0..75f0104 100644 --- a/main.yml +++ b/main.yml @@ -39,7 +39,7 @@ include: tasks/solr-setup.yml - name: Include Local hosts setup tasks - when: static_docker_ip is not none and domain_name is not none + when: docker_network_gateway_ip is not none and domain_name is not none include: tasks/local-hosts-setup.yml - name: Include Settings setup tasks diff --git a/tasks/local-hosts-setup.yml b/tasks/local-hosts-setup.yml index cf017ce..9c90f6a 100644 --- a/tasks/local-hosts-setup.yml +++ b/tasks/local-hosts-setup.yml @@ -6,7 +6,7 @@ marker: "" path: /etc/hosts block: | - {% set ip_part = '.'.join(static_docker_ip.split('.')[:3]) %} + {% set ip_part = '.'.join(docker_network_gateway_ip.split('.')[:3]) %} {{ ip_part }}.10 {{ domain_name }} {{ ip_part }}.11 adminer.{{ domain_name }} {% if solr %} diff --git a/tasks/preflight/network.yml b/tasks/preflight/network.yml index e4a7f41..874f334 100644 --- a/tasks/preflight/network.yml +++ b/tasks/preflight/network.yml @@ -12,12 +12,12 @@ - name: Check static ip is open wait_for: - host: "{{ static_docker_ip }}" + host: "{{ docker_network_gateway_ip }}" port: 80 state: stopped timeout: 3 - msg: "IP address {{ static_docker_ip }} is already in use. Please, set another address in your config." - when: preflight__composer_project.stdout|string|length == 0 and static_docker_ip is not none + msg: "IP address {{ docker_network_gateway_ip }} is already in use. Please, set another address in your config." + when: preflight__composer_project.stdout|string|length == 0 and docker_network_gateway_ip is not none - name: Check http port is open wait_for: diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 2c62c7b..286a7fb 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -1,6 +1,6 @@ version: '3.7' -{% if static_docker_ip is not none %} -{% set ip_part = '.'.join(static_docker_ip.split('.')[:3]) %} +{% if docker_network_gateway_ip is not none %} +{% set ip_part = '.'.join(docker_network_gateway_ip.split('.')[:3]) %} {% endif %} services: @@ -9,7 +9,7 @@ services: image: memcached restart: 'always' container_name: '{{ compose_project_name }}-memcached' -{% if static_docker_ip is not none %} +{% if docker_network_gateway_ip is not none %} networks: - {{ compose_project_name }}-network {% endif %} @@ -52,7 +52,7 @@ services: - ${LOG_DIR-./logs/apache2}:/var/log/apache2{{ ":cached" if docker_cached_volume }} environment: XDEBUG_CONFIG: "{{ xdebug_enviroment }}" -{% if static_docker_ip is not none %} +{% if docker_network_gateway_ip is not none %} networks: {{ compose_project_name }}-network: ipv4_address: {{ ip_part }}.10 @@ -79,7 +79,7 @@ services: MYSQL_DATABASE: {{ mysql_database }} MYSQL_USER: {{ mysql_user }} MYSQL_PASSWORD: {{ mysql_password }} -{% if static_docker_ip is not none %} +{% if docker_network_gateway_ip is not none %} networks: {{ compose_project_name }}-network: ipv4_address: {{ ip_part }}.13 @@ -97,7 +97,7 @@ services: {% else %} - ./data/solr:/opt/solr/example/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} {% endif %} -{% if static_docker_ip is not none %} +{% if docker_network_gateway_ip is not none %} networks: {{ compose_project_name }}-network: ipv4_address: {{ ip_part }}.12 @@ -109,12 +109,12 @@ services: image: adminer container_name: '{{ compose_project_name }}-adminer' restart: always -{% if static_docker_ip is not none %} +{% if docker_network_gateway_ip is not none %} networks: {{ compose_project_name }}-network: ipv4_address: {{ ip_part }}.11 {% endif %} -{% if static_docker_ip is none %} +{% if docker_network_gateway_ip is none %} ports: - "{{ adminer_port }}:8080" {% endif %} @@ -122,7 +122,7 @@ services: - database {% endif %} -{% if static_docker_ip is not none %} +{% if docker_network_gateway_ip is not none %} networks: {{ compose_project_name }}-network: driver: bridge From e9ccaa028f0b8de9b1737d09cda599abd2cbccd8 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 28 Apr 2021 17:11:38 +0300 Subject: [PATCH 155/228] fix: healthcheck timeout --- templates/docker-compose.yml.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 286a7fb..bb3aacb 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -66,9 +66,9 @@ services: command: --max_allowed_packet=1048576000 --skip-grant-tables healthcheck: test: ["CMD-SHELL", 'mysql --database=mysql --password={{ mysql_root_password }} --execute="SELECT count(table_name) > 0 FROM information_schema.tables;" --skip-column-names -B'] - interval: 3s - timeout: 30s - retries: 10 + interval: 10s + timeout: 1m + retries: 6 {% endif %} restart: 'always' volumes: From c6622b273f6bb148a9da2d90f5cd1042beea7500 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 28 Apr 2021 17:14:46 +0300 Subject: [PATCH 156/228] fix: readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 10bbedc..3bcf313 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ compose_project_name: drupal9 user_uid: `id -u` user_gid: `id -g` drupal_root_dir: $HOME/Projects/drupal9 -port: 8090 +expose_http_port: 8090 EOT cd ~/Projects/drupal9/drupal-dockerizer @@ -81,7 +81,7 @@ As a result you should receive the next directory structure: │ ├── ansible.cfg │ ├── db.yml │ ├── default.config.yml -│ ├── drupal9 +│ ├── runtime-drupal9 │ ├── drush-commands.yml │ ├── inventory │ ├── main.yml @@ -108,7 +108,7 @@ There is no magic! It is just a `docker-compose.yml` file. You can find it insid ```bash . ├── drupal-dockerizer -│ ├── drupal9 +│ ├── runtime-drupal9 │ │ └── docker-compose.yml ← │ └── ... ├── drupal-dockerizer.yml From 67ca43e5397c01dece6c793a2543916055da81ae Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 28 Apr 2021 17:18:13 +0300 Subject: [PATCH 157/228] Fix retry for db --- templates/docker-compose.yml.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index bb3aacb..6529fc0 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -66,9 +66,9 @@ services: command: --max_allowed_packet=1048576000 --skip-grant-tables healthcheck: test: ["CMD-SHELL", 'mysql --database=mysql --password={{ mysql_root_password }} --execute="SELECT count(table_name) > 0 FROM information_schema.tables;" --skip-column-names -B'] - interval: 10s - timeout: 1m - retries: 6 + interval: 3s + timeout: 45s + retries: 15 {% endif %} restart: 'always' volumes: From c3b285a864fa017403a8180036552d0c1950cc94 Mon Sep 17 00:00:00 2001 From: Dima Danylevskyi Date: Wed, 28 Apr 2021 17:48:05 +0300 Subject: [PATCH 158/228] Update readme to properly install docker-compose --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3bcf313..42963c9 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,18 @@ Let’s install requirements. ```bash apt update -apt -y install ansible docker.io docker-compose composer git unzip - +apt -y install ansible composer git unzip docker.io systemctl enable --now docker.service ``` +Install latest `docker-compose`. Ubuntu repository has a little bit outdated version. +Read more here: https://docs.docker.com/compose/install/. + +```bash +sudo curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose +sudo chmod +x /usr/local/bin/docker-compose +``` + Now you are able to connect to your server with your SSH keys or just use `su $USERNAME` to log into your user account to start configuring Drupal Dockerizer. ### Configure Drupal Dockerizer From 94e8812216fec82d74c32ce33262b31b027cb722 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 09:51:55 +0300 Subject: [PATCH 159/228] Change php version --- default.config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.config.yml b/default.config.yml index 9ea6516..6cd35bc 100644 --- a/default.config.yml +++ b/default.config.yml @@ -24,7 +24,7 @@ ssl_cert_path: /var/data/ssl/fullchain.pem ssl_key_path: /var/data/ssl/privkey.pem # Look at available options here: https://hub.docker.com/r/jetdevteam/drupal-php-apache/tags?page=1&ordering=last_updated -phpversion: 7.4-develop +phpversion: php7.4-apache--2 # Enviroment variable for php xdebug extensions xdebug_enviroment: remote_enable=1 remote_connect_back=1 remote_port=9008 remote_host=192.168.105.1 show_error_trace=0 show_local_vars=1 remote_autostart=1 show_exception_trace=0 idekey=VSCODE From a7bb40a8b5e71f25a2927a6d4da3ebdfa6207019 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 11:27:19 +0300 Subject: [PATCH 160/228] add php apache images and test for it --- .github/workflows/test_build_container.yml | 91 +++++++++++++++ .github/workflows/test_db_import.yml | 6 +- .github/workflows/test_memcache.yml | 2 +- README.md | 2 +- default.config.yml | 8 +- .../php-apache/7.1-apache.Dockerfile | 10 +- images/php-apache/7.2-apache.Dockerfile | 107 ++++++++++++++++++ images/php-apache/7.3-apache.Dockerfile | 107 ++++++++++++++++++ .../php-apache/7.4-apache.Dockerfile | 19 ++-- tasks/drush-command.yml | 4 +- templates/docker-compose.yml.j2 | 2 +- templates/php.Dockerfile.j2 | 24 +++- 12 files changed, 354 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/test_build_container.yml rename containers/php-apache/7.1.Dockerfile => images/php-apache/7.1-apache.Dockerfile (90%) create mode 100644 images/php-apache/7.2-apache.Dockerfile create mode 100644 images/php-apache/7.3-apache.Dockerfile rename containers/php-apache/7.4.Dockerfile => images/php-apache/7.4-apache.Dockerfile (96%) diff --git a/.github/workflows/test_build_container.yml b/.github/workflows/test_build_container.yml new file mode 100644 index 0000000..d246aac --- /dev/null +++ b/.github/workflows/test_build_container.yml @@ -0,0 +1,91 @@ +name: Check basic functionality + +on: + pull_request: + branches: [main] + paths: + - '**.Dockerfile' + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-20.04 + steps: + - name: Cache Composer dependencies for improve speed + uses: actions/cache@v2 + with: + path: ~/.cache/composer + key: ${{ runner.os }}-drupal + + - name: Get Drupal Project repository + uses: actions/checkout@v2 + with: + repository: 'drupal/recommended-project' + path: './' + ref: '9.2.x' + + - name: Run Composer install + run: composer install --ignore-platform-reqs + + - name: Get Drupal Dockerizer repository + uses: actions/checkout@v2 + with: + path: '.drupal-dockerizer' + + - name: Create basic drupal-dockerizer.yml for php7.4-apache + run: | + echo "---" > drupal-dockerizer.yml + echo "" >> drupal-dockerizer.yml + echo "compose_project_name: drupal-project" >> drupal-dockerizer.yml + echo "user_uid: $(id -u)" >> drupal-dockerizer.yml + echo "user_gid: $(id -g)" >> drupal-dockerizer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml + echo "expose_http_port: 80" >> drupal-dockerizer.yml + echo "php_image: php7.4-apache" + + - name: Build php apache 7.4 container + run: docker build -t php7.4-apache - < .drupal-dockerizer/images/php-apache/7.4-apache.Dockerfile + + - name: Run main playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: main.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Run drush-commands playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: drush-commands.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Check Drupal on php 7.4 version + run: curl http://localhost | grep "Drupal" + + - name: Create basic drupal-dockerizer.yml for php7.3-apache + run: | + echo "---" > drupal-dockerizer.yml + echo "" >> drupal-dockerizer.yml + echo "compose_project_name: drupal-project" >> drupal-dockerizer.yml + echo "user_uid: $(id -u)" >> drupal-dockerizer.yml + echo "user_gid: $(id -g)" >> drupal-dockerizer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml + echo "expose_http_port: 80" >> drupal-dockerizer.yml + echo "php_image: php7.3-apache" + + - name: Build php apache 7.3 container + run: docker build -t php7.3-apache - < .drupal-dockerizer/images/php-apache/7.3-apache.Dockerfile + + - name: Run main playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: main.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Check Drupal on php 7.3 version + run: curl http://localhost | grep "Drupal" diff --git a/.github/workflows/test_db_import.yml b/.github/workflows/test_db_import.yml index 27e9bf8..c8439dc 100644 --- a/.github/workflows/test_db_import.yml +++ b/.github/workflows/test_db_import.yml @@ -60,10 +60,10 @@ jobs: --verbose - name: Change site name by Drush - run: docker exec drupal-project-7.4-develop drush cset system.site name DrupalDump -y + run: docker exec drupal-project-webserver drush cset system.site name DrupalDump -y - name: Dump database from Drupal - run: docker exec drupal-project-7.4-develop drush sql:dump --result-file=dump.sql + run: docker exec drupal-project-webserver drush sql:dump --result-file=dump.sql - name: Destroy containers and runtime uses: dawidd6/action-ansible-playbook@v2 @@ -91,5 +91,5 @@ jobs: - name: Check that import is OK and site name is DrupalDump run: | - result="`docker exec drupal-project-7.4-develop drush cget system.site name --format=string`" + result="`docker exec drupal-project-webserver drush cget system.site name --format=string`" if [[ "$result" == "DrupalDump" ]]; then echo "Import DB is OK"; exit 0; else echo "Import db not correct"; exit 1; fi diff --git a/.github/workflows/test_memcache.yml b/.github/workflows/test_memcache.yml index 1749b15..5271eaa 100644 --- a/.github/workflows/test_memcache.yml +++ b/.github/workflows/test_memcache.yml @@ -62,7 +62,7 @@ jobs: --verbose - name: Enable memcache in database - run: docker exec drupal-project-7.4-develop drush en memcache memcache_admin -y + run: docker exec drupal-project-webserver drush en memcache memcache_admin -y - name: Stop containers uses: dawidd6/action-ansible-playbook@v2 diff --git a/README.md b/README.md index 42963c9..36d5915 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,7 @@ After resetting your environment you have to run `main.yml` playbook again to sp Plese, run `docker ps` to see your Docker container names. ```bash -docker exec drupal9-7.4-develop drush status +docker exec drupal9-webserver drush status ``` ### How to access log files diff --git a/default.config.yml b/default.config.yml index ef871d5..2b745ec 100644 --- a/default.config.yml +++ b/default.config.yml @@ -23,16 +23,18 @@ ssl_enabled: false ssl_cert_path: /var/data/ssl/fullchain.pem ssl_key_path: /var/data/ssl/privkey.pem -# Look at available options here: https://hub.docker.com/r/jetdevteam/drupal-php-apache/tags?page=1&ordering=last_updated -phpversion: php7.4-apache--2 +# Look at available options here: https://hub.docker.com/r/jetdevteam/drupal-dockerizer/tags?page=1&ordering=last_updated +php_image: jetdevteam/drupal-dockerizer:php7.4-apache--2 +php_memory_limit: 512M docker_network_gateway_ip: domain_name: drupal.devel # Enviroment variable for php xdebug extensions +xdebug_install: false xdebug_enviroment: > remote_enable=1 - remote_connect_back=1 + remote_connect_back=0 remote_port=9008 remote_host={{ docker_network_gateway_ip }} show_error_trace=0 diff --git a/containers/php-apache/7.1.Dockerfile b/images/php-apache/7.1-apache.Dockerfile similarity index 90% rename from containers/php-apache/7.1.Dockerfile rename to images/php-apache/7.1-apache.Dockerfile index aa042bc..17ae3a9 100644 --- a/containers/php-apache/7.1.Dockerfile +++ b/images/php-apache/7.1-apache.Dockerfile @@ -58,6 +58,12 @@ RUN docker-php-ext-enable memcached && \ docker-php-ext-enable imagick && \ docker-php-ext-enable apcu +# Opcache enviroment +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ + PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \ + PHP_OPCACHE_MEMORY_CONSUMPTION="192" \ + PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" + # Install php modulues RUN docker-php-ext-install pdo_mysql && \ docker-php-ext-install opcache && \ @@ -75,8 +81,8 @@ RUN docker-php-ext-install pdo_mysql && \ docker-php-ext-install exif # Install Freetype -RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ - docker-php-ext-install -j$(nproc) gd +RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg && \ + docker-php-ext-install gd # Enable apache modules RUN a2enmod rewrite headers diff --git a/images/php-apache/7.2-apache.Dockerfile b/images/php-apache/7.2-apache.Dockerfile new file mode 100644 index 0000000..db57655 --- /dev/null +++ b/images/php-apache/7.2-apache.Dockerfile @@ -0,0 +1,107 @@ +FROM php:7.2-apache + +# Surpresses debconf complaints of trying to install apt packages interactively +# https://github.com/moby/moby/issues/4032#issuecomment-192327844 + +ARG DEBIAN_FRONTEND=noninteractive + +# Install useful tools and install important libaries +RUN apt-get -y update && \ + apt-get -y --no-install-recommends --fix-missing install zsh git vim nano wget sudo\ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + libmagickwand-dev \ + dialog \ + libsqlite3-dev \ + libsqlite3-0 \ + default-mysql-client \ + zlib1g-dev \ + libzip-dev \ + libicu-dev \ + apt-utils \ + build-essential \ + git \ + curl \ + libmemcached-dev \ + libonig-dev \ + libcurl4 \ + libcurl4-openssl-dev \ + zip \ + openssl \ + libxml2-dev + +# Clear Apt +RUN rm -rf /var/lib/apt/lists/* + +# Update pecl +RUN pecl channel-update pecl.php.net + +# Install pecl modules +RUN pecl install \ + imagick \ + memcached \ + apcu-5.1.19 + +# Configure uploadprogress +RUN git clone https://github.com/php/pecl-php-uploadprogress/ /usr/src/php/ext/uploadprogress/ && \ + docker-php-ext-configure uploadprogress + +# Enable php modules +RUN docker-php-ext-enable memcached && \ + docker-php-ext-enable imagick && \ + docker-php-ext-enable apcu + +# Opcache enviroment +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ + PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \ + PHP_OPCACHE_MEMORY_CONSUMPTION="192" \ + PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" + +# Install php modulues +RUN docker-php-ext-install pdo_mysql && \ + docker-php-ext-install opcache && \ + docker-php-ext-install uploadprogress && \ + docker-php-ext-install pdo_sqlite && \ + docker-php-ext-install soap && \ + docker-php-ext-install mysqli && \ + docker-php-ext-install curl && \ + docker-php-ext-install tokenizer && \ + docker-php-ext-install json && \ + docker-php-ext-install zip && \ + docker-php-ext-install -j$(nproc) intl && \ + docker-php-ext-install mbstring && \ + docker-php-ext-install gettext && \ + docker-php-ext-install exif + +# Install Freetype +RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg && \ + docker-php-ext-install gd + +# Enable apache modules +RUN a2enmod rewrite headers +RUN a2enmod ssl + +# Install composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +# Cleanup +RUN rm -rf /usr/src/* + +# Create dockerizer user +RUN useradd -ms /bin/bash dockerizer +RUN groupmod --gid 1000 dockerizer && usermod --uid 1000 --gid 1000 dockerizer + +RUN chmod +x /usr/local/bin/docker-php-entrypoint + +RUN chown -R dockerizer:dockerizer /var/www + +RUN echo dockerizer ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/dockerizer +RUN chmod 0440 /etc/sudoers.d/dockerizer + +ENV APACHE_RUN_USER dockerizer +ENV APACHE_RUN_GROUP dockerizer + + + + diff --git a/images/php-apache/7.3-apache.Dockerfile b/images/php-apache/7.3-apache.Dockerfile new file mode 100644 index 0000000..b8056dd --- /dev/null +++ b/images/php-apache/7.3-apache.Dockerfile @@ -0,0 +1,107 @@ +FROM php:7.3-apache + +# Surpresses debconf complaints of trying to install apt packages interactively +# https://github.com/moby/moby/issues/4032#issuecomment-192327844 + +ARG DEBIAN_FRONTEND=noninteractive + +# Install useful tools and install important libaries +RUN apt-get -y update && \ + apt-get -y --no-install-recommends --fix-missing install zsh git vim nano wget sudo\ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + libmagickwand-dev \ + dialog \ + libsqlite3-dev \ + libsqlite3-0 \ + default-mysql-client \ + zlib1g-dev \ + libzip-dev \ + libicu-dev \ + apt-utils \ + build-essential \ + git \ + curl \ + libmemcached-dev \ + libonig-dev \ + libcurl4 \ + libcurl4-openssl-dev \ + zip \ + openssl \ + libxml2-dev + +# Clear Apt +RUN rm -rf /var/lib/apt/lists/* + +# Update pecl +RUN pecl channel-update pecl.php.net + +# Install pecl modules +RUN pecl install \ + imagick \ + memcached \ + apcu-5.1.19 + +# Configure uploadprogress +RUN git clone https://github.com/php/pecl-php-uploadprogress/ /usr/src/php/ext/uploadprogress/ && \ + docker-php-ext-configure uploadprogress + +# Enable php modules +RUN docker-php-ext-enable memcached && \ + docker-php-ext-enable imagick && \ + docker-php-ext-enable apcu + +# Opcache enviroment +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ + PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \ + PHP_OPCACHE_MEMORY_CONSUMPTION="192" \ + PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" + +# Install php modulues +RUN docker-php-ext-install pdo_mysql && \ + docker-php-ext-install opcache && \ + docker-php-ext-install uploadprogress && \ + docker-php-ext-install pdo_sqlite && \ + docker-php-ext-install soap && \ + docker-php-ext-install mysqli && \ + docker-php-ext-install curl && \ + docker-php-ext-install tokenizer && \ + docker-php-ext-install json && \ + docker-php-ext-install zip && \ + docker-php-ext-install -j$(nproc) intl && \ + docker-php-ext-install mbstring && \ + docker-php-ext-install gettext && \ + docker-php-ext-install exif + +# Install Freetype +RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg && \ + docker-php-ext-install gd + +# Enable apache modules +RUN a2enmod rewrite headers +RUN a2enmod ssl + +# Install composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +# Cleanup +RUN rm -rf /usr/src/* + +# Create dockerizer user +RUN useradd -ms /bin/bash dockerizer +RUN groupmod --gid 1000 dockerizer && usermod --uid 1000 --gid 1000 dockerizer + +RUN chmod +x /usr/local/bin/docker-php-entrypoint + +RUN chown -R dockerizer:dockerizer /var/www + +RUN echo dockerizer ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/dockerizer +RUN chmod 0440 /etc/sudoers.d/dockerizer + +ENV APACHE_RUN_USER dockerizer +ENV APACHE_RUN_GROUP dockerizer + + + + diff --git a/containers/php-apache/7.4.Dockerfile b/images/php-apache/7.4-apache.Dockerfile similarity index 96% rename from containers/php-apache/7.4.Dockerfile rename to images/php-apache/7.4-apache.Dockerfile index b092d63..d4062cb 100644 --- a/containers/php-apache/7.4.Dockerfile +++ b/images/php-apache/7.4-apache.Dockerfile @@ -34,12 +34,6 @@ RUN apt-get -y update && \ # Clear Apt RUN rm -rf /var/lib/apt/lists/* -# Opcache enviroment -ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ - PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \ - PHP_OPCACHE_MEMORY_CONSUMPTION="192" \ - PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" - # Update pecl RUN pecl channel-update pecl.php.net @@ -58,6 +52,12 @@ RUN docker-php-ext-enable memcached && \ docker-php-ext-enable imagick && \ docker-php-ext-enable apcu +# Opcache enviroment +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ + PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \ + PHP_OPCACHE_MEMORY_CONSUMPTION="192" \ + PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" + # Install php modulues RUN docker-php-ext-install pdo_mysql && \ docker-php-ext-install opcache && \ @@ -85,9 +85,6 @@ RUN a2enmod ssl # Install composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -# Set memory limit -RUN echo "memory_limit = 512M" >> /usr/local/etc/php/conf.d/memory_limit.ini - # Cleanup RUN rm -rf /usr/src/* @@ -104,3 +101,7 @@ RUN chmod 0440 /etc/sudoers.d/dockerizer ENV APACHE_RUN_USER dockerizer ENV APACHE_RUN_GROUP dockerizer + + + + diff --git a/tasks/drush-command.yml b/tasks/drush-command.yml index 8dda452..41e802e 100644 --- a/tasks/drush-command.yml +++ b/tasks/drush-command.yml @@ -2,12 +2,12 @@ - name: Add Drush as inventory host. add_host: - name: "{{ compose_project_name }}-{{ phpversion }}" + name: "{{ compose_project_name }}-webserver" ansible_connection: docker changed_when: false - name: Run command in container. - delegate_to: "{{ compose_project_name }}-{{ phpversion }}" + delegate_to: "{{ compose_project_name }}-webserver" become: no raw: "drush -vy {{item}}" loop: "{{ drush_commands }}" diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 6529fc0..7792d4e 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -18,7 +18,7 @@ services: webserver: build: context: ./bin/php/ - container_name: '{{ compose_project_name }}-{{ phpversion }}' + container_name: '{{ compose_project_name }}-webserver' restart: 'always' working_dir: /var/www/{{ drupal_web_root }} sysctls: diff --git a/templates/php.Dockerfile.j2 b/templates/php.Dockerfile.j2 index dff4b7a..8cb7cb6 100644 --- a/templates/php.Dockerfile.j2 +++ b/templates/php.Dockerfile.j2 @@ -1,14 +1,23 @@ -FROM jetdevteam/drupal-php-apache:{{ phpversion }} +FROM {{ php_image }} -{% if user_uid == 0 %} -USER root -{% else %} USER root + +# Set php memory limit +RUN echo "memory_limit = {{ php_memory_limit }}" >> /usr/local/etc/php/conf.d/memory_limit.ini + +# Enable apcu in cofig +RUN echo "apc.enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini + +{% if xdebug_install %} +# Install xdebug +RUN pecl install xdebug-2.8.0 +RUN docker-php-ext-enable xdebug +{% endif %} + ARG USER_UID={{ user_uid }} ARG USER_GID={{ user_gid }} RUN groupmod --gid $USER_GID dockerizer && usermod --uid $USER_UID --gid $USER_GID dockerizer -USER dockerizer -{% endif %} +RUN chown -R dockerizer:dockerizer /var/www {% if drush_version == 8 %} RUN sudo curl -fsSL -o /usr/local/bin/drush "https://github.com/drush-ops/drush/releases/download/8.4.1/drush.phar" && \ @@ -17,3 +26,6 @@ RUN sudo curl -fsSL -o /usr/local/bin/drush "https://github.com/drush-ops/drush/ RUN sudo curl -fsSL -o /usr/local/bin/drush "https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar" && \ sudo chmod +x /usr/local/bin/drush {% endif %} + +USER dockerizer + From 93f0f6b3578fbf4e968a6bf5d69a5e2d6e4bb322 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 11:29:28 +0300 Subject: [PATCH 161/228] fix test containers --- .github/workflows/test_build_container.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_build_container.yml b/.github/workflows/test_build_container.yml index d246aac..142ac2d 100644 --- a/.github/workflows/test_build_container.yml +++ b/.github/workflows/test_build_container.yml @@ -1,4 +1,4 @@ -name: Check basic functionality +name: Check php container build on: pull_request: @@ -8,7 +8,7 @@ on: workflow_dispatch: jobs: - test: + test_container_build: runs-on: ubuntu-20.04 steps: - name: Cache Composer dependencies for improve speed From eba131737df0f8df982eaf860f969bdff8682d68 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 11:36:40 +0300 Subject: [PATCH 162/228] Fix test images --- .github/workflows/test_build_container.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_build_container.yml b/.github/workflows/test_build_container.yml index 142ac2d..5241275 100644 --- a/.github/workflows/test_build_container.yml +++ b/.github/workflows/test_build_container.yml @@ -41,7 +41,7 @@ jobs: echo "user_gid: $(id -g)" >> drupal-dockerizer.yml echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml echo "expose_http_port: 80" >> drupal-dockerizer.yml - echo "php_image: php7.4-apache" + echo "php_image: php7.4-apache" >> drupal-dockerizer.yml - name: Build php apache 7.4 container run: docker build -t php7.4-apache - < .drupal-dockerizer/images/php-apache/7.4-apache.Dockerfile @@ -74,7 +74,7 @@ jobs: echo "user_gid: $(id -g)" >> drupal-dockerizer.yml echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml echo "expose_http_port: 80" >> drupal-dockerizer.yml - echo "php_image: php7.3-apache" + echo "php_image: php7.3-apache" >> drupal-dockerizer.yml - name: Build php apache 7.3 container run: docker build -t php7.3-apache - < .drupal-dockerizer/images/php-apache/7.3-apache.Dockerfile From 48b1d48538128c38ae6563a8dd6bbdd7d29a4463 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 11:37:16 +0300 Subject: [PATCH 163/228] Rename test --- .github/workflows/test_build_container.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_build_container.yml b/.github/workflows/test_build_container.yml index 5241275..335505b 100644 --- a/.github/workflows/test_build_container.yml +++ b/.github/workflows/test_build_container.yml @@ -1,4 +1,4 @@ -name: Check php container build +name: Check php images build on: pull_request: @@ -8,7 +8,7 @@ on: workflow_dispatch: jobs: - test_container_build: + test_images_build: runs-on: ubuntu-20.04 steps: - name: Cache Composer dependencies for improve speed From 38aa2e17baaa9367ab04922ab68e27faffc4fa9b Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 11:38:20 +0300 Subject: [PATCH 164/228] Rename container to image --- .../{test_build_container.yml => test_build_php_images.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{test_build_container.yml => test_build_php_images.yml} (97%) diff --git a/.github/workflows/test_build_container.yml b/.github/workflows/test_build_php_images.yml similarity index 97% rename from .github/workflows/test_build_container.yml rename to .github/workflows/test_build_php_images.yml index 335505b..c43f838 100644 --- a/.github/workflows/test_build_container.yml +++ b/.github/workflows/test_build_php_images.yml @@ -43,7 +43,7 @@ jobs: echo "expose_http_port: 80" >> drupal-dockerizer.yml echo "php_image: php7.4-apache" >> drupal-dockerizer.yml - - name: Build php apache 7.4 container + - name: Build php apache 7.4 image run: docker build -t php7.4-apache - < .drupal-dockerizer/images/php-apache/7.4-apache.Dockerfile - name: Run main playbook @@ -76,7 +76,7 @@ jobs: echo "expose_http_port: 80" >> drupal-dockerizer.yml echo "php_image: php7.3-apache" >> drupal-dockerizer.yml - - name: Build php apache 7.3 container + - name: Build php apache 7.3 image run: docker build -t php7.3-apache - < .drupal-dockerizer/images/php-apache/7.3-apache.Dockerfile - name: Run main playbook From 986a00a0c23b78c138e233be22b026b8f0c83fec Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 11:48:05 +0300 Subject: [PATCH 165/228] Check xdebug_install in docker-compose --- templates/docker-compose.yml.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 7792d4e..42ccb51 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -50,8 +50,10 @@ services: - {{ ssl_key_path }}:/etc/apache2/pivate.key{{ ":cached" if docker_cached_volume }} {% endif %} - ${LOG_DIR-./logs/apache2}:/var/log/apache2{{ ":cached" if docker_cached_volume }} +{% if xdebug_install %} environment: XDEBUG_CONFIG: "{{ xdebug_enviroment }}" +{% endif %} {% if docker_network_gateway_ip is not none %} networks: {{ compose_project_name }}-network: From 2b6f7a483de74cf32a6e6676f2d36df21767aca4 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 11:51:16 +0300 Subject: [PATCH 166/228] Fix gd installation for php <= 7.3 --- images/php-apache/7.1-apache.Dockerfile | 4 ++-- images/php-apache/7.2-apache.Dockerfile | 4 ++-- images/php-apache/7.3-apache.Dockerfile | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/images/php-apache/7.1-apache.Dockerfile b/images/php-apache/7.1-apache.Dockerfile index 17ae3a9..fdf9873 100644 --- a/images/php-apache/7.1-apache.Dockerfile +++ b/images/php-apache/7.1-apache.Dockerfile @@ -81,8 +81,8 @@ RUN docker-php-ext-install pdo_mysql && \ docker-php-ext-install exif # Install Freetype -RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg && \ - docker-php-ext-install gd +RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ + docker-php-ext-install -j$(nproc) gd # Enable apache modules RUN a2enmod rewrite headers diff --git a/images/php-apache/7.2-apache.Dockerfile b/images/php-apache/7.2-apache.Dockerfile index db57655..13100d4 100644 --- a/images/php-apache/7.2-apache.Dockerfile +++ b/images/php-apache/7.2-apache.Dockerfile @@ -75,8 +75,8 @@ RUN docker-php-ext-install pdo_mysql && \ docker-php-ext-install exif # Install Freetype -RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg && \ - docker-php-ext-install gd +RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ + docker-php-ext-install -j$(nproc) gd # Enable apache modules RUN a2enmod rewrite headers diff --git a/images/php-apache/7.3-apache.Dockerfile b/images/php-apache/7.3-apache.Dockerfile index b8056dd..9007509 100644 --- a/images/php-apache/7.3-apache.Dockerfile +++ b/images/php-apache/7.3-apache.Dockerfile @@ -75,8 +75,8 @@ RUN docker-php-ext-install pdo_mysql && \ docker-php-ext-install exif # Install Freetype -RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg && \ - docker-php-ext-install gd +RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ + docker-php-ext-install -j$(nproc) gd # Enable apache modules RUN a2enmod rewrite headers From 01f16be585107b27fb777d11046260fac7835874 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 12:06:07 +0300 Subject: [PATCH 167/228] Move dockerizer user creation to docker-compose build step --- images/php-apache/7.1-apache.Dockerfile | 14 -------------- images/php-apache/7.2-apache.Dockerfile | 18 ------------------ images/php-apache/7.3-apache.Dockerfile | 18 ------------------ images/php-apache/7.4-apache.Dockerfile | 18 ------------------ templates/php.Dockerfile.j2 | 21 ++++++++++++++++----- 5 files changed, 16 insertions(+), 73 deletions(-) diff --git a/images/php-apache/7.1-apache.Dockerfile b/images/php-apache/7.1-apache.Dockerfile index fdf9873..090877d 100644 --- a/images/php-apache/7.1-apache.Dockerfile +++ b/images/php-apache/7.1-apache.Dockerfile @@ -99,17 +99,3 @@ RUN echo "apc.enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini # Cleanup RUN rm -rf /usr/src/* - -# Create dockerizer user -RUN useradd -ms /bin/bash dockerizer -RUN groupmod --gid 1000 dockerizer && usermod --uid 1000 --gid 1000 dockerizer - -RUN chmod +x /usr/local/bin/docker-php-entrypoint - -RUN chown -R dockerizer:dockerizer /var/www - -RUN echo dockerizer ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/dockerizer -RUN chmod 0440 /etc/sudoers.d/dockerizer - -ENV APACHE_RUN_USER dockerizer -ENV APACHE_RUN_GROUP dockerizer diff --git a/images/php-apache/7.2-apache.Dockerfile b/images/php-apache/7.2-apache.Dockerfile index 13100d4..696358e 100644 --- a/images/php-apache/7.2-apache.Dockerfile +++ b/images/php-apache/7.2-apache.Dockerfile @@ -87,21 +87,3 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local # Cleanup RUN rm -rf /usr/src/* - -# Create dockerizer user -RUN useradd -ms /bin/bash dockerizer -RUN groupmod --gid 1000 dockerizer && usermod --uid 1000 --gid 1000 dockerizer - -RUN chmod +x /usr/local/bin/docker-php-entrypoint - -RUN chown -R dockerizer:dockerizer /var/www - -RUN echo dockerizer ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/dockerizer -RUN chmod 0440 /etc/sudoers.d/dockerizer - -ENV APACHE_RUN_USER dockerizer -ENV APACHE_RUN_GROUP dockerizer - - - - diff --git a/images/php-apache/7.3-apache.Dockerfile b/images/php-apache/7.3-apache.Dockerfile index 9007509..fbf989e 100644 --- a/images/php-apache/7.3-apache.Dockerfile +++ b/images/php-apache/7.3-apache.Dockerfile @@ -87,21 +87,3 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local # Cleanup RUN rm -rf /usr/src/* - -# Create dockerizer user -RUN useradd -ms /bin/bash dockerizer -RUN groupmod --gid 1000 dockerizer && usermod --uid 1000 --gid 1000 dockerizer - -RUN chmod +x /usr/local/bin/docker-php-entrypoint - -RUN chown -R dockerizer:dockerizer /var/www - -RUN echo dockerizer ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/dockerizer -RUN chmod 0440 /etc/sudoers.d/dockerizer - -ENV APACHE_RUN_USER dockerizer -ENV APACHE_RUN_GROUP dockerizer - - - - diff --git a/images/php-apache/7.4-apache.Dockerfile b/images/php-apache/7.4-apache.Dockerfile index d4062cb..38465eb 100644 --- a/images/php-apache/7.4-apache.Dockerfile +++ b/images/php-apache/7.4-apache.Dockerfile @@ -87,21 +87,3 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local # Cleanup RUN rm -rf /usr/src/* - -# Create dockerizer user -RUN useradd -ms /bin/bash dockerizer -RUN groupmod --gid 1000 dockerizer && usermod --uid 1000 --gid 1000 dockerizer - -RUN chmod +x /usr/local/bin/docker-php-entrypoint - -RUN chown -R dockerizer:dockerizer /var/www - -RUN echo dockerizer ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/dockerizer -RUN chmod 0440 /etc/sudoers.d/dockerizer - -ENV APACHE_RUN_USER dockerizer -ENV APACHE_RUN_GROUP dockerizer - - - - diff --git a/templates/php.Dockerfile.j2 b/templates/php.Dockerfile.j2 index 8cb7cb6..91fe255 100644 --- a/templates/php.Dockerfile.j2 +++ b/templates/php.Dockerfile.j2 @@ -2,6 +2,22 @@ FROM {{ php_image }} USER root +# Create dockerizer user +ARG USER_UID={{ user_uid }} +ARG USER_GID={{ user_gid }} +RUN useradd -ms /bin/bash dockerizer +RUN groupmod --gid $USER_GID dockerizer && usermod --uid $USER_UID --gid $USER_GID dockerizer + +RUN chmod +x /usr/local/bin/docker-php-entrypoint + +RUN chown -R dockerizer:dockerizer /var/www + +RUN echo dockerizer ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/dockerizer +RUN chmod 0440 /etc/sudoers.d/dockerizer + +ENV APACHE_RUN_USER dockerizer +ENV APACHE_RUN_GROUP dockerizer + # Set php memory limit RUN echo "memory_limit = {{ php_memory_limit }}" >> /usr/local/etc/php/conf.d/memory_limit.ini @@ -14,11 +30,6 @@ RUN pecl install xdebug-2.8.0 RUN docker-php-ext-enable xdebug {% endif %} -ARG USER_UID={{ user_uid }} -ARG USER_GID={{ user_gid }} -RUN groupmod --gid $USER_GID dockerizer && usermod --uid $USER_UID --gid $USER_GID dockerizer -RUN chown -R dockerizer:dockerizer /var/www - {% if drush_version == 8 %} RUN sudo curl -fsSL -o /usr/local/bin/drush "https://github.com/drush-ops/drush/releases/download/8.4.1/drush.phar" && \ sudo chmod +x /usr/local/bin/drush From 876370990c393d372e60545e431895e1aed069ae Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 12:44:19 +0300 Subject: [PATCH 168/228] add php 8.0 --- images/php-apache/8.0-apache.Dockerfile | 82 +++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 images/php-apache/8.0-apache.Dockerfile diff --git a/images/php-apache/8.0-apache.Dockerfile b/images/php-apache/8.0-apache.Dockerfile new file mode 100644 index 0000000..33bc1aa --- /dev/null +++ b/images/php-apache/8.0-apache.Dockerfile @@ -0,0 +1,82 @@ +FROM php:8.0-apache + +# Surpresses debconf complaints of trying to install apt packages interactively +# https://github.com/moby/moby/issues/4032#issuecomment-192327844 + +# Upload progress not work in php-8.0 for now. + +ARG DEBIAN_FRONTEND=noninteractive + +# Install useful tools and install important libaries +RUN apt-get -y update && \ + apt-get -y --no-install-recommends --fix-missing install vim nano wget sudo\ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + libmagickwand-dev \ + dialog \ + libsqlite3-dev \ + libsqlite3-0 \ + default-mysql-client \ + zlib1g-dev \ + libzip-dev \ + libicu-dev \ + apt-utils \ + build-essential \ + git \ + curl \ + libmemcached-dev \ + libonig-dev \ + libcurl4 \ + libcurl4-openssl-dev \ + zip \ + openssl \ + libxml2-dev \ + imagemagick + +# Clear Apt +RUN rm -rf /var/lib/apt/lists/* + +# Opcache enviroment +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ + PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \ + PHP_OPCACHE_MEMORY_CONSUMPTION="192" \ + PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" + +# Update pecl +RUN pecl channel-update pecl.php.net + +# Install pecl modules +RUN pecl install \ + memcached \ + apcu + +RUN git clone https://github.com/Imagick/imagick/ /usr/src/php/ext/imagick/ && \ + docker-php-ext-configure imagick + +# Enable php modules +RUN docker-php-ext-enable memcached && \ + docker-php-ext-enable apcu + +# Install php modulues +RUN docker-php-ext-install pdo_mysql && \ + docker-php-ext-install opcache && \ + docker-php-ext-install imagick && \ + docker-php-ext-install soap && \ + docker-php-ext-install mysqli && \ + docker-php-ext-install gettext && \ + docker-php-ext-install exif + +# Install Freetype +RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg && \ + docker-php-ext-install gd + +# Enable apache modules +RUN a2enmod rewrite headers +RUN a2enmod ssl + +# Install composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +# Cleanup +RUN rm -rf /usr/src/* From e3bebf9e94b45d4eb020fdc710218eb4a927fbc6 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 12:55:00 +0300 Subject: [PATCH 169/228] Add matrix to test --- .github/workflows/test_build_php_images.yml | 35 +++++---------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index c43f838..e244852 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -10,6 +10,9 @@ on: jobs: test_images_build: runs-on: ubuntu-20.04 + strategy: + matrix: + php_version: [7.1, 7.2, 7.3, 7.4, 8.0] steps: - name: Cache Composer dependencies for improve speed uses: actions/cache@v2 @@ -32,7 +35,7 @@ jobs: with: path: '.drupal-dockerizer' - - name: Create basic drupal-dockerizer.yml for php7.4-apache + - name: Create basic drupal-dockerizer.yml for php{{ php_version }}-apache run: | echo "---" > drupal-dockerizer.yml echo "" >> drupal-dockerizer.yml @@ -41,10 +44,10 @@ jobs: echo "user_gid: $(id -g)" >> drupal-dockerizer.yml echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml echo "expose_http_port: 80" >> drupal-dockerizer.yml - echo "php_image: php7.4-apache" >> drupal-dockerizer.yml + echo "php_image: php{{ php_version }}-apache" >> drupal-dockerizer.yml - - name: Build php apache 7.4 image - run: docker build -t php7.4-apache - < .drupal-dockerizer/images/php-apache/7.4-apache.Dockerfile + - name: Build php apache {{ php_version }} image + run: docker build -t php{{ php_version }}-apache - < .drupal-dockerizer/images/php-apache/{{ php_version }}-apache.Dockerfile - name: Run main playbook uses: dawidd6/action-ansible-playbook@v2 @@ -62,30 +65,8 @@ jobs: options: | --verbose - - name: Check Drupal on php 7.4 version + - name: Check Drupal on php {{ php_version }} version run: curl http://localhost | grep "Drupal" - - name: Create basic drupal-dockerizer.yml for php7.3-apache - run: | - echo "---" > drupal-dockerizer.yml - echo "" >> drupal-dockerizer.yml - echo "compose_project_name: drupal-project" >> drupal-dockerizer.yml - echo "user_uid: $(id -u)" >> drupal-dockerizer.yml - echo "user_gid: $(id -g)" >> drupal-dockerizer.yml - echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml - echo "expose_http_port: 80" >> drupal-dockerizer.yml - echo "php_image: php7.3-apache" >> drupal-dockerizer.yml - - - name: Build php apache 7.3 image - run: docker build -t php7.3-apache - < .drupal-dockerizer/images/php-apache/7.3-apache.Dockerfile - - - name: Run main playbook - uses: dawidd6/action-ansible-playbook@v2 - with: - playbook: main.yml - directory: .drupal-dockerizer - options: | - --verbose - - name: Check Drupal on php 7.3 version run: curl http://localhost | grep "Drupal" From 6d274e5b607fb81d7d1d52285ce624e5e6005709 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 12:57:35 +0300 Subject: [PATCH 170/228] Add matrix --- .github/workflows/test_build_php_images.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index e244852..e08e9da 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -35,7 +35,7 @@ jobs: with: path: '.drupal-dockerizer' - - name: Create basic drupal-dockerizer.yml for php{{ php_version }}-apache + - name: Create basic drupal-dockerizer.yml for php{{ matrix.php_version }}-apache run: | echo "---" > drupal-dockerizer.yml echo "" >> drupal-dockerizer.yml @@ -44,10 +44,10 @@ jobs: echo "user_gid: $(id -g)" >> drupal-dockerizer.yml echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml echo "expose_http_port: 80" >> drupal-dockerizer.yml - echo "php_image: php{{ php_version }}-apache" >> drupal-dockerizer.yml + echo "php_image: php{{ matrix.php_version }}-apache" >> drupal-dockerizer.yml - - name: Build php apache {{ php_version }} image - run: docker build -t php{{ php_version }}-apache - < .drupal-dockerizer/images/php-apache/{{ php_version }}-apache.Dockerfile + - name: Build php apache {{ matrix.php_version }} image + run: docker build -t php{{ matrix.php_version }}-apache - < .drupal-dockerizer/images/php-apache/{{ matrix.php_version }}-apache.Dockerfile - name: Run main playbook uses: dawidd6/action-ansible-playbook@v2 @@ -65,8 +65,6 @@ jobs: options: | --verbose - - name: Check Drupal on php {{ php_version }} version + - name: Check Drupal on php {{ matrix.php_version }} version run: curl http://localhost | grep "Drupal" - - name: Check Drupal on php 7.3 version - run: curl http://localhost | grep "Drupal" From 8ef978b364ded3c5bfe2a427b17ded3e5f8abd90 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 13:01:38 +0300 Subject: [PATCH 171/228] Fix for matrix --- .github/workflows/test_build_php_images.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index e08e9da..e874878 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -35,7 +35,9 @@ jobs: with: path: '.drupal-dockerizer' - - name: Create basic drupal-dockerizer.yml for php{{ matrix.php_version }}-apache + - name: Create basic drupal-dockerizer.yml for php${{ matrix.php_version }}-apache + env: + PHP_VERSION: ${{ matrix.php_version }} run: | echo "---" > drupal-dockerizer.yml echo "" >> drupal-dockerizer.yml @@ -44,10 +46,12 @@ jobs: echo "user_gid: $(id -g)" >> drupal-dockerizer.yml echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml echo "expose_http_port: 80" >> drupal-dockerizer.yml - echo "php_image: php{{ matrix.php_version }}-apache" >> drupal-dockerizer.yml + echo "php_image: php$PHP_VERSION-apache" >> drupal-dockerizer.yml - name: Build php apache {{ matrix.php_version }} image - run: docker build -t php{{ matrix.php_version }}-apache - < .drupal-dockerizer/images/php-apache/{{ matrix.php_version }}-apache.Dockerfile + env: + PHP_VERSION: ${{ matrix.php_version }} + run: docker build -t php$PHP_VERSION-apache - < .drupal-dockerizer/images/php-apache/$PHP_VERSION-apache.Dockerfile - name: Run main playbook uses: dawidd6/action-ansible-playbook@v2 @@ -65,6 +69,6 @@ jobs: options: | --verbose - - name: Check Drupal on php {{ matrix.php_version }} version + - name: Check Drupal on php ${{ matrix.php_version }} version run: curl http://localhost | grep "Drupal" From 536fa02ec4b2d6a85a41514aa1265e22dd8b71e7 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 13:05:41 +0300 Subject: [PATCH 172/228] Small fix --- .github/workflows/test_build_php_images.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index e874878..a804362 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - php_version: [7.1, 7.2, 7.3, 7.4, 8.0] + php_version: ['7.1', '7.2', '7.3', '7.4', '8.0'] steps: - name: Cache Composer dependencies for improve speed uses: actions/cache@v2 @@ -48,7 +48,7 @@ jobs: echo "expose_http_port: 80" >> drupal-dockerizer.yml echo "php_image: php$PHP_VERSION-apache" >> drupal-dockerizer.yml - - name: Build php apache {{ matrix.php_version }} image + - name: Build php apache ${{ matrix.php_version }} image env: PHP_VERSION: ${{ matrix.php_version }} run: docker build -t php$PHP_VERSION-apache - < .drupal-dockerizer/images/php-apache/$PHP_VERSION-apache.Dockerfile From dd78d455a848ce56c84d7607df5090f13aa3ed46 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 13:27:28 +0300 Subject: [PATCH 173/228] Add drupal versions to matrix strategy --- .github/workflows/test_build_php_images.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index a804362..fb8c418 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -12,7 +12,17 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - php_version: ['7.1', '7.2', '7.3', '7.4', '8.0'] + include: + - php_version: '7.1' + drupal_version: '8.7.x' + - php_version: '7.2' + drupal_version: '8.8.x' + - php_version: '7.3' + drupal_version: '8.9.x' + - php_version: '7.4' + drupal_version: '9.1.x' + - php_version: '8.0' + drupal_version: '9.2.x' steps: - name: Cache Composer dependencies for improve speed uses: actions/cache@v2 @@ -25,7 +35,7 @@ jobs: with: repository: 'drupal/recommended-project' path: './' - ref: '9.2.x' + ref: ${{ matrix.drupal_version }} - name: Run Composer install run: composer install --ignore-platform-reqs From 3ff1fef1076c137ad80d430ddc62fe6114c40fc1 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 13:29:20 +0300 Subject: [PATCH 174/228] small fix --- .github/workflows/test_build_php_images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index fb8c418..c3210d3 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -14,7 +14,7 @@ jobs: matrix: include: - php_version: '7.1' - drupal_version: '8.7.x' + drupal_version: '8.8.x' - php_version: '7.2' drupal_version: '8.8.x' - php_version: '7.3' From 1a2fe24aaa8e077a6f8b804fe1de069229df30c2 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 13:49:43 +0300 Subject: [PATCH 175/228] Use drupal tarball --- .github/workflows/test_build_php_images.yml | 27 +++++++++------------ default.config.yml | 2 ++ templates/php.Dockerfile.j2 | 2 +- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index c3210d3..54a8a59 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -14,15 +14,15 @@ jobs: matrix: include: - php_version: '7.1' - drupal_version: '8.8.x' + drupal_version: '8.5.10' - php_version: '7.2' - drupal_version: '8.8.x' + drupal_version: '8.7.14' - php_version: '7.3' - drupal_version: '8.9.x' + drupal_version: '8.9.14' - php_version: '7.4' - drupal_version: '9.1.x' + drupal_version: '9.1.7' - php_version: '8.0' - drupal_version: '9.2.x' + drupal_version: '9.1.7' steps: - name: Cache Composer dependencies for improve speed uses: actions/cache@v2 @@ -30,15 +30,11 @@ jobs: path: ~/.cache/composer key: ${{ runner.os }}-drupal - - name: Get Drupal Project repository - uses: actions/checkout@v2 - with: - repository: 'drupal/recommended-project' - path: './' - ref: ${{ matrix.drupal_version }} - - - name: Run Composer install - run: composer install --ignore-platform-reqs + - name: Get Drupal tarball + run: | + wget https://ftp.drupal.org/files/projects/drupal-${{ matrix.drupal_version }}.tar.gz + tar xvf drupal-${{ matrix.drupal_version }}.tar.gz + mv drupal-${{ matrix.drupal_version }} drupal-tarball - name: Get Drupal Dockerizer repository uses: actions/checkout@v2 @@ -54,7 +50,8 @@ jobs: echo "compose_project_name: drupal-project" >> drupal-dockerizer.yml echo "user_uid: $(id -u)" >> drupal-dockerizer.yml echo "user_gid: $(id -g)" >> drupal-dockerizer.yml - echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE/drupal-tarball" >> drupal-dockerizer.yml + echo "drupal_web_root: ./" >> drupal-dockerizer.yml echo "expose_http_port: 80" >> drupal-dockerizer.yml echo "php_image: php$PHP_VERSION-apache" >> drupal-dockerizer.yml diff --git a/default.config.yml b/default.config.yml index 2b745ec..2c88fda 100644 --- a/default.config.yml +++ b/default.config.yml @@ -32,6 +32,8 @@ domain_name: drupal.devel # Enviroment variable for php xdebug extensions xdebug_install: false +# Availible versions https://pecl.php.net/package/xdebug +xdebug_version: 2.9.6 xdebug_enviroment: > remote_enable=1 remote_connect_back=0 diff --git a/templates/php.Dockerfile.j2 b/templates/php.Dockerfile.j2 index 91fe255..8dd0af9 100644 --- a/templates/php.Dockerfile.j2 +++ b/templates/php.Dockerfile.j2 @@ -26,7 +26,7 @@ RUN echo "apc.enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini {% if xdebug_install %} # Install xdebug -RUN pecl install xdebug-2.8.0 +RUN pecl install xdebug-{{ xdebug_version }} RUN docker-php-ext-enable xdebug {% endif %} From 04da40bc47ea1ae6482a16ae19681521733ed924 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 14:12:23 +0300 Subject: [PATCH 176/228] Fix drupal version for php 7.1 --- .github/workflows/test_build_php_images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index 54a8a59..8381613 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -14,7 +14,7 @@ jobs: matrix: include: - php_version: '7.1' - drupal_version: '8.5.10' + drupal_version: '8.6.18' - php_version: '7.2' drupal_version: '8.7.14' - php_version: '7.3' From 91264e9a9c159087c3dbdd6140ab743b21e3b47b Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 14:31:20 +0300 Subject: [PATCH 177/228] Fix for old drupal version --- .github/workflows/test_build_php_images.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index 8381613..92ed706 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -54,6 +54,11 @@ jobs: echo "drupal_web_root: ./" >> drupal-dockerizer.yml echo "expose_http_port: 80" >> drupal-dockerizer.yml echo "php_image: php$PHP_VERSION-apache" >> drupal-dockerizer.yml + echo "drush_commands:" >> drupal-dockerizer.yml + echo " - cc drush" >> drupal-dockerizer.yml + echo " - site-install standard install_configure_form.enable_update_status_module=NULL" >> drupal-dockerizer.yml + echo " - cr" >> drupal-dockerizer.yml + - name: Build php apache ${{ matrix.php_version }} image env: From 13d2c740b6d7e2dc2114afa12d52ed70441023e3 Mon Sep 17 00:00:00 2001 From: Vlad Date: Wed, 5 May 2021 14:39:13 +0300 Subject: [PATCH 178/228] Update default.config.yml Co-authored-by: Dima Danylevskyi --- default.config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.config.yml b/default.config.yml index 2c88fda..d58543c 100644 --- a/default.config.yml +++ b/default.config.yml @@ -24,7 +24,7 @@ ssl_cert_path: /var/data/ssl/fullchain.pem ssl_key_path: /var/data/ssl/privkey.pem # Look at available options here: https://hub.docker.com/r/jetdevteam/drupal-dockerizer/tags?page=1&ordering=last_updated -php_image: jetdevteam/drupal-dockerizer:php7.4-apache--2 +php_image: jetdevteam/drupal-dockerizer:php7.4-apache--v2 php_memory_limit: 512M docker_network_gateway_ip: From 1cb588f5d27453e623635cf2ded0e0590be9ee32 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 15:22:35 +0300 Subject: [PATCH 179/228] Rename solr to solr_core --- tasks/solr-core-setup.yml | 2 +- tasks/solr-setup.yml | 8 ++++---- templates/docker-compose.yml.j2 | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tasks/solr-core-setup.yml b/tasks/solr-core-setup.yml index a451fa4..ba8aafa 100644 --- a/tasks/solr-core-setup.yml +++ b/tasks/solr-core-setup.yml @@ -2,6 +2,6 @@ - name: Copy solr core setup. - command: docker cp data/solr {{ compose_project_name }}-solr:/var/solr/data/{{ solr_core_name }} + command: docker cp data/solr_core {{ compose_project_name }}-solr:/var/solr/data/{{ solr_core_name }} args: chdir: "{{ docker_runtime_dir }}" diff --git a/tasks/solr-setup.yml b/tasks/solr-setup.yml index 9648637..a09ab1e 100644 --- a/tasks/solr-setup.yml +++ b/tasks/solr-setup.yml @@ -37,7 +37,7 @@ - name: Create solr data directory file: recurse: yes - path: "{{ docker_runtime_dir }}/data/solr" + path: "{{ docker_runtime_dir }}/data/solr_core" state: directory owner: "{{user_uid|int}}" group: "{{user_gid|int}}" @@ -54,18 +54,18 @@ - name: Ensure Solr Core file is present. template: src: templates/solr.core.j2 - dest: "{{ docker_runtime_dir }}/data/solr/core.properties" + dest: "{{ docker_runtime_dir }}/data/solr_core/core.properties" mode: '644' owner: "{{user_uid|int}}" group: "{{user_gid|int}}" - name: Copy drupal solr config. - command: cp -r "{{ solr_configs_path }}"/. "{{ docker_runtime_dir }}/data/solr/conf" + command: cp -r "{{ solr_configs_path }}"/. "{{ docker_runtime_dir }}/data/solr_core/conf" - name: Check owner for conf dir. file: recurse: yes - path: "{{ docker_runtime_dir }}/data/solr/conf" + path: "{{ docker_runtime_dir }}/data/solr_core/conf" state: directory owner: "{{user_uid|int}}" group: "{{user_gid|int}}" diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index b1e0ad6..e2de2dc 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -97,9 +97,9 @@ services: {% if solr_version == 8 %} - ./data/solr_data:/var/solr {% elif solr_version != 4 %} - - ./data/solr:/opt/solr/server/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} + - ./data/solr_core:/opt/solr/server/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} {% else %} - - ./data/solr:/opt/solr/example/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} + - ./data/solr_core:/opt/solr/example/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} {% endif %} {% if docker_network_gateway_ip is not none %} networks: From 13ab381b64e1a350af1b8e203622f5aa1a32b4e2 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 15:26:56 +0300 Subject: [PATCH 180/228] Fix for test_multiple_env --- .github/workflows/test_multiple_env.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index e4dbfa0..d7f9f4a 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -54,7 +54,7 @@ jobs: --verbose - name: Change site name by Drush for the first environment - run: docker exec drupal-composer-7.4-develop drush cset system.site name DrupalComposer -y + run: docker exec drupal-composer-webserver drush cset system.site name DrupalComposer -y - name: Use Drupal tarball to prepare the second environment run: | @@ -91,7 +91,7 @@ jobs: --verbose - name: Change site name by Drush for the second environment - run: docker exec drupal-tarball-7.4-develop drush cset system.site name DrupalTarball -y + run: docker exec drupal-tarball-webserver drush cset system.site name DrupalTarball -y - name: Check Drupal whether the first environment is up on 8080 port run: curl http://localhost:8080 | grep "DrupalComposer" From ee9ede89c8c4a9d83fcd33602257ba249d0be948 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 15:30:34 +0300 Subject: [PATCH 181/228] fix solr test --- .github/workflows/test_solr.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_solr.yml b/.github/workflows/test_solr.yml index 6115ff5..7cb444d 100644 --- a/.github/workflows/test_solr.yml +++ b/.github/workflows/test_solr.yml @@ -63,16 +63,16 @@ jobs: --verbose - name: Enable search_api and devel_generator in database - run: docker exec drupal-project-7.4-develop drush en devel_generate search_api_solr -y + run: docker exec drupal-project-webserver drush en devel_generate search_api_solr -y - name: Copy Drupal configs for solr run: mkdir web/solr_drupal_configs && cp -R .drupal-dockerizer/.github/data/solr_drupal_configs/* web/solr_drupal_configs/ - name: Import Drupal configs for solr - run: docker exec drupal-project-7.4-develop drush config:import --diff --partial --source=solr_drupal_configs + run: docker exec drupal-project-webserver drush config:import --diff --partial --source=solr_drupal_configs - name: Generate solr config - run: docker exec drupal-project-7.4-develop drush solr-gsc solr config.zip 8.8 + run: docker exec drupal-project-webserver drush solr-gsc solr config.zip 8.8 - name: Unzip solr configuration. run: unzip web/config.zip -d solr_configuration @@ -93,13 +93,13 @@ jobs: run: docker logs drupal-project-solr - name: Generate random nodes - run: docker exec drupal-project-7.4-develop drush devel-generate:content -y + run: docker exec drupal-project-webserver drush devel-generate:content -y - name: Index nodes - run: docker exec drupal-project-7.4-develop drush -vv sapi-i + run: docker exec drupal-project-webserver drush -vv sapi-i - name: Check search indexes works. - run: docker exec drupal-project-7.4-develop drush sapi-search node Dolore + run: docker exec drupal-project-webserver drush sapi-search node Dolore - name: settings.php should have solr config run: cat web/sites/default/settings.php | grep "solr" From 53b1dfb223d367605b54ba87e20624a7c2a9aff9 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 15:39:25 +0300 Subject: [PATCH 182/228] Small fix --- main.yml | 2 +- templates/docker-compose.yml.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.yml b/main.yml index ace5842..2841c4a 100644 --- a/main.yml +++ b/main.yml @@ -50,7 +50,7 @@ - name: Include Solr copy core task include: tasks/solr-core-setup.yml - when: solr + when: solr and solr_version == 8 - name: Include Memcache setup tasks include: tasks/memcache-setup.yml diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index e2de2dc..352ecd2 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -98,7 +98,7 @@ services: - ./data/solr_data:/var/solr {% elif solr_version != 4 %} - ./data/solr_core:/opt/solr/server/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} -{% else %} +{% elif solr_version == 4 %} - ./data/solr_core:/opt/solr/example/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} {% endif %} {% if docker_network_gateway_ip is not none %} From a0a341367b2857922d62de62d80c04a9c791bed1 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 15:44:47 +0300 Subject: [PATCH 183/228] Expose port on test solr --- .github/workflows/test_solr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_solr.yml b/.github/workflows/test_solr.yml index 7cb444d..c43c6fa 100644 --- a/.github/workflows/test_solr.yml +++ b/.github/workflows/test_solr.yml @@ -43,6 +43,7 @@ jobs: echo "user_uid: $(id -u)" >> drupal-dockerizer.yml echo "user_gid: $(id -g)" >> drupal-dockerizer.yml echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml + echo "expose_http_port: 80" >> drupal-dockerizer.yml echo "solr_configs_path: $GITHUB_WORKSPACE/solr_configuration" >> drupal-dockerizer.yml echo "solr_version: 8" >> drupal-dockerizer.yml From 4354f1097f81d5fad543bdffc9e11cfa20251613 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 16:11:33 +0300 Subject: [PATCH 184/228] Wait for solr cotainer --- .github/workflows/test_solr.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test_solr.yml b/.github/workflows/test_solr.yml index c43c6fa..7e04860 100644 --- a/.github/workflows/test_solr.yml +++ b/.github/workflows/test_solr.yml @@ -93,6 +93,9 @@ jobs: - name: Get solr logs run: docker logs drupal-project-solr + - name: Wait for Solr + run: sleep 10; + - name: Generate random nodes run: docker exec drupal-project-webserver drush devel-generate:content -y From bba640df727d4393aa491d51195f9a6718463f0b Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 17:09:02 +0300 Subject: [PATCH 185/228] Fix playbook logic --- .github/workflows/test_basic.yml | 4 +- .github/workflows/test_build_php_images.yml | 4 +- .github/workflows/test_db_import.yml | 10 +-- .github/workflows/test_memcache.yml | 8 +-- .github/workflows/test_multiple_env.yml | 8 +-- .github/workflows/test_solr.yml | 8 +-- .github/workflows/test_ssl.yml | 8 +-- CONFIG.md | 4 +- README.md | 22 ++---- reset.yml => clean.yml | 9 +-- down.yml | 21 ++++++ db.yml => import-database.yml | 3 + main.yml | 78 --------------------- tasks/preflight.yml | 2 + tasks/preflight/database-dump.yml | 13 ++++ up.yml | 59 ++++++++++++++++ 16 files changed, 134 insertions(+), 127 deletions(-) rename reset.yml => clean.yml (73%) create mode 100644 down.yml rename db.yml => import-database.yml (77%) delete mode 100644 main.yml create mode 100644 tasks/preflight/database-dump.yml diff --git a/.github/workflows/test_basic.yml b/.github/workflows/test_basic.yml index 3cc87b6..1c9a6e5 100644 --- a/.github/workflows/test_basic.yml +++ b/.github/workflows/test_basic.yml @@ -42,10 +42,10 @@ jobs: echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml echo "expose_http_port: 80" >> drupal-dockerizer.yml - - name: Run main playbook + - name: Run up playbook uses: dawidd6/action-ansible-playbook@v2 with: - playbook: main.yml + playbook: up.yml directory: .drupal-dockerizer options: | --verbose diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index 92ed706..388ce20 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -65,10 +65,10 @@ jobs: PHP_VERSION: ${{ matrix.php_version }} run: docker build -t php$PHP_VERSION-apache - < .drupal-dockerizer/images/php-apache/$PHP_VERSION-apache.Dockerfile - - name: Run main playbook + - name: Run up playbook uses: dawidd6/action-ansible-playbook@v2 with: - playbook: main.yml + playbook: up.yml directory: .drupal-dockerizer options: | --verbose diff --git a/.github/workflows/test_db_import.yml b/.github/workflows/test_db_import.yml index c8439dc..2d85e08 100644 --- a/.github/workflows/test_db_import.yml +++ b/.github/workflows/test_db_import.yml @@ -43,10 +43,10 @@ jobs: echo "expose_http_port: 80" >> drupal-dockerizer.yml echo "db_dump_path: $GITHUB_WORKSPACE/web/dump.sql" >> drupal-dockerizer.yml - - name: Run main playbook + - name: Run up playbook uses: dawidd6/action-ansible-playbook@v2 with: - playbook: main.yml + playbook: up.yml directory: .drupal-dockerizer options: | --verbose @@ -68,15 +68,15 @@ jobs: - name: Destroy containers and runtime uses: dawidd6/action-ansible-playbook@v2 with: - playbook: reset.yml + playbook: clean.yml directory: .drupal-dockerizer options: | --verbose - - name: Run main playbook + - name: Run up playbook uses: dawidd6/action-ansible-playbook@v2 with: - playbook: main.yml + playbook: up.yml directory: .drupal-dockerizer options: | --verbose diff --git a/.github/workflows/test_memcache.yml b/.github/workflows/test_memcache.yml index 5271eaa..b493459 100644 --- a/.github/workflows/test_memcache.yml +++ b/.github/workflows/test_memcache.yml @@ -45,10 +45,10 @@ jobs: echo "expose_http_port: 80" >> drupal-dockerizer.yml echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml - - name: Run main playbook + - name: Run up playbook uses: dawidd6/action-ansible-playbook@v2 with: - playbook: main.yml + playbook: up.yml directory: .drupal-dockerizer options: | --verbose @@ -76,10 +76,10 @@ jobs: run: | echo "memcache: true" >> drupal-dockerizer.yml - - name: Run main playbook + - name: Run up playbook uses: dawidd6/action-ansible-playbook@v2 with: - playbook: main.yml + playbook: up.yml directory: .drupal-dockerizer options: | --verbose diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index d7f9f4a..adb0103 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -37,10 +37,10 @@ jobs: echo "drupal_root_dir: $GITHUB_WORKSPACE/drupal-composer" >> dockerizer-composer.yml echo "expose_http_port: 8080" >> drupal-dockerizer.yml - - name: Run the main playbook for the first environment + - name: Run the up playbook for the first environment uses: dawidd6/action-ansible-playbook@v2 with: - playbook: main.yml --extra-vars @/$GITHUB_WORKSPACE/dockerizer-composer.yml + playbook: up.yml --extra-vars @/$GITHUB_WORKSPACE/dockerizer-composer.yml directory: .drupal-dockerizer options: | --verbose @@ -74,10 +74,10 @@ jobs: echo "drupal_web_root: ./" >> dockerizer-tarball.yml - - name: Run the main playbook for the second environment + - name: Run the up playbook for the second environment uses: dawidd6/action-ansible-playbook@v2 with: - playbook: main.yml --extra-vars @/$GITHUB_WORKSPACE/dockerizer-tarball.yml + playbook: up.yml --extra-vars @/$GITHUB_WORKSPACE/dockerizer-tarball.yml directory: .drupal-dockerizer options: | --verbose diff --git a/.github/workflows/test_solr.yml b/.github/workflows/test_solr.yml index 7e04860..7ba9015 100644 --- a/.github/workflows/test_solr.yml +++ b/.github/workflows/test_solr.yml @@ -47,10 +47,10 @@ jobs: echo "solr_configs_path: $GITHUB_WORKSPACE/solr_configuration" >> drupal-dockerizer.yml echo "solr_version: 8" >> drupal-dockerizer.yml - - name: Run main playbook + - name: Run up playbook uses: dawidd6/action-ansible-playbook@v2 with: - playbook: main.yml + playbook: up.yml directory: .drupal-dockerizer options: | --verbose @@ -82,10 +82,10 @@ jobs: run: | echo "solr: true" >> drupal-dockerizer.yml - - name: Run main playbook + - name: Run up playbook uses: dawidd6/action-ansible-playbook@v2 with: - playbook: main.yml + playbook: up.yml directory: .drupal-dockerizer options: | --verbose diff --git a/.github/workflows/test_ssl.yml b/.github/workflows/test_ssl.yml index 9fe2504..2d775c8 100644 --- a/.github/workflows/test_ssl.yml +++ b/.github/workflows/test_ssl.yml @@ -43,10 +43,10 @@ jobs: echo "docker_network_gateway_ip: 192.167.22.1" >> drupal-dockerizer.yml echo "domain_name: drupal.devel" >> drupal-dockerizer.yml - - name: Run main playbook + - name: Run up playbook uses: dawidd6/action-ansible-playbook@v2 with: - playbook: main.yml + playbook: up.yml directory: .drupal-dockerizer options: | --verbose @@ -78,10 +78,10 @@ jobs: echo "ssl_cert_path: $GITHUB_WORKSPACE/cert.pem" >> drupal-dockerizer.yml echo "ssl_enabled: true" >> drupal-dockerizer.yml - - name: Run main playbook with ssl configuration + - name: Run up playbook with ssl configuration uses: dawidd6/action-ansible-playbook@v2 with: - playbook: main.yml + playbook: up.yml directory: .drupal-dockerizer options: | --verbose diff --git a/CONFIG.md b/CONFIG.md index 3eedb78..90419b1 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -35,9 +35,9 @@ | mysql_user | mysql user name | docker | | mysql_password | mysql password | docker | | mysql_database | mysql databse name for drupal | drupal | -| import_database | import database immediately after up docker containers by main.yml playbook. Ensure you have right path to sql dump | false | +| import_database | import database immediately after up docker containers by up.yml playbook. Ensure you have right path to sql dump | false | | install_adminer | Flag for setup adminer | false | | adminer_port | http port for admniner | 8080 | -| run_drush_commands | run drush_commands immediately after up docker containers by main.yml playbook. | false | +| run_drush_commands | run drush_commands immediately after up docker containers by up.yml playbook. | false | | drush_commands | Drush commands that run by run-drush-commands.yml playbook | ['cr', 'cc', 'si'] | | custom_drupal_settings | custom drupal settings. Inserting to end settings.php file | $settings['trusted_host_patterns'] = ['drupal.devel']; | diff --git a/README.md b/README.md index 36d5915..afe3682 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ expose_http_port: 8090 EOT cd ~/Projects/drupal9/drupal-dockerizer -ansible-playbook main.yml --ask-become-pass +ansible-playbook up.yml --ask-become-pass ansible-playbook drush-commands.yml ``` @@ -91,9 +91,9 @@ As a result you should receive the next directory structure: │ ├── runtime-drupal9 │ ├── drush-commands.yml │ ├── inventory -│ ├── main.yml +│ ├── up.yml │ ├── requirements.yml -│ ├── reset.yml +│ ├── clean.yml │ ├── stop.yml │ ├── tasks │ ├── templates @@ -138,7 +138,7 @@ All the configuration is done via `drupal-dockerizer.yml` config file. You can f Drupal Dockerizer is shipped with additional Ansible playbooks to help you automate your routine tasks. Make sure you are running those playbooks inside the `drupal-dockerizer` directory. The place where playbook files actually live. -Each new project should start with running `main.yml` playbook which prepares configuration. +Each new project should start with running `up.yml` playbook which prepares configuration and up containers. It's an equivalent of `docker-compose up` command. ### Stop containers @@ -148,23 +148,15 @@ To stop your containers and save the data you can use the `stop.yml` playbook. I ansible-playbook stop.yml ``` -### Up containers - -To spin up your containers you can use the `up.yml` playbook. It's an equivalent of `docker-compose up` command. - -```bash -ansible-playbook up.yml -``` - ### Remove containers and their data -To remove everything and start from scratch you can use `reset.yml` playbook. It's an equivalent of `docker-compose down` command. This command will not remove your code. Please, note this command requires `sudoers` permissions. +To remove everything and start from scratch you can use `clean.yml` playbook. It's an equivalent of `docker-compose down` command. This command will not remove your code. Please, note this command requires `sudoers` permissions. ```bash -ansible-playbook reset.yml --ask-become-pass +ansible-playbook clean.yml --ask-become-pass ``` -After resetting your environment you have to run `main.yml` playbook again to spin up your environment. +After resetting your environment you have to run `up.yml` playbook again to spin up your environment. ### How to run commands inside containers diff --git a/reset.yml b/clean.yml similarity index 73% rename from reset.yml rename to clean.yml index 808b26c..a939a52 100644 --- a/reset.yml +++ b/clean.yml @@ -15,12 +15,7 @@ tasks: - name: Stop all Docker containers. - command: docker-compose -p {{ compose_project_name }} down - args: - chdir: "{{ docker_runtime_dir }}" - - - name: Kill all Docker containers. - command: docker-compose -p {{ compose_project_name }} kill + command: docker-compose -p {{ compose_project_name }} down --remove-orphans --volumes args: chdir: "{{ docker_runtime_dir }}" @@ -33,7 +28,7 @@ - name: Remove Host name from /etc/hosts become: true blockinfile: - marker: "" + marker: "" state: absent path: /etc/hosts block: | diff --git a/down.yml b/down.yml new file mode 100644 index 0000000..b8a615a --- /dev/null +++ b/down.yml @@ -0,0 +1,21 @@ +--- + +- hosts: all + + vars_files: + - default.config.yml + + pre_tasks: + - name: Include config override file, if it exists. + include_vars: "{{ item }}" + with_fileglob: + - ../drupal-dockerizer.yml + + roles: [] + + tasks: + + - name: Down all Docker containers. + command: docker-compose -p {{ compose_project_name }} down --remove-orphans + args: + chdir: "{{ docker_runtime_dir }}" diff --git a/db.yml b/import-database.yml similarity index 77% rename from db.yml rename to import-database.yml index b7e839e..9007eae 100644 --- a/db.yml +++ b/import-database.yml @@ -14,5 +14,8 @@ tasks: + - name: Include check dump exist task. + include: tasks/preflight/database-dump.yml + - name: Include import-database tasks. include: tasks/import-database.yml diff --git a/main.yml b/main.yml deleted file mode 100644 index 2841c4a..0000000 --- a/main.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- - -- hosts: all - - vars_files: - - default.config.yml - - pre_tasks: - - name: Include config override file, if it exists. - include_vars: "{{ item }}" - with_fileglob: - - ../drupal-dockerizer.yml - - - name: Include prefilight tasks - include: tasks/preflight.yml - - roles: [] - - tasks: - - - name: Include lamp setup tasks - include: tasks/runtime-setup.yml - - - name: Check project tasks. - stat: - path: "{{pre_task_path}}" - register: pre_tasks - - - name: Include custom project pre-tasks - include: "{{ item }}" - with_first_found: - - files: - - "{{pre_task_path}}" - skip: true - when: pre_tasks - - - name: Include solr setup tasks. - when: solr - include: tasks/solr-setup.yml - - - name: Include Local hosts setup tasks - when: docker_network_gateway_ip is not none and domain_name is not none - include: tasks/local-hosts-setup.yml - - - name: Include Settings setup tasks - include: tasks/settings-setup.yml - - - name: Include Docker up tasks - include: tasks/docker-up.yml - - - name: Include Solr copy core task - include: tasks/solr-core-setup.yml - when: solr and solr_version == 8 - - - name: Include Memcache setup tasks - include: tasks/memcache-setup.yml - when: memcache - - - name: Include import-database tasks. - include: tasks/import-database.yml - when: import_database - - - name: Check project tasks. - stat: - path: "{{post_task_path}}" - register: post_tasks - - - name: Include custom project post-tasks - include: "{{ item }}" - with_first_found: - - files: - - "{{post_task_path}}" - skip: true - when: post_tasks - - - name: Run Drush commands. - include: tasks/drush-command.yml - when: drush_install and run_drush_commands diff --git a/tasks/preflight.yml b/tasks/preflight.yml index 22ad596..c9a4a5c 100644 --- a/tasks/preflight.yml +++ b/tasks/preflight.yml @@ -9,3 +9,5 @@ - include: preflight/docker-group.yml - include: preflight/network.yml +- include: preflight/database-dump.yml + when: import_database diff --git a/tasks/preflight/database-dump.yml b/tasks/preflight/database-dump.yml new file mode 100644 index 0000000..a0a131e --- /dev/null +++ b/tasks/preflight/database-dump.yml @@ -0,0 +1,13 @@ +--- + + - name: Check that database dump exist + stat: + path: "{{ db_dump_path }}" + register: preflight__database_dump + + - name: Set failed message + set_fact: preflight__failed_message="Database dump not exist in {{ db_dump_path }} path. Please, ensure that file exist and you have permissions for file." + when: not preflight__database_dump.stat.exists + + - name: Include end_play + include: ./end_play.yml diff --git a/up.yml b/up.yml index 726d1a8..2841c4a 100644 --- a/up.yml +++ b/up.yml @@ -11,9 +11,68 @@ with_fileglob: - ../drupal-dockerizer.yml + - name: Include prefilight tasks + include: tasks/preflight.yml + roles: [] tasks: + - name: Include lamp setup tasks + include: tasks/runtime-setup.yml + + - name: Check project tasks. + stat: + path: "{{pre_task_path}}" + register: pre_tasks + + - name: Include custom project pre-tasks + include: "{{ item }}" + with_first_found: + - files: + - "{{pre_task_path}}" + skip: true + when: pre_tasks + + - name: Include solr setup tasks. + when: solr + include: tasks/solr-setup.yml + + - name: Include Local hosts setup tasks + when: docker_network_gateway_ip is not none and domain_name is not none + include: tasks/local-hosts-setup.yml + + - name: Include Settings setup tasks + include: tasks/settings-setup.yml + - name: Include Docker up tasks include: tasks/docker-up.yml + + - name: Include Solr copy core task + include: tasks/solr-core-setup.yml + when: solr and solr_version == 8 + + - name: Include Memcache setup tasks + include: tasks/memcache-setup.yml + when: memcache + + - name: Include import-database tasks. + include: tasks/import-database.yml + when: import_database + + - name: Check project tasks. + stat: + path: "{{post_task_path}}" + register: post_tasks + + - name: Include custom project post-tasks + include: "{{ item }}" + with_first_found: + - files: + - "{{post_task_path}}" + skip: true + when: post_tasks + + - name: Run Drush commands. + include: tasks/drush-command.yml + when: drush_install and run_drush_commands From 0686929bc45a4244be9a70ccd34974b879c9d7fc Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 17:14:56 +0300 Subject: [PATCH 186/228] Fix import database test --- .github/workflows/test_db_import.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_db_import.yml b/.github/workflows/test_db_import.yml index 2d85e08..c6b3686 100644 --- a/.github/workflows/test_db_import.yml +++ b/.github/workflows/test_db_import.yml @@ -84,7 +84,7 @@ jobs: - name: Import DataBase uses: dawidd6/action-ansible-playbook@v2 with: - playbook: db.yml + playbook: import-database.yml directory: .drupal-dockerizer options: | --verbose From 5058bfd5505d75cf4069520e6c5392573769b13a Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 17:16:07 +0300 Subject: [PATCH 187/228] Small fix in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index afe3682..3e64fcf 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ ansible-playbook stop.yml ### Remove containers and their data -To remove everything and start from scratch you can use `clean.yml` playbook. It's an equivalent of `docker-compose down` command. This command will not remove your code. Please, note this command requires `sudoers` permissions. +To remove everything and start from scratch you can use `clean.yml` playbook. This command will not remove your code. Please, note this command requires `sudoers` permissions. ```bash ansible-playbook clean.yml --ask-become-pass From e17ddb8c3b730fd808770ee4cf83352e9bd3263b Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 17:32:00 +0300 Subject: [PATCH 188/228] fix end_play --- tasks/preflight/end_play.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/preflight/end_play.yml b/tasks/preflight/end_play.yml index b48feae..0c34a94 100644 --- a/tasks/preflight/end_play.yml +++ b/tasks/preflight/end_play.yml @@ -1,6 +1,6 @@ --- - name: Print message why the start is failing - failed_when: preflight__failed_message|string|length > 0 + failed_when: preflight__failed_message or preflight__failed_message|string|length > 0 debug: msg: "The run has been aborted due to the next reason: {{ preflight__failed_message }}" From 1db62b117ebcbc60155e78dac6d7983c508682cf Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 17:36:05 +0300 Subject: [PATCH 189/228] Fix for check dump exist --- import-database.yml | 2 ++ tasks/preflight/end_play.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/import-database.yml b/import-database.yml index 9007eae..c7eeb03 100644 --- a/import-database.yml +++ b/import-database.yml @@ -13,6 +13,8 @@ roles: [] tasks: + - name: Set default failed message + set_fact: preflight__failed_message="" - name: Include check dump exist task. include: tasks/preflight/database-dump.yml diff --git a/tasks/preflight/end_play.yml b/tasks/preflight/end_play.yml index 0c34a94..b48feae 100644 --- a/tasks/preflight/end_play.yml +++ b/tasks/preflight/end_play.yml @@ -1,6 +1,6 @@ --- - name: Print message why the start is failing - failed_when: preflight__failed_message or preflight__failed_message|string|length > 0 + failed_when: preflight__failed_message|string|length > 0 debug: msg: "The run has been aborted due to the next reason: {{ preflight__failed_message }}" From de30cd097d84a74e65e5d0237199821631e5fc51 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Wed, 5 May 2021 18:12:15 +0300 Subject: [PATCH 190/228] Implement private files dir --- CONFIG.md | 2 +- default.config.yml | 3 ++- tasks/settings-setup.yml | 13 ++++++++++++- templates/docker-compose.yml.j2 | 3 ++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index 90419b1..1859e6d 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -9,7 +9,7 @@ | user_gid | uid your user in system. Run `id -g` for see you uid | 1000 | | drupal_root_dir | Absоlute path to your drupal-project directory. | /var/data/drupal | | drupal_web_root | Name directory where placed index.php file indside drupal project directory | web | -| drupal_files_dir | Absolute path to your drupal files directory | /var/data/drupal_files | +| drupal_public_files_dir | Absolute path to your drupal files directory | /var/data/drupal_files | | drupal_hash_salt | Hash salt for drupal site. | demo_site | | drupal_config_sync_folder | Relative path from drupal_web_root for you config sync directory | sites/default/sync | | port | Port where you up your drupal site by http protocol. No need if advanced_networking is true | 80 | diff --git a/default.config.yml b/default.config.yml index d58543c..8df9bd4 100644 --- a/default.config.yml +++ b/default.config.yml @@ -12,7 +12,8 @@ drupal_root_dir: /var/data/drupal # Name of "web" folder inside `drupal_root_dir`. drupal_web_root: web # Absolute Path to Drupal files dir. -drupal_files_dir: "{{drupal_root_dir}}/{{drupal_web_root}}/sites/default/files" +drupal_public_files_dir: "{{drupal_root_dir}}/{{drupal_web_root}}/sites/default/files" +drupal_private_files_dir: "{{drupal_public_files_dir}}/private" drupal_hash_salt: demo_site # Absolute Path to Drupal config sync dir. drupal_config_sync_folder: sites/default/sync diff --git a/tasks/settings-setup.yml b/tasks/settings-setup.yml index 4164a64..3c20f6f 100644 --- a/tasks/settings-setup.yml +++ b/tasks/settings-setup.yml @@ -3,7 +3,17 @@ - name: Make public files dir. become: true file: - path: '{{ drupal_files_dir }}' + path: '{{ drupal_public_files_dir }}' + state: directory + recurse: yes + mode: "u=rwx,og=rx" + owner: "{{user_uid|int}}" + group: "{{user_gid|int}}" + +- name: Make private files dir. + become: true + file: + path: '{{ drupal_public_files_dir }}' state: directory recurse: yes mode: "u=rwx,og=rx" @@ -50,6 +60,7 @@ ]; $settings["file_temp_path"] = '/tmp'; $settings['config_sync_directory'] = '{{drupal_config_sync_folder}}'; + $settings['file_private_path'] = __DIR__ . '/files/private'; $settings['trusted_host_patterns'] = []; {% if solr %} $config['search_api.server.solr']['backend_config']['connector_config']['host'] = '{{ compose_project_name }}-solr'; diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 352ecd2..ccffb5b 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -43,7 +43,8 @@ services: {% endif %} volumes: - {{ drupal_root_dir }}:/var/www/{{ ":cached" if docker_cached_volume }} - - {{ drupal_files_dir }}:/var/www/{{ drupal_web_root }}/sites/default/files/{{ ":cached" if docker_cached_volume }} + - {{ drupal_public_files_dir }}:/var/www/{{ drupal_web_root }}/sites/default/files/{{ ":cached" if docker_cached_volume }} + - {{ drupal_private_files_dir }}:/var/www/{{ drupal_web_root }}/sites/default/files/private{{ ":cached" if docker_cached_volume }} - ${VHOSTS_DIR-./apache}:/etc/apache2/sites-enabled{{ ":cached" if docker_cached_volume }} {% if ssl_enabled %} - {{ ssl_cert_path }}:/etc/apache2/cert.pem{{ ":cached" if docker_cached_volume }} From eb40ff9a8915b8795eac0a6b395d27a5e6ef90b3 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Fri, 7 May 2021 10:22:03 +0300 Subject: [PATCH 191/228] Fix typo --- tasks/settings-setup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/settings-setup.yml b/tasks/settings-setup.yml index 3c20f6f..6b2cea2 100644 --- a/tasks/settings-setup.yml +++ b/tasks/settings-setup.yml @@ -13,7 +13,7 @@ - name: Make private files dir. become: true file: - path: '{{ drupal_public_files_dir }}' + path: '{{ drupal_private_files_dir }}' state: directory recurse: yes mode: "u=rwx,og=rx" From e0cacc42654c69620b389ddc41d7691eead2a2ab Mon Sep 17 00:00:00 2001 From: svicervlad Date: Mon, 24 May 2021 09:25:35 +0300 Subject: [PATCH 192/228] Add drupal commerce support --- images/php-apache/7.1-apache.Dockerfile | 1 + images/php-apache/7.2-apache.Dockerfile | 1 + images/php-apache/7.3-apache.Dockerfile | 1 + images/php-apache/7.4-apache.Dockerfile | 1 + images/php-apache/8.0-apache.Dockerfile | 1 + 5 files changed, 5 insertions(+) diff --git a/images/php-apache/7.1-apache.Dockerfile b/images/php-apache/7.1-apache.Dockerfile index 090877d..f54dd7c 100644 --- a/images/php-apache/7.1-apache.Dockerfile +++ b/images/php-apache/7.1-apache.Dockerfile @@ -66,6 +66,7 @@ ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ # Install php modulues RUN docker-php-ext-install pdo_mysql && \ + docker-php-ext-install bcmath && \ docker-php-ext-install opcache && \ docker-php-ext-install uploadprogress && \ docker-php-ext-install pdo_sqlite && \ diff --git a/images/php-apache/7.2-apache.Dockerfile b/images/php-apache/7.2-apache.Dockerfile index 696358e..63e31d9 100644 --- a/images/php-apache/7.2-apache.Dockerfile +++ b/images/php-apache/7.2-apache.Dockerfile @@ -60,6 +60,7 @@ ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ # Install php modulues RUN docker-php-ext-install pdo_mysql && \ + docker-php-ext-install bcmath && \ docker-php-ext-install opcache && \ docker-php-ext-install uploadprogress && \ docker-php-ext-install pdo_sqlite && \ diff --git a/images/php-apache/7.3-apache.Dockerfile b/images/php-apache/7.3-apache.Dockerfile index fbf989e..576146b 100644 --- a/images/php-apache/7.3-apache.Dockerfile +++ b/images/php-apache/7.3-apache.Dockerfile @@ -60,6 +60,7 @@ ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ # Install php modulues RUN docker-php-ext-install pdo_mysql && \ + docker-php-ext-install bcmath && \ docker-php-ext-install opcache && \ docker-php-ext-install uploadprogress && \ docker-php-ext-install pdo_sqlite && \ diff --git a/images/php-apache/7.4-apache.Dockerfile b/images/php-apache/7.4-apache.Dockerfile index 38465eb..7564443 100644 --- a/images/php-apache/7.4-apache.Dockerfile +++ b/images/php-apache/7.4-apache.Dockerfile @@ -60,6 +60,7 @@ ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ # Install php modulues RUN docker-php-ext-install pdo_mysql && \ + docker-php-ext-install bcmath && \ docker-php-ext-install opcache && \ docker-php-ext-install uploadprogress && \ docker-php-ext-install pdo_sqlite && \ diff --git a/images/php-apache/8.0-apache.Dockerfile b/images/php-apache/8.0-apache.Dockerfile index 33bc1aa..ff5178b 100644 --- a/images/php-apache/8.0-apache.Dockerfile +++ b/images/php-apache/8.0-apache.Dockerfile @@ -60,6 +60,7 @@ RUN docker-php-ext-enable memcached && \ # Install php modulues RUN docker-php-ext-install pdo_mysql && \ + docker-php-ext-install bcmath && \ docker-php-ext-install opcache && \ docker-php-ext-install imagick && \ docker-php-ext-install soap && \ From f7febe8f35a3bd07dc1a173935eb6f2ee7c3a8e2 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Mon, 24 May 2021 09:27:38 +0300 Subject: [PATCH 193/228] Fix test --- .github/workflows/test_basic.yml | 1 + .github/workflows/test_db_import.yml | 1 + .github/workflows/test_memcache.yml | 1 + .github/workflows/test_multiple_env.yml | 1 + .github/workflows/test_solr.yml | 1 + .github/workflows/test_ssl.yml | 1 + 6 files changed, 6 insertions(+) diff --git a/.github/workflows/test_basic.yml b/.github/workflows/test_basic.yml index 1c9a6e5..214b8b4 100644 --- a/.github/workflows/test_basic.yml +++ b/.github/workflows/test_basic.yml @@ -5,6 +5,7 @@ on: branches: [main] paths-ignore: - '**.md' + - '**.Dockerfile' workflow_dispatch: jobs: diff --git a/.github/workflows/test_db_import.yml b/.github/workflows/test_db_import.yml index c6b3686..442afc5 100644 --- a/.github/workflows/test_db_import.yml +++ b/.github/workflows/test_db_import.yml @@ -5,6 +5,7 @@ on: branches: [main] paths-ignore: - '**.md' + - '**.Dockerfile' workflow_dispatch: jobs: diff --git a/.github/workflows/test_memcache.yml b/.github/workflows/test_memcache.yml index b493459..0b99b5e 100644 --- a/.github/workflows/test_memcache.yml +++ b/.github/workflows/test_memcache.yml @@ -5,6 +5,7 @@ on: branches: [main] paths-ignore: - '**.md' + - '**.Dockerfile' workflow_dispatch: jobs: diff --git a/.github/workflows/test_multiple_env.yml b/.github/workflows/test_multiple_env.yml index adb0103..058c845 100644 --- a/.github/workflows/test_multiple_env.yml +++ b/.github/workflows/test_multiple_env.yml @@ -5,6 +5,7 @@ on: branches: [main] paths-ignore: - '**.md' + - '**.Dockerfile' workflow_dispatch: jobs: diff --git a/.github/workflows/test_solr.yml b/.github/workflows/test_solr.yml index 7ba9015..bf06a2e 100644 --- a/.github/workflows/test_solr.yml +++ b/.github/workflows/test_solr.yml @@ -5,6 +5,7 @@ on: branches: [main] paths-ignore: - '**.md' + - '**.Dockerfile' workflow_dispatch: jobs: diff --git a/.github/workflows/test_ssl.yml b/.github/workflows/test_ssl.yml index 2d775c8..d0fdfb7 100644 --- a/.github/workflows/test_ssl.yml +++ b/.github/workflows/test_ssl.yml @@ -5,6 +5,7 @@ on: branches: [main] paths-ignore: - '**.md' + - '**.Dockerfile' workflow_dispatch: jobs: From 57fe4d9d7e267f3bd3fc12e3b4438ecc63d0149c Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 1 Jun 2021 12:18:59 +0300 Subject: [PATCH 194/228] Create 5.6-apache.Dockerfile --- images/php-apache/5.6-apache.Dockerfile | 102 ++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 images/php-apache/5.6-apache.Dockerfile diff --git a/images/php-apache/5.6-apache.Dockerfile b/images/php-apache/5.6-apache.Dockerfile new file mode 100644 index 0000000..e563443 --- /dev/null +++ b/images/php-apache/5.6-apache.Dockerfile @@ -0,0 +1,102 @@ +FROM php:5.6-apache + +# Surpresses debconf complaints of trying to install apt packages interactively +# https://github.com/moby/moby/issues/4032#issuecomment-192327844 + +ARG DEBIAN_FRONTEND=noninteractive + +# Install useful tools and install important libaries +RUN apt-get -y update && \ + apt-get -y --no-install-recommends --fix-missing install zsh git vim nano wget sudo\ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + libmagickwand-dev \ + dialog \ + libsqlite3-dev \ + libsqlite3-0 \ + default-mysql-client \ + zlib1g-dev \ + libzip-dev \ + libicu-dev \ + apt-utils \ + build-essential \ + git \ + curl \ + libmemcached-dev \ + libonig-dev \ + libcurl4 \ + libcurl4-openssl-dev \ + zip \ + openssl \ + libxml2-dev + +# Clear Apt +RUN rm -rf /var/lib/apt/lists/* + +# Opcache enviroment +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ + PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \ + PHP_OPCACHE_MEMORY_CONSUMPTION="192" \ + PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" + +# Update pecl +RUN pecl channel-update pecl.php.net + +# Install pecl modules +RUN pecl install \ + imagick \ + memcached \ + apcu-5.1.19 + +# Configure uploadprogress +RUN git clone https://github.com/php/pecl-php-uploadprogress/ /usr/src/php/ext/uploadprogress/ && \ + docker-php-ext-configure uploadprogress + +# Enable php modules +RUN docker-php-ext-enable memcached && \ + docker-php-ext-enable imagick && \ + docker-php-ext-enable apcu + +# Opcache enviroment +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ + PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \ + PHP_OPCACHE_MEMORY_CONSUMPTION="192" \ + PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" + +# Install php modulues +RUN docker-php-ext-install pdo_mysql && \ + docker-php-ext-install bcmath && \ + docker-php-ext-install opcache && \ + docker-php-ext-install uploadprogress && \ + docker-php-ext-install pdo_sqlite && \ + docker-php-ext-install soap && \ + docker-php-ext-install mysqli && \ + docker-php-ext-install curl && \ + docker-php-ext-install tokenizer && \ + docker-php-ext-install json && \ + docker-php-ext-install zip && \ + docker-php-ext-install -j$(nproc) intl && \ + docker-php-ext-install mbstring && \ + docker-php-ext-install gettext && \ + docker-php-ext-install exif + +# Install Freetype +RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ + docker-php-ext-install -j$(nproc) gd + +# Enable apache modules +RUN a2enmod rewrite headers +RUN a2enmod ssl + +# Install composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +# Set memory limit +RUN echo "memory_limit = 512M" >> /usr/local/etc/php/conf.d/memory_limit.ini + +# Enable apcu in cofig +RUN echo "apc.enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini + +# Cleanup +RUN rm -rf /usr/src/* From b557dbc8f28eeb7189aca1ad090fcff86c87ac05 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 1 Jun 2021 12:20:51 +0300 Subject: [PATCH 195/228] Update test_build_php_images.yml --- .github/workflows/test_build_php_images.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index 388ce20..1b0aee4 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -13,6 +13,8 @@ jobs: strategy: matrix: include: + - php_version: '5.6' + drupal_version: '7.78' - php_version: '7.1' drupal_version: '8.6.18' - php_version: '7.2' From a9c0b681dbb60d6e330232a8528244d88c142a22 Mon Sep 17 00:00:00 2001 From: Vlad Date: Wed, 2 Jun 2021 09:10:48 +0300 Subject: [PATCH 196/228] Update 5.6-apache.Dockerfile --- images/php-apache/5.6-apache.Dockerfile | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/images/php-apache/5.6-apache.Dockerfile b/images/php-apache/5.6-apache.Dockerfile index e563443..0e52902 100644 --- a/images/php-apache/5.6-apache.Dockerfile +++ b/images/php-apache/5.6-apache.Dockerfile @@ -25,8 +25,8 @@ RUN apt-get -y update && \ curl \ libmemcached-dev \ libonig-dev \ - libcurl4 \ - libcurl4-openssl-dev \ + libcurl3 \ + libcurl3-openssl-dev \ zip \ openssl \ libxml2-dev @@ -46,8 +46,7 @@ RUN pecl channel-update pecl.php.net # Install pecl modules RUN pecl install \ imagick \ - memcached \ - apcu-5.1.19 + memcached-2.2.0 # Configure uploadprogress RUN git clone https://github.com/php/pecl-php-uploadprogress/ /usr/src/php/ext/uploadprogress/ && \ @@ -55,8 +54,7 @@ RUN git clone https://github.com/php/pecl-php-uploadprogress/ /usr/src/php/ext/u # Enable php modules RUN docker-php-ext-enable memcached && \ - docker-php-ext-enable imagick && \ - docker-php-ext-enable apcu + docker-php-ext-enable imagick # Opcache enviroment ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ @@ -95,8 +93,7 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local # Set memory limit RUN echo "memory_limit = 512M" >> /usr/local/etc/php/conf.d/memory_limit.ini -# Enable apcu in cofig -RUN echo "apc.enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini - # Cleanup RUN rm -rf /usr/src/* + +ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] From 23ff99b3ee241e198e5cda8ebd841d2b6da16294 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 8 Jun 2021 10:22:12 +0300 Subject: [PATCH 197/228] Fix mariadb and add unzip to php56 --- images/php-apache/5.6-apache.Dockerfile | 1 + templates/docker-compose.yml.j2 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/images/php-apache/5.6-apache.Dockerfile b/images/php-apache/5.6-apache.Dockerfile index 0e52902..75cf03b 100644 --- a/images/php-apache/5.6-apache.Dockerfile +++ b/images/php-apache/5.6-apache.Dockerfile @@ -29,6 +29,7 @@ RUN apt-get -y update && \ libcurl3-openssl-dev \ zip \ openssl \ + unzip \ libxml2-dev # Clear Apt diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index ccffb5b..860d90c 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -65,7 +65,7 @@ services: build: context: "./bin/database" container_name: '{{ compose_project_name }}-database' -{% if database == "mysql" %} +{% if database == "mysql" or database == "mariadb" %} command: --max_allowed_packet=1048576000 --skip-grant-tables healthcheck: test: ["CMD-SHELL", 'mysql --database=mysql --password={{ mysql_root_password }} --execute="SELECT count(table_name) > 0 FROM information_schema.tables;" --skip-column-names -B'] From 7f8eb1a05e48557bfc0aca2c6c3ede8595e190d0 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 8 Jun 2021 10:53:29 +0300 Subject: [PATCH 198/228] Fix databases --- templates/docker-compose.yml.j2 | 2 -- 1 file changed, 2 deletions(-) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 860d90c..1a7220e 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -65,14 +65,12 @@ services: build: context: "./bin/database" container_name: '{{ compose_project_name }}-database' -{% if database == "mysql" or database == "mariadb" %} command: --max_allowed_packet=1048576000 --skip-grant-tables healthcheck: test: ["CMD-SHELL", 'mysql --database=mysql --password={{ mysql_root_password }} --execute="SELECT count(table_name) > 0 FROM information_schema.tables;" --skip-column-names -B'] interval: 3s timeout: 45s retries: 15 -{% endif %} restart: 'always' volumes: - ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql{{ ":cached" if docker_cached_volume }} From cac26c24494d34c3d94a2a5559d0be7ff1db709b Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 8 Jun 2021 11:13:27 +0300 Subject: [PATCH 199/228] Fix drupal 7 settings --- .github/workflows/test_build_php_images.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index 1b0aee4..445417d 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -60,7 +60,9 @@ jobs: echo " - cc drush" >> drupal-dockerizer.yml echo " - site-install standard install_configure_form.enable_update_status_module=NULL" >> drupal-dockerizer.yml echo " - cr" >> drupal-dockerizer.yml - + echo "custom_drupal_settings: |" >> drupal-dockerizer.yml + echo " $conf['drupal_http_request_fails'] = FALSE;" >> drupal-dockerizer.yml + echo " $conf['mail_system'] = array('default-system' => 'TestingMailSystem');" >> drupal-dockerizer.yml - name: Build php apache ${{ matrix.php_version }} image env: From b6ffab832d5e90f334a8d37a53c088cb3f54c8ee Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 8 Jun 2021 11:27:20 +0300 Subject: [PATCH 200/228] fix healthcheck --- templates/docker-compose.yml.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 1a7220e..70ac8ef 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -71,6 +71,7 @@ services: interval: 3s timeout: 45s retries: 15 + start_period: 15s restart: 'always' volumes: - ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql{{ ":cached" if docker_cached_volume }} From a040cc39db350185d71db5ec88911da28274f3f9 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 8 Jun 2021 11:35:46 +0300 Subject: [PATCH 201/228] fix for drupal 7 --- .github/workflows/test_build_php_images.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index 445417d..128de53 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -60,6 +60,10 @@ jobs: echo " - cc drush" >> drupal-dockerizer.yml echo " - site-install standard install_configure_form.enable_update_status_module=NULL" >> drupal-dockerizer.yml echo " - cr" >> drupal-dockerizer.yml + + - name: Fix for drupal 7 + if: ${{ matrix.php_version == '5.6' }} + run: | echo "custom_drupal_settings: |" >> drupal-dockerizer.yml echo " $conf['drupal_http_request_fails'] = FALSE;" >> drupal-dockerizer.yml echo " $conf['mail_system'] = array('default-system' => 'TestingMailSystem');" >> drupal-dockerizer.yml From 08c798233ec3c3014c61422d628833794e48d293 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 8 Jun 2021 11:48:54 +0300 Subject: [PATCH 202/228] debug settings.php --- .github/workflows/test_build_php_images.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index 128de53..4ade52d 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -64,10 +64,14 @@ jobs: - name: Fix for drupal 7 if: ${{ matrix.php_version == '5.6' }} run: | + echo "" >> drupal-dockerizer.yml echo "custom_drupal_settings: |" >> drupal-dockerizer.yml echo " $conf['drupal_http_request_fails'] = FALSE;" >> drupal-dockerizer.yml echo " $conf['mail_system'] = array('default-system' => 'TestingMailSystem');" >> drupal-dockerizer.yml + - name: Cat settings.php + run: cat ./sites/default/settings.php + - name: Build php apache ${{ matrix.php_version }} image env: PHP_VERSION: ${{ matrix.php_version }} From d5f9be7901f8829f843033f3511e6245b4dc86ce Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 8 Jun 2021 11:50:19 +0300 Subject: [PATCH 203/228] fix: settings.php paths --- .github/workflows/test_build_php_images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index 4ade52d..0fb160a 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -70,7 +70,7 @@ jobs: echo " $conf['mail_system'] = array('default-system' => 'TestingMailSystem');" >> drupal-dockerizer.yml - name: Cat settings.php - run: cat ./sites/default/settings.php + run: cat ./drupal-tarball/sites/default/settings.php - name: Build php apache ${{ matrix.php_version }} image env: From 002dc6464bb7711b99585a2dd355db48d5f80bec Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 8 Jun 2021 11:51:30 +0300 Subject: [PATCH 204/228] fix: steps --- .github/workflows/test_build_php_images.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index 0fb160a..ea26679 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -69,8 +69,6 @@ jobs: echo " $conf['drupal_http_request_fails'] = FALSE;" >> drupal-dockerizer.yml echo " $conf['mail_system'] = array('default-system' => 'TestingMailSystem');" >> drupal-dockerizer.yml - - name: Cat settings.php - run: cat ./drupal-tarball/sites/default/settings.php - name: Build php apache ${{ matrix.php_version }} image env: @@ -85,6 +83,9 @@ jobs: options: | --verbose + - name: Cat settings.php + run: cat ./drupal-tarball/sites/default/settings.php + - name: Run drush-commands playbook uses: dawidd6/action-ansible-playbook@v2 with: From 70694705000953ea18d8ab545fddccdc8d570cfe Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 8 Jun 2021 12:10:28 +0300 Subject: [PATCH 205/228] fix: syntax in workflow --- .github/workflows/test_build_php_images.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index ea26679..b4e98c7 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -66,8 +66,8 @@ jobs: run: | echo "" >> drupal-dockerizer.yml echo "custom_drupal_settings: |" >> drupal-dockerizer.yml - echo " $conf['drupal_http_request_fails'] = FALSE;" >> drupal-dockerizer.yml - echo " $conf['mail_system'] = array('default-system' => 'TestingMailSystem');" >> drupal-dockerizer.yml + echo " \$conf['drupal_http_request_fails'] = FALSE;" >> drupal-dockerizer.yml + echo " \$conf['mail_system'] = array('default-system' => 'TestingMailSystem');" >> drupal-dockerizer.yml - name: Build php apache ${{ matrix.php_version }} image From 25e68bcce4d3d865c02d16bea98ed7e1a53caee7 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 8 Jun 2021 12:23:03 +0300 Subject: [PATCH 206/228] fix: mysql health timeout --- templates/docker-compose.yml.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 70ac8ef..278b09a 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -69,8 +69,8 @@ services: healthcheck: test: ["CMD-SHELL", 'mysql --database=mysql --password={{ mysql_root_password }} --execute="SELECT count(table_name) > 0 FROM information_schema.tables;" --skip-column-names -B'] interval: 3s - timeout: 45s - retries: 15 + timeout: 120s + retries: 40 start_period: 15s restart: 'always' volumes: From 7a1726f161916a46a9ae6f9747e9476e5d44f4cf Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 8 Jun 2021 12:31:06 +0300 Subject: [PATCH 207/228] fix: remove not needed cr --- .github/workflows/test_build_php_images.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test_build_php_images.yml b/.github/workflows/test_build_php_images.yml index b4e98c7..37931e5 100644 --- a/.github/workflows/test_build_php_images.yml +++ b/.github/workflows/test_build_php_images.yml @@ -59,7 +59,6 @@ jobs: echo "drush_commands:" >> drupal-dockerizer.yml echo " - cc drush" >> drupal-dockerizer.yml echo " - site-install standard install_configure_form.enable_update_status_module=NULL" >> drupal-dockerizer.yml - echo " - cr" >> drupal-dockerizer.yml - name: Fix for drupal 7 if: ${{ matrix.php_version == '5.6' }} From 7aeb1caf234e3c23ff332980e8b819d7e4f459e5 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 15 Jun 2021 09:47:52 +0300 Subject: [PATCH 208/228] Implement export-import mysql volume --- default.config.yml | 1 + export-database-volume.yml | 28 ++++++++++++++++++++++++++++ import-database-volume.yml | 31 +++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 export-database-volume.yml create mode 100644 import-database-volume.yml diff --git a/default.config.yml b/default.config.yml index 8df9bd4..fb320e7 100644 --- a/default.config.yml +++ b/default.config.yml @@ -77,6 +77,7 @@ mysql_root_password: root mysql_user: docker mysql_password: docker mysql_database: docker +mysql_volume_archive: "{{drupal_root_dir}}/mysql_volume.tar.gz" # If set to true import database after up conteiners. import_database: false diff --git a/export-database-volume.yml b/export-database-volume.yml new file mode 100644 index 0000000..5f5f00e --- /dev/null +++ b/export-database-volume.yml @@ -0,0 +1,28 @@ +--- + +- hosts: all + vars_files: + - default.config.yml + + pre_tasks: + - name: Include config override file, if it exists. + include_vars: "{{ item }}" + with_fileglob: + - ../drupal-dockerizer.yml + + roles: [] + + tasks: + + - name: Stop all Docker containers. + command: docker-compose -p {{ compose_project_name }} stop + args: + chdir: "{{ docker_runtime_dir }}" + + - name: Create archive database. + command: tar -czvf {{mysql_volume_archive}} -C {{ docker_runtime_dir }}/data mysql + + - name: UP all Docker containers. + command: docker-compose -p {{ compose_project_name }} up -d + args: + chdir: "{{ docker_runtime_dir }}" diff --git a/import-database-volume.yml b/import-database-volume.yml new file mode 100644 index 0000000..6781c3b --- /dev/null +++ b/import-database-volume.yml @@ -0,0 +1,31 @@ +--- + +- hosts: all + vars_files: + - default.config.yml + + pre_tasks: + - name: Include config override file, if it exists. + include_vars: "{{ item }}" + with_fileglob: + - ../drupal-dockerizer.yml + + roles: [] + + tasks: + + - name: Stop all Docker containers. + command: docker-compose -p {{ compose_project_name }} stop + args: + chdir: "{{ docker_runtime_dir }}" + + - name: Remove old database data. + command: rm -rf {{ docker_runtime_dir }}/data/mysql + + - name: Unpack database. + command: tar -xzvf {{mysql_volume_archive}} -C {{ docker_runtime_dir }}/data/ + + - name: UP all Docker containers. + command: docker-compose -p {{ compose_project_name }} up -d + args: + chdir: "{{ docker_runtime_dir }}" From d3dd8fc50bf8ad0294746dca62bc314b42d7a37f Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 15 Jun 2021 10:26:46 +0300 Subject: [PATCH 209/228] feat: add mailhog service --- default.config.yml | 3 +++ tasks/local-hosts-setup.yml | 3 +++ tasks/settings-setup.yml | 8 ++++++++ templates/docker-compose.yml.j2 | 19 +++++++++++++++++++ 4 files changed, 33 insertions(+) diff --git a/default.config.yml b/default.config.yml index 8df9bd4..c761e6b 100644 --- a/default.config.yml +++ b/default.config.yml @@ -86,6 +86,9 @@ adminer_port: 8080 pre_task_path: ../pre_task.yml post_task_path: ../post_task.yml +install_mailhog: false +mailhog_expose_port: + custom_drupal_settings: | if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) { include $app_root . '/' . $site_path . '/settings.local.php'; diff --git a/tasks/local-hosts-setup.yml b/tasks/local-hosts-setup.yml index 9c90f6a..397512a 100644 --- a/tasks/local-hosts-setup.yml +++ b/tasks/local-hosts-setup.yml @@ -12,4 +12,7 @@ {% if solr %} {{ ip_part }}.12 solr.{{ domain_name }} {% endif %} + {% if install_mailhog %} + {{ ip_part }}.5 mail.{{ domain_name }} + {% endif %} {{ ip_part }}.13 db.{{ domain_name }} diff --git a/tasks/settings-setup.yml b/tasks/settings-setup.yml index 6b2cea2..44fb717 100644 --- a/tasks/settings-setup.yml +++ b/tasks/settings-setup.yml @@ -66,6 +66,14 @@ $config['search_api.server.solr']['backend_config']['connector_config']['host'] = '{{ compose_project_name }}-solr'; $config['search_api.server.solr']['backend_config']['connector_config']['core'] = '{{ solr_core_name }}'; {% endif %} + {% if install_mailhog %} + $config['smtp.settings']['smtp_on'] = TRUE; + $config['smtp.settings']['smtp_host'] = '{{ compose_project_name }}-mail'; + $config['smtp.settings']['smtp_port'] = '1025'; + $config['smtp.settings']['smtp_username'] = ''; + $config['smtp.settings']['smtp_password'] = ''; + $config['smtp.settings']['smtp_allowhtml'] = TRUE; + {% endif %} $settings["hash_salt"] = '{{ drupal_hash_salt }}'; - name: Add custom settings to settings.php diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 278b09a..82c34c8 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -35,6 +35,9 @@ services: {% endif %} links: - database +{% if install_mailhog %} + - mail +{% endif %} {% if memcache %} - memcached {% endif %} @@ -126,6 +129,22 @@ services: - database {% endif %} +{% if install_mailhog %} + mail: + image: mailhog/mailhog + container_name: '{{ compose_project_name }}-mail' + restart: always +{% if docker_network_gateway_ip is not none %} + networks: + {{ compose_project_name }}-network: + ipv4_address: {{ ip_part }}.5 +{% endif %} +{% if mailhog_expose_port %} + ports: + - "{{mailhog_expose_port}}:8025" +{% endif %} +{% endif %} + {% if docker_network_gateway_ip is not none %} networks: {{ compose_project_name }}-network: From b8600d6a0fc70661541eb86e606fa3f111f2f987 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 15 Jun 2021 10:45:08 +0300 Subject: [PATCH 210/228] fix: healthcheck on fresh run --- tasks/docker-up.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tasks/docker-up.yml b/tasks/docker-up.yml index e5e9aef..1a96e35 100644 --- a/tasks/docker-up.yml +++ b/tasks/docker-up.yml @@ -1,6 +1,11 @@ --- +- name: Build Docker containers. + command: docker-compose -p {{ compose_project_name }} build --pull + args: + chdir: "{{ docker_runtime_dir }}" + - name: Bring up the Docker containers. - command: docker-compose -p {{ compose_project_name }} up --build -d --remove-orphans + command: docker-compose -p {{ compose_project_name }} up -d --remove-orphans args: chdir: "{{ docker_runtime_dir }}" From 8777f19437e2f8bb9a6e90d74dd76c2cfacc3223 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 15 Jun 2021 10:56:30 +0300 Subject: [PATCH 211/228] Add autoheal --- templates/docker-compose.yml.j2 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 82c34c8..e67fa09 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -145,6 +145,14 @@ services: {% endif %} {% endif %} + autoheal: + image: willfarrell/autoheal:latest + tty: true + container_name: autoheal + restart: always + volumes: + - /var/run/docker.sock:/var/run/docker.sock + {% if docker_network_gateway_ip is not none %} networks: {{ compose_project_name }}-network: From 79c2b0f0eb2ce2d1054c123beb1e5d1469aef225 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 15 Jun 2021 11:00:51 +0300 Subject: [PATCH 212/228] Revert "Add autoheal" This reverts commit 8777f19437e2f8bb9a6e90d74dd76c2cfacc3223. --- templates/docker-compose.yml.j2 | 8 -------- 1 file changed, 8 deletions(-) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index e67fa09..82c34c8 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -145,14 +145,6 @@ services: {% endif %} {% endif %} - autoheal: - image: willfarrell/autoheal:latest - tty: true - container_name: autoheal - restart: always - volumes: - - /var/run/docker.sock:/var/run/docker.sock - {% if docker_network_gateway_ip is not none %} networks: {{ compose_project_name }}-network: From fe56539975135bbef47e513bfd64bab3711b3e7e Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 15 Jun 2021 11:01:48 +0300 Subject: [PATCH 213/228] more start period --- templates/docker-compose.yml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 82c34c8..9077d66 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -74,7 +74,7 @@ services: interval: 3s timeout: 120s retries: 40 - start_period: 15s + start_period: 20s restart: 'always' volumes: - ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql{{ ":cached" if docker_cached_volume }} From 99e98d30c7a3b03ee44d4d2ae82ecf88fae4f68d Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 15 Jun 2021 11:13:48 +0300 Subject: [PATCH 214/228] Change health check method --- templates/docker-compose.yml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 9077d66..fdfabb6 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -70,7 +70,7 @@ services: container_name: '{{ compose_project_name }}-database' command: --max_allowed_packet=1048576000 --skip-grant-tables healthcheck: - test: ["CMD-SHELL", 'mysql --database=mysql --password={{ mysql_root_password }} --execute="SELECT count(table_name) > 0 FROM information_schema.tables;" --skip-column-names -B'] + test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] interval: 3s timeout: 120s retries: 40 From be7d76a1a81f1658f3f49aade78c2e0d9ffae65d Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 15 Jun 2021 12:07:43 +0300 Subject: [PATCH 215/228] Improve healt check --- tasks/runtime-setup.yml | 9 +++++++++ templates/docker-compose.yml.j2 | 24 ++++++++++++------------ templates/mariadb.Dockerfile.j2 | 2 ++ templates/mysql-healthcheck.j2 | 31 +++++++++++++++++++++++++++++++ templates/mysql.Dockerfile.j2 | 2 ++ 5 files changed, 56 insertions(+), 12 deletions(-) create mode 100644 templates/mysql-healthcheck.j2 diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index f750ccb..8893ff6 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -87,6 +87,15 @@ owner: "{{user_uid|int}}" group: "{{user_gid|int}}" +- name: Ensure mysql Healthcheck is present. + become: true + template: + src: "templates/mysql-healthcheck.j2" + dest: "{{ docker_runtime_dir }}/bin/database/mysql-healthcheck" + mode: "u=rwx,og=rx" + owner: "{{user_uid|int}}" + group: "{{user_gid|int}}" + - name: Ensure Docker Compose file is present. become: true template: diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index fdfabb6..2b0ef1d 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -45,15 +45,15 @@ services: - solr {% endif %} volumes: - - {{ drupal_root_dir }}:/var/www/{{ ":cached" if docker_cached_volume }} - - {{ drupal_public_files_dir }}:/var/www/{{ drupal_web_root }}/sites/default/files/{{ ":cached" if docker_cached_volume }} - - {{ drupal_private_files_dir }}:/var/www/{{ drupal_web_root }}/sites/default/files/private{{ ":cached" if docker_cached_volume }} - - ${VHOSTS_DIR-./apache}:/etc/apache2/sites-enabled{{ ":cached" if docker_cached_volume }} + - {{ drupal_root_dir }}:/var/www/ + - {{ drupal_public_files_dir }}:/var/www/{{ drupal_web_root }}/sites/default/files/ + - {{ drupal_private_files_dir }}:/var/www/{{ drupal_web_root }}/sites/default/files/private + - ${VHOSTS_DIR-./apache}:/etc/apache2/sites-enabled {% if ssl_enabled %} - - {{ ssl_cert_path }}:/etc/apache2/cert.pem{{ ":cached" if docker_cached_volume }} - - {{ ssl_key_path }}:/etc/apache2/pivate.key{{ ":cached" if docker_cached_volume }} + - {{ ssl_cert_path }}:/etc/apache2/cert.pem + - {{ ssl_key_path }}:/etc/apache2/pivate.key {% endif %} - - ${LOG_DIR-./logs/apache2}:/var/log/apache2{{ ":cached" if docker_cached_volume }} + - ${LOG_DIR-./logs/apache2}:/var/log/apache2 {% if xdebug_install %} environment: XDEBUG_CONFIG: "{{ xdebug_enviroment }}" @@ -70,15 +70,15 @@ services: container_name: '{{ compose_project_name }}-database' command: --max_allowed_packet=1048576000 --skip-grant-tables healthcheck: - test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] + test: [ "CMD", "mysql-healthcheck"] interval: 3s timeout: 120s retries: 40 start_period: 20s restart: 'always' volumes: - - ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql{{ ":cached" if docker_cached_volume }} - - ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql{{ ":cached" if docker_cached_volume }} + - ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql + - ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql environment: MYSQL_ROOT_PASSWORD: {{ mysql_root_password }} MYSQL_DATABASE: {{ mysql_database }} @@ -100,9 +100,9 @@ services: {% if solr_version == 8 %} - ./data/solr_data:/var/solr {% elif solr_version != 4 %} - - ./data/solr_core:/opt/solr/server/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} + - ./data/solr_core:/opt/solr/server/solr/{{ solr_core_name }} {% elif solr_version == 4 %} - - ./data/solr_core:/opt/solr/example/solr/{{ solr_core_name }}{{ ":cached" if docker_cached_volume }} + - ./data/solr_core:/opt/solr/example/solr/{{ solr_core_name }} {% endif %} {% if docker_network_gateway_ip is not none %} networks: diff --git a/templates/mariadb.Dockerfile.j2 b/templates/mariadb.Dockerfile.j2 index 998a7ac..c36da80 100644 --- a/templates/mariadb.Dockerfile.j2 +++ b/templates/mariadb.Dockerfile.j2 @@ -1,5 +1,7 @@ FROM mariadb +COPY mysql-healthcheck /usr/local/bin/ + {% if user_uid != 0 %} ARG USER_UID={{ user_uid }} ARG USER_GID={{ user_gid }} diff --git a/templates/mysql-healthcheck.j2 b/templates/mysql-healthcheck.j2 new file mode 100644 index 0000000..eefb613 --- /dev/null +++ b/templates/mysql-healthcheck.j2 @@ -0,0 +1,31 @@ +#!/bin/bash +set -eo pipefail + +if [ "$MYSQL_RANDOM_ROOT_PASSWORD" ] && [ -z "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then + # there's no way we can guess what the random MySQL password was + echo >&2 'healthcheck error: cannot determine random root password (and MYSQL_USER and MYSQL_PASSWORD were not set)' + exit 0 +fi + +host="$(hostname --ip-address || echo '127.0.0.1')" +user="${MYSQL_USER:-root}" +export MYSQL_PWD="${MYSQL_PASSWORD:-$MYSQL_ROOT_PASSWORD}" + +args=( + # force mysql to not use the local "mysqld.sock" (test "external" connectibility) + -h"$host" + -u"$user" + --silent +) + +if command -v mysqladmin &> /dev/null; then + if mysqladmin "${args[@]}" ping > /dev/null; then + exit 0 + fi +else + if select="$(echo 'SELECT 1' | mysql "${args[@]}")" && [ "$select" = '1' ]; then + exit 0 + fi +fi + +exit 1 diff --git a/templates/mysql.Dockerfile.j2 b/templates/mysql.Dockerfile.j2 index dd81df8..6627d62 100644 --- a/templates/mysql.Dockerfile.j2 +++ b/templates/mysql.Dockerfile.j2 @@ -1,5 +1,7 @@ FROM mysql:5.7 +COPY mysql-healthcheck /usr/local/bin/ + {% if user_uid != 0 %} ARG USER_UID={{ user_uid }} ARG USER_GID={{ user_gid }} From 103066e84d14617baf99adf09172fd9dc215e98d Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 15 Jun 2021 12:08:33 +0300 Subject: [PATCH 216/228] fix: ansible fail docker-compose up command --- default.config.yml | 1 - tasks/docker-up.yml | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/default.config.yml b/default.config.yml index c761e6b..2f12b5a 100644 --- a/default.config.yml +++ b/default.config.yml @@ -2,7 +2,6 @@ compose_project_name: my-project docker_runtime_dir: "runtime-{{compose_project_name}}" -docker_cached_volume: true user_uid: 1000 user_gid: 1000 diff --git a/tasks/docker-up.yml b/tasks/docker-up.yml index 1a96e35..5357061 100644 --- a/tasks/docker-up.yml +++ b/tasks/docker-up.yml @@ -6,6 +6,6 @@ chdir: "{{ docker_runtime_dir }}" - name: Bring up the Docker containers. - command: docker-compose -p {{ compose_project_name }} up -d --remove-orphans - args: + shell: + cmd: sleep 1; docker-compose -p {{ compose_project_name }} up -d --remove-orphans; sleep 1; chdir: "{{ docker_runtime_dir }}" From 7e71a619bb45ad09078bd912765aef905eeaf405 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 15 Jun 2021 13:01:14 +0300 Subject: [PATCH 217/228] Move health check to ansible --- tasks/docker-up.yml | 18 ++++++++++++++++-- templates/docker-compose.yml.j2 | 9 +-------- templates/mariadb.Dockerfile.j2 | 2 -- templates/mysql-healthcheck.j2 | 31 ------------------------------- templates/mysql.Dockerfile.j2 | 2 -- 5 files changed, 17 insertions(+), 45 deletions(-) delete mode 100644 templates/mysql-healthcheck.j2 diff --git a/tasks/docker-up.yml b/tasks/docker-up.yml index 5357061..5794166 100644 --- a/tasks/docker-up.yml +++ b/tasks/docker-up.yml @@ -6,6 +6,20 @@ chdir: "{{ docker_runtime_dir }}" - name: Bring up the Docker containers. - shell: - cmd: sleep 1; docker-compose -p {{ compose_project_name }} up -d --remove-orphans; sleep 1; + command: docker-compose -p {{ compose_project_name }} up -d + args: chdir: "{{ docker_runtime_dir }}" + +- name: Add DataBase as inventory host. + add_host: + name: "{{ compose_project_name }}-database" + ansible_connection: docker + changed_when: false + +- name: DataBase Healthcheck. + delegate_to: "{{ compose_project_name }}-database" + become: no + raw: "mysqladmin ping -h localhost" + register: database_health + until: database_health is not failed + retries: 7 diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 2b0ef1d..39c1956 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -24,8 +24,7 @@ services: sysctls: - net.ipv4.ip_unprivileged_port_start=0 depends_on: - database: - condition: service_healthy + - database {% if expose_http_port|int > 0 %} ports: - "{{ expose_http_port }}:80" @@ -69,12 +68,6 @@ services: context: "./bin/database" container_name: '{{ compose_project_name }}-database' command: --max_allowed_packet=1048576000 --skip-grant-tables - healthcheck: - test: [ "CMD", "mysql-healthcheck"] - interval: 3s - timeout: 120s - retries: 40 - start_period: 20s restart: 'always' volumes: - ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql diff --git a/templates/mariadb.Dockerfile.j2 b/templates/mariadb.Dockerfile.j2 index c36da80..998a7ac 100644 --- a/templates/mariadb.Dockerfile.j2 +++ b/templates/mariadb.Dockerfile.j2 @@ -1,7 +1,5 @@ FROM mariadb -COPY mysql-healthcheck /usr/local/bin/ - {% if user_uid != 0 %} ARG USER_UID={{ user_uid }} ARG USER_GID={{ user_gid }} diff --git a/templates/mysql-healthcheck.j2 b/templates/mysql-healthcheck.j2 deleted file mode 100644 index eefb613..0000000 --- a/templates/mysql-healthcheck.j2 +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -set -eo pipefail - -if [ "$MYSQL_RANDOM_ROOT_PASSWORD" ] && [ -z "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then - # there's no way we can guess what the random MySQL password was - echo >&2 'healthcheck error: cannot determine random root password (and MYSQL_USER and MYSQL_PASSWORD were not set)' - exit 0 -fi - -host="$(hostname --ip-address || echo '127.0.0.1')" -user="${MYSQL_USER:-root}" -export MYSQL_PWD="${MYSQL_PASSWORD:-$MYSQL_ROOT_PASSWORD}" - -args=( - # force mysql to not use the local "mysqld.sock" (test "external" connectibility) - -h"$host" - -u"$user" - --silent -) - -if command -v mysqladmin &> /dev/null; then - if mysqladmin "${args[@]}" ping > /dev/null; then - exit 0 - fi -else - if select="$(echo 'SELECT 1' | mysql "${args[@]}")" && [ "$select" = '1' ]; then - exit 0 - fi -fi - -exit 1 diff --git a/templates/mysql.Dockerfile.j2 b/templates/mysql.Dockerfile.j2 index 6627d62..dd81df8 100644 --- a/templates/mysql.Dockerfile.j2 +++ b/templates/mysql.Dockerfile.j2 @@ -1,7 +1,5 @@ FROM mysql:5.7 -COPY mysql-healthcheck /usr/local/bin/ - {% if user_uid != 0 %} ARG USER_UID={{ user_uid }} ARG USER_GID={{ user_gid }} From 02327af3a780fdbddf9dbc52f228e15e2b897fe3 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 15 Jun 2021 13:02:58 +0300 Subject: [PATCH 218/228] fix: runtime setup --- tasks/runtime-setup.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tasks/runtime-setup.yml b/tasks/runtime-setup.yml index 8893ff6..f750ccb 100644 --- a/tasks/runtime-setup.yml +++ b/tasks/runtime-setup.yml @@ -87,15 +87,6 @@ owner: "{{user_uid|int}}" group: "{{user_gid|int}}" -- name: Ensure mysql Healthcheck is present. - become: true - template: - src: "templates/mysql-healthcheck.j2" - dest: "{{ docker_runtime_dir }}/bin/database/mysql-healthcheck" - mode: "u=rwx,og=rx" - owner: "{{user_uid|int}}" - group: "{{user_gid|int}}" - - name: Ensure Docker Compose file is present. become: true template: From 49066b49d50325d2c9d1a48f2fe935166121816c Mon Sep 17 00:00:00 2001 From: svicervlad Date: Thu, 17 Jun 2021 13:17:57 +0300 Subject: [PATCH 219/228] Implement test for volume import-export --- .github/workflows/test_db_volume_import.yml | 100 ++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .github/workflows/test_db_volume_import.yml diff --git a/.github/workflows/test_db_volume_import.yml b/.github/workflows/test_db_volume_import.yml new file mode 100644 index 0000000..57d9297 --- /dev/null +++ b/.github/workflows/test_db_volume_import.yml @@ -0,0 +1,100 @@ +name: Check database volume import export functionality + +on: + pull_request: + branches: [main] + paths-ignore: + - '**.md' + - '**.Dockerfile' + workflow_dispatch: + +jobs: + test_import_db: + runs-on: ubuntu-20.04 + steps: + - name: Cache Composer dependencies for improve speed + uses: actions/cache@v2 + with: + path: ~/.cache/composer + key: ${{ runner.os }}-drupal + + - name: Get Drupal Project repository + uses: actions/checkout@v2 + with: + repository: 'drupal/recommended-project' + path: './' + ref: '9.2.x' + + - name: Run Composer install + run: composer install --ignore-platform-reqs + + - name: Get Drupal Dockerizer repository + uses: actions/checkout@v2 + with: + path: '.drupal-dockerizer' + + - name: Create basic drupal-dockerizer.yml + run: | + echo "---" > drupal-dockerizer.yml + echo "" >> drupal-dockerizer.yml + echo "compose_project_name: drupal-project" >> drupal-dockerizer.yml + echo "user_uid: $(id -u)" >> drupal-dockerizer.yml + echo "user_gid: $(id -g)" >> drupal-dockerizer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml + echo "expose_http_port: 80" >> drupal-dockerizer.yml + + - name: Run up playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: up.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Run drush-commands playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: drush-commands.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Change site name by Drush + run: docker exec drupal-project-webserver drush cset system.site name DrupalVolumeDump -y + + - name: Dump database volume with installed Drupal + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: export-database-volume.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Destroy containers and runtime + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: clean.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Run up playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: up.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Import DataBase volume + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: import-database-volume.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Check that import is OK and site name is DrupalVolumeDump + run: | + result="`docker exec drupal-project-webserver drush cget system.site name --format=string`" + if [[ "$result" == "DrupalVolumeDump" ]]; then echo "Import DB is OK"; exit 0; else echo "Import db not correct"; exit 1; fi From 58b352ad5a446e03099524a3e710cfc785fd881b Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 20 Jul 2021 13:11:41 +0000 Subject: [PATCH 220/228] feat(webserver): add nodejs support --- default.config.yml | 4 ++++ templates/php.Dockerfile.j2 | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/default.config.yml b/default.config.yml index 2b3a029..4b2fe0b 100644 --- a/default.config.yml +++ b/default.config.yml @@ -30,6 +30,10 @@ php_memory_limit: 512M docker_network_gateway_ip: domain_name: drupal.devel +# Install nvm and node with npm to webserver container. +node_version: +nvm_version: v0.38.0 + # Enviroment variable for php xdebug extensions xdebug_install: false # Availible versions https://pecl.php.net/package/xdebug diff --git a/templates/php.Dockerfile.j2 b/templates/php.Dockerfile.j2 index 8dd0af9..4338a5c 100644 --- a/templates/php.Dockerfile.j2 +++ b/templates/php.Dockerfile.j2 @@ -40,3 +40,25 @@ RUN sudo curl -fsSL -o /usr/local/bin/drush "https://github.com/drush-ops/drush- USER dockerizer +{% if node_version %} +# Install nvm. +# Set default shel for build to bash. +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +ENV NODE_VERSION {{node_version}} + +ENV NVM_DIR /home/dockerizer/.nvm + +# Clone nvm repository. +RUN git clone --depth 1 --branch v0.38.0 https://github.com/nvm-sh/nvm.git /home/dockerizer/.nvm + +# Configure nvm. +RUN echo 'export NVM_DIR="$HOME/.nvm"' >> "$HOME/.bashrc" +RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> "$HOME/.bashrc" +RUN echo '[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> "$HOME/.bashrc" + +# nodejs and tools +RUN bash -c 'source $HOME/.nvm/nvm.sh && \ + nvm install $NODE_VERSION && \ + npm install --prefix "$HOME/.nvm/"' +{% endif %} From 429c3f45d3381236971f082d6e06fa5241f7fed3 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 27 Jul 2021 06:09:08 +0000 Subject: [PATCH 221/228] fix(node): use boolean for setup node in php container --- default.config.yml | 3 ++- templates/php.Dockerfile.j2 | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/default.config.yml b/default.config.yml index 4b2fe0b..d704af7 100644 --- a/default.config.yml +++ b/default.config.yml @@ -31,7 +31,8 @@ docker_network_gateway_ip: domain_name: drupal.devel # Install nvm and node with npm to webserver container. -node_version: +node_install: false +node_version: 14 nvm_version: v0.38.0 # Enviroment variable for php xdebug extensions diff --git a/templates/php.Dockerfile.j2 b/templates/php.Dockerfile.j2 index 4338a5c..3e814e9 100644 --- a/templates/php.Dockerfile.j2 +++ b/templates/php.Dockerfile.j2 @@ -40,9 +40,10 @@ RUN sudo curl -fsSL -o /usr/local/bin/drush "https://github.com/drush-ops/drush- USER dockerizer -{% if node_version %} -# Install nvm. -# Set default shel for build to bash. +{% if node_install %} +# Install nvm +# @see https://github.com/nvm-sh/nvm/blob/master/Dockerfile. +# Set default shell for build to bash. SHELL ["/bin/bash", "-o", "pipefail", "-c"] ENV NODE_VERSION {{node_version}} @@ -50,7 +51,7 @@ ENV NODE_VERSION {{node_version}} ENV NVM_DIR /home/dockerizer/.nvm # Clone nvm repository. -RUN git clone --depth 1 --branch v0.38.0 https://github.com/nvm-sh/nvm.git /home/dockerizer/.nvm +RUN git clone --depth 1 --branch v{{ nvm_version }} https://github.com/nvm-sh/nvm.git /home/dockerizer/.nvm # Configure nvm. RUN echo 'export NVM_DIR="$HOME/.nvm"' >> "$HOME/.bashrc" From b33f7d67e05ccc394f78126f9195e653acd8aca9 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 27 Jul 2021 06:27:20 +0000 Subject: [PATCH 222/228] feat(node): add test to check nodejs functionality --- .github/workflows/test_node_support.yml | 62 +++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/test_node_support.yml diff --git a/.github/workflows/test_node_support.yml b/.github/workflows/test_node_support.yml new file mode 100644 index 0000000..b2a4372 --- /dev/null +++ b/.github/workflows/test_node_support.yml @@ -0,0 +1,62 @@ +name: Check nodejs functionality + +on: + pull_request: + branches: [main] + paths-ignore: + - '**.md' + - '**.Dockerfile' + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-20.04 + steps: + - name: Cache Composer dependencies for improve speed + uses: actions/cache@v2 + with: + path: ~/.cache/composer + key: ${{ runner.os }}-drupal + + - name: Get Drupal Project repository + uses: actions/checkout@v2 + with: + repository: 'drupal/recommended-project' + path: './' + ref: '9.2.x' + + - name: Run Composer install + run: composer install --ignore-platform-reqs + + - name: Get Drupal Dockerizer repository + uses: actions/checkout@v2 + with: + path: '.drupal-dockerizer' + + - name: Create basic drupal-dockerizer.yml + run: | + echo "---" > drupal-dockerizer.yml + echo "" >> drupal-dockerizer.yml + echo "compose_project_name: drupal-project" >> drupal-dockerizer.yml + echo "user_uid: $(id -u)" >> drupal-dockerizer.yml + echo "user_gid: $(id -g)" >> drupal-dockerizer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml + echo "expose_http_port: 80" >> drupal-dockerizer.yml + echo "node_install: true" >> drupal-dockerizer.yml + + - name: Run up playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: up.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Check nvm version + run: docker exec drupal-project-webserver nvm --version || { echo 'nvm does not installed' ; exit 1; }; + + - name: Check node version + run: docker exec drupal-project-webserver node --version || { echo 'nodejs does not installed' ; exit 1; }; + + - name: Check npm version + run: docker exec drupal-project-webserver npm --version || { echo 'npm does not installed' ; exit 1; }; From bc2d286ca92412b66e78909093c561efdd57ac6a Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 27 Jul 2021 06:30:45 +0000 Subject: [PATCH 223/228] fix(typo): double v in nvm version --- templates/php.Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/php.Dockerfile.j2 b/templates/php.Dockerfile.j2 index 3e814e9..af56e32 100644 --- a/templates/php.Dockerfile.j2 +++ b/templates/php.Dockerfile.j2 @@ -51,7 +51,7 @@ ENV NODE_VERSION {{node_version}} ENV NVM_DIR /home/dockerizer/.nvm # Clone nvm repository. -RUN git clone --depth 1 --branch v{{ nvm_version }} https://github.com/nvm-sh/nvm.git /home/dockerizer/.nvm +RUN git clone --depth 1 --branch {{ nvm_version }} https://github.com/nvm-sh/nvm.git /home/dockerizer/.nvm # Configure nvm. RUN echo 'export NVM_DIR="$HOME/.nvm"' >> "$HOME/.bashrc" From cb9c1f640231bc0a02a78740bafb56c84355e571 Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 27 Jul 2021 07:13:13 +0000 Subject: [PATCH 224/228] fix(node): use nodejs instruction for install --- .github/workflows/test_node_support.yml | 3 --- default.config.yml | 6 +++--- templates/php.Dockerfile.j2 | 22 ++-------------------- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/.github/workflows/test_node_support.yml b/.github/workflows/test_node_support.yml index b2a4372..6a510ec 100644 --- a/.github/workflows/test_node_support.yml +++ b/.github/workflows/test_node_support.yml @@ -52,9 +52,6 @@ jobs: options: | --verbose - - name: Check nvm version - run: docker exec drupal-project-webserver nvm --version || { echo 'nvm does not installed' ; exit 1; }; - - name: Check node version run: docker exec drupal-project-webserver node --version || { echo 'nodejs does not installed' ; exit 1; }; diff --git a/default.config.yml b/default.config.yml index d704af7..b9533a0 100644 --- a/default.config.yml +++ b/default.config.yml @@ -30,10 +30,10 @@ php_memory_limit: 512M docker_network_gateway_ip: domain_name: drupal.devel -# Install nvm and node with npm to webserver container. -node_install: false +# Install node with npm to webserver container. +# See https://github.com/nodesource/distributions#installation-instructions for available version. +node_install: true node_version: 14 -nvm_version: v0.38.0 # Enviroment variable for php xdebug extensions xdebug_install: false diff --git a/templates/php.Dockerfile.j2 b/templates/php.Dockerfile.j2 index af56e32..7c7ea79 100644 --- a/templates/php.Dockerfile.j2 +++ b/templates/php.Dockerfile.j2 @@ -41,25 +41,7 @@ RUN sudo curl -fsSL -o /usr/local/bin/drush "https://github.com/drush-ops/drush- USER dockerizer {% if node_install %} -# Install nvm -# @see https://github.com/nvm-sh/nvm/blob/master/Dockerfile. -# Set default shell for build to bash. -SHELL ["/bin/bash", "-o", "pipefail", "-c"] +RUN curl -fsSL https://deb.nodesource.com/setup_{{node_version}}.x | sudo -E bash - +RUN sudo apt-get install -y nodejs -ENV NODE_VERSION {{node_version}} - -ENV NVM_DIR /home/dockerizer/.nvm - -# Clone nvm repository. -RUN git clone --depth 1 --branch {{ nvm_version }} https://github.com/nvm-sh/nvm.git /home/dockerizer/.nvm - -# Configure nvm. -RUN echo 'export NVM_DIR="$HOME/.nvm"' >> "$HOME/.bashrc" -RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> "$HOME/.bashrc" -RUN echo '[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> "$HOME/.bashrc" - -# nodejs and tools -RUN bash -c 'source $HOME/.nvm/nvm.sh && \ - nvm install $NODE_VERSION && \ - npm install --prefix "$HOME/.nvm/"' {% endif %} From 64f954ad6c548a54dafe23732447ea4b318b47ae Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 27 Jul 2021 07:20:59 +0000 Subject: [PATCH 225/228] fix(node): set deafault to false --- default.config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.config.yml b/default.config.yml index b9533a0..9bbfb17 100644 --- a/default.config.yml +++ b/default.config.yml @@ -32,7 +32,7 @@ domain_name: drupal.devel # Install node with npm to webserver container. # See https://github.com/nodesource/distributions#installation-instructions for available version. -node_install: true +node_install: false node_version: 14 # Enviroment variable for php xdebug extensions From 4fbe0eec4c108b084e9dd669acf8b2818aae2407 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 27 Jul 2021 10:33:24 +0300 Subject: [PATCH 226/228] fix(node): remove empty line --- templates/php.Dockerfile.j2 | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/php.Dockerfile.j2 b/templates/php.Dockerfile.j2 index 7c7ea79..c482b3e 100644 --- a/templates/php.Dockerfile.j2 +++ b/templates/php.Dockerfile.j2 @@ -43,5 +43,4 @@ USER dockerizer {% if node_install %} RUN curl -fsSL https://deb.nodesource.com/setup_{{node_version}}.x | sudo -E bash - RUN sudo apt-get install -y nodejs - {% endif %} From 1aee531fb562a80e0e2ad55d1103a1e60b70248a Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 27 Jul 2021 07:37:59 +0000 Subject: [PATCH 227/228] fix(adminer): expose port if it set --- default.config.yml | 2 +- templates/docker-compose.yml.j2 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/default.config.yml b/default.config.yml index 2b3a029..80fcce8 100644 --- a/default.config.yml +++ b/default.config.yml @@ -81,7 +81,7 @@ mysql_volume_archive: "{{drupal_root_dir}}/mysql_volume.tar.gz" import_database: false install_adminer: false -adminer_port: 8080 +adminer_expose_port: pre_task_path: ../pre_task.yml post_task_path: ../post_task.yml diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 39c1956..dd0e2c2 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -114,9 +114,9 @@ services: {{ compose_project_name }}-network: ipv4_address: {{ ip_part }}.11 {% endif %} -{% if docker_network_gateway_ip is none %} +{% if adminer_expose_port %} ports: - - "{{ adminer_port }}:8080" + - "{{ adminer_expose_port }}:8080" {% endif %} links: - database From caadec054e255b43e78aba150380be268dd56b9d Mon Sep 17 00:00:00 2001 From: svicervlad Date: Tue, 27 Jul 2021 07:40:26 +0000 Subject: [PATCH 228/228] feat(adminer): test adminer functionality --- .github/workflows/test_adminer.yml | 57 ++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/test_adminer.yml diff --git a/.github/workflows/test_adminer.yml b/.github/workflows/test_adminer.yml new file mode 100644 index 0000000..a6ffec5 --- /dev/null +++ b/.github/workflows/test_adminer.yml @@ -0,0 +1,57 @@ +name: Check adminer functionality + +on: + pull_request: + branches: [main] + paths-ignore: + - '**.md' + - '**.Dockerfile' + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-20.04 + steps: + - name: Cache Composer dependencies for improve speed + uses: actions/cache@v2 + with: + path: ~/.cache/composer + key: ${{ runner.os }}-drupal + + - name: Get Drupal Project repository + uses: actions/checkout@v2 + with: + repository: 'drupal/recommended-project' + path: './' + ref: '9.2.x' + + - name: Run Composer install + run: composer install --ignore-platform-reqs + + - name: Get Drupal Dockerizer repository + uses: actions/checkout@v2 + with: + path: '.drupal-dockerizer' + + - name: Create basic drupal-dockerizer.yml + run: | + echo "---" > drupal-dockerizer.yml + echo "" >> drupal-dockerizer.yml + echo "compose_project_name: drupal-project" >> drupal-dockerizer.yml + echo "user_uid: $(id -u)" >> drupal-dockerizer.yml + echo "user_gid: $(id -g)" >> drupal-dockerizer.yml + echo "drupal_root_dir: $GITHUB_WORKSPACE" >> drupal-dockerizer.yml + echo "expose_http_port: 80" >> drupal-dockerizer.yml + echo "install_adminer: true" >> drupal-dockerizer.yml + echo "adminer_expose_port: 8085" >> drupal-dockerizer.yml + + - name: Run up playbook + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: up.yml + directory: .drupal-dockerizer + options: | + --verbose + + - name: Check Adminer + run: curl http://localhost:8085