1

I am just getting started using Deployer and I was quite happy setting it up was so easy and straight forward.

But now I ran into some issues when it comes to using .env-vars for the Artisan migration using this script:

<?php
namespace Deployer;

require 'recipe/laravel.php';

set('application', 'xxx');
set('repository', 'git@xxxx/xxx.git');
set('branch', 'master');
set('deploy_path', '~/xxx');
set('http_user', 'xxx');

host('xxx')
    ->configFile('~/.ssh/config')
    ->identityFile('~/.ssh/id_rsa')
    ->forwardAgent(true)
    ->multiplexing(true);

after('deploy:writable', 'artisan:migrate');

I get the following error with username, db_name and ip coming from the .env-file on my server:

The command "/usr/bin/php ~/test/releases/12/artisan migrate --force" failed.

Exit Code: 1 (General error)

Host Name: xxx

================

In Connection.php line 664:

SQLSTATE[HY000] [1045] Access denied for user 'username'@'11.22.33.44' (us ing password: YES) (SQL: select * from information_schema.tables where tabl e_schema = db_name and table_name = migrations)

In Connector.php line 68:

SQLSTATE[HY000] [1045] Access denied for user 'username'@'11.22.33.44' (us ing password: YES)

When adding

->set('env', [
    'DB_HOST' => 'myserver',
    'DB_PORT' => '3306',
    'DB_DATABASE' => 'db_name',
    'DB_USERNAME' => 'username',
    'DB_PASSWORD' => 'mypassword'
])

to the host manually, everything is working fine. Any ideas? Thanks in advance

Sanguinary
  • 354
  • 2
  • 3
  • 16
Jannes
  • 11
  • 2

0 Answers0