Skip to content

Commit

Permalink
Merge ezplatform-ee/master into master
Browse files Browse the repository at this point in the history
  • Loading branch information
damianz5 committed Mar 27, 2018
2 parents c89413b + 79ba5cd commit 25dbff2
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
24 changes: 18 additions & 6 deletions .platform.app.yaml
Expand Up @@ -85,26 +85,38 @@ hooks:
composer config http-basic.updates.ez.no $COMPOSER_KEY $COMPOSER_PASSWORD
composer install --no-dev --prefer-dist --no-progress --no-interaction --optimize-autoloader
rm web/app_dev.php
. ./.env
if [ "$SYMFONY_ENV" = "dev" ] ; then
composer install --prefer-dist --no-progress --no-interaction --optimize-autoloader
else
composer install --no-dev --prefer-dist --no-progress --no-interaction --optimize-autoloader
fi
# Deploy hook, access to services & done once (per cluster, not per node), only mounts are writable at this point
# Note: Http traffic is paused while this is running, so for prod code this should finish as fast as possible, < 30s
deploy: |
set -e
. ./.env
# Mainly relevant for eZ Platform demo usage, for own setup adapt this or remove and rely on migrations.
if [ ! -f web/var/.platform.installed ]; then
. ./.env
php -d memory_limit=-1 bin/console ezplatform:install $INSTALL_EZ_INSTALL_TYPE
touch web/var/.platform.installed
fi
# As we are deploying code changes we need to clear any kind of code/system cache
rm -Rf var/cache/*/*.*
bin/console cache:clear
# Example of addtional deploy hooks if you use doctrine and/or kaliop migration bundle
# When deploying changes to existing cluster, clear all cache now that we have shared mounts available
if [ "$SYMFONY_ENV" != "prod" ] ; then
# Clear class cache before we boot up symfony in case of interface changes on classes cached
rm -Rf var/cache/$SYMFONY_ENV/*.*
bin/console cache:clear
elif [ -d "var/cache/prod/$PLATFORM_TREE_ID" ] ; then
# Clear cache on re-deploy when the folder exits, move folder so post_deploy can cleanup
mv -f var/cache/prod/$PLATFORM_TREE_ID var/cache/prod/old_deploy
fi
# Example of additional deploy hooks if you use doctrine and/or kaliop migration bundle
##bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration
##bin/console kaliop:migration:migrate --no-interaction --no-debug
# Post deploy hook, like deploy but after being deployed and live, for deploy tasks we can do asynchronously
post_deploy: |
set -e
# Cleanup old prod cache folders, basically all except current $PLATFORM_TREE_ID folder.
find var/cache/prod -mindepth 1 -maxdepth 1 -type d \! \( -name "$PLATFORM_TREE_ID" \) -exec rm -rf '{}' \;
# The configuration of scheduled execution.
# see http://symfony.com/doc/current/components/console/introduction.html
Expand Down
5 changes: 5 additions & 0 deletions app/AppKernel.php
Expand Up @@ -97,6 +97,11 @@ public function getCacheDir()
return rtrim($_SERVER['SYMFONY_TMP_DIR'], '/') . '/var/cache/' . $this->getEnvironment();
}

// On platform.sh place each deployment cache in own folder to rather cleanup old cache async
if ($this->getEnvironment() === 'prod' && ($platformTreeId = getenv('PLATFORM_TREE_ID'))) {
return dirname(__DIR__) . '/var/cache/prod/' . $platformTreeId;
}

return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
}

Expand Down
2 changes: 1 addition & 1 deletion app/config/env/platformsh.php
Expand Up @@ -101,7 +101,7 @@
$container->setParameter('session.save_path', sprintf('%s:%d', $endpoint['host'], $endpoint['port']));
}
} elseif (isset($relationships['rediscache'])) {
foreach ($relationships['redissession'] as $endpoint) {
foreach ($relationships['rediscache'] as $endpoint) {
if ($endpoint['scheme'] !== 'redis') {
continue;
}
Expand Down
7 changes: 6 additions & 1 deletion app/config/routing.yml
Expand Up @@ -39,7 +39,12 @@ kernel.internal:

kernel.rest:
resource: '@EzPublishRestBundle/Resources/config/routing.yml'
prefix: /api/ezp/v2
prefix: '%ezpublish_rest.path_prefix%'

kernel.rest.options:
resource: '@EzPublishRestBundle/Resources/config/routing.yml'
prefix: '%ezpublish_rest.path_prefix%'
type: rest_options

ezplatform.admin_ui:
resource: '@EzPlatformAdminUiBundle/Resources/config/routing.yml'
Expand Down
3 changes: 2 additions & 1 deletion bin/console
Expand Up @@ -26,5 +26,6 @@ if ($debug) {
Debug::enable();
}

$application = new Application(new AppKernel($env, $debug));
$kernel = new AppKernel($env, $debug);
$application = new Application($kernel);
$application->run($input);

0 comments on commit 25dbff2

Please sign in to comment.