helhum / TYPO3-Distribution

A distribution package for TYPO3 CMS with added typo3_console support
81 stars 19 forks source link

Access denied for user while trying surf deploy in surf task Helhum\TYPO3\Distribution\DefinedTask\UpdateDBSchema #13

Closed helipus closed 6 years ago

helipus commented 6 years ago

When trying to use surf for the first time with a composer installation from the helhum/typo3-distribution I get an error: Access denied for user. Maybe it has to do with the .env file? There is no configuration file .env at the production server. Where should this be placed? The releases folder change with every deploy.

I use the following surf version: TYPO3 Surf 2.0.0-beta7

The error is:

#surf deploy
Deploying surf (20180110152413)
Stage initialize
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\CreateDirectoriesTask
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\Generic\CreateDirectoriesTask
Stage package
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\Package\GitTask
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\DefinedTask\Composer\LocalInstallTask
Stage transfer
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\Transfer\RsyncTask
sub.domain.tld (TYPO3 CMS) Helhum\TYPO3\Distribution\DefinedTask\CopyIndexPhp
sub.domain.tld (TYPO3 CMS) Helhum\TYPO3\Distribution\DefinedTask\DumpConfiguration
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\Generic\CreateSymlinksTask
Stage update
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\TYPO3\CMS\SymlinkDataTask
Stage migrate
sub.domain.tld (TYPO3 CMS) Helhum\TYPO3\Distribution\DefinedTask\UpdateDBSchema
    >
    > [ Doctrine\DBAL\Exception\ConnectionException ]                                 An exception occured in driver: Access denied for user ''@'localhost' (usin     g password: NO)                                                                                                                                                Exception trace: #0 ()    vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:103 #1 Doctrine\DBAL\Driver\AbstractMySQLDriver::convertException()    vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:145
    > #2 Doctrine\DBAL\DBALException::driverException()    vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Driver.php:38 #3 Doctrine\DBAL\Driver\Mysqli\Driver::connect()    vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:360 #4 Doctrine\DBAL\Connection::connect()    vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:429 #5 Doctrine\DBAL\Connection::getDatabasePlatformVersion()    vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:389 #6 Doctrine\DBAL\Connection::detectDatabasePlatform()    vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:328 #7 Doctrine\DBAL\Connection::getDatabasePlatform()    typo3/sysext/core/Classes/Database/ConnectionPool.php:170 #8 TYPO3\CMS\Core\Database\ConnectionPool::getDatabaseConnection()    typo3/sysext/core/Classes/Database/ConnectionPool.php:132 #9 TYPO3\CMS\Core\Database\ConnectionPool::getConnectionByName()    typo3/sysext/core/Classes/Database/ConnectionPool.php:83 #10 TYPO3\CMS\Core\Database\ConnectionPool::getConnectionForTable()    typo3/sysext/core/Classes/Preparations/TcaPreparation.php:79 #11 TYPO3\CMS\Core\Preparations\TcaPreparation::prepareQuotingOfTableNamesAndColumnNames()    typo3/sysext/core/Classes/Preparations/TcaPreparation.php:45 #12 TYPO3\CMS\Core\Preparations\TcaPreparation::prepare()    typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php:1789 #13 TYPO3\CMS\Core\Utility\ExtensionManagementUtility::buildBaseTcaFromSingleFiles()    typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php:1709 #14 TYPO3\CMS\Core\Utility\ExtensionManagementUtility::loadBaseTca()    vendor/helhum/typo3-console/Classes/Core/Booting/Scripts.php:176 #15 Helhum\Typo3Console\Core\Booting\Scripts::initializePersistence()    vendor/helhum/typo3-console/Classes/Core/Booting/Step.php:53 #16 Helhum\Typo3Console\Core\Booting\Step::__invoke()    vendor/helhum/typo3-console/Classes/Core/Booting/Sequence.php:109 #17 Helhum\Typo3Console\Core\Booting\Sequence::invokeStep()    vendor/helhum/typo3-console/Classes/Core/Booting/Sequence.php:112 #18 Helhum\Typo3Console\Core\Booting\Sequence::invokeStep()    vendor/helhum/typo3-console/Classes/Core/Booting/Sequence.php:93 #19 Helhum\Typo3Console\Core\Booting\Sequence::invoke()    vendor/helhum/typo3-console/Classes/Core/Booting/RunLevel.php:90 #20 Helhum\Typo3Console\Core\Booting\RunLevel::runSequenceForCommand()    vendor/helhum/typo3-console/Classes/Core/Kernel.php:177 #21 Helhum\Typo3Console\Core\Kernel::handle()    vendor/helhum/typo3-console/Scripts/typo3-console.php:24 #22 {closure}()
    > vendor/helhum/typo3-console/Scripts/typo3-console.php:26 #23 require()    vendor/helhum/typo3-console/typo3cms:18  Caused by:
    > [ Doctrine\DBAL\Driver\Mysqli\MysqliException ]                Access denied for user ''@'localhost' (using password: NO)                                                                   Exception trace: #0 ()
    > vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php:73 #1 Doctrine\DBAL\Driver\Mysqli\MysqliConnection::__construct()    vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Driver.php:36 #2 Doctrine\DBAL\Driver\Mysqli\Driver::connect()    vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:360 #3 Doctrine\DBAL\Connection::connect()    vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:429 #4 Doctrine\DBAL\Connection::getDatabasePlatformVersion()    vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:389 #5 Doctrine\DBAL\Connection::detectDatabasePlatform()    vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:328 #6 Doctrine\DBAL\Connection::getDatabasePlatform()    typo3/sysext/core/Classes/Database/ConnectionPool.php:170 #7 TYPO3\CMS\Core\Database\ConnectionPool::getDatabaseConnection()    typo3/sysext/core/Classes/Database/ConnectionPool.php:132 #8 TYPO3\CMS\Core\Database\ConnectionPool::getConnectionByName()    typo3/sysext/core/Classes/Database/ConnectionPool.php:83 #9 TYPO3\CMS\Core\Database\ConnectionPool::getConnectionForTable()    typo3/sysext/core/Classes/Preparations/TcaPreparation.php:79 #10 TYPO3\CMS\Core\Preparations\TcaPreparation::prepareQuotingOfTableNamesAndColumnNames()    typo3/sysext/core/Classes/Preparations/TcaPreparation.php:45 #11 TYPO3\CMS\Core\Preparations\TcaPreparation::prepare()    typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php:1789 #12 TYPO3\CMS\Core\Utility\ExtensionManagementUtility::buildBaseTcaFromSingleFiles()    typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php:1709 #13 TYPO3\CMS\Core\Utility\ExtensionManagementUtility::loadBaseTca()    vendor/helhum/typo3-console/Classes/Core/Booting/Scripts.php:176 #14 Helhum\Typo3Console\Core\Booting\Scripts::initializePersistence()    vendor/helhum/typo3-console/Classes/Core/Booting/Step.php:53 #15 Helhum\Typo3Console\Core\Booting\Step::__invoke()    vendor/helhum/typo3-console/Classes/Core/Booting/Sequence.php:109 #16 Helhum\Typo3Console\Core\Booting\Sequence::invokeStep()    vendor/helhum/typo3-console/Classes/Core/Booting/Sequence.php:112 #17 Helhum\Typo3Console\Core\Booting\Sequence::invokeStep()
    > vendor/helhum/typo3-console/Classes/Core/Booting/Sequence.php:93 #18 Helhum\Typo3Console\Core\Booting\Sequence::invoke()    vendor/helhum/typo3-console/Classes/Core/Booting/RunLevel.php:90 #19 Helhum\Typo3Console\Core\Booting\RunLevel::runSequenceForCommand()    vendor/helhum/typo3-console/Classes/Core/Kernel.php:177 #20 Helhum\Typo3Console\Core\Kernel::handle()    vendor/helhum/typo3-console/Scripts/typo3-console.php:24 #21 {closure}()    vendor/helhum/typo3-console/Scripts/typo3-console.php:26 #22 require()    vendor/helhum/typo3-console/typo3cms:18

