Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freshening up #42

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})
* Updated default Varnish image to 6.0
* Updated Nginx to `1.27.2` to match Nginx plugin default version
* Fixed bug where data dir was not being mounted correctly

## v1.1.0 - [March 8, 2024](https://github.com/lando/varnish/releases/tag/v1.1.0)
* Updated to latest database services.

Expand Down
11 changes: 8 additions & 3 deletions builders/varnish.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ const _ = require('lodash');

// Helper to get varnsh ssl nginx
const varnishSsl = options => ({
image: 'bitnami/nginx:1.27.2-debian-12-r0',
command: `/launch.sh /opt/bitnami/nginx/conf/lando.conf`,
image: 'bitnami/nginx:1.17.10-debian-10-r52',
depends_on: [options.name],
environment: {
NGINX_HTTP_PORT_NUMBER: '80',
NGINX_DAEMON_USER: 'root',
NGINX_DAEMON_GROUP: 'root',
LANDO_VARNISH_ALIAS: `${options.name}_varnish`,
LANDO_NEEDS_EXEC: 'DOEEET',
LANDO_VARNISH_ALIAS: `${options.name}_varnish`,
},
ports: ['80'],
user: 'root',
volumes: [
`${options.confDest}/launch.sh:/launch.sh`,
Expand All @@ -26,8 +28,10 @@ const varnishSsl = options => ({
module.exports = {
name: 'varnish',
config: {
version: '4.1',
version: '6.0',
supported: ['6', '6.0', '4', '4.1'],
patchesSupported: true,
legacy: ['4', '4.1'],
backends: ['appserver'],
confSrc: path.resolve(__dirname, '..', 'config'),
backend_port: '80',
Expand Down Expand Up @@ -65,6 +69,7 @@ module.exports = {
networks: {default: {aliases: [`${options.name}_varnish`]}},
ports: ['80'],
volumes: [
`${options.data}:/var/lib/varnish`,
`${options.confDest}/lando.default.vcl.tmpl:/etc/gotpl/default.vcl.tmpl`,
`${options.confDest}/lando.varnishd.init.d.tmpl:/etc/gotpl/varnishd.init.d.tmpl`,
],
Expand Down
2 changes: 1 addition & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Also note that options, in addition to the [build steps](https://docs.lando.dev/
```yaml
services:
myservice:
type: varnish:4.1
type: varnish:6
backends:
- appserver
backend_port: 80
Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ You can easily add it to your Lando app by adding an entry to the [services](htt
```yaml
services:
myservice:
type: varnish
type: varnish:6
backends:
- appserver
backend_port: 80
```

## Supported versions

* [6.0](https://hub.docker.com/r/wodby/varnish)
* **[6.0](https://hub.docker.com/r/wodby/varnish)** **(default)**
* [6](https://hub.docker.com/r/wodby/varnish)
* **[4.1](https://hub.docker.com/r/wodby/varnish)** **(default)**
* [4.1](https://hub.docker.com/r/wodby/varnish)
* [4](https://hub.docker.com/r/wodby/varnish)
* [custom](https://docs.lando.dev/core/v3/services/lando.html#overrides)

Expand Down
2 changes: 1 addition & 1 deletion examples/4.x/.lando.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: lando-varnish-4
services:
defaults:
type: varnish
type: varnish:4
appserver:
type: nginx

Expand Down
18 changes: 7 additions & 11 deletions examples/4.x/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
Varnish Example
===============
# Varnish Example

This example exists primarily to test the following documentation:

* [Varnish Service](https://docs.devwithlando.io/tutorials/varnish.html)

Start up tests
--------------
## Start up tests

Run the following commands to get up and running with this example.

Expand All @@ -16,21 +14,19 @@ lando poweroff
lando start
```

Verification commands
---------------------
## Verification commands

Run the following commands to validate things are rolling as they should.

```bash
# Should use varnish 4.x by default
lando ssh -s defaults -c "varnishd -V 2>&1 | grep varnish-4"
# Should use varnish 4.x
lando exec defaults -- varnishd -V 2>&1 | grep varnish-4

# Should backend from appserver by default
lando ssh -s defaults -c "curl localhost | grep sophisticated"
lando exec defaults -- curl localhost | grep sophisticated
```

Destroy tests
-------------
## Destroy tests

Run the following commands to trash this app like nothing ever happened.

Expand Down
2 changes: 1 addition & 1 deletion examples/6.x/.lando.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: lando-varnish-6
services:
defaults:
type: varnish:6
type: varnish
appserver:
type: nginx

Expand Down
18 changes: 7 additions & 11 deletions examples/6.x/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
Varnish Example
===============
# Varnish Example

This example exists primarily to test the following documentation:

* [Varnish Service](https://docs.devwithlando.io/tutorials/varnish.html)

Start up tests
--------------
## Start up tests

Run the following commands to get up and running with this example.

Expand All @@ -16,21 +14,19 @@ lando poweroff
lando start
```

Verification commands
---------------------
## Verification commands

Run the following commands to validate things are rolling as they should.

```bash
# Should use varnish 6.x
lando ssh -s defaults -c "varnishd -V 2>&1 | grep varnish-6"
# Should use varnish 6.x by default
lando exec defaults -- varnishd -V 2>&1 | grep varnish-6

# Should backend from appserver by default
lando ssh -s defaults -c "curl localhost | grep sophisticated"
lando exec defaults -- curl localhost | grep sophisticated
```

Destroy tests
-------------
## Destroy tests

Run the following commands to trash this app like nothing ever happened.

Expand Down
12 changes: 10 additions & 2 deletions examples/custom/.lando.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: lando-varnish
name: lando-varnish-custom
services:
custom:
type: varnish:4
type: varnish:6.0
backends:
- appserver
ssl: true
Expand All @@ -22,6 +22,14 @@ services:
type: python
port: 8000
command: python /app/python.py
curly:
api: 4
image: curlimages/curl
command: sleep infinity

tooling:
curl:
service: curly

# This is important because it lets lando know to test against the plugin in this repo
# DO NOT REMOVE THIS!
Expand Down
33 changes: 15 additions & 18 deletions examples/custom/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
Varnish Example
===============
# CustomVarnish Example


This example exists primarily to test the following documentation:

* [Varnish Service](https://docs.devwithlando.io/tutorials/varnish.html)

Start up tests
--------------
## Start up tests

Run the following commands to get up and running with this example.

Expand All @@ -16,33 +15,31 @@ lando poweroff
lando start
```

Verification commands
---------------------
## Verification commands

Run the following commands to validate things are rolling as they should.

```bash
# Should also serve over https if specified
lando ssh -s custom_ssl -c "curl https://localhost | grep sophisticated"
# Should serve over https if specified
lando exec curly -- curl https://custom_ssl.landovarnishcustom.internal | grep sophisticated

# Shoule use a custom vcl file if specified
lando ssh -s custom -c "cat /etc/varnish/lando.vcl | grep LANDOVARNISH"
lando ssh -s custom -c "env | grep LANDO_CUSTOM_VCL | grep YOUBETCHA"
lando ssh -s custom -c "curl -I localhost" | grep X-Lando-Varnish | grep capes
# Should use a custom vcl file if specified
lando exec custom -- cat /etc/varnish/lando.vcl | grep LANDOVARNISH
lando exec custom -- env | grep LANDO_CUSTOM_VCL | grep YOUBETCHA
lando exec curly -- curl -I custom.landovarnishcustom.internal | grep X-Lando-Varnish | grep capes

# Should inherit overrides from its generator
lando ssh -s custom -c "env | grep MEGAMAN | grep X"
lando ssh -s custom_ssl -c "env | grep MEGAMAN | grep X"
lando exec custom -- env | grep MEGAMAN | grep X
lando exec custom_ssl -- env | grep MEGAMAN | grep X

# Should use a custom backend port when specified
lando ssh -s customport -c "curl http://localhost | grep SAW"
lando exec curly -- curl http://customport.landovarnishcustom.internal | grep SAW

# Should use a custom backend port with SSL if specified
lando ssh -s customport_ssl -c "curl https://localhost | grep SAW"
lando exec curly -- curl https://customport_ssl.landovarnishcustom.internal | grep SAW
```

Destroy tests
-------------
## Destroy tests

Run the following commands to trash this app like nothing ever happened.

Expand Down
Loading
Loading