Hi
I'm trying to deploy staging and production to the same multiple hosts. I've tried the below but files only get deployed to abc1.net? Any advice?
host('production')
->hostname('abc1.net', abc2.net')
->set('deploy_path', '/www/{{application}}/production')
->set('branch', 'master')
->stage('production')
->user('deployuser');
host('staging')
->hostname('abc1.net', abc2.net')
->set('deploy_path', '/www/{{application}}/staging')
->set('branch', 'master')
->stage('staging')
->user('deployuser');
You may pass an array to the host function.
host(['abc1.net', 'abc2.net'])
->set('deploy_path', '/www/{{application}}/production')
->set('branch', 'master')
->stage('production')
->user('deployuser');
I tried that, this is the error message I get?
[TypeError] Argument 1 passed to Deployer\Collection\Collection::has() must
be of the type string, array given, called in
phar:///usr/local/bin/dep/src/functions.php on line 45
Using PHP 7.2.5
In Deployer v6.4, The host function accepts an array. You can see it here.
You should provide more information that is guided in the .github/ISSUE_TEMPLATE.md. It's helpful for me and the others before going deeply and debugging.
Sorry I should clarify i can pass 2 string into hosts but when i use the same hosts for different stages this is not possible
| Q | A
| ----------------- | ---
| Issue Type | Bug
| Deployer Version | Deployer 6.4.3
| Local Machine OS | N/A
| Remote Machine OS | N/A
If you're reporting a bug, please include following information
deploy.php// Production Server(s)
host('abc1.net', 'abc2.net')
->set('deploy_path', '/www/{{application}}/production')
->set('branch', 'master')
->stage('production')
->user('deployuser');
// Staging Server
host('abc1.net', 'abc2.net')
->set('deploy_path', '/www/{{application}}/staging')
->set('branch', 'master')
->stage('staging')
->user('deployuser');
With enabled option for verbose output -vvv.
[Error] Call to a member function set() on array
#0 phar:///usr/local/bin/dep/src/Deployer.php(325): require()
#1 [internal function]: Deployer\Deployer::Deployer{closure}()
#2 phar:///usr/local/bin/dep/src/Deployer.php(326):
call_user_func(Object(Closure))
#3 phar:///usr/local/bin/dep/bin/dep(125): Deployer\Deployer::run('6.4.3',
'/Sites/sse/depl...')
#4 /usr/local/bin/dep(4): require('phar:///usr/loc...')
#5 {main}
You may try host aliases.
host('abc1.net/production', 'abc2.net/production')
host('abc1.net/staging', 'abc2.net/staging')
you're a genius, that worked - thanks for your time and assistance! 馃憤
Most helpful comment
You may try host aliases.