aboutsummaryrefslogtreecommitdiffstats
path: root/status.php
blob: 3789d9e510de992f8f1d209c532c20bc93c6ad6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
require_once('util.php');
require_once('serviceDefinitions.php');
?>
<!DOCTYPE html>
<html>

<head>
    <title>Bongo status</title>
    <link rel="stylesheet" type="text/css" href="styles.css">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

<body>
    <div class="container">
        <h1>Bongo status</h1>
        <a href="index.php">Home</a>
        <?php foreach ($services as $service) : ?>
            <hr>
            <?php
            echo '<h2>' . $service->prettyName . '</h2>';
            $containers = [];
            if (is_array($service->containerName)) {
                $containers = $service->containerName; 
            } else {
                $containers = [$service->containerName];
            }
            ?>
            <?php if ($service->luks !== null) : ?>
                <?php
                $luksDevice = $service->luks;
                $mountpoint = exec('cat /proc/mounts | grep "/dev/mapper/' . $luksDevice->mountPoint . ' /mnt/' . $luksDevice->mountPoint . '"');
                if (empty($mountpoint)) {
                    Util\createBanner('✗', '/dev/mapper/' . $luksDevice->mountPoint . ' is not mounted at /mnt/' . $luksDevice->mountPoint, 'bad');
                } else {
                    Util\createBanner('✓', '/dev/mapper/' . $luksDevice->mountPoint . ' is mounted at /mnt/' . $luksDevice->mountPoint, 'good');
                }
                ?>
                <p class="control-list">
                    <a href="mount.php?service=<?php echo $service->name ?>">[Mount device or provide encryption key]</a>
                </p>
                <p>
                <details>
                    <summary>Output</summary>

                    <code>
                        <?php echo $mountpoint ?>
                    </code>
                </details>
                </p>
            <?php endif; ?>
            <?php foreach ($containers as $containerName) : ?>
                <?php
                $status = Util\getDockerStatus($containerName);
                Util\createStatusBanner($status);
                ?>
                <?php if ($status->isNotFound === false) : ?>
                    <p class="control-list">
                        <a href="manage.php?container=<?php echo $containerName ?>">[Manage container]</a>
                    </p>
                    <p>
                    <details>
                        <summary>Status as reported by Docker</summary>

                        <?php Util\createStatusTable($status) ?>
                    </details>
                    </p>
                <?php endif; ?>
            <?php endforeach; ?>
        <?php endforeach; ?>
    </div>
</body>