Skip to content
This repository was archived by the owner on Sep 3, 2026. It is now read-only.
Closed
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 .env
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ APP_DOCKER_FILE=Dockerfile

# Install config, used by .platform.app.yaml among others
INSTALL_EZ_INSTALL_TYPE=clean

# Behat / Selenium config
EZP_TEST_REST_HOST=web
BEHAT_SELENIUM_HOST=selenium
BEHAT_WEB_HOST=web
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ env:
- SYMFONY_DEBUG=1
# list of behat arguments to test
matrix:
# Disabled until failures on BDD tests with redis is solved / figured out
#- TEST_CMD="bin/behat -vv --profile=rest --suite=fullJson --tags=~@broken" COMPOSE_FILE="doc/docker-compose/base-prod.yml:doc/docker-compose/redis.yml:doc/docker-compose/selenium.yml"
- TEST_CMD="bin/behat -vv --profile=rest --suite=fullJson --tags=~@broken" COMPOSE_FILE="doc/docker-compose/base-prod.yml:doc/docker-compose/selenium.yml"
# Disabled until failures on BDD tests with redis, and travis segfault with varnish is solved / figured out
#- TEST_CMD="bin/behat -vv --profile=rest --suite=fullJson --tags=~@broken" COMPOSE_FILE="doc/docker-compose/base-prod.yml:doc/docker-compose/redis.yml:doc/docker-compose/varnish.yml:doc/docker-compose/selenium.yml" BEHAT_WEB_HOST="varnish"
- TEST_CMD="bin/behat -vv --profile=rest --suite=fullJson --tags=~@broken" COMPOSE_FILE="doc/docker-compose/base-prod.yml:doc/docker-compose/varnish.yml:doc/docker-compose/selenium.yml"
- TEST_CMD="bin/behat -vv --profile=rest --suite=fullXml --tags=~@broken"
- TEST_CMD="bin/behat -vv --profile=core --tags=~@broken"
- TEST_CMD="bin/phpunit -v vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishRestBundle/Tests/Functional"
Expand Down
4 changes: 2 additions & 2 deletions app/AppCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* @license For full copyright and license information view LICENSE file distributed with this source code.
* @version //autogentag//
*/
use eZ\Bundle\EzPublishCoreBundle\HttpCache;
use EzSystems\PlatformHttpCacheBundle\AppCache as PlatformHttpCacheBundleAppCache;

/**
* Class AppCache.
*
* For easier upgrade do not change this file, as of 2015.01 possible to extend
* cleanly via SYMFONY_HTTP_CACHE_CLASS & SYMFONY_CLASSLOADER_FILE env variables!
*/
class AppCache extends HttpCache
class AppCache extends PlatformHttpCacheBundleAppCache
{
}
1 change: 1 addition & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function registerBundles()
new Hautelook\TemplatedUriBundle\HautelookTemplatedUriBundle(),
new Liip\ImagineBundle\LiipImagineBundle(),
new FOS\HttpCacheBundle\FOSHttpCacheBundle(),
new EzSystems\PlatformHttpCacheBundle\EzSystemsPlatformHttpCacheBundle(),
new eZ\Bundle\EzPublishCoreBundle\EzPublishCoreBundle(),
new eZ\Bundle\EzPublishLegacySearchEngineBundle\EzPublishLegacySearchEngineBundle(),
new eZ\Bundle\EzPublishIOBundle\EzPublishIOBundle(),
Expand Down
4 changes: 4 additions & 0 deletions app/config/default_parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ parameters:

cache_memcached_port: 11211
cache_redis_port: 6379

# Settings for HttpCache
purge_type: "local"
purge_server: "http://my.varnish.server:80"
6 changes: 6 additions & 0 deletions app/config/env/docker.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,9 @@
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../cache_pool'));
$loader->load($pool . '.yml');
}

// HttpCache setting (for configuring Varnish purging)
if ($purgeServer = getenv('HTTPCACHE_PURGE_SERVER')) {
$container->setParameter('purge_type', 'http');
$container->setParameter('purge_server', $purgeServer);
}
11 changes: 11 additions & 0 deletions app/config/ezplatform.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
ezpublish:
# HttpCache settings, By default 'local' (Symfony HttpCache Proxy), by setting it to 'http' you can point it to Varnish
http_cache:
purge_type: %purge_type%

# Repositories configuration, setup default repository to support solr if enabled
repositories:
default:
Expand Down Expand Up @@ -29,3 +33,10 @@ ezpublish:
# so removing eng-GB from this list may lead to errors or content not being shown, unless you change
# all eng-GB data to other locales first.
languages: [eng-GB]
# HttpCache purge server(s) setting, eg Varnish, for when ezpublish.http_cache.purge_type is set to 'http'.
http_cache:
purge_servers: ["%purge_server%"]
# Given we use ezplatform-http-cache package we increase the default TTL as the package aims to correctly
# invalidate all cache when they update, and hence longer TTL should be supported.
content:
default_ttl: 900
15 changes: 15 additions & 0 deletions doc/docker-compose/Dockerfile-varnish
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM debian:stretch
# Stretch is used in order to install varnish-modules withouth having to compile from source
# links:
# - https://github.com/varnish/varnish-modules/blob/master/docs/vmod_xkey.rst
# - https://wikitech.wikimedia.org/wiki/XKey

