diff --git a/.env b/.env index e5857ab..2eae689 100644 --- a/.env +++ b/.env @@ -1,15 +1,15 @@ -CONFIG_NAME='This is NOT development. It is not how environment works in CodeIgniter!' +CONFIG_NAME='This is development!' CONTAINER_PORT=8094 UID=1000 -SERVER_PATH = production +SERVER_PATH=production -PATH_MACHINE_LOCAL = '/home/chiefsoft/DevSites/MERMS/MermsProvision/ANSIBLE/parts/' +PATH_MACHINE_LOCAL='/home/chiefsoft/DevSites/MERMS/MermsProvision/ANSIBLE/parts/' # '/home/chiefsoft/MermsProvision/ANSIBLE/parts/' -# REMOTE_COMPOSER_PATH = 'chiefsoft@10.0.0.32:/home/chiefsoft/MermsProvision/ANSIBLE/parts/' +# REMOTE_COMPOSER_PATH='chiefsoft@10.0.0.32:/home/chiefsoft/MermsProvision/ANSIBLE/parts/' # THIS IS WHERE TO COPY GENERATED FILES - -REMOTE_COMPOSER_PATH = 'chiefsoft@10.10.10.13:/home/chiefsoft/DevSites/MERMS/MermsProvision/ANSIBLE/parts/' -DESTINATION_HOME_FOLDER = '/home/chiefsoft/SITES/' +REMOTE_COMPOSER_PATH='chiefsoft@10.10.10.13:/home/chiefsoft/DevSites/MERMS/MermsProvision/ANSIBLE/parts/' +DESTINATION_HOME_FOLDER='/home/chiefsoft/SITES/' ANSIBLE_AUTOMATION_SERVER_LOCATION="http://172.16.4.90:3000" ANSIBLE_AUTOMATION_PROJECT_ID="8" diff --git a/.env.live b/.env.live index 3e601e0..0ec5572 100644 --- a/.env.live +++ b/.env.live @@ -5,12 +5,12 @@ CI_ENVIRONMENT=production SERVER_PATH = production -PATH_MACHINE_LOCAL = '/home/chiefsoft/DevSites/MERMS/MermsProvision/ANSIBLE/parts/' +PATH_MACHINE_LOCAL='/home/chiefsoft/DevSites/MERMS/MermsProvision/ANSIBLE/parts/' # '/home/chiefsoft/MermsProvision/ANSIBLE/parts/' # REMOTE_COMPOSER_PATH = 'chiefsoft@10.0.0.32:/home/chiefsoft/MermsProvision/ANSIBLE/parts/' # THIS IS WHERE TO COPY GENERATED FILES - -REMOTE_COMPOSER_PATH = 'chiefsoft@10.10.10.13:/home/chiefsoft/DevSites/MERMS/MermsProvision/ANSIBLE/parts/' -DESTINATION_HOME_FOLDER = '/home/chiefsoft/SITES/' +REMOTE_COMPOSER_PATH='chiefsoft@10.10.10.13:/home/chiefsoft/DevSites/MERMS/MermsProvision/ANSIBLE/parts/' +DESTINATION_HOME_FOLDER='/home/chiefsoft/SITES/' ANSIBLE_AUTOMATION_SERVER_LOCATION="http://172.16.4.90:3000" diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 892beb3..0416145 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -6,84 +6,85 @@ class Home extends BaseController { public function index(): string { - return view('welcome_message'); + $data['label_env'] = $this->what_env(); + return view('welcome_message',$data); } public function what_env(): string { $curr_env = env('CONFIG_NAME','undefined?'); - echo env('CI_ENVIRONMENT'); + // echo env('CI_ENVIRONMENT'); return $curr_env; } - public function provision(): string - { - $public_path = FCPATH; - $ansible_folder = str_replace("public/", "ANSIBLE", $public_path); - $partMachineLocal = "/home/chiefsoft/MermsProvision/ANSIBLE/parts/"; - if (!is_dir($ansible_folder."/parts") ){ - mkdir($ansible_folder."/parts", 0700); - } - - $mysql = "SELECT id, uid, internal_url,product_id,status,provision_port FROM members_products WHERE provision_port = 0 "; - $query = $this->db->query($mysql); - // $num = $query->num_rows(); - $provision_list= $query->getResult(); - //$provision_list =[]; - foreach ($provision_list as $pr){ - $provisionPort = $pr->provision_port; - $productId = $pr->product_id; - $provisionUID = $pr->uid; - $ContainerName= $productId.str_pad( $pr->id, 10, "0", STR_PAD_LEFT); - $partFolder = $ansible_folder."/parts/".$provisionUID; - - $allocatedPort = 8011; - - if (!is_dir($partFolder) ){ - mkdir($partFolder, 0700); - } - - - // THIS PROVISONING COMPOSERS - $composer_template_path = $ansible_folder."/templates/composers/".$productId."/docker-compose.yml"; - $composer_template_path_local = $partMachineLocal.$provisionUID; - - $prov_name = str_replace(".", "_", $pr->internal_url).".yml"; - $template_file = $ansible_folder ."/templates/".$pr->product_id.".yml"; - //Get the domposer template file - $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; - $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("PROVISION_UID_REPLACE", $provisionUID, $composer_template_contents); - //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); - - // GET THE TEMPLATE FOR THIS PROVISIONING - $template_content = file_get_contents($template_file); - $template_content_processed = str_replace("WHAT_HOST_IN_USE", $productId."_SERVER", $template_content); - $template_content_processed = str_replace("WHAT_PART_FOLDER", $partFolder, $template_content_processed); - $template_content_processed = str_replace("DESTINATION_FOLDER", $destinationHomeFolder, $template_content_processed); - $template_content_processed = str_replace("WHAT_PART_LOCAL", $composer_template_path_local, $template_content_processed); // depends on the local machine - // CREATE PROVISOINING FILE - $myfile = fopen( $ansible_folder ."/".$prov_name, "w") or die("Unable to open file!"); - fwrite($myfile, $template_content_processed); - fclose($myfile); - } - - // echo (__dir__); - - - - - - return view('welcome_message'); - } +// public function provision(): string +// { +// $public_path = FCPATH; +// $ansible_folder = str_replace("public/", "ANSIBLE", $public_path); +// $partMachineLocal = "/home/chiefsoft/MermsProvision/ANSIBLE/parts/"; +// if (!is_dir($ansible_folder."/parts") ){ +// mkdir($ansible_folder."/parts", 0700); +// } +// +// $mysql = "SELECT id, uid, internal_url,product_id,status,provision_port FROM members_products WHERE provision_port = 0 "; +// $query = $this->db->query($mysql); +// // $num = $query->num_rows(); +// $provision_list= $query->getResult(); +// //$provision_list =[]; +// foreach ($provision_list as $pr){ +// $provisionPort = $pr->provision_port; +// $productId = $pr->product_id; +// $provisionUID = $pr->uid; +// $ContainerName= $productId.str_pad( $pr->id, 10, "0", STR_PAD_LEFT); +// $partFolder = $ansible_folder."/parts/".$provisionUID; +// +// $allocatedPort = 8011; +// +// if (!is_dir($partFolder) ){ +// mkdir($partFolder, 0700); +// } +// +// +// // THIS PROVISONING COMPOSERS +// $composer_template_path = $ansible_folder."/templates/composers/".$productId."/docker-compose.yml"; +// $composer_template_path_local = $partMachineLocal.$provisionUID; +// +// $prov_name = str_replace(".", "_", $pr->internal_url).".yml"; +// $template_file = $ansible_folder ."/templates/".$pr->product_id.".yml"; +// //Get the domposer template file +// $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; +// $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("PROVISION_UID_REPLACE", $provisionUID, $composer_template_contents); +// //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); +// +// // GET THE TEMPLATE FOR THIS PROVISIONING +// $template_content = file_get_contents($template_file); +// $template_content_processed = str_replace("WHAT_HOST_IN_USE", $productId."_SERVER", $template_content); +// $template_content_processed = str_replace("WHAT_PART_FOLDER", $partFolder, $template_content_processed); +// $template_content_processed = str_replace("DESTINATION_FOLDER", $destinationHomeFolder, $template_content_processed); +// $template_content_processed = str_replace("WHAT_PART_LOCAL", $composer_template_path_local, $template_content_processed); // depends on the local machine +// // CREATE PROVISOINING FILE +// $myfile = fopen( $ansible_folder ."/".$prov_name, "w") or die("Unable to open file!"); +// fwrite($myfile, $template_content_processed); +// fclose($myfile); +// } +// +// // echo (__dir__); +// +// +// +// $data['label_env'] = "Olusesan"; +// +// return view('welcome_message',$data); +// } } diff --git a/app/Views/welcome_message.php b/app/Views/welcome_message.php index 8cba53c..f1348b5 100644 --- a/app/Views/welcome_message.php +++ b/app/Views/welcome_message.php @@ -8,199 +8,53 @@ + + + + - -
+ + + MERMS Provision =$label_env??''?> + -MERMS Provision +| # | +First | +Last | +Handle | +
|---|---|---|---|
| 1 | +Mark | +Otto | +@mdo | +
| 2 | +Jacob | +Thornton | +@fat | +
| 3 | +Larry the Bird | +||
+
+
+
+
+
+ Sleek, intuitive, and powerful front-end framework for faster and easier web development.
+
+ Explore Bootstrap docs »
+
+
+ Bootstrap Themes
+ ·
+ Job Board
+ ·
+ Blog
+