Skip to content

Commit

Permalink
Merge branch 'master' into studio_master
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Jul 23, 2018
2 parents 4cf858b + 959ec5a commit 0ebcec7
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 86 deletions.
3 changes: 1 addition & 2 deletions app/AppCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
/**
* 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!
* For easier upgrade do not change this file, prefer to adapt web/app.php instead.
*/
class AppCache extends PlatformHttpCacheBundleAppCache
{
Expand Down
8 changes: 6 additions & 2 deletions app/config/default_parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ parameters:
# Settings for HttpCache
purge_server: '%env(HTTPCACHE_PURGE_SERVER)%'

fastly_service_id: default_service_id
fastly_key: default_fastly_key
# Only relevant when using ezplatform-http-cache-fastly bundle provided with eZ Platform Enterprise
fastly_service_id: '%env(FASTLY_SERVICE_ID)%'
fastly_key: '%env(FASTLY_KEY)%'

# By default cache ttl is set to 24h, when using Varnish you can set a much higher value. High values depends on
# using EzSystemsPlatformHttpCacheBundle (default as of v1.12) which by design expires affected cache on changes
Expand Down Expand Up @@ -73,6 +74,9 @@ parameters:

env(HTTPCACHE_PURGE_SERVER): "http://localhost:80"

env(FASTLY_SERVICE_ID): default_service_id
env(FASTLY_KEY): default_fastly_key

env(HTTPCACHE_DEFAULT_TTL): 86400

env(SESSION_SAVE_PATH): '%kernel.project_dir%/var/sessions/%kernel.environment%'
Expand Down
9 changes: 0 additions & 9 deletions app/config/env/generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,3 @@
if ($value = getenv('SESSION_HANDLER_ID')) {
$container->setParameter('session.handler_id', $value);
}

// EzSystemsPlatformFastlyCacheBundle settings
if ($value = getenv('FASTLY_SERVICE_ID')) {
$container->setParameter('fastly_service_id', $value);
}

if ($value = getenv('FASTLY_KEY')) {
$container->setParameter('fastly_key', $value);
}
42 changes: 15 additions & 27 deletions bin/vhost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ declare -a option_vars=(
%HOST_NAME%
%HOST_ALIAS%
%SYMFONY_ENV%
%SYMFONY_CLASSLOADER_FILE%
%SYMFONY_DEBUG%
%SYMFONY_HTTP_CACHE%
%SYMFONY_HTTP_CACHE_CLASS%
%SYMFONY_TRUSTED_PROXIES%
%BODY_SIZE_LIMIT%
%TIMEOUT%
Expand Down Expand Up @@ -41,8 +39,6 @@ declare -a template_values=(
""
""
""
""
""
"50331648"
"90"
"unix:/var/run/php5-fpm.sock"
Expand Down Expand Up @@ -95,8 +91,6 @@ Arguments:
[--sf-trusted-proxies=127.0.0.1,....] : Comma separated trusted proxies (e.g. Varnish), that we can get client ip from
[--sf-http-cache=0|1] : To disable Symfony HTTP cache Proxy for using a different reverse proxy
By default disabled when evn is "dev", enabled otherwise.
[--sf-http-cache-class=<class-file.php>] : DEPRECATED - To specify a different class then default to use as the Symfony proxy
[--sf-classloader-file=<class-file.php>] : DEPRECATED - To specify a different class then default to use for PHP auto loading
[--body-size-limit=<int>] : Limit in megabytes for max size of request body, 0 value disables limit.
[--request-timeout=<int>] : Limit in seconds before timeout of request, 0 value disables timeout limit.
[--binary-data-handler=dfs|] : Name of handler in user. Specify "dfs" if you are using the dfs io handler.
Expand All @@ -123,12 +117,12 @@ function inject_environment_variables
if [ "$option_value" != "SomeDefault" ]; then
template_values[$i]="$option_value";
if [ "$current_env_variable" == "BODY_SIZE_LIMIT" ]; then
let template_values[11]="$option_value"*1024
template_values[15]="${option_value}m"
let template_values[9]="$option_value"*1024
template_values[13]="${option_value}m"
fi
if [ "$current_env_variable" == "TIMEOUT" ]; then
template_values[12]="$option_value"
template_values[16]="${option_value}s"
template_values[10]="$option_value"
template_values[14]="${option_value}s"
fi
fi
let i=$i+1;
Expand Down Expand Up @@ -159,31 +153,25 @@ case $i in
-e=*|--sf-env=*)
template_values[5]="${i#*=}"
;;
--sf-classloader-file=*)
template_values[6]="${i#*=}"
;;
-d=*|--sf-debug=*)
template_values[7]="${i#*=}"
template_values[6]="${i#*=}"
;;
--sf-http-cache=*)
template_values[8]="${i#*=}"
;;
--sf-http-cache-class=*)
template_values[9]="${i#*=}"
template_values[7]="${i#*=}"
;;
--sf-trusted-proxies=*)
template_values[10]="${i#*=}"
template_values[8]="${i#*=}"
;;
--binary-data-handler=*)
template_values[14]="${i#*=}"
template_values[12]="${i#*=}"
;;
--body-size-limit=*)
let template_values[11]="${i#*=}"*1024*1024
template_values[15]="${i#*=}m"
let template_values[9]="${i#*=}"*1024*1024
template_values[13]="${i#*=}m"
;;
--request-timeout=*)
template_values[12]="${i#*=}"
template_values[16]="${i#*=}s"
template_values[10]="${i#*=}"
template_values[14]="${i#*=}s"
;;
-t=*|--template-file=*)
template_file="${i#*=}"
Expand Down Expand Up @@ -224,10 +212,10 @@ fi
## Option specific logic

