Skip to content

Commit

Permalink
Merge pull request #62 from cytopia/release-0.10
Browse files Browse the repository at this point in the history
Release v0.10
  • Loading branch information
cytopia authored May 26, 2017
2 parents 38cab08 + fac2025 commit d09a588
Show file tree
Hide file tree
Showing 33 changed files with 714 additions and 234 deletions.
10 changes: 8 additions & 2 deletions .devilbox/www/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
putenv('RES_OPTIONS=retrans:1 retry:1 timeout:1 attempts:1');


$DEVILBOX_VERSION = 'v0.9';
$DEVILBOX_DATE = '2017-05-20';
$DEVILBOX_VERSION = 'v0.10';
$DEVILBOX_DATE = '2017-05-26';
$DEVILBOX_API_PAGE = 'devilbox-api/status.json';

//
Expand Down Expand Up @@ -41,6 +41,7 @@
$PGSQL_HOST_NAME = 'pgsql';
$REDIS_HOST_NAME = 'redis';
$MEMCD_HOST_NAME = 'memcd';
$MONGO_HOST_NAME = 'mongo';


//
Expand Down Expand Up @@ -132,6 +133,11 @@ function loadClass($class) {
$_LOADED_LIBS[$class] = \devilbox\Memcd::getInstance($GLOBALS['MEMCD_HOST_NAME']);
break;

case 'Mongo':
loadFile($class, $cnt_dir);
$_LOADED_LIBS[$class] = \devilbox\Mongo::getInstance($GLOBALS['MONGO_HOST_NAME']);
break;

// Get optional docker classes
default:
// Redis
Expand Down
50 changes: 50 additions & 0 deletions .devilbox/www/htdocs/db_mongo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php require '../config.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php echo loadClass('Html')->getHead(); ?>
</head>

<body>
<?php echo loadClass('Html')->getNavbar(); ?>

<div class="container">

<h1>MongoDB Databases</h1>
<br/>
<br/>

<div class="row">
<div class="col-md-12">

<?php if (!loadClass('Mongo')->isAvailable()): ?>
<p>MongoDB container is not running.</p>
<?php else: ?>
<table class="table table-striped ">
<thead class="thead-inverse ">
<tr>
<th>Name</th>
<th>Size</th>
<th>Empty</th>
</th>
</thead>
<tbody>
<?php foreach (loadClass('Mongo')->getDatabases() as $db): ?>
<tr>
<td><?php echo $db['name'];?></td>
<td><?php echo round($db['size']/(1024*1024), 2);?> MB</td>
<td><?php echo $db['empty'];?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>

</div>
</div>

</div><!-- /.container -->

<?php echo loadClass('Html')->getFooter(); ?>
</body>
</html>
64 changes: 63 additions & 1 deletion .devilbox/www/htdocs/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
$avail_pgsql = loadClass('Pgsql')->isAvailable();
$avail_redis = loadClass('Redis')->isAvailable();
$avail_memcd = loadClass('Memcd')->isAvailable();
$avail_mongo = loadClass('Mongo')->isAvailable();


/*************************************************************
Expand Down Expand Up @@ -150,6 +151,32 @@
);
}

// ---- MONGO ----
if ($avail_mongo) {
$host = $GLOBALS['MONGO_HOST_NAME'];
$succ = loadClass('Mongo')->canConnect($error, $host);
$connection['MongoDB'][$host] = array(
'error' => $error,
'host' => $host,
'succ' => $succ
);
$host = loadClass('Mongo')->getIpAddress();
$succ = loadClass('Mongo')->canConnect($error, $host);
$connection['MongoDB'][$host] = array(
'error' => $error,
'host' => $host,
'succ' => $succ
);
$host = '127.0.0.1';
$succ = loadClass('Mongo')->canConnect($error, $host);
$connection['MongoDB'][$host] = array(
'error' => $error,
'host' => $host,
'succ' => $succ
);
}


// ---- BIND (required)----
$host = $GLOBALS['DNS_HOST_NAME'];
$succ = loadClass('Dns')->canConnect($error, $host);
Expand Down Expand Up @@ -288,7 +315,7 @@
<?php echo loadClass('Html')->getCirle('memcd'); ?>
</div>
<div class="col-xl-4 col-lg-6 col-md-6 col-sm-12 col-xs-4" style="margin-bottom:15px;">
<?php echo loadClass('Html')->getCirle('mongodb'); ?>
<?php echo loadClass('Html')->getCirle('mongo'); ?>
</div>
</div>
</div>
Expand Down Expand Up @@ -516,6 +543,13 @@
<td><?php echo loadClass('Memcd')->getIpAddress(); ?></td>
</tr>
<?php endif; ?>
<?php if ($avail_mongo): ?>
<tr>
<th>mongo</th>
<td><?php echo $GLOBALS['MONGO_HOST_NAME']; ?></td>
<td><?php echo loadClass('Mongo')->getIpAddress(); ?></td>
</tr>
<?php endif; ?>
<?php if ($avail_dns): ?>
<tr>
<th>bind</th>
Expand Down Expand Up @@ -585,6 +619,13 @@
<td>11211</td>
</tr>
<?php endif; ?>
<?php if ($avail_mongo): ?>
<tr>
<th>mongo</th>
<td><?php echo loadClass('Helper')->getEnv('LOCAL_LISTEN_ADDR').loadClass('Helper')->getEnv('HOST_PORT_MONGO');?></td>
<td>27017</td>
</tr>
<?php endif; ?>
<?php if ($avail_dns): ?>
<tr>
<th>bind</th>
Expand Down Expand Up @@ -656,6 +697,13 @@
<td>-</td>
</tr>
<?php endif; ?>
<?php if ($avail_mongo): ?>
<tr>
<th>mongo</th>
<td><?php echo loadClass('Helper')->getEnv('HOST_PATH_MONGO_DATADIR'); ?></td>
<td>/data/db</td>
</tr>
<?php endif; ?>
<?php if ($avail_dns): ?>
<tr>
<th>bind</th>
Expand Down Expand Up @@ -724,6 +772,13 @@
<td>-</td>
</tr>
<?php endif; ?>
<?php if ($avail_mongo): ?>
<tr>
<th>mongo</th>
<td>-</td>
<td>-</td>
</tr>
<?php endif; ?>
<?php if ($avail_dns): ?>
<tr>
<th>bind</th>
Expand Down Expand Up @@ -792,6 +847,13 @@
<td>/var/log/memcached</td>
</tr>
<?php endif; ?>
<?php if ($avail_mongo): ?>
<tr>
<th>mongo</th>
<td>-</td>
<td>-</td>
</tr>
<?php endif; ?>
<?php if ($avail_dns): ?>
<tr>
<th>bind</th>
Expand Down
48 changes: 48 additions & 0 deletions .devilbox/www/htdocs/info_mongo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php require '../config.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php echo loadClass('Html')->getHead(); ?>
</head>

<body>
<?php echo loadClass('Html')->getNavbar(); ?>

<div class="container">

<h1>MongoDB Info</h1>
<br/>
<br/>

<div class="row">
<div class="col-md-12">

<?php if (!loadClass('Mongo')->isAvailable()): ?>
<p>MongoDB container is not running.</p>
<?php else: ?>
<table class="table table-striped">
<thead class="thead-inverse">
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach (loadClass('Mongo')->getInfo() as $key => $val): ?>
<tr>
<td><?php print_r($key);?></td>
<td class="break-word"><pre><?php print_r($val);?></pre></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>

</div>
</div>

</div><!-- /.container -->

<?php echo loadClass('Html')->getFooter(); ?>
</body>
</html>
14 changes: 14 additions & 0 deletions .devilbox/www/include/lib/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class Html
'name' => 'PgSQL DB',
'path' => '/db_pgsql.php'
),
array(
'name' => 'MongoDB DB',
'path' => '/db_mongo.php'
),
array(
'name' => 'Redis DB',
'path' => '/db_redis.php'
Expand Down Expand Up @@ -63,6 +67,10 @@ class Html
'name' => 'PgSQL Info',
'path' => '/info_pgsql.php'
),
array(
'name' => 'MongoDB Info',
'path' => '/info_mongo.php'
),
array(
'name' => 'Redis Info',
'path' => '/info_redis.php'
Expand Down Expand Up @@ -271,6 +279,12 @@ public function getCirle($name)
$available = loadClass('Memcd')->isAvailable();
$name = loadClass('Memcd')->getName();
break;
case 'mongo':
$class = 'bg-danger';
$version = loadClass('Mongo')->getVersion();
$available = loadClass('Mongo')->isAvailable();
$name = loadClass('Mongo')->getName();
break;
default:
$available = false;
$version = '';
Expand Down
Loading

0 comments on commit d09a588

Please sign in to comment.