pomander
pomander copied to clipboard
Parallel deployment to multiple servers
Is is possible with Pomander? I seek PHP alternative for Capistrano, it can do parallel deployment to multiple servers.
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?
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.
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!
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.
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!
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.
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.
@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.