Skip to content

Instantly share code, notes, and snippets.

@shqld
Last active March 23, 2022 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shqld/5ed5871e93df621bdc7b4d9b0a4834eb to your computer and use it in GitHub Desktop.
Save shqld/5ed5871e93df621bdc7b4d9b0a4834eb to your computer and use it in GitHub Desktop.
Benchmarking varnish sample
version: '3.8'
services:
varnish:
image: varnish:stable
volumes:
- type: bind
source: ./varnish
target: /etc/varnish
read_only: true
tmpfs: /var/lib/varnish:exec
working_dir: /app
depends_on:
- origin
healthcheck:
test: ['CMD', 'varnishstat', '-1', '-f', 'MAIN.uptime']
interval: 1s
timeout: 3s
retries: 3
restart: 'no'
entrypoint: varnishd -F -a :8080 -f /etc/varnish/default.vcl
deploy:
resources:
limits:
cpus: '1'
memory: 1g
origin:
image: ubuntu:20.04
environment:
- ORIGIN_HOST=0.0.0.0
- ORIGIN_PORT=3000
volumes:
- type: bind
source: ./origin/${TARGET_DIR}
target: /app
read_only: true
working_dir: /app
init: true
entrypoint: './origin'
restart: 'no'
deploy:
resources:
limits:
cpus: '1'
memory: 1g
benchmarker:
image: williamyeh/hey
platform: linux/amd64
environment:
- BENCHMARK_DATETIME=${BENCHMARK_DATETIME}
- BENCHMARK_HOST=varnish
volumes:
- ./benchmark.sh:/benchmark.sh:ro
- ./logs:/logs
depends_on:
varnish:
condition: service_healthy
entrypoint: 'sh /benchmark.sh'
restart: 'no'
deploy:
resources:
limits:
cpus: '1'
memory: 1g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment