/**
  * Constuctor
  *
  * @param array $supervisorsConfiguration Configuration in the symfony parameters
  */
 public function __construct(array $supervisorsConfiguration)
 {
     foreach ($supervisorsConfiguration as $serverName => $configuration) {
         $supervisor = new Supervisor($serverName, $configuration['host'], $configuration['username'], $configuration['password'], $configuration['port']);
         $this->supervisors[$supervisor->getKey()] = $supervisor;
     }
 }
Пример #2
0
 public function __construct()
 {
     $uri = 'http://' . Config::get('services.supervisord.host') . ':' . (Config::get('services.supervisord.port') ?: 9001) . '/RPC2';
     $client = new Client($uri, new Guzzle4Bridge(new \GuzzleHttp\Client(['defaults' => ['auth' => ['user', '123']]])));
     $connector = new XmlRpc($client);
     parent::__construct($connector);
 }
 /**
  * @param Supervisor      $supervisor
  * @param InputInterface  $input
  * @param OutputInterface $output
  * @return array|\Supervisor\Process[]
  */
 protected function findProcesses(Supervisor $supervisor, InputInterface $input, OutputInterface $output)
 {
     $processes = $supervisor->getProcesses();
     if ($input->getOption('group') != null) {
         $processes = $this->filterByGroupName($processes, $input->getOption('group'));
         if (count($processes) == 0) {
             $output->writeln('<error>No processes found with the group ' . $input->getOption('group') . '</error>');
         }
     }
     if ($input->getOption('process') != null) {
         $processes = $this->filterByProcessName($processes, $input->getOption('process'));
         if (count($processes) == 0) {
             $output->writeln('<error>No processes found with the name ' . $input->getOption('process') . '</error>');
         }
     }
     return $processes;
 }
Пример #4
0
 /**
  * publishs the tracking of terms with supervisor and phirehose
  *
  * @return \Illuminate\View\View
  */
 public function publish($team, $network_id)
 {
     $team = Team::where('slug', '=', $team)->first();
     $network = Network::find($network_id);
     $network = $network->title;
     $keys = json_decode($team->{$network});
     //Create GuzzleHttp client
     $guzzleClient = new \GuzzleHttp\Client();
     // Pass the url and the guzzle client to the XmlRpc Client
     $client = new Client('http://localhost:9001/RPC2', new HttpAdapterTransport(new Guzzle6HttpAdapter($guzzleClient)));
     // Generate XMLRpc and Supervisor Instances
     $connector = new XmlRpc($client);
     $supervisor = new Supervisor($connector);
     // setup flysystem
     $adapter = new Local('/etc/supervisor/conf.d/');
     $filesystem = new Filesystem($adapter);
     // create new supervisor files
     $writer = new File($filesystem, 'test.conf');
     $configuration = new Configuration();
     $section = $this->generateNewProcess($keys, $team->id);
     $configuration->addSection($section);
     $writer->write($configuration);
     // restart supervisor
     $supervisor->restart();
 }