Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
382e09d
Ignore errors when setting log retention
MariuszJozwiak Nov 28, 2025
bbee46a
Update magerun to 9.3.0
MariuszJozwiak Mar 2, 2026
0485f01
Add Google Tag Manager server-side
MariuszJozwiak Jan 7, 2026
658b686
Merge pull request #503 from mageops/dev-rotation
Szpadel Mar 3, 2026
ff2e830
Restrict GTM app ingress on ports 8080/8081 to Varnish security group
Szpadel Mar 3, 2026
0f93b88
Fix GTM vcl_recv branch syntax by using valid VCL 'elsif'
Szpadel Mar 3, 2026
ee5113f
Run GTM role only with standalone Varnish topology
Szpadel Mar 3, 2026
b6afdcf
Merge pull request #517 from mageops/dev-magerun
Szpadel Mar 3, 2026
e212504
Merge pull request #515 from mageops/dev-gtm
Szpadel Mar 3, 2026
0f50729
feat: DEVOPS-621 add search ajax suggest cache type
piotrmatras Mar 6, 2026
790d429
Merge pull request #518 from piotrmatras/feat/DEVOPS-621/add-search-a…
Szpadel Mar 6, 2026
d857551
feat: DEVOPS-623 add realpath cache configuration
piotrmatras Mar 9, 2026
4473c4c
Align php realpath cache group vars with updated defaults
Szpadel Mar 10, 2026
2957432
Merge pull request #520 from piotrmatras/feat/DEVOPS-623/realpath-cac…
Szpadel Mar 10, 2026
bdf8c09
Implement rclone replacement for s3fs
Szpadel Mar 11, 2026
1ef63e9
Merge pull request #521 from mageops/dev-rclone
MariuszJozwiak Mar 13, 2026
48b2fd5
Add slowlog depth trace option to PHP
MariuszJozwiak Mar 16, 2026
13e3a9a
Apply suggestions from code review
Szpadel Mar 17, 2026
dee72a5
Merge pull request #523 from mageops/dev-slowlog
Szpadel Mar 17, 2026
94337cc
Fix plugin reinstall logic
Szpadel Mar 17, 2026
1c0be8d
Merge pull request #524 from mageops/dev-opensearch-plugins
MariuszJozwiak Mar 17, 2026
159142f
Move lazy resize to etc.php
MariuszJozwiak Mar 18, 2026
e4dcd66
feat: DEVOPS-627 allow cache search results
piotrmatras Mar 19, 2026
57db75a
Merge pull request #526 from mageops/dev-lazy
Szpadel Mar 20, 2026
fef179b
Merge pull request #525 from piotrmatras/feat/DEVOPS-627/allow-cache-…
Szpadel Mar 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2152,3 +2152,8 @@ aws_pio_ebs_volume_size: "{{ aws_app_node_ebs_volume_size }}"
new_relic_app_name: "{{ mageops_app_name }}"
mageops_new_relic_enabled: no
# new_relic_license need to be set up

# ---------------------
# ----- Google Tag Manger -----
# ---------------------
gtm_enabled: no
3 changes: 2 additions & 1 deletion requirements-galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ collections:
- name: ansible.netcommon
version: 5.1.2
- community.crypto
- ansible.posix
- ansible.posix
- containers.podman
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
varnish_backend_probe_endpoint: "{{ varnish_backend_probe_endpoint }}"
varnish_backend_max_conns: "{{ varnish_backend_max_conns }}"
varnish_backend_first_byte_timeout: "{{ varnish_backend_first_byte_timeout }}"
gtm_enabled: "{{ gtm_enabled | default(false) }}"

- name: Check if lambda function exists
community.aws.lambda_info:
Expand Down
3 changes: 3 additions & 0 deletions roles/cs.aws-logs-retention/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@
- name: Set log retention for groups without retention
shell: "aws logs put-retention-policy --log-group-name={{ item }} --retention-in-days=7 --region={{ aws_region }}"
loop: "{{ aws_log_retention_groups.ansible_facts.data.groups }}"
ignore_errors: true
when: aws_log_retention_groups.ansible_facts.data.groups | length > 0

9 changes: 7 additions & 2 deletions roles/cs.aws-security-group/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
name: "{{ aws_security_group_app_name }}"
description: "{{ mageops_app_name }} Webnodes security group"
region: "{{ aws_region }}"
rules: "{{ aws_security_group_app_rules_base + aws_security_group_app_rules + aws_security_group_app_extra_rules }}"
rules: "{{ aws_security_group_app_rules_base + aws_security_group_app_rules + aws_security_group_app_extra_rules + (aws_security_group_app_gtm_rules if gtm_enabled | default(false) else []) }}"
vpc_id: "{{ aws_vpc_id }}"
tags: "{{ aws_tags_default | combine(ec2_sg_tags) }}"
vars:
Expand All @@ -88,7 +88,12 @@
ports:
- "{{ mageops_varnish_backend_port }}"
group_name: "{{ aws_security_group_varnish_name }}"

