Skip to content

Commit

Permalink
Fixes for deploy-next
Browse files Browse the repository at this point in the history
  • Loading branch information
pinkeen authored and krisdante committed Mar 18, 2021
1 parent 54f2636 commit dd7c7f4
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 77 deletions.
2 changes: 0 additions & 2 deletions roles/cs.magento-configure/defaults/main/general.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
magento_build_mode: no

magento_core_config_settings: []
magento_core_config_settings_to_remove: []

Expand Down

This file was deleted.

11 changes: 11 additions & 0 deletions roles/cs.magento-configure/tasks/250-setup-services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- name: Install node warmup service
template:
src: magento-node-warmup.service
dest: /etc/systemd/system/magento-node-warmup.service

- name: Enable node warmup service
systemd:
name: magento-node-warmup.service
state: stopped
enabled: yes
daemon_reload: yes
9 changes: 2 additions & 7 deletions roles/cs.magento-configure/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@
- include_tasks: 040-install-magento.yml
- name: Set up new code
block:
# - include_tasks: 050-install-sample-data.yml
# when: magento_install_sample_data
# Checking if it works without
# - include_tasks: action/flush-cache.yml
- include_tasks: 070-setup-modules.yml
- include_tasks: 075-compile-di.yml
- include_tasks: 076-optimize-autoload.yml
- include_tasks: 080-core-config.yml
# - include_tasks: 090-setup-upgrade.yml
# when: not magento_build_mode
- include_tasks: 110-deploy-static-content.yml
when: not magento_scd_skip
- include_tasks: action/flush-cache.yml
- include_tasks: 140-install-extra-scripts.yml
when: deploy_install_new_release
become: yes
become_user: "{{ magento_user }}"
Expand All @@ -37,5 +30,7 @@
- include_tasks: 210-setup-workers.yml
when: magento_consumer_workers_enable and magento_version is version('2.3', '>=')

- include_tasks: 250-setup-services.yml



25 changes: 25 additions & 0 deletions roles/cs.magento-configure/templates/magento-node-warmup.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[Unit]
Description=Magento App Node Warmup

After=network.target
After=network-online.target

Requires=network-online.target
Requires=nginx.service
Requires=php-fpm.service

ConditionPathExists=!{{ magento_live_release_dir }}/pub/WARMUP

[Service]
Type=oneshot
RemainAfterExit=no

ExecStartPre={{ magento_live_release_dir }}/bin/magento setup:db:status
ExecStart={{ magento_live_release_dir }}/bin/magento cs:warm-node \
--local-url="http://localhost:{{ nginx_app_port }}"

User={{ magento_user }}
Group={{ magento_group }}

[Install]
WantedBy=multi-user.target
16 changes: 0 additions & 16 deletions roles/cs.magento-configure/templates/magento_node_warmup.sh.j2

This file was deleted.

62 changes: 17 additions & 45 deletions site.step-65-post-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,69 +8,41 @@
delay: 10
timeout: 300

# Non-zero status means setup:upgrade is required
# bin/magento setup:db:status
# systemctl stop supervisord

# su - {{ magento_user }} -c 'php {{ magento_live_release_dir }}/bin/magento maintenance:enable'
# su - {{ magento_user }} -c 'php {{ magento_live_release_dir }}/bin/magento setup:upgrade --keep-generated'
# su - {{ magento_user }} -c 'php {{ magento_live_release_dir }}/bin/magento maintenance:disable'

# systemctl start supervisord
- hosts: app:&current
gather_facts: no
tasks:
- name: Run Magento setup upgrade
- name: Run Magento post-deploy setup
command: "{{ item.cmd | default(item) }}"
args:
chdir: "{{ item.dir | default(magento_live_release_dir) }}"
run_once: true
become: yes
become_user: "{{ magento_user }}"
loop:
- "bin/magento app:config:import --no-interaction"
- "bin/magento setup:upgrade --keep-generated"
- "bin/magento maintenance:disable"
# - "bin/magento cache:flush full_page"
- "{{ magento_live_release_dir }}{{ magento_node_warmup_script_path }}"
loop: "{{ commands_base + magento_post_deploy_commands | default([]) }}"
loop_control:
label: "{{ item.cmd | default(item) }}"
register: out
vars:
commands_base:
- "bin/magento app:config:import --no-interaction"
- "bin/magento setup:upgrade --keep-generated"
- "bin/magento maintenance:disable"

- name: Show Magento post-deploy command output
- name: Show Magento post-deploy output
debug:
msg: "{{ result.stdout | default('--- N/A ---') }}"
loop: "{{ out.results }}"
loop_control:
loop_var: result
label: "{{ result.cmd | default([]) | join(' ') }}"

- hosts: app:&current
gather_facts: no
tasks:
- name: Run Magento post-deploy commands
command: "{{ item.cmd | default(item) }}"
args:
chdir: "{{ item.dir | default(magento_live_release_dir) }}"
run_once: true
become: yes
become_user: "{{ magento_user }}"
loop: "{{ magento_post_deploy_commands | default([]) }}"
- name: Start Magento services
service:
name: "{{ service_name }}"
state: started
loop:
- magento-node-warmup.service
- supervisord.service
loop_control:
label: "{{ item.cmd | default(item) }}"
register: out

- name: Show Magento post-deploy command output
debug:
msg: "{{ result.stdout | default('--- N/A ---') }}"
loop: "{{ out.results }}"
loop_control:
loop_var: result
label: "{{ result.cmd | default([]) | join(' ') }}"


- hosts: app:&current
gather_facts: no
tasks:
- name: Start supervisord Magento workers
command: /usr/bin/systemctl start supervisord
loop_var: service_name

0 comments on commit dd7c7f4

Please sign in to comment.