Exemplo n.º 1
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();
 }