• To reproduce.

    1) Create + LXC container

    2) Wire container to public IP

    3) Do fresh WordPress install + verify site working

    4) Install WP Super Cache + enable + test cache

    If required, I can setup an LXC container + make it available to a developer to debug this.

    I’m hosting 1000s of WordPress client sites in LXC containers + prefer to use WP Super Cache, so I’m happy to assist a developer debugging this.

    Thanks.

    https://wordpress.org/plugins/wp-super-cache/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter David Favor

    (@dfavor)

    Problem persists with WordPress 4.4 + WP Super Cache 1.4.7

    Testing done on fresh install using TwentySixteen with WP Super Cache as only installed plugin.

    Debug log enabled + is quiet (no output being logged).

    Researching now + will update ticket with any fixes I determine.

    Thread Starter David Favor

    (@dfavor)

    This appears to be an iptables problem where there is no default PREROUTING + POSTROUTING nat rules to all access of either host or LXC container IP from inside LXC container.

    As soon as I resolve this, I’ll update this ticket.

    For now, WP Super Cache appears to work inside LXC containers.

    Only the cache test operation fails.

    Plugin Author Brandon Kraft

    (@kraftbj)

    Code Wrangler

    Thanks for your updates and my apologies for the radio silence from us. Working on finding a good workflow to balance WPSC and our day-to-day duties.

    Cheers!

    Thread Starter David Favor

    (@dfavor)

    This problem only arises in large scale hosting situations where LXC containers host WordPress containers.

    There are a variety of solutions + the most simple + highest performance + somewhat self documenting appears as follows…

    1) Every LXC container has it’s own IP address. For me, each client owns their own IP address, so if one client engages in hinky-black-hat-esque behavior, then only their sites suffer. Also resource management, especially IOPs tracking + capping is a breeze.

    2) Route all protocols (TCP/UDP/ICMP) + all ports from public facing IP to Container IP, for example…

    iptables -w -t nat -A PREROUTING -i eth0 –dst 198.50.134.220 -j DNAT –to 10.0.3.54 -m comment –comment ‘lxc-wire-ip faststablehosting.com ‘

    3) The route all local traffic targeting the public IP (which routes across lo/127.0.0.1) for a particular back to the correct Container IP, for example…

    iptables -w -t nat -A OUTPUT -o lo –src 198.50.134.220 -j DNAT –to 10.0.3.54 -m comment –comment ‘lxc-wire-ip faststablehosting.com ‘

    This will allow code like WP Super Cache + Social Engine linkage to work correctly, as this iptables rule correctly handles public IP references from both the host machine + all LXC Containers.

    One caveat, there appears to be a bug in iptables which breaks packet routing if the actual interface for a public IP is used, instead of it’s parent interface, which had my pulling my hair out for a good bit.

    So if 198.50.134.220 lives on eth0:1 for the first iptables rule to work, eth0 must be used. The eth0:1 interface will be accepted + packets are dropped silently.

    I’ve opened an upstream Ubuntu bug ticket to either have this fixed of for iptables to emit an error message + error out, if a child interface is specified, as current behavior is down right ugly.

    Thread Starter David Favor

    (@dfavor)

    One other fix is required for WP Super Cache to work correctly in LXC containers.

    For every site hosted in the container, /etc/hosts must provide loopback access to site, for cache test to succeed. Format is…

    $addr $canonical $alias

    So…

    127.0.0.1 davidfavor.com http://www.davidfavor.com some-other-random-host.davidfavor.com

    This allows cache test to work for following hosts…

    davidfavor.com
    http://www.davidfavor.com
    some-other-random-host.davidfavor.com

    All steps of LXC setup + log tracking + adaptive (realtime) tuning seems like a good WordCamp talk to give.

    I’ll add this to my todo list.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WP Super Cache fails cache test on all LXC hosted sites’ is closed to new replies.