<?php ini_set('max_execution_time', 3600); $appName = $argv[1]; define('CURRENT_DIR', realpath(dirname(__FILE__))); define('_SUB_DIR', CURRENT_DIR . '/dns/'); require_once './create-po-config.php'; $poAccountName = $appName . '-cvc'; $vpoClient = new bsVideoPublisherServicesSoapClient($vpoBaseUrl, null, $poKey, 'Admin'); $response = $vpoClient->createCustomer($poAccountName); $adminKey = new bsVideoPublisherKeyHelper($poKey); $result = bsVideoPublisherCryptoHelper::aesDecryptData($response['CreateCustomerResult']['Data'], $adminKey->getPrivateKey(), $adminKey->getIvSalt()); $xml = @simplexml_load_string($result); if (!$xml) { pake_error("Error creating po account for " . $appName); } $poCustomerId = (string) $xml->CustomerGuid; $poCustomerKey = (string) $xml->ApiKey; //TODO Store this in order to user with deployment $info = array('po_customer_id' => $poCustomerId, 'po_customer_key' => $poCustomerKey); pake_echo($appName . ' : ' . serialize($info)); addPillarInformation($appName, "po_customer_id", $poCustomerId); addPillarInformation($appName, "po_customer_key", $poCustomerKey); echo "\nDONE\n";
<?php ini_set('max_execution_time', 3600); $appName = $argv[1]; define('CURRENT_DIR', realpath(dirname(__FILE__))); require_once "../utils.php"; $commands = array(); $mysqlUser = "******"; $mysqlDatabase = $mysqlUser; $mysqlPassword = substr(md5(uniqid()), 0, 10); //$mysqlHost = "10.0.0.7"; $mysqlHost = "127.0.0.1"; addPillarInformation($appName, "mysql_password", $mysqlPassword); addPillarInformation($appName, "mysql_user", $mysqlUser); addPillarInformation($appName, "mysql_database", $mysqlUser); addPillarInformation($appName, "mysql_host", $mysqlHost); $saltCommand = 'salt ' . $appName . '-node1 state.sls eztv.deploydatabase'; echo pake_echo($saltCommand); passthru($saltCommand); echo "\n";
$playerManagerApi->accountCreate($playerManagerSecretKey, $accountName, $packages); if ($result['status'] !== bsPlayerManagerApi::STATUS_SUCCESS) { pake_error("Error creating PM Account"); exit(1); } $accountUid = $result['data']['guid']; //pad name (can not exist if error on creation) $url_pad = ""; if (array_key_exists('url_pad', $result['data'])) { $url_pad = $result['data']['url_pad']; } $playerManagerApi->userCreate($playerManagerSecretKey, $email, $firstname, $lastname, $accounts, $username, $plainPassword); if ($result['status'] !== bsPlayerManagerApi::STATUS_SUCCESS) { bsLogger::err('Player Manager: Failed to create user with email ' . $email . ' and username ' . $username); return null; } $userUid = $result['data']['guid']; if (!$userUid) { throw new sfException("Player manager create user account error : " . json_encode($result)); } $pmUser = bsPlayerManager::userGet("guid", $userUid); $tvPmUserUid = $pmUser['guid']; $tvPmUserSecret = $pmUser['secret']; //We have to store following informations : $info = array('pad' => $url_pad, 'accountUid' => $accountUid, 'userUid' => $tvPmUserUid, 'userSecret' => $tvPmUserSecret); pake_echo($appName . ' : ' . serialize($info)); addPillarInformation($appName, "pm_pad", $url_pad); addPillarInformation($appName, "pm_account_uid", $accountUid); addPillarInformation($appName, "pm_user_uid", $tvPmUserUid); addPillarInformation($appName, "pm_user_secret", $tvPmUserSecret); pake_echo("DONE");
//Log some information in order to debug file_put_contents("/tmp/create_ext_ress", "\n\n" . serialize($informations), FILE_APPEND); $informations['storageAccountName'] = $storageAccountName; $informations['storageAccountKey'] = $storageAccountKey; //Log some information in order to debug file_put_contents("/tmp/create_ext_ress", "\n\n" . serialize($informations), FILE_APPEND); $portalUser = "******"; $portalPassword = substr(md5(uniqid()), 0, 10); $apiKey = substr(md5(uniqid()), 0, 20); addPillarInformation($appName, "portal_username", $portalUser); addPillarInformation($appName, "portal_password", $portalPassword); addPillarInformation($appName, "portal_apikey", $apiKey); addPillarInformation($appName, "number_of_front", $numberOfFront); addPillarInformation($appName, "number_of_node", $numberOfNode); addPillarInformation($appName, "storage_account_name", $storageAccountName); addPillarInformation($appName, "storage_account_key", $storageAccountKey); define('CURRENT_DIR', realpath(dirname(__FILE__))); define('_SUB_DIR', CURRENT_DIR . '/_sub/'); #TODO : mail about this script run //TODO inputs //TODO : Placer les pillars MySQL file_put_contents("/tmp/salt-ask-" . $appName, $secret); $tasks = array(); $command = "sudo php " . _SUB_DIR . "create-pad.php " . escapeshellarg($appName) . " " . $numberOfFront . " " . $numberOfNode; $tasks[] = $command; $command = "sudo php " . _SUB_DIR . "create-dns.php " . escapeshellarg($appName) . " " . $numberOfFront . " " . $numberOfNode; $tasks[] = $command; $command = "sudo php " . _SUB_DIR . "create-po-account.php " . escapeshellarg($appName) . " " . $numberOfFront . " " . $numberOfNode; $tasks[] = $command; $command = "sudo php " . _SUB_DIR . "create-pm-account.php " . escapeshellarg($appName) . " " . $numberOfFront . " " . $numberOfNode; $tasks[] = $command;