使用MySQL将Symfony应用程序部署到AWS

时间:2016-06-22 14:11:17

标签: mysql symfony amazon-web-services awsdeploy

我在AWS上运行了一个Web应用程序,以及一个MySQL数据库实例。我已经设置了我的本地环境来运行symfony应用程序并连接到aws db实例就好了。在尝试部署时,一切都很好,直到我添加了MySQL的东西。现在,当我部署时,composer install hook失败了,我还剩下这个输出:

categories

有趣的是,我上传的这个特定的zip文件中甚至没有作曲家。*文件。所以我对它的看法有点困惑。我认为我的问题是没有为我的数据库连接设置正确的值。但是,我使用命名方案SYMFONY__ENV__MYSQL__SERVER等将环境变量添加到我的环境配置中......

这是我的parameters.yml.dist文件:

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

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

问题是我的Web应用程序实例没有(通过安全组)访问我的数据库实例。我是如何修理的,非常基础。我删除了当前的数据库实例,并从Web应用程序控制台创建了一个新实例 - >配置 - >数据层。然后,我重建了环境,现在似乎正在运作。