2017-03-14 20:18:30 +07:00
# Upgrade from 4.x to 5.x
1. Servers to Hosts
2017-03-15 19:49:58 +07:00
* `server($name, $hostname)` to `host($hostname)`
* `localServer($name)` to `localhost()`
* `cluster($name, $nodes, $port)` to `hosts(...$hodes)`
* `serverList($file)` to `inventory($file)`
2017-05-24 14:33:03 +07:00
If you need to deploy to same server use [host aliases ](https://deployer.org/docs/hosts#host-aliases ):
```php
host('domain.com/green', 'domain.com/blue')
->set('deploy_path', '~/{{hostname}}')
...
```
Or you can define different hosts with same hostname:
```php
host('production')
->hostname('domain.com')
2017-05-24 14:33:48 +07:00
->set('deploy_path', '~/production')
2017-05-24 14:33:03 +07:00
...
host('beta')
->hostname('domain.com')
2017-05-24 14:33:48 +07:00
->set('deploy_path', '~/beta')
2017-05-24 14:33:03 +07:00
...
```
2017-03-14 20:18:30 +07:00
2. Configuration options
* Rename `{{server.name}}` to `{{hostname}}`
3. 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:
```php
set('a', ['b' => 1]);
// ...
get('a.b');
```
To:
```php
set('a_b', 1);
// ...
get('a_b');
```
2017-03-15 19:49:58 +07:00
4. 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)` to `identityFile($privateKeyFile)`
* `pemFile($pemFile)` to `identityFile($pemFile)`
* `forwardAgent()` to `forwardAgent(true)`
2017-03-25 16:23:11 +07:00
5. Tasks constraints
* `onlyOn` to `onHosts`
* `onlyOnStage` to `onStage`
2017-03-14 20:18:30 +07:00
2016-11-05 16:42:46 +07:00
# Upgrade from 3.x to 4.x
2015-02-05 17:14:35 +03:00
2016-11-07 13:57:38 +07:00
1. Namespace for functions
Add to beginning of *deploy.php* next line:
2016-12-08 00:04:55 +01:00
2016-11-07 13:57:38 +07:00
```php
2016-12-08 00:07:03 +01:00
use function Deployer\{server, task, run, set, get, add, before, after};
2016-11-07 13:57:38 +07:00
```
2016-12-08 00:04:55 +01:00
2016-11-07 13:57:38 +07:00
If you are using PHP version less than 5.6, you can use this:
2016-12-08 00:04:55 +01:00
2016-11-07 13:57:38 +07:00
```php
namespace Deployer;
```
2. `env()` to `set()` /`get()`
2016-12-08 00:04:55 +01:00
2016-11-05 17:56:11 +07:00
Rename all calls `env($name, $value)` to `set($name, $value)` .
2016-12-08 00:04:55 +01:00
2016-11-05 17:50:18 +07:00
Rename all rvalue `env($name)` to `get($name)` .
2016-12-08 00:04:55 +01:00
2016-11-05 17:50:18 +07:00
Rename all `server(...)->env(...)` to `server(...)->set(...)` .
2015-02-05 17:14:35 +03:00
2016-11-17 23:18:16 +07:00
3. Moved *NonFatalException*
2016-12-08 00:04:55 +01:00
2016-11-13 17:43:52 +07:00
Rename `Deployer\Task\NonFatalException` to `Deployer\Exception\NonFatalException` .
2016-11-22 14:34:51 -05:00
4. Prior release cleanup
2016-12-08 00:04:55 +01:00
2016-11-22 14:34:51 -05:00
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.
2016-11-05 16:42:46 +07:00
# Upgrade from 2.x to 3.x
2015-02-05 17:14:35 +03:00
2016-12-08 00:04:55 +01:00
1. ### `->path('...')`
2016-11-05 16:43:41 +07:00
Replace your server paths configuration:
2016-12-08 00:04:55 +01:00
2016-11-05 16:43:41 +07:00
```php
server(...)
->path(...);
```
2016-12-08 00:04:55 +01:00
2016-11-05 16:43:41 +07:00
to:
2016-12-08 00:04:55 +01:00
```php
2016-11-05 16:43:41 +07:00
server(...)
->env('deploy_path', '...');
```