# For httpd servers having just one host config we provide HOST_LIST
template_values[17]="${template_values[3]}"
template_values[15]="${template_values[3]}"
if [[ "${template_values[4]}" != "" ]] ; then
tmp="${template_values[17]} ${template_values[4]}"
template_values[17]=$tmp
tmp="${template_values[15]} ${template_values[4]}"
template_values[15]=$tmp
fi


Expand Down
16 changes: 5 additions & 11 deletions doc/apache2/vhost.2.2.template
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,23 @@
# Defaults to enabled if SYMFONY_ENV is set to "dev" if env value is omitted or empty
#if[SYMFONY_DEBUG] SetEnv SYMFONY_DEBUG "%SYMFONY_DEBUG%"

# Optional: Whether to use custom ClassLoader (autoloader) file
# Needs to be a valid path relative to root web/ directory
# Defaults to bootstrap.php.cache, or autoload.php in debug if env value is omitted or empty
#if[SYMFONY_CLASSLOADER_FILE] SetEnv SYMFONY_CLASSLOADER_FILE "%SYMFONY_CLASSLOADER_FILE%"

# Optional: Whether to use Symfony's builtin HTTP Caching Proxy.
# Disable it if you are using an external reverse proxy (e.g. Varnish)
# Possible values: 0, 1 or ""
# Defaults to disabled if SYMFONY_ENV is set to "dev" or SYMFONY_TRUSTED_PROXIES is set,
# and if this env value is omitted or empty
#if[SYMFONY_HTTP_CACHE] SetEnv SYMFONY_HTTP_CACHE "%SYMFONY_HTTP_CACHE%"

# Optional: Whether to use custom HTTP Cache class if SYMFONY_HTTP_CACHE is enabled
# Value must be a autoloadable cache class
# Defaults to to use provided "AppCache" if env value is omitted or empty
#if[SYMFONY_HTTP_CACHE_CLASS] SetEnv SYMFONY_HTTP_CACHE_CLASS "%SYMFONY_HTTP_CACHE_CLASS%"

