-
Changed branch option priority
If you have host definition with
branch(...)
parameter, adding--branch
option will not override it any more. If nobranch(...)
parameter persists, branch will be fetched from current local git branch.host('prod') ->set('branch', 'production')
In order to return to old behavior add checking of
--branch
option.host('prod') ->set('branch', function () { return input()->getOption('branch') ?: 'production'; })
-
Add
deploy:info
task to the beginning todeploy
task. -
run
returns string instead ofDeployer\Type\Result
Now
run
andrunLocally
returnsstring
instead ofDeployer\Type\Result
. Replace method calls as:run('command')->toString()
→run('command')
run('if command; then echo "true"; fi;')->toBool()
→test('command')
-
env_vars
renamed toenv
set('env_vars', 'FOO=bar');
→set('env', ['FOO' => 'bar']);
If your are using Symfony recipe, then you need to change
env
setting:set('env', 'prod');
→set('symfony_env', 'prod');
-
Servers to Hosts
server($name, $hostname)
tohost($hostname)
localServer($name)
tolocalhost()
cluster($name, $nodes, $port)
tohosts(...$hodes)
serverList($file)
toinventory($file)
If you need to deploy to same server use host aliases:
host('domain.com/green', 'domain.com/blue') ->set('deploy_path', '~/{{hostname}}') ...
Or you can define different hosts with same hostname:
host('production') ->hostname('domain.com') ->set('deploy_path', '~/production') ... host('beta') ->hostname('domain.com') ->set('deploy_path', '~/beta') ...
-
Configuration options
- Rename
{{server.name}}
to{{hostname}}
- Rename
-
DotArray syntax
In v5 access to nested arrays in config via dot notation was removed. If you was using it, consider to move to plain config options.
Refactor this:
set('a', ['b' => 1]); // ... get('a.b');
To:
set('a_b', 1); // ... get('a_b');
-
Credentials
Best practice in new v5 is to omit credentials for connection in
deploy.php
and write them in~/.ssh/config
instead.identityFile($publicKeyFile,, $privateKeyFile, $passPhrase)
toidentityFile($privateKeyFile)
pemFile($pemFile)
toidentityFile($pemFile)
forwardAgent()
toforwardAgent(true)
-
Tasks constraints
onlyOn
toonHosts
onlyOnStage
toonStage
-
Namespace for functions
Add to beginning of deploy.php next line:
use function Deployer\{server, task, run, set, get, add, before, after};
If you are using PHP version less than 5.6, you can use this:
namespace Deployer;
-
env()
toset()
/get()
Rename all calls
env($name, $value)
toset($name, $value)
.Rename all rvalue
env($name)
toget($name)
.Rename all
server(...)->env(...)
toserver(...)->set(...)
. -
Moved NonFatalException
Rename
Deployer\Task\NonFatalException
toDeployer\Exception\NonFatalException
. -
Prior release cleanup
Due to changes in release management, the new cleanup task will ignore any prior releases deployed with 3.x. These will need to be manually removed after migrating to and successfully releasing via 4.x.
-
Replace your server paths configuration:
server(...) ->path(...);
to:
server(...) ->env('deploy_path', '...');