Skip to content
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
23 changes: 23 additions & 0 deletions docker/Dockerfile-varnish9
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM varnish:9.0

SHELL ["/bin/bash", "-c"]

# set the user to root, and install build dependencies
USER root
RUN set -e && \
read -ra vmod_deps <<< "$VMOD_DEPS" && \
apt-get update && \
apt-get -y --no-install-recommends install "${vmod_deps[@]}" && \
install-vmod https://github.com/varnish/varnish-modules/releases/download/0.28.0/varnish-modules-0.28.0.tar.gz && \
rm -rf /var/lib/apt/lists/*

COPY vendor/ibexa/http-cache/docs/varnish/vcl/varnish9.vcl /etc/varnish/default.vcl
COPY doc/docker/entrypoint/varnish/parameters.vcl /etc/varnish/parameters.vcl
COPY doc/docker/entrypoint/varnish/entrypoint.sh /entrypoint.sh

# entrypoint.sh writes into /etc/varnish at runtime (parameters.vcl.template), so hand the
# directory to the non-root "varnish" user the base image already runs as by default
RUN chown -R varnish:varnish /etc/varnish
USER varnish

ENTRYPOINT ["/entrypoint.sh"]
43 changes: 43 additions & 0 deletions docker/varnish9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: '3.3'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still use version in compose files?

It's been obsolete for a year now 😉
https://www.ajeetraina.com/do-you-still-use-version-in-docker-compose/


## WARNING!
# This service is currently work in progress, is not tested by CI, and thus not guaranteed to work.
# You are however more then welcome to try it out and help make it stable.

services:
app:
environment:
- APP_HTTP_CACHE=0
# Never do this in production if the app container is accesible for the public as well
# See https://developers.ibexa.co/security-advisories/ezsa-2020-002-unauthorised-cache-purge-with-misconfigured-fastly
- TRUSTED_PROXIES=REMOTE_ADDR
- HTTPCACHE_PURGE_SERVER=http://varnish
- HTTPCACHE_PURGE_TYPE=varnish

varnish:
build:
context: ../../
dockerfile: doc/docker/Dockerfile-varnish9
ports:
- "8081:80"
environment:
- VARNISH_MALLOC_SIZE=256m
depends_on:
- web
- app
networks:
- frontend
- backend
# command: ["--acl-add", "app", "--debug-acl-add", "app"]
stdin_open: true
tty: true

## DEBUG??
# In need of debugging all request going to Varnish, use varnishlog, example:
# dockercompose exec varnish varnishlog -c -i ReqURL,ReqMethod -I ReqHeader:xkey
# Or more relevant only PURGE's with all info:
# docker compose exec varnish varnishlog -g request -q "ReqMethod eq 'PURGE'"
#
# But before doing that check that http and not local purge client is set:
# docker compose exec app bin/console --env=dev debug:container ibexa.http_cache.purge_client_internal
#
Loading