Skip to content

Instantly share code, notes, and snippets.

View tdgroot's full-sized avatar
🔌

Timon de Groot tdgroot

🔌
View GitHub Profile
@JeroenBoersma
JeroenBoersma / NGINX - Magento 2 Static files optimization.md
Last active April 10, 2024 14:26
NGINX - Magento 2 Static files optimization

Introduction

Because Varnish doesn't support SSL, most people choose a setup where Nginx SSL will forward all traffic to Varnish and Varnish will forward will forward the traffic it cannot handle back to nginx. Or worse, bind Varnish on port 80 and direct all traffic into Varnish. This will already degrade performance, because Varnish will purge more because static files are also taking up room in the cache.

Default configuration

Next up, the Nginx configuration of Magento will handle static files.

@tdgroot
tdgroot / disable_unused_magento2_modules.sh
Last active January 11, 2021 11:27
Disable unused Magento 2 modules
#!/bin/bash
bin/magento module:status | \
grep -E '(Magento_(Adobe|Inventory|Braintree|Signifyd|Fedex|Marketplace|Authorizenet.*|.*GraphQl.*|.*Analytics)|Temando_|Amazon_|Dotdigitalgroup_|Vertex_|Klarna_)' | \
grep -v Magento_GoogleAnalytics | \
xargs bin/magento module:disable
@jalogut
jalogut / magento2-config-dump-skip-system.xml
Last active September 27, 2018 15:37
Magento 2 skip dumping the whole core_config_data when using app:config:dump
<!-- module.xml -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="VendorName_ModuleName" setup_version="0.0.1" >
<sequence>
<module name="Magento_Config"/>
</sequence>
</module>
</config>
<!-- di.xml -->
@hn-support
hn-support / cache-warmer.py
Last active May 6, 2024 10:20
A threaded cache warmer in python
#!/usr/bin/env python
"""
Warm the caches of your website by crawling each page defined in sitemap.xml.
To use, download this file and make it executable. Then run:
./cache-warmer.py --threads 4 --file /data/web/public/sitemap.xml -v
"""
import argparse
import multiprocessing.pool as mpool
import os.path
import re
@JPvRiel
JPvRiel / ubunut_network_manager_docker_dns_workaround.md
Last active July 18, 2022 23:09
Ubuntu, NetworkManager and Docker DNS workaround

Docker issues are frequently logged for DNS resolution in containers because it doens't inhert or get values for DNS from NetworkManager which leverages a built in dnsmasq to inteligently manage DNS.

Perminant workarround

sudo bash -c "echo listen-address=$(ip -4 addr show dev docker0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}') > /etc/NetworkManager/dnsmasq.d/docker-bridge"
sudo systemctl reload NetworkManager
sudo bash -c 'echo -e "{\n\t\"dns\": [\"$(ip -4 addr show dev docker0 | grep -oP "(?<=inet\s)\d+(\.\d+){3}")\"]\n}" > /etc/docker/daemon.json'
sudo systemctl restart docker