# Optional: Defines the proxies to trust
# Needed when using Varnish as proxy, if so disable SYMFONY_HTTP_CACHE.
# Separate entries by a comma, example: "proxy1.example.com,proxy2.example.org"
# Separate entries by a comma, example: "ip1,ip2"
# Defaults to not be set if env value is omitted or empty
#if[SYMFONY_TRUSTED_PROXIES] SetEnv SYMFONY_TRUSTED_PROXIES "%SYMFONY_TRUSTED_PROXIES%"

# TIP: There are many more environment variables supported by eZ Platform. However unlike those listed above
# they should in most cases rather be set in the environment then in vhost config to make sure cronjobs
# and cli command usage takes them into account as well.

<IfModule mod_rewrite.c>
RewriteEngine On

Expand Down
16 changes: 5 additions & 11 deletions doc/apache2/vhost.template
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,23 @@
# Defaults to enabled if SYMFONY_ENV is set to "dev" if env value is omitted or empty
#if[SYMFONY_DEBUG] SetEnv SYMFONY_DEBUG "%SYMFONY_DEBUG%"

# Optional: Whether to use custom ClassLoader (autoloader) file
# Needs to be a valid path relative to root web/ directory
# Defaults to bootstrap.php.cache, or autoload.php in debug if env value is omitted or empty
#if[SYMFONY_CLASSLOADER_FILE] SetEnv SYMFONY_CLASSLOADER_FILE "%SYMFONY_CLASSLOADER_FILE%"

# Optional: Whether to use Symfony's builtin HTTP Caching Proxy.
# Disable it if you are using an external reverse proxy (e.g. Varnish)
# Possible values: 0, 1 or ""
# Defaults to disabled if SYMFONY_ENV is set to "dev" or SYMFONY_TRUSTED_PROXIES is set,
# and if this env value is omitted or empty
#if[SYMFONY_HTTP_CACHE] SetEnv SYMFONY_HTTP_CACHE "%SYMFONY_HTTP_CACHE%"

# Optional: Whether to use custom HTTP Cache class if SYMFONY_HTTP_CACHE is enabled
# Value must be a autoloadable cache class
# Defaults to to use provided "AppCache" if env value is omitted or empty
#if[SYMFONY_HTTP_CACHE_CLASS] SetEnv SYMFONY_HTTP_CACHE_CLASS "%SYMFONY_HTTP_CACHE_CLASS%"

# Optional: Defines the proxies to trust
# Needed when using Varnish as proxy, if so disable SYMFONY_HTTP_CACHE.
# Separate entries by a comma, example: "proxy1.example.com,proxy2.example.org"
# Separate entries by a comma, example: "ip1,ip2"
# Defaults to not be set if env value is omitted or empty
#if[SYMFONY_TRUSTED_PROXIES] SetEnv SYMFONY_TRUSTED_PROXIES "%SYMFONY_TRUSTED_PROXIES%"

# TIP: There are many more environment variables supported by eZ Platform. However unlike those listed above
# they should in most cases rather be set in the environment then in vhost config to make sure cronjobs
# and cli command usage takes them into account as well.

<IfModule mod_rewrite.c>
RewriteEngine On