aws_security_group_app_gtm_rules:
- proto: tcp
ports:
- 8080
- 8081
group_name: "{{ aws_security_group_varnish_name }}"
register: aws_security_group_app

- name: Create security group for persistant node
Expand Down
57 changes: 57 additions & 0 deletions roles/cs.gtm/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
- name: Ensure Podman is installed (RHEL/CentOS/Amazon Linux 2023)
ansible.builtin.dnf:
name:
- podman
- containers-common
- slirp4netns
- fuse-overlayfs
state: present

- name: Pull Google Tag Manager Server-Side image
containers.podman.podman_image:
name: gcr.io/cloud-tagging-10302018/gtm-cloud-image
tag: stable

# MAIN (tagging) container
- name: Run GTM SS main container and create systemd service
containers.podman.podman_container:
name: gtm
image: gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable
state: started
restart_policy: always
publish:
- "8080:8080"
env:
PORT: "8080"
PREVIEW_SERVER_URL: "https://{{ mageops_gtm_preview_domain }}"
CONTAINER_CONFIG: "{{ gtm_container_config }}"
generate_systemd:
path: /etc/systemd/system
restart_policy: always

# PREVIEW container (separate instance)
- name: Run GTM SS preview container and create systemd service
containers.podman.podman_container:
name: gtm-preview
image: gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable
state: started
restart_policy: always
publish:
- "8081:8080"
env:
PORT: "8080"
RUN_AS_PREVIEW_SERVER: "true"
CONTAINER_CONFIG: "{{ gtm_container_config }}"
generate_systemd:
path: /etc/systemd/system
restart_policy: always

- name: Reload systemd and enable services
ansible.builtin.systemd:
name: "{{ item }}"
enabled: yes
state: started
daemon_reload: yes
loop:
- container-gtm.service
- container-gtm-preview.service
1 change: 1 addition & 0 deletions roles/cs.magento-configure/defaults/main/app-etc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ magento_app_etc_config:
vertex: 1
elasticsuite: 1
graphql_query_resolver_result: 1
search_ajax_suggest: 1

install:
date: "Tue, 11 Nov 2016 11:11:00 +0000"
Expand Down
5 changes: 3 additions & 2 deletions roles/cs.magerun/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
magerun_version: 7.4.0
magerun_checksum: sha256:35377402bd94c8ee19c3aecbc52f9bb6f6f9b4970447d1d7884fb6cfbb8cdf9b
magerun_version: 9.3.0
magerun_checksum: sha256:15041cdf99466d80691d9f2ed5f37330115ea37b5ca19b4f1883f1c9a18bd26c

1 change: 1 addition & 0 deletions roles/cs.varnish/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,4 @@ varnish_gzip_bypass_extensions:
# Each url should start with `/`
varnish_auth_bypass_urls: []
varnish_custom_bypass: []
gtm_enabled: false
65 changes: 61 additions & 4 deletions roles/cs.varnish/templates/vcl/backends.vcl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,83 @@ probe app_probe {
.window = 3;
}

{% if (gtm_enabled | default(false)) %}
probe gtm_probe {
.request =
"GET /healthy HTTP/1.1"
"Host: localhost"
"Connection: close";
.interval = 1s;
.timeout = 1s;
.threshold = 2;
.window = 3;
}
{% endif %}



{% for instance in (varnish_backend_instances_app + varnish_backend_instances_extra) %}
backend {{ instance.instance_id | replace('-','') }} {
.host = "{{ instance.private_ip_address }}";
.port = "{{ varnish_backend_port }}";
.max_connections = {{ varnish_backend_max_conns }};
.probe = app_probe;
.first_byte_timeout = {{ varnish_backend_first_byte_timeout }}; # How long to wait before we receive a first byte from our backend?
.connect_timeout = 5s; # How long to wait for a backend connection?
.between_bytes_timeout = 60s; # How long to wait between bytes received from our backend?
.first_byte_timeout = {{ varnish_backend_first_byte_timeout }};
.connect_timeout = 5s;
.between_bytes_timeout = 60s;
}
{% endfor %}

{% if (gtm_enabled | default(false)) %}
{% for instance in (varnish_backend_instances_app + varnish_backend_instances_extra) %}
backend gtm_{{ instance.instance_id | replace('-','') }} {
.host = "{{ instance.private_ip_address }}";
.port = "8080";
.max_connections = {{ varnish_backend_max_conns }};
.probe = gtm_probe;
.first_byte_timeout = {{ varnish_backend_first_byte_timeout }};
.connect_timeout = 5s;
.between_bytes_timeout = 60s;
}
{% endfor %}
{% endif %}

{% if (gtm_enabled | default(false)) %}
{% for instance in (varnish_backend_instances_app + varnish_backend_instances_extra) %}
backend gtm_preview{{ instance.instance_id | replace('-','') }} {
.host = "{{ instance.private_ip_address }}";
.port = "8081";
.probe = gtm_probe;
.max_connections = {{ varnish_backend_max_conns }};
.first_byte_timeout = {{ varnish_backend_first_byte_timeout }};
.connect_timeout = 5s;
.between_bytes_timeout = 60s;
}
{% endfor %}
{% endif %}

