2016-06-22 2 views
0

J'ai une application web fonctionnant sur AWS, ainsi qu'une instance de base de données MySQL. J'ai configuré mon environnement local pour lancer l'application symfony et me connecter à l'instance aws db. En essayant de déployer, tout allait bien jusqu'à ce que j'ai ajouté les trucs de MySQL. Maintenant, quand je Deploy, compositeur point d'installation échoue, et je suis parti avec cette sortie:Déploiement de l'application Symfony sur AWS avec MySQL

i-04b06d321dedd2a9c Severe 1 hour 8 - - - - - - - - - - 0.00 0.01 0.1 0.0 99.9 0.0 
Application deployment failed at 2016-06-22T13:51:22Z with exit status 1 and error: Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_composer_install.sh failed. 

+ . /opt/elasticbeanstalk/support/envvars 
++ export COMPOSER_HOME=/root 
++ COMPOSER_HOME=/root 
++ export PHP_MEMORY_LIMIT=256M 
++ PHP_MEMORY_LIMIT=256M 
++ export PHP_MAX_EXECUTION_TIME=60 
++ PHP_MAX_EXECUTION_TIME=60 
++ export PHP_DISPLAY_ERRORS=Off 
++ PHP_DISPLAY_ERRORS=Off 
++ export PHP_COMPOSER_OPTIONS= 
++ PHP_COMPOSER_OPTIONS= 
++ export PHP_ALLOW_URL_FOPEN=On 
++ PHP_ALLOW_URL_FOPEN=On 
++ export PHP_ZLIB_OUTPUT_COMPRESSION=Off 
++ PHP_ZLIB_OUTPUT_COMPRESSION=Off 
++ export PHP_DOCUMENT_ROOT= 
++ PHP_DOCUMENT_ROOT= 
++ export PHP_DATE_TIMEZONE=UTC 
++ PHP_DATE_TIMEZONE=UTC 
++ /opt/elasticbeanstalk/bin/get-config container -k app_staging_dir 
+ EB_APP_STAGING_DIR=/var/app/ondeck 
+ cd /var/app/ondeck 
+ '[' -f composer.json ']' 
+ export COMPOSER_HOME=/root 
+ COMPOSER_HOME=/root 
+ '[' -d vendor ']' 
++ /opt/elasticbeanstalk/bin/get-config optionsettings -n aws:elasticbeanstalk:container:php:phpini -o composer_options 
+ PHP_COMPOSER_OPTIONS= 
+ echo 'Found composer.json file. Attempting to install vendors.' 
Found composer.json file. Attempting to install vendors. 
+ composer.phar install --no-ansi --no-interaction 
Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted 
Loading composer repositories with package information 
Installing dependencies (including require-dev) from lock file 
- Installing twig/twig (v1.24.1) 
Loading from cache 

- Installing symfony/polyfill-util (v1.2.0) 
Loading from cache 

- Installing paragonie/random_compat (v2.0.2) 
Loading from cache 

- Installing symfony/polyfill-php70 (v1.2.0) 
Loading from cache 

- Installing symfony/polyfill-php56 (v1.2.0) 
Loading from cache 

- Installing symfony/polyfill-mbstring (v1.2.0) 
Loading from cache 

- Installing symfony/symfony (v3.1.1) 
Loading from cache 

- Installing symfony/polyfill-intl-icu (v1.2.0) 
Loading from cache 

- Installing psr/log (1.0.0) 
Loading from cache 

- Installing psr/cache (1.0.0) 
Loading from cache 

- Installing doctrine/lexer (v1.0.1) 
Loading from cache 

- Installing doctrine/inflector (v1.1.0) 
Loading from cache 

- Installing doctrine/collections (v1.3.0) 
Loading from cache 

- Installing doctrine/cache (v1.6.0) 
Loading from cache 

- Installing doctrine/annotations (v1.2.7) 
Loading from cache 

- Installing doctrine/common (v2.6.1) 
Loading from cache 

- Installing bmatzner/fontawesome-bundle (4.6.1) 
Loading from cache 

- Installing jdorn/sql-formatter (v1.2.17) 
Loading from cache 

- Installing doctrine/doctrine-cache-bundle (1.3.0) 
Loading from cache 

- Installing doctrine/dbal (v2.5.4) 
Loading from cache 

- Installing doctrine/doctrine-bundle (1.6.3) 
Loading from cache 

- Installing doctrine/instantiator (1.0.5) 
Loading from cache 

- Installing doctrine/orm (v2.5.4) 
Loading from cache 

- Installing friendsofsymfony/user-bundle (dev-master 298f27c) 
Cloning 298f27ce696deaa6ecd72e6ba563f892a17e0512 

- Installing incenteev/composer-parameter-handler (v2.1.2) 
Loading from cache 

- Installing sensiolabs/security-checker (v3.0.2) 
Loading from cache 

- Installing sensio/distribution-bundle (v5.0.6) 
Loading from cache 

- Installing sensio/framework-extra-bundle (v3.0.16) 
Loading from cache 

