setServer() public method

Sets the script to run on a remote server.
public setServer ( Server $server, string $private_key, string $alternative_user = null )
$server REBELinBLUE\Deployer\Server
$private_key string
$alternative_user string
コード例 #1
0
 /**
  * Execute the command.
  */
 public function handle()
 {
     $this->server->status = Server::TESTING;
     $this->server->save();
     $key = tempnam(storage_path('app/'), 'sshkey');
     file_put_contents($key, $this->server->project->private_key);
     try {
         $process = new Process('TestServerConnection', ['project_path' => $this->server->clean_path, 'test_file' => time() . '_testing_deployer.txt', 'test_directory' => time() . '_testing_deployer_dir']);
         $process->setServer($this->server, $key)->run();
         if (!$process->isSuccessful()) {
             $this->server->status = Server::FAILED;
         } else {
             $this->server->status = Server::SUCCESSFUL;
         }
     } catch (\Exception $error) {
         $this->server->status = Server::FAILED;
     }
     $this->server->save();
     unlink($key);
 }
コード例 #2
0
ファイル: DeployProject.php プロジェクト: JamesForks/deployer
 /**
  * Remove left over artifacts from a failed deploy on each server.
  */
 private function cleanupDeployment()
 {
     foreach ($this->deployment->project->servers as $server) {
         if (!$server->deploy_code) {
             continue;
         }
         $process = new Process('deploy.CleanupFailedRelease', ['project_path' => $server->clean_path, 'release_path' => $server->clean_path . '/releases/' . $this->deployment->release_id, 'remote_archive' => $server->clean_path . '/' . $this->release_archive]);
         $process->setServer($server, $this->private_key)->run();
     }
 }