sub backends_init {
new app_director = directors.round_robin();
{% for instance in varnish_backend_instances_app %}
app_director.add_backend({{ instance.instance_id | replace('-','') }});
{% endfor %}

{% if (gtm_enabled | default(false)) %}
new gtm_director = directors.round_robin();
{% for instance in varnish_backend_instances_app %}
gtm_director.add_backend(gtm_{{ instance.instance_id | replace('-','') }});
Comment on lines +80 to +81
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include extra instances in the GTM directors

The template now defines gtm_* backends for both varnish_backend_instances_app + varnish_backend_instances_extra above, but this director is still populated from varnish_backend_instances_app only (and the preview director below has the same pattern). In environments that rely on the extra ASG for capacity or failover, GTM traffic will never use those healthy extra nodes, and it can go unavailable if the base app pool is empty or unhealthy even though GTM backends were generated for the extra pool.

Useful? React with 👍 / 👎.

{% endfor %}

new gtm_preview_director = directors.round_robin();
{% for instance in varnish_backend_instances_app %}
gtm_preview_director.add_backend(gtm_preview{{ instance.instance_id | replace('-','') }});
{% endfor %}
{% endif %}



new extra_director = directors.round_robin();
{% for instance in varnish_backend_instances_extra %}
extra_director.add_backend({{ instance.instance_id | replace('-','') }});
{% endfor %}
}
}
53 changes: 33 additions & 20 deletions roles/cs.varnish/templates/vcl/subroutines/recv.vcl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,43 @@

{% if varnish_standalone %}
{# This has to be first line, remember this is not declarative config, we always need the director! #}
{% if (gtm_enabled | default(false)) %}
if (req.http.Host == "{{ mageops_gtm_domain }}" ) {
set req.backend_hint = gtm_director.backend();
return (pass);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve forwarded client IP before GTM passthrough

The new GTM host branch returns pass immediately, so requests never reach the later req.restarts == 0 block that normalizes X-Forwarded-For from X-Real-IP for localhost-origin traffic. In the standalone nginx→varnish setup, this means GTM can receive loopback/internal addresses instead of the real client IP, which breaks IP-dependent tagging/geo logic specifically when req.http.Host matches the GTM domains.

Useful? React with 👍 / 👎.

} elsif (req.http.Host == "{{ mageops_gtm_preview_domain }}" ) {
set req.backend_hint = gtm_preview_director.backend();
return (pass);
} else {
set req.backend_hint = app_director.backend();
}
{% else %}
set req.backend_hint = app_director.backend();
{% endif %}

if (req.http.X-Use-Extra-Instance
{% if aws_extra_app_asg_passthrough_uagent_pattern %}
|| req.http.User-Agent ~ "{{ aws_extra_app_asg_passthrough_uagent_pattern }}"
{% endif %}
{% if aws_extra_app_asg_passthrough_url_pattern %}
|| req.url ~ "{{ aws_extra_app_asg_passthrough_url_pattern }}"
{% endif %}
{% if aws_extra_app_asg_passthrough_ip_pattern %}
|| req.http.x-forwarded-for ~ "{{ aws_extra_app_asg_passthrough_ip_pattern }}"
{% endif %}
) {
set req.backend_hint = extra_director.backend();
if (req.http.X-Use-Extra-Instance
{% if aws_extra_app_asg_passthrough_uagent_pattern %}
|| req.http.User-Agent ~ "{{ aws_extra_app_asg_passthrough_uagent_pattern }}"
{% endif %}
{% if aws_extra_app_asg_passthrough_url_pattern %}
|| req.url ~ "{{ aws_extra_app_asg_passthrough_url_pattern }}"
{% endif %}
{% if aws_extra_app_asg_passthrough_ip_pattern %}
|| req.http.x-forwarded-for ~ "{{ aws_extra_app_asg_passthrough_ip_pattern }}"
{% endif %}
) {
set req.backend_hint = extra_director.backend();

{% if varnish_extra_instance_failover_enable %}
if (!std.healthy(req.backend_hint)) {
set req.backend_hint = app_director.backend();
}
{% else %}
# Extra instance failover is disabled - requests will return 5xx
# in case all of the the extra instances are not healthy.
{% endif %}
{% if varnish_extra_instance_failover_enable %}
if (!std.healthy(req.backend_hint)) {
set req.backend_hint = app_director.backend();
}
{% else %}
# Extra instance failover is disabled - requests will return 5xx
# in case all of the the extra instances are not healthy.
{% endif %}

}
{% endif %}

{% if varnish_vcl_recv_extra %}
Expand Down
3 changes: 3 additions & 0 deletions site.step-45-app-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
pio_tasks: app
when: mageops_pio_worker_enable

- role: cs.gtm
when: gtm_enabled and varnish_standalone

tasks:
- name: Execute custom post deploy tasks
include_tasks: "{{ mageops_extra_tasks_deploy }}"
Expand Down