Provision Socket Calls
This commit is contained in:
@@ -149,24 +149,15 @@ class Provision extends BaseController
|
||||
$subscriptionId = $pr->subscription_id;
|
||||
$provisionPort = $pr->provision_port;
|
||||
$productId = $pr->product_id;
|
||||
$provisionUID = $pr->uid;
|
||||
// $provisionUID = $pr->uid;
|
||||
$subscriptionUId = $pr->uid;
|
||||
$memberID = $pr->member_id;
|
||||
$ContainerName = $this->generatedContainerName($productId, $pr->id); // $productId . str_pad($pr->id, 10, "0", STR_PAD_LEFT);
|
||||
$partFolder = $ansible_folder . "/parts/" . $provisionUID;
|
||||
|
||||
// // make sure we compose the docker compose to use
|
||||
// $this->prepareDockerComposer(
|
||||
// $subscriptionId,
|
||||
// $provisionPort,
|
||||
// $productId,
|
||||
// $provisionUID,
|
||||
// $memberID,
|
||||
// $pr->internal_url
|
||||
// );
|
||||
$partFolder = $ansible_folder . "/parts/" . $subscriptionUId;
|
||||
|
||||
|
||||
$allocatedPort = $provisionPort;
|
||||
$this->updateToNow($provisionUID);
|
||||
$this->updateToNow($subscriptionUId);
|
||||
|
||||
if (!is_dir($partFolder)) {
|
||||
mkdir($partFolder, 0700);
|
||||
@@ -174,7 +165,7 @@ class Provision extends BaseController
|
||||
|
||||
// THIS PROVISONING COMPOSERS
|
||||
$composer_template_path = $ansible_folder . "/templates/composers/" . $productId . "/docker-compose.yml";
|
||||
$composer_template_path_local = $partMachineLocal . $provisionUID;
|
||||
$composer_template_path_local = $partMachineLocal . $subscriptionUId;
|
||||
|
||||
$prov_name = str_replace(".", "_", $pr->internal_url) . ".yml";
|
||||
$template_file = $ansible_folder . "/templates/" . $pr->product_id . ".yml";
|
||||
@@ -182,32 +173,7 @@ class Provision extends BaseController
|
||||
$destinationHomeFolder = $_ENV['DESTINATION_HOME_FOLDER'] . $ContainerName;
|
||||
$composer_template_contents = file_get_contents($composer_template_path);
|
||||
// Do the processing
|
||||
// $composer_template_contents = str_replace("WHAT_CONTAINER_NAME", $ContainerName, $composer_template_contents);
|
||||
//$destinationHomeFolder = "/home/chiefsoft/SITES/" . $ContainerName;
|
||||
// $SITE_CONTENTS_GATEWAY = $_ENV['SITE_CONTENTS_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";
|
||||
// $destinationHomeFolder = $_ENV['DESTINATION_HOME_FOLDER'] . $ContainerName;
|
||||
// $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("CNT_DB_NAME", $ContainerName, $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("PROVISION_UID_REPLACE", $provisionUID, $composer_template_contents);
|
||||
// $composer_template_contents = str_replace("PROVISION_IMAGE_NAME_REPLACE", "registry.chiefsoft.com/pweb/pweb-01-merms-pweb0006c:latest", $composer_template_contents);
|
||||
// $composer_template_contents = str_replace("SITE_CONTENTS_URL_REPLACE", $SITE_CONTENTS_GATEWAY, $composer_template_contents);
|
||||
// $composer_template_contents = str_replace("SITE_CONTACT_URL_REPLACE", $SITE_CONTACT_GATEWAY, $composer_template_contents);
|
||||
//
|
||||
// $templateRandom = 'P' . rand(1, 6);
|
||||
// $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, $pr->id);
|
||||
|
||||
//Save to the specific path
|
||||
// $destination_composer_path = $ansible_folder . "/parts/" . $provisionUID . "/docker-compose.yml";
|
||||
// $composerFile = fopen($destination_composer_path, "w") or die("Unable to open file!");
|
||||
// fwrite($composerFile, $composer_template_contents);
|
||||
// fclose($composerFile);
|
||||
$composer_template_contents = $this->prepareTemplateFile($composer_template_contents, $ContainerName, $allocatedPort, $subscriptionUId, $ansible_folder, $productId, $pr->internal_url, $pr->id);
|
||||
|
||||
// GET THE TEMPLATE FOR THIS PROVISIONING
|
||||
$template_content = file_get_contents($template_file);
|
||||
@@ -222,7 +188,7 @@ class Provision extends BaseController
|
||||
|
||||
|
||||
$this->registerProvision($subscriptionId, $prov_name);
|
||||
$this->provisionActions($memberID, $provisionUID, "Auto Configuration Started");
|
||||
$this->provisionActions($memberID, $subscriptionUId, "Auto Configuration Started");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -556,7 +522,8 @@ class Provision extends BaseController
|
||||
$provision_port = $pr->provision_port;
|
||||
$members_product_id = $pr->mpid;
|
||||
|
||||
$this->provisionActions($member_id, $provisionUID, "Rebuilding Provision Started ");
|
||||
|
||||
$this->provisionActions($member_id, $subscriptionUId, "Rebuilding Provision Started ");
|
||||
|
||||
|
||||
log_message('critical', "Members Product ID ***** " . $pr->mpid . " Provision_Status == " . $pr->provision_status);
|
||||
@@ -619,7 +586,7 @@ class Provision extends BaseController
|
||||
log_message('critical', "Calling WHY PATH update_To_Completed ***** " . $ansibleReturn);
|
||||
$this->update_To_Completed($productUid);
|
||||
}
|
||||
$this->provisionActions($member_id, $provisionUID, "Rebuilding Provision Completed ");
|
||||
$this->provisionActions($member_id, $subscriptionUId, "Rebuilding Provision Completed ");
|
||||
}
|
||||
return 100;
|
||||
}
|
||||
@@ -874,7 +841,7 @@ class Provision extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
private function provisionActions($memberID, $provisionUID, $actionText)
|
||||
private function provisionActions($memberID, $provisionUID, $actionText): int
|
||||
{
|
||||
log_message('critical', "***** ***** Provision :: provisionActions($memberID, $provisionUID,$actionText) ");
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user