- Installing kriswallsmith/assetic (v1.3.2) 
Loading from cache 

- Installing symfony/assetic-bundle (v2.8.0) 
Loading from cache 

- Installing monolog/monolog (1.19.0) 
Loading from cache 

- Installing symfony/monolog-bundle (2.11.1) 
Loading from cache 

- Installing symfony/polyfill-apcu (v1.2.0) 
Loading from cache 

- Installing swiftmailer/swiftmailer (v5.4.2) 
Loading from cache 

- Installing symfony/swiftmailer-bundle (v2.3.11) 
Loading from cache 

- Installing sensio/generator-bundle (v3.0.6) 
Loading from cache 

- Installing symfony/phpunit-bridge (v3.1.1) 
Loading from cache 

paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.) 
doctrine/doctrine-cache-bundle suggests installing symfony/security-acl (For using this bundle to cache ACLs) 
friendsofsymfony/user-bundle suggests installing willdurand/propel-typehintable-behavior (Needed when using the propel implementation) 
sensio/framework-extra-bundle suggests installing symfony/psr-http-message-bridge (To use the PSR-7 converters) 
kriswallsmith/assetic suggests installing leafo/lessphp (Assetic provides the integration with the lessphp LESS compiler) 
kriswallsmith/assetic suggests installing leafo/scssphp (Assetic provides the integration with the scssphp SCSS compiler) 
kriswallsmith/assetic suggests installing leafo/scssphp-compass (Assetic provides the integration with the SCSS compass plugin) 
kriswallsmith/assetic suggests installing patchwork/jsqueeze (Assetic provides the integration with the JSqueeze JavaScript compressor) 
kriswallsmith/assetic suggests installing ptachoire/cssembed (Assetic provides the integration with phpcssembed to embed data uris) 
symfony/assetic-bundle suggests installing kriswallsmith/spork (to be able to dump assets in parallel) 
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB) 
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server) 
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required)) 
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server) 
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server) 
monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver) 
monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib) 
monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome) 
monolog/monolog suggests installing raven/raven (Allow sending log messages to a Sentry server) 
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar) 
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server) 
Generating autoload files 
> Incenteev\ParameterHandler\ScriptHandler::buildParameters 
Updating the "app/config/parameters.yml" file 
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap 
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache 


[Doctrine\DBAL\Exception\ConnectionException] 
An exception occured in driver: SQLSTATE[HY000] [2002] Connection timed out 



[Doctrine\DBAL\Driver\PDOException] 
SQLSTATE[HY000] [2002] Connection timed out 



[PDOException] 
SQLSTATE[HY000] [2002] Connection timed out 


Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception 


[RuntimeException] 
An error occurred when executing the "'cache:clear --no-warmup'" command: 

[Doctrine\DBAL\Exception\ConnectionException] 
An exception occured in driver: SQLSTATE[HY000] [2002] Connection timed out 


[Doctrine\DBAL\Driver\PDOException] 
SQLSTATE[HY000] [2002] Connection timed out 


[PDOException] 
SQLSTATE[HY000] [2002] Connection timed out 

. 


install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] []... 
Incorrect application version "app-b659-160621_222635" (deployment 8). Expected version "which-lineup-1" (deployment 13). 

Il est intéressant, je ne ai même pas un fichier * compositeur dans ce fichier zip particulier que j'uploadé.. Donc, je suis un peu confus quant à la façon dont il pense même que. Je pensais que mon problème n'était pas d'avoir les bonnes valeurs pour ma connexion DB. Cependant, j'ai ajouté des variables d'environnement à ma configuration de l'environnement avec le schéma de nommage SYMFONY__ENV__MYSQL__SERVER, etc ...

Voici mon fichier parameters.yml.dist:

# This file is a "template" of what your parameters.yml file should look like 
# Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production. 
# http://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration 
parameters: 
    database_host:  %env.mysql.server% 
    database_port:  %env.mysql.port% 
    database_name:  %env.mysql.database% 
    database_user:  %env.mysql.username% 
    database_password: %env.mysql.password% 

Toute aide est grandement appréciée.

+0

'SQLSTATE [HY000] [2002] La connexion a expiré 'indique une erreur de connexion (pas d'informations d'identification). La valeur '% env.mysql.server%' est-elle correcte et le service MySQL fonctionne-t-il? – Egg

+0

Le serveur et les informations d'identification sont tous définis via des variables d'environnement. La connexion fonctionne correctement depuis ma machine locale. Je dois supposer que le SYMFONY__ENV__MYQL__SERVER vsriable n'est pas disponible pendant l'installation du composeur – AMB0027

Répondre

0

Le problème était que mon instance d'application Web n'avait pas accès (via des groupes de sécurité) à mon instance de base de données. Comment je l'ai réparé, était très basique. J'ai supprimé l'instance de base de données actuelle et j'en ai créé une nouvelle à partir de Web Application Console -> Configuration -> Data Tier. J'ai ensuite reconstruit l'environnement, et cela semble fonctionner maintenant.