Rocketeer. How can I execute commands on different servers after deployment?
I have multiple servers - backend, frontend and api. To deploy the code to servers I am using Rocketeer.
I am using multiple servers for one connection:
'connections' => array(
'production' => array(
'servers' => array(
array(
'host' => 'xxx.xxx.xxx.xxx', // backend
'username' => 'admin',
'password' => 'xxxxxx',
'key' => '',
'keyphrase' => '',
),
array(
'host' => 'xxx.xxx.xxx.xxx', // api
'username' => 'admin',
'password' => 'xxxxxx',
'key' => '',
'keyphrase' => '',
),
array(
'host' => 'xxx.xxx.xxx.xxx', // frontend
'username' => 'admin',
'password' => 'xxxxxx',
'key' => '',
'keyphrase' => '',
),
),
),
).
It performs its own tasks for each server.
To determine the current connection, I am using the following code in hooks.php
$connection = $task->getConnection();
$server = $connection->connections->getServer();
$credentials = $connection->connections->getServerCredentials($connection->connections->getConnection(), $server);
switch($credentials['host']){
case 'xxx.xxx.xxx.xxx':
$task->runForCurrentRelease('...');
break;
}
The data is uploaded to the servers sequentially.
After deploying to the last server, I am unable to execute the command on the previous servers.
How can I execute commands on different servers after deployment? (ex: restart nginx, restart memcached, etc.)
+3
source to share
1 answer
I believe this is what you are looking for: http://rocketeer.autopergamene.eu/#/docs/docs/II-Concepts/Events
You must create your own listener for each instruction set.
0
source to share