### Varnish Controller 7 Installation and Quickstart Source: https://docs.varnish-software.com/varnish-controller7/license Guides for installing Varnish Controller 7 and getting started quickly with its basic functionalities. ```APIDOC Installation: - Installation Guide: https://docs.varnish-software.com/varnish-controller7/installation/ - Quickstart: https://docs.varnish-software.com/varnish-controller7/installation/quickstart ``` -------------------------------- ### Varnish Controller 7 Installation and Quickstart Source: https://docs.varnish-software.com/varnish-controller7/cli Provides guidance on installing Varnish Controller 7 and getting started quickly with its features. ```APIDOC Installation: Instructions for installing Varnish Controller 7. Quickstart: A guide to quickly set up and begin using Varnish Controller 7. ``` -------------------------------- ### Varnish WAF Installation Test Source: https://docs.varnish-software.com/varnish-waf/getting-started Tests Varnish WAF installation by running a VTC script that makes requests and checks for blocking behavior. ```Shell varnishtest /etc/varnish/modsec/waf.vtc ``` -------------------------------- ### Setup Varnish Enterprise Repository on Ubuntu Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/ubuntu2204 Installs necessary packages, adds the Varnish Enterprise GPG key, and configures the APT sources list for Varnish Enterprise 6.0 on Ubuntu 22.04. It also details how to manage authenticated access to multiple repositories. ```shell sudo apt update sudo apt install apt-transport-https gpg curl curl -L https://TOKEN:@packagecloud.io/varnishplus/60/gpgkey | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/varnish-enterprise-6.0.gpg deb https://packagecloud.io/varnishplus/60/ubuntu/ jammy main machine packagecloud.io/varnishplus/60 login TOKEN sudo chown root:root /etc/apt/auth.conf.d/varnish.conf sudo chmod 600 /etc/apt/auth.conf.d/varnish.conf machine packagecloud.io/varnishplus/60-extra1 login TOKEN1 machine packagecloud.io/varnishplus/60-extra2 login TOKEN2 machine packagecloud.io/varnishplus/60 login TOKEN ``` -------------------------------- ### Varnish Software Getting Started Tutorial Source: https://docs.varnish-software.com/tutorials/getting-started A tutorial to help users get started with Varnish on supported platforms. It includes instructions for selecting a Varnish version, such as Varnish Enterprise 6.0. ```APIDOC Getting Started Tutorial: https://docs.varnish-software.com/tutorials/getting-started/ Varnish Enterprise 6.0 Tutorial: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/ ``` -------------------------------- ### Configure Varnish Enterprise Repository Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/el8 Sets up the Varnish Software repository for package installation. Requires a token for access. Also enables the EPEL repository. ```bash [varnish-enterprise] name=Varnish Enterprise baseurl=https://TOKEN:@packagecloud.io/varnishplus/60/el/8/x86_64 repo_gpgcheck=1 gpgcheck=0 enabled=1 gpgkey=https://TOKEN:@packagecloud.io/varnishplus/60/gpgkey sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300 sudo dnf install epel-release ``` -------------------------------- ### Dockerfile for Varnish Cache Plus Source: https://docs.varnish-software.com/tutorials/getting-started-with-docker This is an example Dockerfile for building a Varnish Cache Plus image. It sets up environment variables for Varnish configuration, installs necessary packages including Varnish Plus and its modules, configures user and directory permissions, and specifies the entrypoint script. ```dockerfile FROM debian:bullseye-slim ARG version ENV VARNISH_LISTEN_ADDRESS "" ENV VARNISH_LISTEN_PORT "6081" ENV VARNISH_VCL_CONF "/etc/varnish/default.vcl" ENV VARNISH_ADMIN_LISTEN_ADDRESS "127.0.0.1" ENV VARNISH_ADMIN_LISTEN_PORT "6082" ENV VARNISH_TTL "120" ENV VARNISH_MIN_THREADS "50" ENV VARNISH_MAX_THREADS "1000" ENV VARNISH_THREAD_TIMEOUT "120" ENV VARNISH_SECRET_FILE "/etc/varnish/secret" ENV MSE_MEMORY_TARGET "80%" ENV MSE_CONFIG "/etc/varnish/mse.conf" ENV VARNISH_TLS_CFG "" ENV VARNISH_EXTRA "" RUN --mount=type=secret,id=auth_conf,dst=/etc/apt/auth.conf cat /etc/apt/auth.conf && \ apt-get update && \ apt-get -y upgrade && \ apt-get install -y --no-install-recommends ca-certificates apt-transport-https curl gnupg uuid-runtime busybox && \ groupadd -r varnish && \ useradd -r -s /bin/false -g varnish varnish && \ curl -L -s https://$(tail -n1 /etc/apt/auth.conf|tr -d 'login '):@packagecloud.io/varnishplus/60/gpgkey | apt-key add - && \ echo "deb https://packagecloud.io/varnishplus/60/debian/ bullseye main" > /etc/apt/sources.list.d/varnish-enterprise-60.list && \ apt-get update && \ # Install Varnish apt-get install -y --no-install-recommends varnish-plus=${version}* varnish-plus-vmods-extra=${version}* varnish-plus-ha=${version}* && \ apt-get install -y jq && \ mkdir -p /var/lib/mse && \ chown -R varnish:varnish /var/lib/varnish /var/lib/mse && \ chown varnish:varnish /etc/varnish && \ # Cleanup apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false gnupg && \ rm -fr /root/.gnupg && \ rm -rf /var/lib/apt/lists/* && \ rm -f /etc/varnish/secret && \ rm -fr /var/lib/varnish/* && \ rm -f /etc/apt/sources.list.d/varnish-enterprise-60.list COPY entrypoint.sh /entrypoint.sh USER varnish WORKDIR /etc/varnish EXPOSE $VARNISH_LISTEN_PORT ENTRYPOINT ["/entrypoint.sh"] ``` -------------------------------- ### Enable and Start Broadcaster Service Source: https://docs.varnish-software.com/varnish-high-availability/installation Commands to enable the Varnish Broadcaster service to start automatically on boot and then start it immediately. ```shell sudo systemctl enable broadcaster sudo systemctl start broadcaster ``` -------------------------------- ### Install and Start Varnish Controller Agent (RPM-based) Source: https://docs.varnish-software.com/varnish-controller/installation/quickstart Installs the Varnish Controller agent package on RPM-based systems and starts the service after configuration. ```shell sudo dnf -y install varnish-controller-agent # Configure NATS for the agent by editing systemd unit file. sudo systemctl edit varnish-controller-agent # Add the following [Service] Environment="VARNISH_CONTROLLER_AGENT_NAME=agent01" Environment="VARNISH_CONTROLLER_NATS_SERVER=controller-host:4222" Environment="VARNISH_CONTROLLER_BASE_URL=http://agent01.example.com" # Reload, enable, and start sudo systemctl daemon-reload sudo systemctl enable varnish-controller-agent sudo systemctl start varnish-controller-agent ``` -------------------------------- ### Install and Start Varnish Controller Agent (Debian/Ubuntu) Source: https://docs.varnish-software.com/varnish-controller/installation/quickstart Installs the Varnish Controller agent package on Debian/Ubuntu systems and starts the service after configuration. ```shell sudo apt install varnish-controller-agent # Configure NATS for the agent by editing systemd unit file. sudo systemctl edit varnish-controller-agent # Add the following [Service] Environment="VARNISH_CONTROLLER_AGENT_NAME=agent01" Environment="VARNISH_CONTROLLER_NATS_SERVER=controller-host:4222" Environment="VARNISH_CONTROLLER_BASE_URL=http://agent01.example.com" # Reload, enable, and start sudo systemctl daemon-reload sudo systemctl enable varnish-controller-agent sudo systemctl start varnish-controller-agent ``` -------------------------------- ### Getting Started with Varnish Enterprise 6.0 Tutorials Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6 This section provides links to tutorials for setting up Varnish Enterprise 6.0 on various platforms. It covers installation for Red Hat Enterprise Linux (EL9, EL8), Debian (12, 11), Ubuntu Server (22.04), and Docker. ```en Red Hat Enterprise Linux and derivatives: EL9 EL8 Debian: 12 (Bookworm) 11 (Bullseye) Ubuntu Server: 22.04 (Jammy) Container: Docker ``` -------------------------------- ### Install APT Packages for Repository Setup Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/debian12 Installs necessary packages like apt-transport-https, curl, and gpg to set up the Varnish Software Debian repository. ```bash sudo apt update sudo apt install apt-transport-https curl gpg ``` -------------------------------- ### Varnish Cloud OCI Post-Deployment Steps Source: https://docs.varnish-software.com/varnish-cloud/getting-started/oci This section covers the initial steps after a Varnish Cloud instance is successfully deployed and running on Oracle Cloud Infrastructure (OCI). It includes accessing the welcome page, logging into the server, and performing initial parameter tuning and configuration. ```APIDOC APIDOC: Instance is up and running: - Welcome page: Access the welcome page of the deployed instance. - Logging into the server: Log into the server using the provided username and SSH key. - Parameter tuning: Adjust Varnish parameters as needed for optimal performance. - Configure your instance: Perform necessary configurations for your Varnish Cloud instance. ``` -------------------------------- ### Install APT Packages for Repository Setup Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/debian11 Installs necessary packages like apt-transport-https, curl, and gpg to enable secure repository access and package management. ```bash sudo apt update sudo apt install apt-transport-https curl gpg ``` -------------------------------- ### Deploying Varnish Software on DigitalOcean Source: https://docs.varnish-software.com/varnish-cloud/getting-started/digitalocean Steps to deploy a Varnish Software instance on DigitalOcean via the marketplace. This includes finding the product, launching an instance, and configuring droplet details. ```APIDOC APIDOC: Endpoint: DigitalOcean Marketplace Action: Deploy Varnish Software instance Steps: 1. Find Varnish Software product in the Digital Ocean marketplace. 2. Click "Create Varnish Cache droplet". 3. Login to your OCI account. 4. Click "Launch instance". 5. On the "Create droplets" screen, configure: - Region - Droplet type and size - SSH key - Number of droplets - Hostname - Project 6. Click "Create droplets". Output: - Public IP address and username of the server. ``` -------------------------------- ### Enable and Start VCS Agent Service Source: https://docs.varnish-software.com/varnish-custom-statistics/installation Enables the VCS agent to start on boot and starts the service immediately. ```bash sudo systemctl enable vcs-agent sudo systemctl start vcs-agent ``` -------------------------------- ### Minimal UI Server Setup Source: https://docs.varnish-software.com/varnish-controller7/installation/user-interface Demonstrates a minimal setup for running the UI server with default configurations, specifying API hosts and disabling TLS. ```bash varnish-controller-ui -api-hosts=http://api-gw:8002 -no-tls ``` -------------------------------- ### Enable and Start VCS Server Service Source: https://docs.varnish-software.com/varnish-custom-statistics/installation Enables the VCS server to start on boot and starts the service immediately. ```bash sudo systemctl enable vcs sudo systemctl start vcs ``` -------------------------------- ### Accessing and Configuring Varnish Instance Source: https://docs.varnish-software.com/varnish-cloud/getting-started/digitalocean Instructions for accessing a running Varnish Software instance on DigitalOcean, including logging into the server and performing initial parameter tuning and configuration. ```APIDOC APIDOC: Action: Access and configure Varnish Software instance Steps: 1. Verify server is up and running via droplet details screen. 2. Obtain the Public IP address and username. 3. Login to the server (details on how to log in are not provided in this snippet). 4. Perform parameter tuning. 5. Configure your instance. ``` -------------------------------- ### Set up Varnish Controller Repository (Debian/Ubuntu) Source: https://docs.varnish-software.com/varnish-controller/installation/quickstart Installs necessary tools, adds the Varnish Controller GPG key, configures the APT repository, and updates package lists for Debian/Ubuntu systems. ```bash sudo apt update sudo apt install -y gpg sudo wget # Add keys wget --auth-no-challenge --quiet -O - https://:@packagecloud.io/varnishplus/controller/gpgkey | \ sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/varnish-controller.gpg # Add repo echo "deb [signed-by=/etc/apt/trusted.gpg.d/varnish-controller.gpg] https://packagecloud.io/varnishplus/controller/debian/ stretch main" | \ sudo tee -a /etc/apt/sources.list.d/varnish-controller.list # Add authentication info for the repo echo -e "machine packagecloud.io/varnishplus/controller\nlogin " | \ sudo tee /etc/apt/auth.conf.d/varnish-controller.conf # Fetch new package info sudo apt update ``` -------------------------------- ### Install EPEL Repository Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/el9 Installs the Extra Packages for Enterprise Linux (EPEL) repository, which may be a dependency for Varnish VMODs. ```shell sudo dnf install epel-release ``` -------------------------------- ### Clone Repository and Navigate Source: https://docs.varnish-software.com/varnish-controller/examples/tokens Clones the router_example repository and navigates into the project directory. This is the initial step for setting up the environment. ```bash $ git clone git@github.com:varnish/router_example.git $ cd router_example ``` -------------------------------- ### Install Varnish Enterprise Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/el8 Disables the default Varnish Cache module stream and installs Varnish Enterprise along with its VMODs. ```bash sudo dnf module disable varnish sudo dnf install varnish-plus ``` -------------------------------- ### Complete Workflow Example Source: https://docs.varnish-software.com/varnish-controller/authorization/examples A comprehensive example demonstrating the CLI workflow from logging in as a system admin, creating organizations and users, assigning roles, logging in as a regular user, creating domains and deployments, and testing permissions. ```bash # Login as system admin VARNISH_CONTROLLER_CLI_PASSWORD=test vcli login http://localhost:8002 -u test # Create organization vcli org add neworg # Create user vcli account add user --password test # Assign user to organization vcli org assign 1 --account 2 # Login as regular user VARNISH_CONTROLLER_CLI_PASSWORD=test vcli login http://localhost:8002 -u user -o neworg # Create a domain vcli domain add example.com # Create a deployment vcli dep add test # Create new user vcli account add newuser --password test # Assign permissions to new user (read domains) vcli perm add domain --account 3 -r # Login with new user vcli login http://localhost:8002 -u newuser -o neworg Password: **** # List domains (read access) vcli domain ls # Create domain (no access) vcli domain add example.org # List deployments (no access) vcli deployments ls ``` -------------------------------- ### Install Varnish Enterprise Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/ubuntu2204 Installs the Varnish Enterprise package and its associated VMODs on Ubuntu 22.04 after the repository has been set up. ```shell sudo apt update sudo apt install varnish-plus ``` -------------------------------- ### Install Varnish Enterprise Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/el9 Installs the core Varnish Enterprise package. The `varnish-plus-vmods-extra` package is optional and provides additional Varnish Modules (VMODs). ```shell sudo dnf install varnish-plus ``` -------------------------------- ### Varnish Cloud OCI Deployment Steps Source: https://docs.varnish-software.com/varnish-cloud/getting-started/oci This section outlines the process of deploying a Varnish Cloud instance on Oracle Cloud Infrastructure (OCI). It details the steps from subscribing to the product in the OCI Marketplace to creating and configuring the compute instance. ```APIDOC APIDOC: Deploying Varnish Cloud instance: - Subscription and configuration: Access Varnish Software product in the OCI Marketplace and click 'Get App' to subscribe. - Launch instance: Login to your OCI account and click 'Launch instance'. Choose the 'default' version and select a compartment. - Create compute instance: Configure instance name, compartment, availability domain, shape, virtual cloud network, subnet, SSH key, and boot volume. Click 'Create'. - Instance details: Note the public IP address and username from the instance details screen once the server is running. ``` -------------------------------- ### Install Varnish Enterprise and VMODs Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/debian12 Installs the Varnish Enterprise package along with any necessary Varnish Modules (VMODs) using APT. ```bash sudo apt update sudo apt install varnish-plus ``` -------------------------------- ### Example Varnish and Agent Configuration Source: https://docs.varnish-software.com/varnish-controller/installation/agents Demonstrates how to start a Varnish instance and configure the Varnish Controller Agent to connect to it, particularly when using custom VSM directories. ```bash # Varnish started with a custom VSM directory VARNISH_CMD="varnishd -a 0.0.0.0:8091 -S /tmp/secret -T localhost:6082 -f '' -n /tmp/myvarnish" $VARNISH_CMD # Agent configured to use the custom VSM directory AGENT_CMD="varnish-controller-agent -varnish-name /tmp/myvarnish" $AGENT_CMD ``` -------------------------------- ### Install Varnish Enterprise on Ubuntu 20.04 Source: https://docs.varnish-software.com/tutorials/getting-started-with-docker This Dockerfile installs Varnish Enterprise 6.0 on Ubuntu 20.04. It configures the package repository, adds the GPG key, and installs the varnish-plus package. ```dockerfile FROM ubuntu:20.04 # Packages in our repositories are signed and distributed via HTTPS. # You need to enable HTTPS support in the package manager and install our public key before installing the packages RUN sudo apt-get update RUN apt-get install -y apt-transport-https curl gnupg RUN curl -L https://$TOKEN:@packagecloud.io/varnishplus/60/gpgkey | sudo apt-key add - RUN sudo echo "machine packagecloud.io/varnishplus/60" > /etc/apt/auth.conf RUN sudo echo "login $TOKEN" >> /etc/apt/auth.conf # Make sure auth.conf is not world readable: RUN sudo chown root:root /etc/apt/auth.conf RUN sudo chmod 600 /etc/apt/auth.conf RUN sudo echo "deb https://packagecloud.io/varnishplus/60/ubuntu/ focal main" > /etc/apt/sources.list.d/varnish-6.0-plus.list # Run apt-get update to update repository metadata and follow the product installation instructions RUN sudo apt-get update # Install Varnish-plus RUN sudo apt-get install varnish-plus ``` -------------------------------- ### Enable and Start Varnish Service Source: https://docs.varnish-software.com/varnish-controller7/installation/quickstart Enables the Varnish service to start on boot and then starts the service immediately. ```bash sudo systemctl enable varnish sudo systemctl start varnish ``` -------------------------------- ### Install Varnish Enterprise on Ubuntu 20.04 Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/docker This Dockerfile installs Varnish Enterprise 6.0 on Ubuntu 20.04. It configures the package repository, adds the GPG key, and installs the varnish-plus package. ```dockerfile FROM ubuntu:20.04 # Packages in our repositories are signed and distributed via HTTPS. # You need to enable HTTPS support in the package manager and install our public key before installing the packages RUN sudo apt-get update RUN apt-get install -y apt-transport-https curl gnupg RUN curl -L https://$TOKEN:@packagecloud.io/varnishplus/60/gpgkey | sudo apt-key add - RUN sudo echo "machine packagecloud.io/varnishplus/60" > /etc/apt/auth.conf RUN sudo echo "login $TOKEN" >> /etc/apt/auth.conf # Make sure auth.conf is not world readable: RUN sudo chown root:root /etc/apt/auth.conf RUN sudo chmod 600 /etc/apt/auth.conf RUN sudo echo "deb https://packagecloud.io/varnishplus/60/ubuntu/ focal main" > /etc/apt/sources.list.d/varnish-6.0-plus.list # Run apt-get update to update repository metadata and follow the product installation instructions RUN sudo apt-get update # Install Varnish-plus RUN sudo apt-get install varnish-plus ``` -------------------------------- ### Setup Test Environment with Git Source: https://docs.varnish-software.com/varnish-controller7/examples/routing Command to clone a Git repository for setting up a test environment for Varnish Controller routing examples. This repository includes necessary files like VCL, Docker Compose configuration, and video assets. ```bash git clone https://github.com/varnish/router_example ``` -------------------------------- ### List Docker Images Source: https://docs.varnish-software.com/tutorials/getting-started-with-docker Lists all Docker images available on the system, useful for verifying the build. ```bash docker image ls ``` -------------------------------- ### Dockerfile for Varnish Cache Plus Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/docker This is an example Dockerfile for building a Varnish Cache Plus image. It sets up environment variables for Varnish configuration, installs necessary packages including Varnish Plus and its modules, configures user and directory permissions, and specifies the entrypoint script. ```dockerfile FROM debian:bullseye-slim ARG version ENV VARNISH_LISTEN_ADDRESS "" ENV VARNISH_LISTEN_PORT "6081" ENV VARNISH_VCL_CONF "/etc/varnish/default.vcl" ENV VARNISH_ADMIN_LISTEN_ADDRESS "127.0.0.1" ENV VARNISH_ADMIN_LISTEN_PORT "6082" ENV VARNISH_TTL "120" ENV VARNISH_MIN_THREADS "50" ENV VARNISH_MAX_THREADS "1000" ENV VARNISH_THREAD_TIMEOUT "120" ENV VARNISH_SECRET_FILE "/etc/varnish/secret" ENV MSE_MEMORY_TARGET "80%" ENV MSE_CONFIG "/etc/varnish/mse.conf" ENV VARNISH_TLS_CFG "" ENV VARNISH_EXTRA "" RUN --mount=type=secret,id=auth_conf,dst=/etc/apt/auth.conf cat /etc/apt/auth.conf && \ apt-get update && \ apt-get -y upgrade && \ apt-get install -y --no-install-recommends ca-certificates apt-transport-https curl gnupg uuid-runtime busybox && \ groupadd -r varnish && \ useradd -r -s /bin/false -g varnish varnish && \ curl -L -s https://$(tail -n1 /etc/apt/auth.conf|tr -d 'login '):@packagecloud.io/varnishplus/60/gpgkey | apt-key add - && \ echo "deb https://packagecloud.io/varnishplus/60/debian/ bullseye main" > /etc/apt/sources.list.d/varnish-enterprise-60.list && \ apt-get update && \ # Install Varnish apt-get install -y --no-install-recommends varnish-plus=${version}* varnish-plus-vmods-extra=${version}* varnish-plus-ha=${version}* && \ apt-get install -y jq && \ mkdir -p /var/lib/mse && \ chown -R varnish:varnish /var/lib/varnish /var/lib/mse && \ chown varnish:varnish /etc/varnish && \ # Cleanup apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false gnupg && \ rm -fr /root/.gnupg && \ rm -rf /var/lib/apt/lists/* && \ rm -f /etc/varnish/secret && \ rm -fr /var/lib/varnish/* && \ rm -f /etc/apt/sources.list.d/varnish-enterprise-60.list COPY entrypoint.sh /entrypoint.sh USER varnish WORKDIR /etc/varnish EXPOSE $VARNISH_LISTEN_PORT ENTRYPOINT ["/entrypoint.sh"] ``` -------------------------------- ### Varnish WAF Configuration Source: https://docs.varnish-software.com/varnish-waf/getting-started Includes Varnish WAF in VCL and sets configuration files for ModSecurity and OWASP CRS. Requires a comfortable stack size in the varnishd command line. ```VCL vcl 4.1; include "waf.vcl"; sub vcl_init { varnish_waf.add_files("/etc/varnish/modsec/modsecurity.conf"); varnish_waf.add_files("/etc/varnish/modsec/owasp-crs-{VERSION_NUMBER}/crs-setup.conf"); varnish_waf.add_files("/etc/varnish/modsec/owasp-crs-{VERSION_NUMBER}/rules/*.conf"); } ``` ```Shell ExecStart=varnishd ... -p thread_pool_stack=96k ``` -------------------------------- ### VHA6 Cluster Configuration Example Source: https://docs.varnish-software.com/varnish-high-availability/installation Example of a /etc/varnish/nodes.conf file used to define the VHA6 cluster. Each entry represents a host in the cluster with its hostname and routable address/port. ```bash alpha = 1.2.3.4 bravo = [1:2::3]:45 charlie = https://5.6.7.8:90 delta = http://[1::2] ``` -------------------------------- ### Clone Repository and Start Environment Source: https://docs.varnish-software.com/varnish-controller7/examples/tokens Clones the Varnish Controller router example repository and starts the Docker Compose environment. Requires Docker, docker-compose, and git. ```bash $ git clone git@github.com:varnish/router_example.git $ cd router_example # Add Varnish Controller license file as router_license.lic $ docker-compose up ``` -------------------------------- ### Install Varnish Agent and Configure Secret Source: https://docs.varnish-software.com/tutorials/getting-started-with-docker This snippet shows how to install the varnish-agent package, set a secret file for Varnish, and switch to the varnish user. ```dockerfile RUN apt-get install varnish-agent RUN echo "varnish-secret" > /etc/varnish/secret USER varnish ``` -------------------------------- ### Install Varnish Agent and Configure Secret Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/docker This snippet shows how to install the varnish-agent package, set a secret file for Varnish, and switch to the varnish user. ```dockerfile RUN apt-get install varnish-agent RUN echo "varnish-secret" > /etc/varnish/secret USER varnish ``` -------------------------------- ### Starting NATS Servers with Configuration Files Source: https://docs.varnish-software.com/varnish-controller/installation/nats Commands to start NATS servers using their respective configuration files. ```bash nats-server -c nats1.conf nats-server -c nats2.conf ``` -------------------------------- ### Varnish Enterprise Introduction and Setup Source: https://docs.varnish-software.com/varnish-enterprise Provides an overview of Varnish Enterprise, its versioning, available modules, package repository, and further reading resources. It also outlines the manual's scope for administrators and developers. ```text What is Varnish Enterprise? Versioning and release schedule Varnish modules Package repository Further reading This is the administrator and developer manual for Varnish Enterprise. It includes (but is not limited to) information on: how to install, configure, and update Varnish Enterprise features available in Varnish Enterprise and its related packages how to tune Varnish Enterprise for better performance how to extend its capabilities through the use of Varnish Modules The main audience for this manual are systems administrators and managers looking into Varnish Enterprise to solve their caching needs and users that need to reference information on various Varnish Enterprise components. This documentation is not a replacement for other resources where basic Varnish concepts are explained. For this we refer to The Varnish Book and other introductions to Varnish and VCL. ``` -------------------------------- ### Install Varnish Enterprise on Debian 10.0 (Buster) Source: https://docs.varnish-software.com/tutorials/getting-started-with-docker This Dockerfile installs Varnish Enterprise 6.0 on Debian 10.0 (Buster). It configures the package repository, adds the GPG key, and installs the varnish-plus package. ```dockerfile FROM debian:buster RUN sudo apt-get update RUN apt-get install -y apt-transport-https curl gnupg RUN curl -L https://$TOKEN:@packagecloud.io/varnishplus/60/gpgkey | sudo apt-key add - RUN sudo echo "machine packagecloud.io/varnishplus/60" > /etc/apt/auth.conf RUN sudo echo "login $TOKEN" >> /etc/apt/auth.conf # Make sure auth.conf is not world readable: RUN sudo chown root:root /etc/apt/auth.conf RUN sudo chmod 600 /etc/apt/auth.conf RUN sudo echo "deb https://packagecloud.io/varnishplus/60/debian/ buster main" > /etc/apt/sources.list.d/varnish-6.0-plus.list # Run apt-get update to update repository metadata and follow the product installation instructions RUN sudo apt-get update # Install Varnish-plus RUN sudo apt-get install varnish-plus ``` -------------------------------- ### Varnish Controller 7 API Examples Source: https://docs.varnish-software.com/varnish-controller7/examples/deploying-vcl-files Examples demonstrating how to interact with the Varnish Controller 7 API for various functionalities including managing configurations, VCL files, and routing rules. ```APIDOC APIDOC: API Endpoints: - /api/v1/configs: Manages configuration sets. - /api/v1/vcls: Manages VCL configurations. - /api/v1/routing-rules: Manages routing rules. - /api/v1/agents: Manages agents. Example: Deploying a VCL file POST /api/v1/vcls Request Body: { "name": "my-vcl", "content": "import std;\nsub vcl_recv {\n set req.http.X-Hello = \"World\";\n}" } Response: 201 Created { "id": "vcl-123", "name": "my-vcl", "status": "uploaded" } Example: Creating a routing rule POST /api/v1/routing-rules Request Body: { "name": "default-route", "condition": "req.http.Host == \"example.com\"", "vcl": "my-vcl" } Response: 201 Created { "id": "route-456", "name": "default-route", "status": "created" } ``` -------------------------------- ### Install Varnish Enterprise on Debian 10.0 (Buster) Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/docker This Dockerfile installs Varnish Enterprise 6.0 on Debian 10.0 (Buster). It configures the package repository, adds the GPG key, and installs the varnish-plus package. ```dockerfile FROM debian:buster RUN sudo apt-get update RUN apt-get install -y apt-transport-https curl gnupg RUN curl -L https://$TOKEN:@packagecloud.io/varnishplus/60/gpgkey | sudo apt-key add - RUN sudo echo "machine packagecloud.io/varnishplus/60" > /etc/apt/auth.conf RUN sudo echo "login $TOKEN" >> /etc/apt/auth.conf # Make sure auth.conf is not world readable: RUN sudo chown root:root /etc/apt/auth.conf RUN sudo chmod 600 /etc/apt/auth.conf RUN sudo echo "deb https://packagecloud.io/varnishplus/60/debian/ buster main" > /etc/apt/sources.list.d/varnish-6.0-plus.list # Run apt-get update to update repository metadata and follow the product installation instructions RUN sudo apt-get update # Install Varnish-plus RUN sudo apt-get install varnish-plus ``` -------------------------------- ### Start Varnish Broadcaster Service Source: https://docs.varnish-software.com/varnish-broadcaster/usage Starts the Varnish Broadcaster service using systemctl. The service will use the default configuration file located at /etc/varnish/nodes.conf and set the log level to INFO. ```bash $ systemctl start broadcaster ``` -------------------------------- ### Run Varnish Enterprise with Custom VCL (Docker) Source: https://docs.varnish-software.com/tutorials/getting-started-with-docker Starts a Varnish Enterprise container, mounting a custom VCL file to /etc/varnish/default.vcl and publishing port 6081. Includes Varnish startup banner. ```bash docker run -it --rm -p 6081:6081 --name varnish -v /tmp/my.vcl:/etc/varnish/default.vcl quay.io/varnish-software/varnish-plus:latest __ __ _ _ ____ _ \ \ / /_ _ _ __ _ __ (_)___| |__ | _ \| |_ _ ___ \ \ / / _' | '__| '_ \| / __| '_ \ | |_) | | | | / __| \ V / (_| | | | | | | \__ \ | | | | __/| | |_| \__ \ \_/ \__,_|_| |_| |_|_|___/_| |_| |_| |_|\__,_|___/ www.varnish-software.com varnishd (varnish-plus-6.0.9r4 revision 89b7b028f75a0cb5ceb3f58c78d909081f60f6ff) Generating new secrets file: /etc/varnish/secret Opening environment 'mse' Environment 'mse' opened successfully Debug: Version: varnish-plus-6.0.9r4 revision 89b7b028f75a0cb5ceb3f58c78d909081f60f6ff Debug: Platform: Linux,5.10.76-linuxkit,x86_64,-jnone,-smse,-hcritbit Debug: Child (27) Started Info: Child (27) said Child starts Info: Child (27) said Environment mse fully populated in 0.00 seconds. (0.00 0.00 0.00 0 0 0/4 0 0 0 0) ``` -------------------------------- ### Dockerfile Example: Varnish Plus Latest Source: https://docs.varnish-software.com/tutorials/getting-started-with-docker A Dockerfile example that pulls the latest Varnish Plus image and sets default environment variables for VARNISH_LISTEN_PORT and MSE_MEMORY_TARGET. ```dockerfile FROM quay.io/varnish-software/varnish-plus:latest ENV VARNISH_LISTEN_PORT "8080" ENV MSE_MEMORY_TARGET "512m" EXPOSE $VARNISH_LISTEN_PORT ``` -------------------------------- ### PostgreSQL Connection Example Source: https://docs.varnish-software.com/varnish-controller7/installation/brainz Demonstrates how to start the varnish-controller-brainz process with specified PostgreSQL connection parameters. These parameters can also be configured via environment variables. ```bash varnish-controller-brainz -db-server localhost:5432 -db-user varnish-controller -db-pass mypassword -db-name varnish-controller ``` -------------------------------- ### Varnish Controller 7 CLI Examples Source: https://docs.varnish-software.com/varnish-controller7/installation/user-interface Provides practical examples of using the Varnish Controller 7 command-line interface (CLI) for various management tasks. ```bash # Example: Listing Varnish instances vcli list instances # Example: Deploying a VCL configuration vcli deploy vcl --file my_vcl.vcl --name my_vcl_config # Example: Purging a URL vcli purge --url /path/to/purge # Example: Managing agents vcli agent list vcli agent add --name my-agent --address 192.168.1.100 # Example: Managing routing rules vcli routing-rule list vcli routing-rule create --name default-rule --pattern "*" --backend varnish-instance-1 ``` -------------------------------- ### Dockerfile Example: Varnish Plus Latest Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/docker A Dockerfile example that pulls the latest Varnish Plus image and sets default environment variables for VARNISH_LISTEN_PORT and MSE_MEMORY_TARGET. ```dockerfile FROM quay.io/varnish-software/varnish-plus:latest ENV VARNISH_LISTEN_PORT "8080" ENV MSE_MEMORY_TARGET "512m" EXPOSE $VARNISH_LISTEN_PORT ``` -------------------------------- ### Install Varnish Enterprise and VMODs Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/debian11 Installs the Varnish Enterprise package along with its associated Varnish Modules (VMODs) using APT, making Varnish ready for configuration. ```bash sudo apt update sudo apt install varnish-plus ``` -------------------------------- ### Custom VCL for Docker Compose Example Source: https://docs.varnish-software.com/tutorials/getting-started-with-docker A VCL file for the Docker Compose example, setting the backend to 'echoserver' on port 8080 and adding a custom header 'X-Varnish-Added-This' to requests. ```vcl vcl 4.1; backend default { .host = "echoserver"; .port = "8080"; } sub vcl_recv { set req.http.x-varnish-added-this = "yes"; } ``` -------------------------------- ### Custom VCL for Docker Compose Example Source: https://docs.varnish-software.com/tutorials/getting-started/varnish-enterprise-6.0/docker A VCL file for the Docker Compose example, setting the backend to 'echoserver' on port 8080 and adding a custom header 'X-Varnish-Added-This' to requests. ```vcl vcl 4.1; backend default { .host = "echoserver"; .port = "8080"; } sub vcl_recv { set req.http.x-varnish-added-this = "yes"; } ``` -------------------------------- ### Create and Deploy VCLGroup Source: https://docs.varnish-software.com/varnish-controller7/examples/using-labels This example demonstrates creating a VCLGroup and marking it as a root deployment, then deploying it with specific VCLs and includes using the CLI. ```bash # Create the VCLGroup and mark it as root deployment (--root) vcli vg add myvg --root=true --tags id=1 # Deploy the VCLGroup with ID 1 # Select our main vcl with ID 1 and our included (labeled) VCL with ID 2. vcli vg deploy 1 --vcl 1 --includes 2 ```