Deploy Symfony app to AWS with MySQL - mysql

I have a web application running on AWS, as well as a MySQL database instance. I have set up my local environment to run the symfony app and connect to the aws db instance just fine. When trying to deploy, everything was fine until I added the MySQL stuff. Now, when I deploy, composer install hook fails, and I'm left with this output:
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).
Interestingly enough, I don't even have a composer.* file in this particular zip file that I uploaded. So I'm a little confused as to how it even thinks that. I thought my problem was not having the correct values set up for my DB connection. However, I added environment variables to my environment configuration with the naming scheme SYMFONY__ENV__MYSQL__SERVER, etc...
Here is my parameters.yml.dist file:
# 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%
Any help is greatly appreciated.

The problem was that my web application instance did not have access (via security groups) to my database instance. How I fixed it, was very basic. I deleted the current database instance, and created a new one from Web Application Console -> Configuration -> Data Tier. I then rebuilt the environment, and it seems to be working now.

Related

Mock fails to download disable plugin patterns while building 32bit RPMs: 403 on repository 'local'

I am trying to build a few RPMs for 32 bit Fedora using the SRPM. I tried running Mock with:-
mock -r fedora-32-i386 rebuild src.rpm
It gives me the following error:
No matches found for the following disable plugin patterns: local, spacewalk
local 83 B/s | 199 B 00:02
Errors during downloading metadata for repository 'local':
- Status code: 403 for https://kojipkgs.fedoraproject.org/repos/f32-build/latest/i386/repodata/repomd.xml (IP: 38.145.60.21)
Error: Failed to download metadata for repo 'local': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
ERROR: Command failed:
# /usr/bin/dnf --installroot /var/lib/mock/fedora-32-i686-bootstrap/root/ --releasever 32 --setopt=deltarpm=False --allowerasing --disableplugin=local --disableplugin=spacewalk install dnf dnf-plugins-core --setopt=tsflags=nocontexts
No matches found for the following disable plugin patterns: local, spacewalk
local 83 B/s | 199 B 00:02
Errors during downloading metadata for repository 'local':
- Status code: 403 for https://kojipkgs.fedoraproject.org/repos/f32-build/latest/i386/repodata/repomd.xml (IP: 38.145.60.21)
Error: Failed to download metadata for repo 'local': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
I have tried disabling the fastest mirror in the conf file in /etc/dnf, with no luck. Is mock using a different repo file than my current installation? How do I fix this?
Mock is using configs from the directory /etc/mock/ so for fedora-32-i386 it is /etc/mock/fedora-32-i386.cfg This config contains yum config which is used during the installation of the buildroot.
More about Mock's configs: https://rpm-software-management.github.io/mock/configuration

Open-shift-Running Handler [openshift_master : verify API Server] FAILED - RETRYING Verify API Server

I am Trying to Install Openshift 3.9.1 In CentOS 7.5. All the process Done but Below Failed Issue Occurring. If you have any suggestion about it,
( Running Handler [ openshift_master : verify API Server ])
FAILED - RETRYING Verify API Server (120 retries left).
install configuration
problem occurring...
If any proper step by step guideline notice me. thanks

ejabberd stops when I am adding mod_http_offline to ejabberd.cfg

I am using ejabberd 2.1.10 for implementing the mod_http_offline mod for IOS push notification. I tried to do this using two solutions like
http://jasonrowe.com/2011/12/30/ejabberd-offline-messages/
&
https://github.com/adamvduke/mod_interact
But both the time when I am adding Modules to the ejabberd configuration file It stops the server and return the below error in the log
ERROR REPORT==== 2014-01-28 15:09:13 ===
C(<0.41.0>:gen_mod:75) : Problem starting the module mod_http_offline for host "23.23.191.229"
options: []
error: function_clause

Plesk MySQL driver configuration error on CentOS

After manually upgrading PHP and MySQL on my Cent OS box then logging in to my Plesk administration panel, I'm receiving the following error when attempting to carry out numerous tasks. PHP and MySQL are functioning correctly in their own right.
New files of configuration for Apache web server were not built due to errors in configuration templates: Template processing failed: file = /usr/local/psa/admin/conf/templates/default/domainVhost.php, error = [unixODBC][Driver Manager]Can't open lib '/usr/lib64/libmyodbc3.so' : /usr/lib64/libmyodbc3.so: cannot open shared object file: No such file or directory. The detailed error message was e-mailed to you, so please check the e-mail, fix the errors, and click here to retry generating broken configuration or click here to retry generating of all configurations.
I have located the ODBC configuration details in the following file:
/etc/odbcinst.ini
The contents of which are as follows:
# Driver from the MyODBC package
# Setup from the unixODBC package
[MySQL]
Description = MySQL driver for Plesk
Driver = /usr/lib64/libmyodbc3.so
Setup =
FileUsage = 1
Driver64 = /usr/lib64/libmyodbc3.so
Setup64 =
UsageCount = 1
I expect that the Driver & Driver64 parameters must be updated to reflect the changes that occurred when MySQL was upgraded however I am unable to locate the path to the appropriate driver and am out of my depth now. Any advice greatly welcomed.
UPDATE: a '# locate libmyodbc3' returns no results.
Turns out the ODBC and mysql-connector-odbc packages were missing.
They were installed using YUM as follows:
# yum install unixODBC
# yum mysql-connector-odbc packages

Error when trying to add subdomain or add databases with cPanel

cPanel is throwing up an error everytime I try to add or edit an existing subdomain. The same error is showing up when I try to add a new database.
Cpanel::AdminBin::_get_cpwrapd_connection could not connect to /usr/local/cpanel/var/cpwrapd.sock
PHPMyAdmin, FTP and SSH are all working perfectly, so the problem is something to do with cPanel. The server is a VPS with GoDaddy. I was installing a program running on Ruby 1.8.7, and this error started showing up after I installed the program. I have tried /scripts/installruby but that's giving me this error:
The internal error was:
(RegexpError) Stack overflow in regexp matcher: /.*((?>\/\*.*?\*\/\s+))
([\w\.\s]+\s* = \s+)?rb_define_(class|module).*?"(Mongrel)"/mx
ERROR: While generating documentation for mongrel-1.1.5
... MESSAGE: Stack overflow in regexp matcher: /.*((?>\/\*.*?\*\/\s+))
([\w\.\s]+\s* = \s+)?rb_define_(class|module).*?"(Mongrel)"/mx
... RDOC args: --ri --op /usr/local/rvm/gems/ruby-1.8.7-p374/doc/mongrel-1.1.5/ri --line-numbers --title Mongrel --main README lib ext CHANGELOG COPYING lib/mongrel/camping.rb lib/mongrel/cgi.rb lib/mongrel/command.rb lib/mongrel/configurator.rb lib/mongrel/const.rb lib/mongrel/debug.rb lib/mongrel/gems.rb lib/mongrel/handlers.rb lib/mongrel/header_out.rb lib/mongrel/http_request.rb lib/mongrel/http_response.rb lib/mongrel/init.rb lib/mongrel/rails.rb lib/mongrel/stats.rb lib/mongrel/tcphack.rb lib/mongrel/uri_classifier.rb lib/mongrel.rb LICENSE README --title mongrel-1.1.5 Documentation --quiet
die [installruby] Failed command: /usr/bin/gem install mongrel-1.1.5.gem --local
exit level [die] [pid=5273] (Failed command: /usr/bin/gem install mongrel-1.1.5.gem --local)
I solved the problem by rebooting cPanel, using /etc/init.d/cpanel restart