Maxcluster: cluster-control restart PHP with deployer

Most of our customers are hosted on maxcluster. And thanks to their cluster-control one can automate a lot of things using it. For example restarting PHP after deployment. You don’t want this on a production environment, but sometimes it might make sense to have it on a stage machine.

    // ...
    ->set('mc-cluster', 'C-1234')
    ->set('mc-server', 'srv-a');

task('maxcluster:apache:restart', function () {
    $apiKey = escapeshellarg(getenv('MAXCLUSTER_PA_TOKEN'));

    run("cluster-control login --pa_token=$apiKey");
    run('cluster-control php:restart {{mc-cluster}} {{mc-server}}');
    run("cluster-control logout");

Kommentar verfassen