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

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 yo file.

1
2
3
4
5
  varnish:
    environment:
      VCL_CONFIG: /tmp/varnish/default.vcl
    volumes:
      - ./etc/varnish/:/tmp/varnish

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

  • Ensure the correct backend is defined

    1
    2
    3
    4
    5
    backend default {
        .host = "apache-<PROJECT_NAME>";
        .port = "80";
        .first_byte_timeout = 300s;
    }
    

  • Ensure the correct backend is defined

    1
    2
    3
    acl purge {
        "apache-<PROJECT_NAME>";
    }