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

Parallel deployment to multiple servers #48

Open
max-voloshin opened this issue Jan 29, 2014 · 8 comments
Open

Parallel deployment to multiple servers #48

max-voloshin opened this issue Jan 29, 2014 · 8 comments
Labels

Comments

@max-voloshin
Copy link
Contributor

Is is possible with Pomander?
I seek PHP alternative for Capistrano, it can do parallel deployment to multiple servers.

@tamagokun
Copy link
Owner

It can deploy to multiple servers, though currently it does not deploy in parallel, but sequentially.

This decision was mainly to keep the output/progress of the deployment organized. Is it important that the deployments happen simultaneously, or are you just looking for something that can handle specifying multiple servers?

@tamagokun
Copy link
Owner

Just as a reference, this is how you can deploy to multiple servers: $env->app and $env->db can accept a hostname, or an array of hostnames for deployment:

$env->app(array(
  'server1.example.com',
  'server2.example.com'
));

$env->db(array(
  'db1.example.com',
  'db1.example.com'
));

Tasks that perform application related stuff (deploying code, etc) will run on all hostnames inside $env->app and similarly all tasks that perform database related stuff will run on all hostnames inside $env->db. This is very similar to how Capistrano's configuration works.

@max-voloshin
Copy link
Contributor Author

Thanks for your reply!

Parallel deployment is it what I really need (I have project with multiple backends), but I understand that this is not trivial with PHP... So, I will continue research by subject:)

Thanks for your project!

@tamagokun
Copy link
Owner

It's actually pretty simple to do, but I don't understand why you need the deployments to be run in parallel as opposed to being run one after the other?

It might be worth adding an option to Pomander to run host tasks at the same time instead of one after the other.

@max-voloshin
Copy link
Contributor Author

It's actually pretty simple to do

Really? I thought it involves pcntl or something like that.. What implementation do you have in mind?

but I don't understand why you need the deployments to be run in parallel as opposed to being run one after the other?

I want reduce time which my backends has different code versions, because it is unexpected state of project and it leads to weird effects. Is there another way to achieve this goal?

It might be worth adding an option to Pomander to run host tasks at the same time instead of one after the other.

If it is desired feature for Pomander project, It would be nice:) So I reopen this issue.
But feel free to close it if you don't think so.

Thanks for your attention!

@max-voloshin max-voloshin reopened this Jan 29, 2014
@tamagokun
Copy link
Owner

Pomander actually used to work this way, for every task it got to in the task list, it would run it on all app/db hosts at the same time. The output returned was sort of all over the place though, so it was changed so that for each host, the full list of tasks would run.

I think it would be easy enough to add some sort of options like:

$env->run_async = true;

and it would allow for this.

@tamagokun
Copy link
Owner

Here is how multiple roles are handled currently:

https://github.com/tamagokun/pomander/blob/master/lib/Pomander/Environment.php#L98

Currently, it basically goes through each task that is dependent on the role (app/db/anything custom that you add), and will add an "after" hook that basically tells it to re-run the task on the next host in the target until there are no more hosts.


To get a parallel setup working, rather than adding an "after" hook for each task, you would want to invoke the task again and again for each host in the role.

@muxx
Copy link

muxx commented Feb 28, 2014

@max-voloshin Look at deployer https://github.com/muxx/dplr which uses library libpssh and pssh_extension for PHP that allow simultaneously and in parallel run commands and upload files on multiple servers. You'll have to do additional work to install libssh2, libpssh and pssh_extension but you will get full control and time profit in deployment.

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

No branches or pull requests

3 participants