Skip to content

Varnish

Supported versions

The only supported version is Varnish 4.1.

Base image

Launchpad uses a custom image based on Alpine 3.6.

Usage

Varnish support can be enabled by passing the --varnish service flag when starting up a project.

Services and service settings can also be specified in a .dlp.yml file.
See project configuration for more info.

Configuration

Overridable env vars

  • VCL_CONFIG (default: /etc/varnish/default.vcl)
  • CACHE_SIZE (default: 64m)
  • VARNISHD_PARAMS (default: -p default_ttl=3600 -p default_grace=3600)
  • BACKEND_HOST (default: apache)

Overriding the VCL

Dropsolid Platform doesn't allow a custom VCL by default

Overriding the VCL should only be used for non-dropsolid platform projects, or to test or debug functionality.

The recommended approach to override the Varnisch VCL by adding an etc/varnish folder to your project, and adding the custom VCL in it.

Afterwards, add following snippet to your docker-compose.local.yml file.

varnish:
  environment:
    VCL_CONFIG: /tmp/varnish/default.vcl
  volumes:
    - ./etc/varnish/:/tmp/varnish

In the VCL, you need to do some minor alterations:

leave the BACKEND_HOST part, the container takes care of this.

  • Ensure the correct backend is defined

    1
    2
    3
    4
    5
    backend default {
        .host = "BACKEND_HOST";
        .port = "80";
        .first_byte_timeout = 300s;
    }
    
  • Ensure the correct acl for pur is defined.

    1
    2
    3
    acl purge {
        "BACKEND_HOST";
    }
    

Assumptions

Specific Drupal modules are used to connect to Varnish

  • For D7, the varnish module should be present and enabled.
  • For D8n the dropsolid_purge module should be present and enabled.