Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
brookinsconsulting committed Jul 23, 2018
2 parents afc8fa4 + 959ec5a commit 34e8477
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 105 deletions.
3 changes: 1 addition & 2 deletions app/AppCache.php
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
10 changes: 5 additions & 5 deletions app/config/config.yml
Expand Up @@ -64,12 +64,12 @@ framework:
trusted_hosts: ~
session:
# https://symfony.com/doc/current/reference/configuration/framework.html#handler-id
# handler_id set to null will use default session handler from php.ini
handler_id: '%ezplatform.session.handler_id%'
save_path: '%ezplatform.session.save_path%'
# Note: eZ Publish also allows session name and session cookie configuration to be per SiteAccess, by
# if handler_id set to null will use default session handler from php.ini
handler_id: '%session.handler_id%'
save_path: '%session.save_path%'
# Note: eZ Platform also allows session name and session cookie configuration to be per SiteAccess, by
# default session name will be set to "eZSESSID{siteaccess_hash}" (unique session name per siteaccess)
# Further reading on sessions: http://doc.ezplatform.com/en/master/guide/sessions/
# Further reading on sessions: http://doc.ezplatform.com/en/latest/guide/sessions/
fragments: ~
http_method_override: true
assets: true
Expand Down
25 changes: 22 additions & 3 deletions app/config/default_parameters.yml
@@ -1,8 +1,6 @@
# This file contains defaults for optional parameters, which you can override in parameters.yml
parameters:
locale_fallback: en
ezplatform.session.handler_id: session.handler.native_file
ezplatform.session.save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'

# A secret key that's used to generate certain security-related tokens
secret: '%env(SYMFONY_SECRET)%'
Expand Down Expand Up @@ -45,6 +43,14 @@ parameters:
# using EzSystemsPlatformHttpCacheBundle (default as of v1.12) which by design expires affected cache on changes
httpcache_default_ttl: '%env(HTTPCACHE_DEFAULT_TTL)%'

# Session save path as used by symfony session handlers (eg. used for dsn with redis)
session.save_path: '%env(SESSION_SAVE_PATH)%'

# Recommendation Bundle params
ez_recommendation.default.yoochoose.customer_id: '%env(RECOMMENDATIONS_CUSTOMER_ID)%'
ez_recommendation.default.yoochoose.license_key: '%env(RECOMMENDATIONS_LICENSE_KEY)%'
ez_recommendation.default.server_uri: '%env(PUBLIC_SERVER_URI)%'

# Fallback values for when environment variables do not exist

env(MAILER_HOST): 127.0.0.1
Expand All @@ -66,19 +72,32 @@ parameters:

env(HTTPCACHE_DEFAULT_TTL): 86400

env(SESSION_SAVE_PATH): '%kernel.project_dir%/var/sessions/%kernel.environment%'

env(RECOMMENDATIONS_CUSTOMER_ID): ~
env(RECOMMENDATIONS_LICENSE_KEY): ~
env(PUBLIC_SERVER_URI): ~


# Compile time handlers
## These are defined at compile time, and hence can't be set at runtime using env()
## app/config/env/generic.php takes care about letting you set them by env variables

## Log type is one of "stream", "error_log" or other types supported by monolog
# env: LOG_TYPE
log_type: stream

## Mail transport used by SwiftMailer
# env: MAILER_TRANSPORT
mailer_transport: smtp

# Purge type used by HttpCache system ("local", "varnish"/"http", and on ee also "fastly")
## Purge type used by HttpCache system ("local", "varnish"/"http", and on ee also "fastly")
# env: HTTPCACHE_PURGE_TYPE
purge_type: local

## Session handler, by default set to file based in order to be able to use %session.save_path%
# env: SESSION_HANDLER_ID
session.handler_id: session.handler.native_file

# Admin siteaccess group name
admin_group_name: admin_group
20 changes: 1 addition & 19 deletions app/config/env/generic.php
Expand Up @@ -68,24 +68,6 @@
$container->setParameter('log_type', $value);
}

// EzSystemsRecommendationsBundle settings
// @todo Move to use env() and params
if ($value = getenv('RECOMMENDATIONS_CUSTOMER_ID')) {
$container->setParameter('ez_recommendation.default.yoochoose.customer_id', $value);
}

if ($value = getenv('RECOMMENDATIONS_LICENSE_KEY')) {
$container->setParameter('ez_recommendation.default.yoochoose.license_key', $value);
}

if ($value = getenv('PUBLIC_SERVER_URI')) {
$container->setParameter('ez_recommendation.default.server_uri', $value);
}

if ($value = getenv('SESSION_HANDLER_ID')) {
$container->setParameter('ezplatform.session.handler_id', $value);
}

if ($value = getenv('SESSION_SAVE_PATH')) {
$container->setParameter('ezplatform.session.save_path', $value);
$container->setParameter('session.handler_id', $value);
}
4 changes: 2 additions & 2 deletions app/config/env/platformsh.php
Expand Up @@ -104,7 +104,7 @@
continue;
}

$container->setParameter('ezplatform.session.handler_id', 'ezplatform.core.session.handler.native_redis');
$container->setParameter('session.handler_id', 'ezplatform.core.session.handler.native_redis');
$container->setParameter('session.save_path', sprintf('%s:%d', $endpoint['host'], $endpoint['port']));
}
} elseif (isset($relationships['rediscache'])) {
Expand All @@ -113,7 +113,7 @@
continue;
}

$container->setParameter('ezplatform.session.handler_id', 'ezplatform.core.session.handler.native_redis');
$container->setParameter('session.handler_id', 'ezplatform.core.session.handler.native_redis');
$container->setParameter('session.save_path', sprintf('%s:%d', $endpoint['host'], $endpoint['port']));
}
}
6 changes: 5 additions & 1 deletion app/config/parameters.yml.dist
@@ -1,7 +1,11 @@
# This file is a "template" of what your parameters.yml file should look like
#
# NB!: Some parameters are on purpose placed in default_parameters.yml to not
# prompt on all possible parameters during install with no info to go with it.
# (This will change once we move to use Symfony flex)
parameters:
# A secret key that's used to generate certain security-related tokens
env(SYMFONY_SECRET): ThisEzPlatformTokenIsNotSoSecretChangeIt
env(SYMFONY_SECRET): ThisEzPlatformTokenIsNotSoSecret_PleaseChangeIt

# Settings for database backend used by Doctrine DBAL
# In turn used for default storage engine & default search engine (if legacy is configured as search engine)
Expand Down
42 changes: 15 additions & 27 deletions bin/vhost.sh
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
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
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
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
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
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
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
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
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 34e8477

Please sign in to comment.