ENV DEBIAN_FRONTEND noninteractive

RUN \
apt-get update -q -y && \
apt-get install -q -y --force-yes --no-install-recommends ca-certificates varnish-modules varnish

EXPOSE 80 6082

CMD ["varnishd", "-F", "-a", ":80", "-T", ":6082", "-f", "/etc/varnish/default.vcl", "-s", "malloc,256M"]
1 change: 1 addition & 0 deletions doc/docker-compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ The current Docker Compose files are made to be mixed and matched togtehr as you

In addition the following exists but are work in progress, thus not tested yet and are known to be somewhat broken:
- redis.yml _(optional, adds redis service and appends config to app)_
- varnish.yml _(optional, adds varnish service and appends config to app)_
- solr.yml _(optional, add solr service and configure app for it)_


Expand Down
4 changes: 4 additions & 0 deletions doc/docker-compose/redis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
version: '2.1'
# Redis config, to be appended after base-prod or base-dev, ..., but before selenium.yml

## 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:
depends_on:
Expand Down
8 changes: 4 additions & 4 deletions doc/docker-compose/selenium.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: '2.1'
# Appends services to prod.yml, prod+dev, prod+redis, ..., always latests
# Appends services to prod.yml, prod+dev, prod+redis, ..., always latest

services:
selenium:
Expand All @@ -16,6 +16,6 @@ services:
depends_on:
- selenium
environment:
- EZP_TEST_REST_HOST=web
- BEHAT_SELENIUM_HOST=selenium
- BEHAT_WEB_HOST=web
- EZP_TEST_REST_HOST
- BEHAT_SELENIUM_HOST
- BEHAT_WEB_HOST
4 changes: 4 additions & 0 deletions doc/docker-compose/solr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ version: '2.1'
# NOTE: You'll need to manually reindex the solr index when booting this as we don't have entrypoint for solr yet.
# (Unless you use ezplatform:install command which indexes for you)

## 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:
depends_on:
Expand Down
39 changes: 39 additions & 0 deletions doc/docker-compose/varnish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: '2.1'
# Simple single server setup for prod

## 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:
- SYMFONY_HTTP_CACHE=0
- SYMFONY_TRUSTED_PROXIES=varnish
- HTTPCACHE_PURGE_SERVER=http://varnish

varnish:
build:
context: .
dockerfile: Dockerfile-varnish
image: my_varnish
mem_limit: 384M
memswap_limit: 512M
ports:
- "8081:80"
depends_on:
- web
volumes:
- ${COMPOSE_DIR}/../vendor/ezsystems/ezplatform-http-cache/docs/varnish/vcl/varnish4.vcl:/etc/varnish/default.vcl:ro


## DEBUG??
# In need of debugging all request going to Varnish, use varnishlog, example:
# docker-compose 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 app/console --env=dev debug:container ezplatform.http_cache.purge_client
#
# And if in prod make sure you have rebuilt app container on code changes ;)
8 changes: 5 additions & 3 deletions doc/varnish/varnish.md → doc/varnish/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ eZ Platform Varnish configuration

Prerequisites
-------------
* A working Varnish 3 or Varnish 4 setup.
* A working Varnish 4.1 and higher setup with xkey module installed.

Recommended VCL base files
--------------------------
For Varnish to work properly with eZ, you'll need to use one of the provided files as a basis:

* [eZ 5.4+ / 2014.09+ with Varnish 3](vcl/varnish3.vcl)
* [eZ 5.4+ / 2014.09+ with Varnish 4](vcl/varnish4.vcl)
* [eZ Platform optimized Varnish VCL using xkey](https://github.com/ezsystems/ezplatform-http-cache/blob/master/docs/varnish/vcl/varnish4.vcl)
* Further documentation on this option can be found in [ezplatform-http-cache package](https://github.com/ezsystems/ezplatform-http-cache/tree/master/docs)
* [(Deprecated) eZ Platform optimized Varnish VCL using BAN](vcl/varnish_ban.vcl)
* To use this one you'll need to disable `EzSystemsPlatformHttpCacheBundle`.

> **Note:** Http cache management is done with the help of [FOSHttpCacheBundle](http://foshttpcachebundle.readthedocs.org/).
One may need to tweak their VCL further on according to [FOSHttpCache documentation](http://foshttpcache.readthedocs.org/en/latest/varnish-configuration.html)
Expand Down
Loading