Skip to content
Advertisement

using SncRedisBundle on platform.sh

I’m trying to get my app hosted by platform.sh, my problem is that I use SncRedisBundle, with this config:


JavaScript

JavaScript

When I push to platform.sh, their build process include a call to composer update, which end like this:

Generating optimized autoload files > IncenteevParameterHandlerScriptHandler::buildParameters > SensioBundleDistributionBundleComposerScriptHandler::buildBootstrap > SensioBundleDistributionBundleComposerScriptHandler::clearCache Script SensioBundleDistributionBundleComposerScriptHandler::clearCache handling the symfony-scripts event terminated with an exception

[RuntimeException]
An error occurred when executing the “‘cache:clear –no-warmup'” command:
string(17) “$relationships : “
bool(false)
NULL

[PredisConnectionConnectionException]
php_network_getaddresses: getaddrinfo failed: Name or service not known [tcp://localhost&database=4:6379]

JavaScript

I contacted their support team, which told me this:

Hi,

May I know if you’re trying to get PLATFORM_RELATIONSHIPS during the build phase?

That’s not available since the build is environment agnostic.

If you need to connect DB / Redis / other services, please do so in deploy phase (i.e. Deploy Hook).


edit : the support has answered to me that the problem lie on this composer.json section:

JavaScript

for example, the "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache" but also the "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets" are causing Symfony to clear the cache which is do too soon (during the build phase where platform.sh don’t provide the env. necessary for the linked redis and MySQL to wok…)


I don’t know how to correct this, platform.sh want me to alter the composer.json file, but I find it strange & dangerous. How would you do?

Advertisement

Answer

in your platform.app.yaml, set

JavaScript

and just make a parameters.dist.yml with fake values (add redis_url: xxx in this file). Those fake value will be overridden in your parameters_platform.php

here is the code of the hook of my platform.app.yaml:

JavaScript

The platform.php of our project:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement