本文整理汇总了PHP中DBServer::getScalarizrRepository方法的典型用法代码示例。如果您正苦于以下问题:PHP DBServer::getScalarizrRepository方法的具体用法?PHP DBServer::getScalarizrRepository怎么用?PHP DBServer::getScalarizrRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBServer
的用法示例。
在下文中一共展示了DBServer::getScalarizrRepository方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupScalrAgent
public static function setupScalrAgent(\DBServer $dbServer)
{
$baseurl = \Scalr::config('scalr.endpoint.scheme') . "://" . \Scalr::config('scalr.endpoint.host');
$env = $dbServer->GetEnvironmentObject();
$azure = $env->azure();
$branch = $dbServer->getScalarizrRepository()['repository'];
$develRepos = \Scalr::getContainer()->config->get('scalr.scalarizr_update.devel_repos');
$scmBranch = $dbServer->GetFarmRoleObject()->GetSetting('user-data.scm_branch');
if ($scmBranch != '' && $develRepos) {
$branch = $dbServer->GetFarmRoleObject()->GetSetting('base.devel_repository');
$scmBranch = "{$scmBranch}/";
} else {
$scmBranch = '';
}
if ($dbServer->osType == 'linux') {
$extensionProperties = new ResourceExtensionProperties('Microsoft.OSTCExtensions', 'CustomScriptForLinux', '1.2');
$extensionProperties->setSettings(['commandToExecute' => "bash -c 'curl -k -L \"{$baseurl}/public/linux/{$branch}/azure/{$scmBranch}install_scalarizr.sh\" | bash && service scalr-upd-client start'"]);
} else {
$extensionProperties = new ResourceExtensionProperties('Microsoft.Compute', 'CustomScriptExtension', '1.4');
$extensionProperties->setSettings(["commandToExecute" => "powershell -NoProfile -ExecutionPolicy Bypass -Command \"iex ((new-object net.webclient).DownloadString('{$baseurl}/public/windows/{$branch}/{$scmBranch}install_scalarizr.ps1')); start-service ScalrUpdClient\""]);
}
$createExtension = new CreateResourceExtension('scalarizr', $dbServer->cloudLocation, $extensionProperties);
try {
$response = $azure->compute->resourceExtension->create($env->keychain(SERVER_PLATFORMS::AZURE)->properties[Entity\CloudCredentialsProperty::AZURE_SUBSCRIPTION_ID], $dbServer->GetProperty(\AZURE_SERVER_PROPERTIES::RESOURCE_GROUP), $dbServer->GetProperty(\AZURE_SERVER_PROPERTIES::SERVER_NAME), $createExtension);
\Scalr::getContainer()->logger(\LOG_CATEGORY::FARM)->info(new \FarmLogMessage($dbServer, sprintf(_("Created azure resource extension to install and launch scalr agent"))));
$dbServer->SetProperty(\AZURE_SERVER_PROPERTIES::SZR_EXTENSION_DEPLOYED, 1);
} catch (\Exception $e) {
\Scalr::getContainer()->logger(\LOG_CATEGORY::FARM)->fatal(new \FarmLogMessage($dbServer, sprintf(_("Unable to create azure resource extension to install and launch scalr agent: %s"), $e->getMessage())));
}
}
示例2: getBaseConfiguration
public function getBaseConfiguration(DBServer $dbServer, $isHostInit = false)
{
$configuration = new stdClass();
$dbFarmRole = $dbServer->GetFarmRoleObject();
//Storage
try {
if ($dbFarmRole) {
$storage = new FarmRoleStorage($dbFarmRole);
$volumes = $storage->getVolumesConfigs($dbServer->index, $isHostInit);
if (!empty($volumes)) {
$configuration->volumes = $volumes;
}
}
} catch (Exception $e) {
$this->logger->error(new FarmLogMessage($dbServer->farmId, "Cannot init storage: {$e->getMessage()}"));
}
// Base
try {
if ($dbFarmRole) {
$scriptingLogTimeout = $dbFarmRole->GetSetting(self::ROLE_BASE_KEEP_SCRIPTING_LOGS_TIME);
if (!$scriptingLogTimeout) {
$scriptingLogTimeout = 3600;
}
$configuration->base = new stdClass();
$configuration->base->keepScriptingLogsTime = $scriptingLogTimeout;
$configuration->base->resumeStrategy = PlatformFactory::NewPlatform($dbFarmRole->Platform)->getResumeStrategy();
$governance = new Scalr_Governance($dbFarmRole->GetFarmObject()->EnvID);
if ($governance->isEnabled(Scalr_Governance::CATEGORY_GENERAL, Scalr_Governance::GENERAL_HOSTNAME_FORMAT)) {
$hostNameFormat = $governance->getValue(Scalr_Governance::CATEGORY_GENERAL, Scalr_Governance::GENERAL_HOSTNAME_FORMAT);
} else {
$hostNameFormat = $dbFarmRole->GetSetting(self::ROLE_BASE_HOSTNAME_FORMAT);
}
$configuration->base->hostname = !empty($hostNameFormat) ? $dbServer->applyGlobalVarsToValue($hostNameFormat) : '';
$apiPort = $dbFarmRole->GetSetting(self::ROLE_BASE_API_PORT);
$messagingPort = $dbFarmRole->GetSetting(self::ROLE_BASE_MESSAGING_PORT);
$configuration->base->apiPort = $apiPort ? $apiPort : 8010;
$configuration->base->messagingPort = $messagingPort ? $messagingPort : 8013;
}
//Update settings
$updateSettings = $dbServer->getScalarizrRepository();
$configuration->base->update = new stdClass();
foreach ($updateSettings as $k => $v) {
$configuration->base->update->{$k} = $v;
}
} catch (Exception $e) {
}
return $configuration;
}