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

Access server host inside a task #216

Closed
guratr opened this issue Feb 11, 2021 · 5 comments
Closed

Access server host inside a task #216

guratr opened this issue Feb 11, 2021 · 5 comments

Comments

@guratr
Copy link

guratr commented Feb 11, 2021

The documentation suggests using something like this for parallel execution

@servers(['web-1' => '192.168.1.1', 'web-2' => '192.168.1.2'])

@task('deploy', ['on' => ['web-1', 'web-2'], 'parallel' => true])
    cd site
    ...
    ...
@endtask

If all of your sites live on different servers, you always can create "site" symlink on server to your site path.
But when you have multiple sites on the same server, for example

@servers(['web-1' => '192.168.1.1', 'web-2' => '192.168.1.1'])

there is no way to specify where to "cd" for each site in the task.

It would be great if we had access to some variable "$currentHost" inside a task

@driesvints
Copy link
Member

If you want to propose something feel free to send in a PR 👍

@Oxicode
Copy link

Oxicode commented Mar 5, 2021

I like your idea @guratr
Please create PR 🙏

@guratr
Copy link
Author

guratr commented Mar 5, 2021

I like your idea @guratr
Please create PR 🙏

I created PR, but unfortunately it was rejected 😭.
If you need this functionality, you can use my my version here.
You can check out pull request to see how it works.

@Oxicode
Copy link

Oxicode commented Mar 6, 2021

OK, i go to your repo.

@rluetke
Copy link

rluetke commented Sep 27, 2021

I found out, that I can use $__container->getServer($name) to access a server in the TaskContainer https://github.com/laravel/envoy/blob/2.x/src/TaskContainer.php.
Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants