2016-06-22 18 views
0

私はAWS上で動作するWebアプリケーションとMySQLデータベースインスタンスを持っています。 symfonyアプリケーションを実行し、aws dbインスタンスに接続するためのローカル環境を設定しました。デプロイしようとすると、MySQLのものを追加するまでは問題ありませんでした。さて、私が展開するときに、作曲フックが失敗し、インストール、および私は、この出力を残しています:SymfonyアプリケーションをMySQLを使用してAWSにデプロイ

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). 

興味深いことに、私も作曲を持っていない*私は、アップロードされたこの特定のzipファイル内のファイルを。だから私はそれがどのように考えているかについて少し混乱しています。私の問題は私のDB接続に正しい値を設定していないと思った。すべてのヘルプは大歓迎です

# 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% 

:しかし、私は

はここに私のparameters.yml.distファイルである...など命名体系のSYMFONY__ENV__MYSQL__SERVERと私の環境の構成に環境変数を追加しました。

+0

'SQLSTATE [HY000] [2002] Connection timed out'は接続(資格情報ではない)エラーを示します。 '%env.mysql.server%'の値は正しいのですが、MySQLサービスは稼働していますか? – Egg

+0

サーバーと資格情報はすべて環境変数によって設定されます。接続はローカルマシンから正常に動作します。作者のインストール中にSYMFONY__ENV__MYQL__SERVERのvsriableが利用できないと仮定しなければなりません – AMB0027

答えて

0

問題は、Webアプリケーションインスタンスが(セキュリティグループを介して)データベースインスタンスにアクセスできなかったことです。私はそれをどのように修正したのかは非常に基本的でした。現在のデータベースインスタンスを削除し、Webアプリケーションコンソール - >構成 - >データ層から新しいインスタンスを作成しました。私はその後、環境を再構築し、それは今働いているようです。

関連する問題