Restarting php7.1-fpm on Cloudways servers from a Deployer file.
A quick and dirty deployer task to restart php7.1 fpm hosted on cloudways
Should be simple to modify to restart other services. See https://platform.cloudways.com/api
You need a Cloudways account and server, an api key, and the id of the server you want to restart services on.
It's just a couple of utility functions and a deployer task. Either download and include restart-php7.1-fpm.php or install via composer:
composer require --dev samyapp/cloudways-restart-php-deployer-task
In your deploy.php
script, include restart-php7.1-fpm.php after you include your recipes.
Then set the following variables:
// The email attached to your cloudways account.
set('cloudways_email', '[email protected]');
// the id of the cloudways server to restart
set('cloudways_server_id', 42);
// your cloudways api key - you could hard code this in your deploy script of
// just set it in your environment instead.
set('cloudways_api_key', $_ENV['CLOUDWAYS_API_KEY']);
Finally, call the restart task from somewhere appropriate, eg:
after('deploy:symlink', 'deploy:restart-php7.1-fpm');