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

Support for multiple hosts on the same server. #217

Closed
wants to merge 1 commit into from

Conversation

guratr
Copy link

@guratr guratr commented Feb 11, 2021

This change allows you to execute tasks on multiple servers with the same remote host.

@servers([
'web-1' => ['192.168.1.1'], 
'web-2' => ['192.168.1.1']]
)
@task('deploy', ['on' => ['web-1', 'web-2']])
    pwd
@endtask

Previously this configuration would only run once for web-1 , because $processes where keyed by host. I changed it to be keyed by server name and host combination.

There's also a need to be able to navigate to different directories for different hosts on the same server. So I also added @serverName and @serverHost variables that can be used in tasks to be replaced by actual data before execution.
For example

@servers([
'web-1' => ['192.168.1.1'], 
'web-2' => ['192.168.1.1']]
)
@task('deploy', ['on' => ['web-1', 'web-2']])
    cd /home/admin/web/@serverName/public_html/
    ....
    supervisorctl stop  @serverName-horizon-worker:*
@endtask

Only difference it makes for other use cases is that the server name will also be present in the output.

image

…ented support for multiple hosts on one server
@taylorotwell
Copy link
Member

So, what is the use case for doing this in practical terms?

@guratr
Copy link
Author

guratr commented Feb 11, 2021

So, what is the use case for doing this in practical terms?

In my case, I have multiple sites with the same code, and they all hosted on the same server. Without this I can't deploy to all sites at once.
There's also case when you keep your dev/staging/prod environments on the same server, and in some cases need to deploy to all of them at once. Without @serverName it would be impossible to know where to "go" and witch workers to reload.

@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions!

If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response.

@Oxicode
Copy link

Oxicode commented Mar 6, 2021

If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions!

Very bad idea.

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

Successfully merging this pull request may close these issues.

None yet

3 participants