Giter Club home page Giter Club logo

Comments (15)

antonmedv avatar antonmedv commented on June 19, 2024 3

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.

antonmedv avatar antonmedv commented on June 19, 2024 1

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.

johnny-bit avatar johnny-bit commented on June 19, 2024

from recipes.

nickdenardis avatar nickdenardis commented on June 19, 2024

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.

antonmedv avatar antonmedv commented on June 19, 2024

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.

johnny-bit avatar johnny-bit commented on June 19, 2024

from recipes.

antonmedv avatar antonmedv commented on June 19, 2024

Docs will be there: https://github.com/deployphp/docs/blob/master/advanced/deploy-strategies.md

from recipes.

johnny-bit avatar johnny-bit commented on June 19, 2024

Migrating from "old" ways would be great too ;)

from recipes.

antonmedv avatar antonmedv commented on June 19, 2024

@johnny-bit can you write about it in UPGRADE.md later? :)

from recipes.

johnny-bit avatar johnny-bit commented on June 19, 2024

from recipes.

nickdenardis avatar nickdenardis commented on June 19, 2024

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.

antonmedv avatar antonmedv commented on June 19, 2024

@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.

nickdenardis avatar nickdenardis commented on June 19, 2024

@antonmedv for sure, not a problem :)

from recipes.

lorisleiva avatar lorisleiva commented on June 19, 2024

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.

lorisleiva avatar lorisleiva commented on June 19, 2024

Cool, looking forward to see that. No problem take you time :)

from recipes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.