Navigation Menu

Skip to content

Commit

Permalink
Merge ezplatform/master into master
Browse files Browse the repository at this point in the history
  • Loading branch information
damianz5 committed Mar 27, 2018
2 parents 2ad490a + 51dc682 commit 864ba77
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 12 deletions.
24 changes: 18 additions & 6 deletions .platform.app.yaml
Expand Up @@ -69,26 +69,38 @@ hooks:
build: |
set -e
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 @@ -80,6 +80,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 @@ -13,7 +13,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);
6 changes: 3 additions & 3 deletions composer.json
Expand Up @@ -36,12 +36,12 @@
"sensio/distribution-bundle": "^5.0.19",
"incenteev/composer-parameter-handler": "~2.1",
"ezsystems/ezpublish-kernel": "^7.1@dev",
"ezsystems/repository-forms": "^2.0@dev",
"ezsystems/repository-forms": "^2.1@dev",
"ezsystems/ezplatform-solr-search-engine": "^1.5@dev",
"ezsystems/ez-support-tools": "^0.2@dev",
"ezsystems/ezplatform-http-cache": "^0.5@dev",
"ezsystems/ezplatform-admin-ui": "^1.0@dev",
"ezsystems/ezplatform-admin-ui-modules": "^1.0@dev",
"ezsystems/ezplatform-admin-ui": "^1.1@dev",
"ezsystems/ezplatform-admin-ui-modules": "^1.1@dev",
"ezsystems/ezplatform-admin-ui-assets": "^2.0@dev",
"ezsystems/ezplatform-design-engine": "^1.1",
"knplabs/knp-menu-bundle": "^2.1",
Expand Down

0 comments on commit 864ba77

Please sign in to comment.