Expand Down
1 change: 0 additions & 1 deletion doc/docker/base-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ services:
- SYMFONY_ENV=${SYMFONY_ENV-dev}
- SYMFONY_DEBUG
- SYMFONY_HTTP_CACHE
- SYMFONY_HTTP_CACHE_CLASS
- SYMFONY_TRUSTED_PROXIES
- DATABASE_USER
- DATABASE_PASSWORD
Expand Down
1 change: 0 additions & 1 deletion doc/docker/base-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ services:
- SYMFONY_ENV=${SYMFONY_ENV-prod}
- SYMFONY_DEBUG
- SYMFONY_HTTP_CACHE
- SYMFONY_HTTP_CACHE_CLASS
- SYMFONY_TRUSTED_PROXIES
- DATABASE_USER
- DATABASE_PASSWORD
Expand Down
1 change: 0 additions & 1 deletion doc/docker/distribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ services:
- SYMFONY_ENV=${SYMFONY_ENV-prod}
- SYMFONY_DEBUG
- SYMFONY_HTTP_CACHE
- SYMFONY_HTTP_CACHE_CLASS
- SYMFONY_TRUSTED_PROXIES
- DATABASE_USER
- DATABASE_PASSWORD
Expand Down
1 change: 0 additions & 1 deletion doc/docker/my-ez-app-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ services:
- SYMFONY_ENV=prod
- SYMFONY_DEBUG
- SYMFONY_HTTP_CACHE
- SYMFONY_HTTP_CACHE_CLASS
- SYMFONY_TRUSTED_PROXIES
- DATABASE_USER=ezp
- DATABASE_PASSWORD=SetYourOwnPassword
Expand Down
10 changes: 1 addition & 9 deletions doc/docker/varnish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ services:
# 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
#
# Or if you are using BAN requests and not using EzSystemsPlatformHttpCacheBundle:
# docker-compose exec varnish varnishlog -c -i ReqURL,ReqMethod -I ReqHeader:X-Location-Id
# Or more relevant only BAN's with all info:
# docker-compose exec varnish varnishlog -g request -q "ReqMethod eq 'BAN'"
#
# But before doing that check that http and not local purge client is set:
# docker-compose exec app app/console --env=dev debug:container ezpublish.http_cache.purge_client
# docker-compose exec app bin/console --env=dev debug:container ezplatform.http_cache.purge_client_internal
#
# And if in prod make sure you have rebuilt app container on code changes ;)
16 changes: 5 additions & 11 deletions doc/nginx/vhost.template
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ server {
# Defaults to "prod" if omitted
#if[SYMFONY_ENV] fastcgi_param SYMFONY_ENV %SYMFONY_ENV%;

# Whether to use custom ClassLoader (autoloader) file
# Needs to be a valid path relative to root web/ directory
# Defaults to bootstrap.php.cache, or autoload.php in debug
#if[SYMFONY_CLASSLOADER_FILE] fastcgi_param SYMFONY_CLASSLOADER_FILE "%SYMFONY_CLASSLOADER_FILE%";

# Whether to use debugging.
# Possible values: 0 or 1
# Defaults to 0 if omitted, unless SYMFONY_ENV is set to: "dev"
Expand All @@ -55,16 +50,15 @@ server {
# Defaults to 1 if omitted, unless SYMFONY_ENV is set to: "dev"
#if[SYMFONY_HTTP_CACHE] fastcgi_param SYMFONY_HTTP_CACHE "%SYMFONY_HTTP_CACHE%";

# Optional: Whether to use custom HTTP Cache class if SYMFONY_HTTP_CACHE is enabled
# Value must be na autoloadable cache class
# Defaults to "AppCache"
#if[SYMFONY_HTTP_CACHE_CLASS] fastcgi_param SYMFONY_HTTP_CACHE_CLASS "%SYMFONY_HTTP_CACHE_CLASS%";

# Optional: Defines the proxies to trust
# Needed when using Varnish as proxy, if so disable SYMFONY_HTTP_CACHE.
# Separate entries by a comma, example: "proxy1.example.com,proxy2.example.org"
# Separate entries by a comma, example: "ip1,ip2"
# Defaults to not be set if env value is omitted or empty
#if[SYMFONY_TRUSTED_PROXIES] fastcgi_param SYMFONY_TRUSTED_PROXIES "%SYMFONY_TRUSTED_PROXIES%";

# TIP: There are many more environment variables supported by eZ Platform. However unlike those listed above
# they should in most cases rather be set in the environment then in vhost config to make sure cronjobs
# and cli command usage takes them into account as well.
}
}

Expand Down

0 comments on commit 0ebcec7

Please sign in to comment.