This commit is contained in:
@@ -12,7 +12,7 @@ function ping_redis() {
|
||||
else return false;
|
||||
}
|
||||
|
||||
function check_install() {
|
||||
function check_install() { // is install in progress
|
||||
|
||||
global $REDIS_HOST;
|
||||
|
||||
@@ -42,8 +42,9 @@ function check_redis($group="scheduler_in", $key="") {
|
||||
$members = $redis->sMembers($group); // redis-cli -h redis-server smembers $group
|
||||
//print_r($members);
|
||||
|
||||
$result = array();
|
||||
foreach ($members as $member) {
|
||||
if ($key!="" && $member!=$key) continue; // check a specific key in a group
|
||||
if ($key!="" && $member!=$key) continue; // find a specific key in a group
|
||||
|
||||
$value = $redis->get($member);
|
||||
$json_data = base64_decode($value);
|
||||
@@ -52,10 +53,11 @@ function check_redis($group="scheduler_in", $key="") {
|
||||
echo "JSON read error...";
|
||||
// TODO json error
|
||||
}
|
||||
else {
|
||||
return array("$member" => $data);
|
||||
else {
|
||||
$result["$member"] = $data;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
14
index.html
14
index.html
@@ -48,12 +48,12 @@ function redirectToManage() {
|
||||
window.location.href = 'manage.html';
|
||||
}
|
||||
|
||||
function start_init() {
|
||||
var url = 'scan.php?op=init';
|
||||
function start_system() {
|
||||
var url = 'scan.php?op=system';
|
||||
$.get(url, function(data){
|
||||
if (data=='OK') {
|
||||
$("#previous").html('Scanning for previous install. Please wait...');
|
||||
check_init();
|
||||
check_system();
|
||||
}
|
||||
else {
|
||||
$("#previous").html('Scanning for previous install has aborted...');
|
||||
@@ -61,8 +61,8 @@ function start_init() {
|
||||
});
|
||||
}
|
||||
|
||||
function check_init() {
|
||||
var url = 'scan.php?op=check_init';
|
||||
function check_system() {
|
||||
var url = 'scan.php?op=check_system';
|
||||
$.get(url, function(data){
|
||||
console.log(data);
|
||||
if (data=='NEW') {
|
||||
@@ -74,7 +74,7 @@ function check_init() {
|
||||
setTimeout(redirectToManage, 3000);
|
||||
}
|
||||
else if (data=='WAIT') {
|
||||
setTimeout(check_init, 1000);
|
||||
setTimeout(check_system, 1000);
|
||||
}
|
||||
else {
|
||||
// UNEXPECTED ERROR
|
||||
@@ -86,7 +86,7 @@ function check_init() {
|
||||
$.get(url, function(data){
|
||||
if (data=='OK') {
|
||||
$("#redis").html('Redis server - OK');
|
||||
start_init();
|
||||
start_system();
|
||||
}
|
||||
else {
|
||||
$("#redis").html('Redis server is not available...');
|
||||
|
25
manage.html
25
manage.html
@@ -70,6 +70,7 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.6/dist/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.2.1/dist/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
|
||||
<script>
|
||||
|
||||
function check_repositories() {
|
||||
var url = 'scan.php?op=check_repositories';
|
||||
jQuery.get(url, function(data) {
|
||||
@@ -89,8 +90,27 @@ function get_repositories() {
|
||||
});
|
||||
}
|
||||
|
||||
function check_system() {
|
||||
var url = 'scan.php?op=check_system&services=1';
|
||||
jQuery.get(url, function(data) {
|
||||
if (data!="") {
|
||||
jQuery("#system").html(data);
|
||||
}
|
||||
else setTimeout(check_system, 500);
|
||||
});
|
||||
}
|
||||
|
||||
function get_system() {
|
||||
var url = 'scan.php?op=system';
|
||||
jQuery.get(url, function(data) {
|
||||
if (data=="OK") {
|
||||
setTimeout(check_system, 500);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function check_deployments() {
|
||||
var url = 'scan.php?op=check_init&services=1';
|
||||
var url = 'scan.php?op=check_deployments&services=1';
|
||||
jQuery.get(url, function(data) {
|
||||
if (data!="") {
|
||||
jQuery("#deployments").html(data);
|
||||
@@ -100,14 +120,13 @@ function check_deployments() {
|
||||
}
|
||||
|
||||
function get_deployments() {
|
||||
var url = 'scan.php?op=init';
|
||||
var url = 'scan.php?op=deployments';
|
||||
jQuery.get(url, function(data) {
|
||||
if (data=="OK") {
|
||||
setTimeout(check_deployments, 500);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function check_containers() {
|
||||
var url = 'scan.php?op=check_containers';
|
||||
jQuery.get(url, function(data) {
|
||||
|
76
scan.php
76
scan.php
@@ -28,6 +28,52 @@ switch ($_GET["op"]) {
|
||||
}
|
||||
else echo "NOT EXISTS";
|
||||
break;
|
||||
case "system":
|
||||
$arr = array("STATUS" => 0);
|
||||
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
||||
|
||||
$op = "system"; //"init:".date("YmdHis");
|
||||
redis_set($op,$json);
|
||||
echo "OK"; // TODO?
|
||||
break;
|
||||
case "check_system":
|
||||
$arr = check_redis("web_out","system");
|
||||
if (!empty($arr)) {
|
||||
foreach ($arr as $key=>$data) {
|
||||
if ($key=="system") {
|
||||
if ($data["INSTALL_STATUS"]==2) echo "NEW";
|
||||
elseif ($data["INSTALL_STATUS"]==1) {
|
||||
if ($_GET["services"]==1) {
|
||||
$deployments = "";
|
||||
foreach ($data["INSTALLED_SERVICES"] as $service_name => $content) {
|
||||
//echo base64_decode($content);
|
||||
echo $service_name."<br>";
|
||||
}
|
||||
echo $deployments."<br>";
|
||||
}
|
||||
else echo "EXISTS";
|
||||
}
|
||||
redis_remove("$key");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else echo "WAIT";
|
||||
$arr = check_redis("web_out","repositories");
|
||||
if (!empty($arr)) {
|
||||
foreach ($arr as $key=>$data) {
|
||||
}
|
||||
}
|
||||
else echo "";
|
||||
break;
|
||||
case "deployments":
|
||||
$arr = array("STATUS" => 0);
|
||||
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
||||
|
||||
$op = "deployments";
|
||||
redis_set($op,$json);
|
||||
echo "OK"; // TODO?
|
||||
break;
|
||||
case "repositories":
|
||||
$arr = array("STATUS" => 0);
|
||||
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
||||
@@ -48,36 +94,6 @@ switch ($_GET["op"]) {
|
||||
}
|
||||
else echo "";
|
||||
break;
|
||||
case "init":
|
||||
$arr = array("STATUS" => 0);
|
||||
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
||||
|
||||
$op = "init:".date("YmdHis");
|
||||
redis_set($op,$json);
|
||||
echo "OK"; // TODO?
|
||||
break;
|
||||
case "check_init":
|
||||
$arr = check_redis("web_out");
|
||||
if (!empty($arr)) {
|
||||
foreach ($arr as $key=>$data) {
|
||||
|
||||
if ($data["INSTALL_STATUS"]==2) echo "NEW";
|
||||
elseif ($data["INSTALL_STATUS"]==1) {
|
||||
if ($_GET["services"]==1) {
|
||||
$deployments = "";
|
||||
foreach ($data["INSTALLED_SERVICES"] as $service_name => $content) {
|
||||
//echo base64_decode($content);
|
||||
echo $service_name."<br>";
|
||||
}
|
||||
echo $deployments."<br>";
|
||||
}
|
||||
else echo "EXISTS";
|
||||
}
|
||||
redis_remove("$key");
|
||||
}
|
||||
}
|
||||
else echo "WAIT";
|
||||
break;
|
||||
case "containers":
|
||||
$arr = array("STATUS" => 0);
|
||||
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
||||
|
Reference in New Issue
Block a user