Got exception "Command returned non-zero return code: 1" but rollback disabled. Stopping.

surf simulate runs without problems:

# surf simulate
Simulating surf (20180110152537)
Stage initialize
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\CreateDirectoriesTask
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\Generic\CreateDirectoriesTask
Stage package
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\Package\GitTask
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\DefinedTask\Composer\LocalInstallTask
Stage transfer
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\Transfer\RsyncTask
sub.domain.tld (TYPO3 CMS) Helhum\TYPO3\Distribution\DefinedTask\CopyIndexPhp
sub.domain.tld (TYPO3 CMS) Helhum\TYPO3\Distribution\DefinedTask\DumpConfiguration
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\Generic\CreateSymlinksTask
Stage update
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\TYPO3\CMS\SymlinkDataTask
Stage migrate
sub.domain.tld (TYPO3 CMS) Helhum\TYPO3\Distribution\DefinedTask\UpdateDBSchema
sub.domain.tld (TYPO3 CMS) Helhum\TYPO3\Distribution\DefinedTask\FlushFileCaches
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\TYPO3\CMS\SetUpExtensionsTask
Stage finalize
Stage test
Stage switch
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\SymlinkReleaseTask
Node "sub.domain.tld" would be live!
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\TYPO3\CMS\FlushCachesTask
Stage cleanup
sub.domain.tld (TYPO3 CMS) TYPO3\Surf\Task\CleanupReleasesTask
Would remove releases 20180110151532

sub.domain.tld was replaces here. On my server the configuration is correctly unter .surf/surf.php and running as the folders are created at the production server.

Appart from my error I would recommend having a private key option at the parameters at the top of the surf.php.dist:

//$privateKey = '/.ssh/keyfile';

And a optional node configuration for the privateKey below in the surf.php.dist script:

if (!isset($privateKey) {
    $node->setOption('privateKeyFile', $privateKey);
}
helhum commented 6 years ago

When trying to use surf for the first time with a composer installation from the helhum/typo3-distribution

This very likely is a organizational deployment question, rather than a question/ issue within this project.

If you need professional support, feel free to contact me.

Other than that, you may get free support within the TYPO3 Slack (#cig-deployment, #typo3-surf, or anything similar.