Comments (15)
Or even simpler(!)
task('build', function () {
set('deploy_path', __DIR__ . '/.build');
invoke('deploy:prepare');
invoke('deploy:release');
invoke('deploy:update_code');
invoke('deploy:vendors');
invoke('deploy:symlink');
})->local();
task('upload', function () {
upload(__DIR__ . "/.build/current/", '{{release_path}}');
});
task('deploy', [
'build',
'deploy:prepare',
'deploy:release',
'upload',
'deploy:shared',
'deploy:writable',
'deploy:symlink',
'cleanup',
'success'
]);
Works as a charm.
from recipes.
I came out with better solution for local builds for v7. Will be simple and instead of adding set on tasks.
Just need to find time to implement it) now all my free time in Deployer Pro project. Hope to get some money to support open source development.
from recipes.
from recipes.
I agree with @johnny-bit this sounds like a good idea.
I'm not as familiar with the inner workings of deployer, need to get up to speed with the v5 codebase.
But that two phase example you provided is spot on!
from recipes.
I found a nice solution without complicating code. I think what build always should be performed on one host.
task('build', function () {
set('deploy_path', __DIR__ . '/.build');
invoke('deploy:prepare');
invoke('deploy:release');
invoke('deploy:update_code');
invoke('deploy:vendors');
$releasePath = get('release_path');
on(Deployer::get()->hosts, function () use ($releasePath) {
set('build_path', "$releasePath/");
});
})->local();
task('upload', function () {
upload('{{build_path}}', '{{release_path}}');
});
task('deploy', [
'deploy:prepare',
'deploy:release',
'upload',
'deploy:shared',
'deploy:writable',
'deploy:symlink',
'cleanup',
'success'
]);
before('deploy', 'build');
And this is already working! More, it's possible to specify different host for as build machine(!) not only localhost.
task('build', function () {
invoke('deploy:prepare');
invoke('deploy:release');
invoke('deploy:update_code');
invoke('deploy:vendors');
$releasePath = get('release_path');
on(roles('app'), function () use ($releasePath) {
set('build_path', "$releasePath/");
});
})->onRoles('build');
from recipes.
from recipes.
Docs will be there: https://github.com/deployphp/docs/blob/master/advanced/deploy-strategies.md
from recipes.
Migrating from "old" ways would be great too ;)
from recipes.
@johnny-bit can you write about it in UPGRADE.md later? :)
from recipes.
from recipes.
I really like the direction of this!
The deploy path switching makes sense now that I see the second example, much cleaner.
If I can help let me know, I may have some time in the next week or two, hopefully.
from recipes.
@nickdenardis will be cool if you can write new article about new local deploy strategy. Also planning to release v5 on next weeks.
from recipes.
@antonmedv for sure, not a problem :)
from recipes.
Hello, thank you for this helpful thread. How difficult would it be to add a set
method on the Deployer\Task\Task
class, that redefines a variable only inside that task?
This would enable us to transform
task('build', function () {
set('deploy_path', __DIR__ . '/.build');
invoke('deploy:prepare');
invoke('deploy:release');
invoke('deploy:update_code');
invoke('deploy:vendors');
invoke('deploy:symlink');
})->local();
into
task('build', [
'deploy:prepare',
'deploy:release',
'deploy:update_code',
'deploy:vendors',
'deploy:symlink',
])->local()->set('deploy_path', __DIR__ . '/.build');
As an alternative we could let the local
method accept an optional local deploy_path
, like so:
task('build', [
'deploy:prepare',
'deploy:release',
'deploy:update_code',
'deploy:vendors',
'deploy:symlink',
])->local(__DIR__ . '/.build');
What do you think? 🙂
from recipes.
Cool, looking forward to see that. No problem take you time :)
from recipes.
Related Issues (20)
- Email recipe HOT 4
- [Error] Call to undefined method Symfony\Component\Console\Helper\QuestionHelper::getInputStream() HOT 5
- What about merging recipes and deployer? HOT 7
- Issue with recipe/sentry HOT 3
- [slack] No branch or commit name HOT 2
- add npm build to npm recipe
- Rsync filterperdir wrong variable HOT 2
- RocketChat Integration HOT 2
- Sentry recipe fails when there's no .git directory HOT 2
- MS Teams notification integration HOT 1
- Website recipes documentation is not aligned with repository docs
- Problems configuring cachetool
- Sentry Release/Deploy fails due to server response HOT 4
- Segmentation Fault / Slack Recipe / PHP 7.3
- Problem resolving CacheTool binary
- Catch-22: Deployer installs composer dependencies, but deployer/recipes is a dependency HOT 3
- Zulip recipe HOT 1
- releaseIsGitDirectory() needs to return 0 if it's not a git repo
- Rollbar notify do not work with --hosts option
- New cachetool release (5.X) breaks cachetool recipe expectations for PHP 7.1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from recipes.