$CNT_DB_NAME
This commit is contained in:
@@ -115,6 +115,11 @@ class Provision extends BaseController
|
|||||||
return $productId . "-SVR-" . str_pad($provID, 10, "0", STR_PAD_LEFT);
|
return $productId . "-SVR-" . str_pad($provID, 10, "0", STR_PAD_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function generatedBlogDatabaseName($productId, $provID): string
|
||||||
|
{
|
||||||
|
return strtoupper($productId . str_pad($provID, 10, "0", STR_PAD_LEFT));
|
||||||
|
}
|
||||||
|
|
||||||
public function updateProvision(): string
|
public function updateProvision(): string
|
||||||
{
|
{
|
||||||
$list_limit = 1; // for noow
|
$list_limit = 1; // for noow
|
||||||
@@ -193,7 +198,7 @@ class Provision extends BaseController
|
|||||||
// $templateRandom = 'P' . rand(1, 6);
|
// $templateRandom = 'P' . rand(1, 6);
|
||||||
// $composer_template_contents = str_replace("TEMPLATE_NAME_REPLACE", $templateRandom, $composer_template_contents);
|
// $composer_template_contents = str_replace("TEMPLATE_NAME_REPLACE", $templateRandom, $composer_template_contents);
|
||||||
|
|
||||||
$composer_template_contents = $this->prepareTemplateFile($composer_template_contents, $ContainerName, $allocatedPort, $provisionUID, $ansible_folder, $productId, $pr->internal_url);
|
$composer_template_contents = $this->prepareTemplateFile($composer_template_contents, $ContainerName, $allocatedPort, $provisionUID, $ansible_folder, $productId, $pr->internal_url, $pr->id);
|
||||||
|
|
||||||
//Save to the specific path
|
//Save to the specific path
|
||||||
// $destination_composer_path = $ansible_folder . "/parts/" . $provisionUID . "/docker-compose.yml";
|
// $destination_composer_path = $ansible_folder . "/parts/" . $provisionUID . "/docker-compose.yml";
|
||||||
@@ -269,7 +274,7 @@ class Provision extends BaseController
|
|||||||
|
|
||||||
log_message('critical', "***** ***** assignProvideImageName ProductTemplate: $PROVISION_IMAGE_NAME CustomTemplate: $custom_template ");
|
log_message('critical', "***** ***** assignProvideImageName ProductTemplate: $PROVISION_IMAGE_NAME CustomTemplate: $custom_template ");
|
||||||
}
|
}
|
||||||
return [$PROVISION_IMAGE_NAME,$PROVISION_IMAGE_FLAVOR];
|
return [$PROVISION_IMAGE_NAME, $PROVISION_IMAGE_FLAVOR];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function selectCustomnTemplateFromName($custom_id)
|
private function selectCustomnTemplateFromName($custom_id)
|
||||||
@@ -341,7 +346,7 @@ class Provision extends BaseController
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function prepareTemplateFile($composer_template_contents, $ContainerName, $allocatedPort, $provisionUID, $ansible_folder, $productId, $internalUrl): string
|
private function prepareTemplateFile($composer_template_contents, $ContainerName, $allocatedPort, $provisionUID, $ansible_folder, $productId, $internalUrl, $provID): string
|
||||||
{
|
{
|
||||||
|
|
||||||
// $PROVISION_IMAGE_NAME = match ($productId) {
|
// $PROVISION_IMAGE_NAME = match ($productId) {
|
||||||
@@ -359,11 +364,13 @@ class Provision extends BaseController
|
|||||||
$SITE_CONTACT_GATEWAY = $_ENV['SITE_CONTACT_GATEWAY'];
|
$SITE_CONTACT_GATEWAY = $_ENV['SITE_CONTACT_GATEWAY'];
|
||||||
$MYSQL_PROVISION_DATABASE_PORT = $_ENV['PROVISION_MSQL_DATABASE_IP'] . ":" . $_ENV['PROVISION_MSQL_DATABASE_PORT']; // "172.16.4.96:3307";
|
$MYSQL_PROVISION_DATABASE_PORT = $_ENV['PROVISION_MSQL_DATABASE_IP'] . ":" . $_ENV['PROVISION_MSQL_DATABASE_PORT']; // "172.16.4.96:3307";
|
||||||
$destinationHomeFolder = $_ENV['DESTINATION_HOME_FOLDER'] . $ContainerName;
|
$destinationHomeFolder = $_ENV['DESTINATION_HOME_FOLDER'] . $ContainerName;
|
||||||
|
$CNT_DB_NAME = $this->generatedBlogDatabaseName($productId, $provID);
|
||||||
//$templateRandom = 'P' . rand(1, 6);
|
//$templateRandom = 'P' . rand(1, 6);
|
||||||
$composer_template_contents = str_replace("WHAT_CONTAINER_NAME", $ContainerName, $composer_template_contents);
|
$composer_template_contents = str_replace("WHAT_CONTAINER_NAME", $ContainerName, $composer_template_contents);
|
||||||
$composer_template_contents = str_replace("DESTINATION_FOLDER", $destinationHomeFolder, $composer_template_contents);
|
$composer_template_contents = str_replace("DESTINATION_FOLDER", $destinationHomeFolder, $composer_template_contents);
|
||||||
$composer_template_contents = str_replace("ALLOCATED_PORT", $allocatedPort, $composer_template_contents);
|
$composer_template_contents = str_replace("ALLOCATED_PORT", $allocatedPort, $composer_template_contents);
|
||||||
$composer_template_contents = str_replace("CNT_DB_NAME", $ContainerName, $composer_template_contents);
|
// $composer_template_contents = str_replace("CNT_DB_NAME", $ContainerName, $composer_template_contents);
|
||||||
|
$composer_template_contents = str_replace("CNT_DB_NAME", $CNT_DB_NAME, $composer_template_contents);
|
||||||
$composer_template_contents = str_replace("CNT_DB_PASS", $provisionUID, $composer_template_contents);
|
$composer_template_contents = str_replace("CNT_DB_PASS", $provisionUID, $composer_template_contents);
|
||||||
$composer_template_contents = str_replace("CNT_DB_DATA", $MYSQL_PROVISION_DATABASE_PORT, $composer_template_contents);
|
$composer_template_contents = str_replace("CNT_DB_DATA", $MYSQL_PROVISION_DATABASE_PORT, $composer_template_contents);
|
||||||
$composer_template_contents = str_replace("PROVISION_UID_REPLACE", $provisionUID, $composer_template_contents);
|
$composer_template_contents = str_replace("PROVISION_UID_REPLACE", $provisionUID, $composer_template_contents);
|
||||||
@@ -620,7 +627,7 @@ class Provision extends BaseController
|
|||||||
// $templateRandom = 'P' . rand(1, 6);
|
// $templateRandom = 'P' . rand(1, 6);
|
||||||
// $composer_template_contents = str_replace("TEMPLATE_NAME_REPLACE", $templateRandom, $composer_template_contents);
|
// $composer_template_contents = str_replace("TEMPLATE_NAME_REPLACE", $templateRandom, $composer_template_contents);
|
||||||
//
|
//
|
||||||
$composer_template_contents = $this->prepareTemplateFile($composer_template_contents, $ContainerName, $allocatedPort, $provisionUID, $ansible_folder, $productId, $internal_url);
|
$composer_template_contents = $this->prepareTemplateFile($composer_template_contents, $ContainerName, $allocatedPort, $provisionUID, $ansible_folder, $productId, $internal_url, $members_product_id);
|
||||||
|
|
||||||
//Save to the specific path
|
//Save to the specific path
|
||||||
// $composerFile = fopen($destination_composer_path, "w") or die("Unable to open file!");
|
// $composerFile = fopen($destination_composer_path, "w") or die("Unable to open file!");
|
||||||
|
|||||||
Reference in New Issue
Block a user