Skip to content

Commit

Permalink
feat: add helper commands (#16)
Browse files Browse the repository at this point in the history
* Add Varnish helper commands.
* Update README with information on Varnish helper commands.

---------

Co-authored-by: tyler36 <7234392+tyler36@users.noreply.github.com>
  • Loading branch information
tyler36 and tyler36 authored Feb 2, 2023
1 parent c921485 commit af8f7c8
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ If you use a project_tld other than ddev.site or additional_fqdns DDEV will help

Run `ddev get drud/ddev-varnish` after changes to name, additional_hostnames, additional_fqdns, or project_tld in .ddev/config.yml so that .ddev/docker-compose.varnish-extras.yaml is regenerated.

## Helper commands

This addon also providers several helper commands. These helpers allow developers to run Varnish commands from the host, however, the commands are actually run inside the Varnish container.

| Command | Description |
| --- | --- |
| `ddev varnishd` | Varnish-cli |
| `ddev varnishhist` | Display Varnish request histogram |
| `ddev varnishlog` | Display Varnish logs |
| `ddev varnishncsa` | Display Varnish logs in Apache / NCSA combined log format |
| `ddev varnishstat` | Display Varnish Cache statistics |
| `ddev varnishtest` | Test program for Varnish |
| `ddev varnishtop` | Display Varnish log entry ranking |

See [The Varnish Reference Manual](https://varnish-cache.org/docs/6.5/reference/index.html) for more information about the commands, their flags, and their arguments.

## Additional Configuration

* You may want to edit the `.ddev/varnish/default.vcl` to meet your needs. Remember to remove '#ddev-generated' from the file if you want your changes to the file preserved.
Expand Down
14 changes: 14 additions & 0 deletions commands/varnish/varnishd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

## #ddev-generated
## Description: Varnish-cli
## Usage: varnishd [flags] [args]
## Example: "ddev varnishd -d" for CLI in foreground.
## Example: "ddev varnishd -T" to connect with varnishadm or telnet.
## Example: "ddev varnishd -M" to connect back to a listening service pushing the CLI to that service.

# This example runs inside the varnish container.
# Note that this requires that /mnt/ddev_config be mounted
# into the varnish container.

varnishd "$@"
12 changes: 12 additions & 0 deletions commands/varnish/varnishhist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

## #ddev-generated
## Description: Display Varnish request histogram
## Usage: varnishhist [flags] [args]
## Example: "ddev varnishhist"

# This example runs inside the varnish container.
# Note that this requires that /mnt/ddev_config be mounted
# into the varnish container.

varnishhist "$@"
12 changes: 12 additions & 0 deletions commands/varnish/varnishlog
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

## #ddev-generated
## Description: Display Varnish logs
## Usage: varnishlog [flags] [args]
## Example: "ddev varnishlog"

# This example runs inside the varnish container.
# Note that this requires that /mnt/ddev_config be mounted
# into the varnish container.

varnishlog "$@"
12 changes: 12 additions & 0 deletions commands/varnish/varnishncsa
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

## #ddev-generated
## Description: Display Varnish logs in Apache / NCSA combined log format
## Usage: varnishncsa [flags] [args]
## Example: "ddev varnishncsa"

# This example runs inside the varnish container.
# Note that this requires that /mnt/ddev_config be mounted
# into the varnish container.

varnishncsa "$@"
12 changes: 12 additions & 0 deletions commands/varnish/varnishstat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

## #ddev-generated
## Description: Display Varnish Cache statistics
## Usage: varnishstat [flags] [args]
## Example: "ddev varnishstat"

# This example runs inside the varnish container.
# Note that this requires that /mnt/ddev_config be mounted
# into the varnish container.

varnishstat "$@"
12 changes: 12 additions & 0 deletions commands/varnish/varnishtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

## #ddev-generated
## Description: Test program for Varnish
## Usage: varnishtest [flags] [args]
## Example: "ddev varnishtest"

# This example runs inside the varnish container.
# Note that this requires that /mnt/ddev_config be mounted
# into the varnish container.

varnishtest "$@"
12 changes: 12 additions & 0 deletions commands/varnish/varnishtop
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

## #ddev-generated
## Description: Display Varnish log entry ranking
## Usage: varnishtop [flags] [args]
## Example: "ddev varnishtop"

# This example runs inside the varnish container.
# Note that this requires that /mnt/ddev_config be mounted
# into the varnish container.

varnishtop "$@"
1 change: 1 addition & 0 deletions install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: varnish
project_files:
- docker-compose.varnish.yaml
- varnish
- commands/varnish

post_install_actions:
- |
Expand Down

0 comments on commit af8f7c8

Please sign in to comment.