Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployer Next 🚀 #1092

Merged
merged 95 commits into from
Mar 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
92a4c20
Refactor server+environment to host
antonmedv Mar 12, 2017
df21fa1
Refactor runLocally function
antonmedv Mar 12, 2017
ace2889
Better tty
antonmedv Mar 12, 2017
f5b0dbe
Delete builder
antonmedv Mar 12, 2017
beb15a4
Add FileLoader
antonmedv Mar 12, 2017
077070f
Delete BootstrapByConfigFile
antonmedv Mar 12, 2017
4325980
Allow overriding ssh multiplexing
antonmedv Mar 12, 2017
1db456a
Remove unreachable code
antonmedv Mar 12, 2017
6edb6d7
Refactor ParallelExecutor to use hosts
antonmedv Mar 13, 2017
4a1c12b
Apply fixes from StyleCI
antonmedv Mar 13, 2017
f04f2db
Merge pull request #1098 from deployphp/analysis-8LPb3n
antonmedv Mar 13, 2017
14a8f8f
Add use_atomic_symlink option
antonmedv Mar 13, 2017
64aca18
Update CHANGELOG.md
antonmedv Mar 13, 2017
20d213c
Update CHANGELOG.md
antonmedv Mar 13, 2017
31fd582
Move deployer/phar-update to suggest section
antonmedv Mar 13, 2017
c3659d2
Add docblock, remove unused use
antonmedv Mar 13, 2017
2e9a795
Fix docblock
antonmedv Mar 13, 2017
54fe1ea
Add useful error message
antonmedv Mar 13, 2017
81ba8e3
Add facts
antonmedv Mar 14, 2017
34c985e
Remove DotArray syntax
antonmedv Mar 14, 2017
ba4416c
Add hosts lists, inventory, proxy
antonmedv Mar 14, 2017
66b40c7
Better errors
antonmedv Mar 14, 2017
35c3024
Apply fixes from StyleCI
antonmedv Mar 14, 2017
11fa9ea
Merge pull request #1105 from deployphp/analysis-qonayb
antonmedv Mar 15, 2017
67ecaeb
Add stare and roles helpers
antonmedv Mar 15, 2017
a4beca7
Upload/download functions
antonmedv Mar 15, 2017
d118d24
Merge remote-tracking branch 'origin/next' into next
antonmedv Mar 15, 2017
c4b025a
Add docblock
antonmedv Mar 15, 2017
b5e79ac
Refactor rsync
antonmedv Mar 16, 2017
f8a13c1
Composer update
antonmedv Mar 16, 2017
5745a71
Start refactoring tests
antonmedv Mar 16, 2017
30298cf
Tests for src
antonmedv Mar 16, 2017
c162cb9
Add a few tests
antonmedv Mar 16, 2017
d4fca69
Refactor local exec
antonmedv Mar 16, 2017
dafc57c
Update Symfony min version to 2.7
antonmedv Mar 16, 2017
9e7ffe7
Refactor recipe tests
antonmedv Mar 16, 2017
982221b
Move test app
antonmedv Mar 16, 2017
4cd0c8e
Fix tests
antonmedv Mar 16, 2017
c28292e
Fix .styleci.yml
antonmedv Mar 16, 2017
1669ee3
Set http_user for travis
antonmedv Mar 16, 2017
bf7028c
Rename TestCase to DepCase
antonmedv Mar 16, 2017
fbe9560
Add git user/email
antonmedv Mar 16, 2017
51f6bf6
Add acl on .travis.yml
antonmedv Mar 16, 2017
0e918fb
Add host ranges
antonmedv Mar 17, 2017
0abec76
Expand hosts in host func
antonmedv Mar 17, 2017
d6ba93d
Add more tests
antonmedv Mar 17, 2017
4668d2f
Add FileLoaderTest
antonmedv Mar 18, 2017
8e2c025
Add method tests
antonmedv Mar 18, 2017
eadea2f
Refactor tasks
antonmedv Mar 18, 2017
be23ad3
Introduce support helpers
antonmedv Mar 18, 2017
3f52da4
Add support tests
antonmedv Mar 18, 2017
78789d2
Implement stage, roles, hostnames checks
antonmedv Mar 19, 2017
ed2fb08
Refactor IO catching
antonmedv Mar 19, 2017
ecbe80b
Add shouldBePerformed tests
antonmedv Mar 19, 2017
3bbf987
Add ssh command
antonmedv Mar 19, 2017
da84ec3
Refactor parallel execution
antonmedv Mar 19, 2017
7345377
Add new --limit option
antonmedv Mar 19, 2017
2add71f
Add parallel test
antonmedv Mar 19, 2017
20bde90
Remove elfet/pure
antonmedv Mar 19, 2017
6afdc38
Composer update
antonmedv Mar 19, 2017
6a6d237
Move build bin
antonmedv Mar 19, 2017
db37dcb
Allow vars in deploy_path
antonmedv Mar 20, 2017
2e0b2e2
Add host aliases
antonmedv Mar 20, 2017
d81c6b5
Fix issue
antonmedv Mar 20, 2017
dd54f5c
Fix issue
antonmedv Mar 20, 2017
51048d9
Fix newline in parallel mode
antonmedv Mar 21, 2017
66d2a23
Refactor test recipes location
antonmedv Mar 21, 2017
254cf26
Rename onFailure to fail
antonmedv Mar 21, 2017
231b81d
Rename FIXTURES to DEPLOYER_FIXTURES
antonmedv Mar 21, 2017
cc4bac3
Rename onFailure to fail
antonmedv Mar 22, 2017
7b6af03
Better error handling in parallel mode
antonmedv Mar 22, 2017
24135b7
Apply fixes from StyleCI
antonmedv Mar 22, 2017
c65834d
Merge pull request #1122 from deployphp/analysis-8K3pGj
antonmedv Mar 22, 2017
0743ae3
Fix docblock
antonmedv Mar 22, 2017
194c4fb
Better config current
antonmedv Mar 22, 2017
10552e4
Apply fixes from StyleCI
antonmedv Mar 22, 2017
5d4c561
Merge pull request #1123 from deployphp/analysis-zObAel
antonmedv Mar 22, 2017
3b6e581
Fix doc
antonmedv Mar 22, 2017
3d0382d
Merge remote-tracking branch 'origin/next' into next
antonmedv Mar 22, 2017
eb0e53e
Add on func
antonmedv Mar 23, 2017
55ce776
Localhost extend Host
antonmedv Mar 23, 2017
e5d499a
Add logger
antonmedv Mar 23, 2017
efcb6eb
Better error logging
antonmedv Mar 23, 2017
9d79f9e
Add persistent config
antonmedv Mar 24, 2017
c6c3f49
Add storage test
antonmedv Mar 25, 2017
d30a100
Apply fixes from StyleCI
antonmedv Mar 25, 2017
efc33b9
Merge pull request #1127 from deployphp/analysis-8bLE5a
antonmedv Mar 25, 2017
81509d3
Add --hosts and --roles
antonmedv Mar 25, 2017
d67a96b
Update CHANGELOG.md
antonmedv Mar 25, 2017
7321763
Add deployer/phar-update as dependency
antonmedv Mar 25, 2017
a8502fe
Add warning message
antonmedv Mar 25, 2017
0f69260
Fix typo
antonmedv Mar 25, 2017
7ad4d5f
Use dep self-update in message
antonmedv Mar 25, 2017
5671d7a
Update UPGRADE.md
antonmedv Mar 25, 2017
54878eb
Remove io from on
antonmedv Mar 26, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.php_cs.cache
/vendor/
/test/localhost
/test/fixture/recipe/tmp/
.php_cs.cache
*.phar
/.vagrant
deploy.php
4 changes: 1 addition & 3 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ filter:
- src/*
- recipe/*
- bin/*
excluded_paths:
- src/Resources/*

build:
environment:
php: '5.6.26'
php: '7.0.8'
tests:
override:
-
Expand Down
4 changes: 4 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ preset: psr2
enabled:
- short_array_syntax
- no_whitespace_in_blank_line

finder:
not-name:
- "tester.php"
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
language: php

sudo: required

php:
- 5.6
- 7.0
- 7.1

Expand All @@ -16,9 +13,11 @@ env:
- COMPOSER_FLAGS="--prefer-lowest"
- COMPOSER_FLAGS="--prefer-stable"

before_install:
- sudo apt-get -qq update
- sudo apt-get install -y acl

install:
- eval `ssh-agent -s`
- test/travis/setup-secure-shell.sh
- composer self-update
- composer update --no-interaction --prefer-source $COMPOSER_FLAGS

Expand Down
32 changes: 25 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,40 @@
## master
[v4.3.0...master](https://github.com/deployphp/deployer/compare/v4.3.0...master)

--
### Added
- Added `use_atomic_symlink` and `use_relative_symlink` option [14a8f8](https://github.com/deployphp/deployer/pull/1092/commits/14a8f8f9c4ebbc7da45c2b6b7c3c00a51b563ccf)
- Added `Ssh\Client` [#1092](https://github.com/deployphp/deployer/pull/1092)
- Added host ranges [#1092](https://github.com/deployphp/deployer/pull/1092)
- Added --hosts and --roles options [#1092](https://github.com/deployphp/deployer/pull/1092)
- Added `on` function [#1092](https://github.com/deployphp/deployer/pull/1092)
- Added `host` and `localhost` [#1092](https://github.com/deployphp/deployer/pull/1092)
- Added persistent config [#1092](https://github.com/deployphp/deployer/pull/1092)
- Added `--log` option [#1092](https://github.com/deployphp/deployer/pull/1092)

### Changed
- `server` refactored to `host` [#1092](https://github.com/deployphp/deployer/pull/1092)
- `Enviroment` refactored to `Configuration` [#1092](https://github.com/deployphp/deployer/pull/1092)
- phpunit test refactored [#1092](https://github.com/deployphp/deployer/pull/1092)
- `upload` and `download` now uses rsync [#1092](https://github.com/deployphp/deployer/pull/1092)
- Only native ssh client for now [#1092](https://github.com/deployphp/deployer/pull/1092)
- Task `current` to `config:current` [#1092](https://github.com/deployphp/deployer/pull/1092)
- `onFailure` to `fail` [#1092](https://github.com/deployphp/deployer/pull/1092)


## v4.3.0
[v4.2.1...v4.3.0](https://github.com/deployphp/deployer/compare/v4.2.1...v4.3.0)

### Added
- Add support for multiple choice questions [#1076](https://github.com/deployphp/deployer/pull/1076)
- Add a way to retrieve a defined task [#1008](https://github.com/deployphp/deployer/pull/1008)
- Add support for configFile in the NativeSsh implementation [#979](https://github.com/deployphp/deployer/pull/979)
- Add `--no-hooks` option for running commands without `before()` and `after()` [#1061](https://github.com/deployphp/deployer/pull/1061)
- Added support for multiple choice questions [#1076](https://github.com/deployphp/deployer/pull/1076)
- Added a way to retrieve a defined task [#1008](https://github.com/deployphp/deployer/pull/1008)
- Added support for configFile in the NativeSsh implementation [#979](https://github.com/deployphp/deployer/pull/979)
- Added `--no-hooks` option for running commands without `before()` and `after()` [#1061](https://github.com/deployphp/deployer/pull/1061)
- Added a usefull error when ask*() is not used wihtin a task() [#1083](https://github.com/deployphp/deployer/pull/1083)

### Changed
- Parse hyphens in environment setting names [#1073](https://github.com/deployphp/deployer/pull/1074)
- Autoload functions via Composer [#1015](https://github.com/deployphp/deployer/pull/1015)
- Add task queue:restart for Laravel recipe [#1007](https://github.com/deployphp/deployer/pull/1007)
- Added task queue:restart for Laravel recipe [#1007](https://github.com/deployphp/deployer/pull/1007)
- Changed output of errors for native ssh [#1012](https://github.com/deployphp/deployer/issues/1012)

### Fixed
Expand All @@ -30,7 +48,7 @@
- Fixed old releases not being cleaned up when keep_releases reduced by more than half.
- Fixed creating non-existed `writable_dirs` [#1000](https://github.com/deployphp/deployer/pull/1000)
- Fixed uploading files with spaces in a path via Native SSH [#1010](https://github.com/deployphp/deployer/issues/1010)
- Fix merge of string array config options [#1067](https://github.com/deployphp/deployer/pull/1067)
- Fixed merge of string array config options [#1067](https://github.com/deployphp/deployer/pull/1067)
- Fixed uploading of files containing spaces [#1077](https://github.com/deployphp/deployer/issues/1077)
- Fixed download of files when filename remote contains spaces [#1082](https://github.com/deployphp/deployer/pull/1082)

Expand Down
52 changes: 52 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,55 @@
# Upgrade from 4.x to 5.x

1. Servers to Hosts

* `server($name, $hostname)` to `host($hostname)`
* `localServer($name)` to `localhost()`
* `cluster($name, $nodes, $port)` to `hosts(...$hodes)`
* `serverList($file)` to `inventory($file)`

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');
```

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)`

5. Tasks constraints

* `onlyOn` to `onHosts`
* `onlyOnStage` to `onStage`


# Upgrade from 3.x to 4.x

1. Namespace for functions
Expand Down
21 changes: 13 additions & 8 deletions build → bin/build
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/usr/bin/env php
<?php
/* __ ___ __
* | \ |__ |__)
* |__/ |___ |
/* (c) Anton Medvedev <anton@medv.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/../vendor/autoload.php';

define('ROOT', realpath(__DIR__ . '/..'));
$opt = getopt('v::');

$version = 'dev-master';
Expand All @@ -17,8 +19,11 @@ if (array_key_exists('v', $opt)) {
}
}

chdir(ROOT);
exec('composer install --no-dev');

$pharName = "deployer.phar";
$pharFile = __DIR__ . '/' . $pharName;
$pharFile = ROOT . '/' . $pharName;

if (file_exists($pharFile)) {
unlink($pharFile);
Expand All @@ -40,18 +45,18 @@ $finder->files()
->exclude('test')
->exclude('tests')
->exclude('phpspec')
->in(__DIR__);
->in(ROOT);

foreach ($finder as $fileInfo) {
$file = str_replace(__DIR__, '', $fileInfo->getRealPath());
$file = str_replace(ROOT, '', $fileInfo->getRealPath());

echo "Add file: " . $file . "\n";

$phar->addFile($fileInfo->getRealPath(), $file);
}

// Add bin/dep file
$depContent = file_get_contents(__DIR__ . '/bin/dep');
$depContent = file_get_contents(ROOT . '/bin/dep');
$depContent = str_replace("#!/usr/bin/env php\n", '', $depContent);
$depContent = str_replace("'master'", "'$version'", $depContent);
$depContent = str_replace('__FILE__', 'str_replace("phar://", "", Phar::running())', $depContent);
Expand Down
35 changes: 13 additions & 22 deletions bin/dep
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,19 @@ if (is_readable($composerLockFile)) {
}
}

// Init Deployer
$console = new \Deployer\Console\Application('Deployer', $version);
$input = new \Symfony\Component\Console\Input\ArgvInput();
$output = new \Symfony\Component\Console\Output\ConsoleOutput();
$deployer = new \Deployer\Deployer($console, $input, $output);

// Pretty-print uncaught exceptions in symfony-console
// SymfonyStyle was added in sf-console 2.7, therefore we feature detect first
if (class_exists('\Symfony\Component\Console\Style\SymfonyStyle')) {
set_exception_handler(function($e) use ($input, $output) {
$io = new \Symfony\Component\Console\Style\SymfonyStyle($input, $output);
$io->error($e);
});
}
$method = new ReflectionMethod('Deployer\Deployer', 'run');
if (!$method->isStatic()) {
die(
'You need to update Deployer to the latest version:' . PHP_EOL .
PHP_EOL .
' dep self-update' . PHP_EOL .
PHP_EOL .
'Or use composer installed version:' . PHP_EOL .
PHP_EOL .
' php vendor/bin/dep' . PHP_EOL .
PHP_EOL

// Require deploy.php file
if (is_readable($deployFile)) {
// Prevent variable leak into deploy.php file
call_user_func(function () use ($deployFile) {
require $deployFile;
});
);
}

// Run Deployer
$deployer->run();
\Deployer\Deployer::run($version, $deployFile);
20 changes: 9 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,27 @@
"Deployer\\": "src/"
},
"files": [
"src/Support/helpers.php",
"src/functions.php"
]
},
"bin": [
"bin/dep"
],
"require": {
"php": ">=5.6.0",
"elfet/pure": "~2.0",
"monolog/monolog": "^1.21",
"phpseclib/phpseclib": "~2.0",
"php": "~7.0",
"deployer/phar-update": "~2.0",
"pimple/pimple": "~3.0",
"symfony/console": "~2.6|~3.0",
"symfony/finder": "~2.6|~3.0",
"symfony/process": "~2.6|~3.0",
"symfony/yaml": "~2.6|~3.0"
"symfony/console": "~2.7|~3.0",
"symfony/finder": "~2.7|~3.0",
"symfony/process": "~2.7|~3.0",
"symfony/yaml": "~2.7|~3.0"
},
"require-dev": {
"deployer/phar-update": "~2.0",
"phpunit/phpunit": "~5.7"
"phpunit/phpunit": "~6.0"
},
"suggest": {
"ext-sockets": "For parallel deployment"
"deployer/phar-update": "~2.0"
},
"config": {
"sort-packages": true
Expand Down
Loading