Skip to content

Commit

Permalink
WIP...
Browse files Browse the repository at this point in the history
Closes #43
Implement sqlite3 to replace settings and servers json files
Add nightly branch
Refactor notifications so multiples can be sent per platform
Refactor the api functions some
Add a trait/interface function loader
Add some defines for common platforms
Fix the dialogClose function
Fix backups not being removed
Some rewording
  • Loading branch information
austinwbest committed Sep 9, 2024
1 parent c091e4c commit 66427a8
Show file tree
Hide file tree
Showing 65 changed files with 2,841 additions and 1,408 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ name: Docker

on:
push:
branches: [ "main", "develop" ]
branches: [ "main", "develop", "nightly" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main", "develop" ]
branches: [ "main", "develop", "nightly" ]

env:
# Use docker.io for Docker Hub if empty
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ RUN \
# install sockets
RUN apk add --no-cache \
php82-sockets

# install sqlite3
RUN apk add --no-cache \
sqlite \
php82-sqlite3

# add regctl for container digest checks
ARG TARGETARCH
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
## Purpose

Simple UI driven way to manage updates & notifications for Docker containers.
No database required. All settings are stored locally in a volume mount.
No database container required, all settings are stored locally with sqlite3

## Branches
- `:main` Stable releases after testing on develop
- `:develop` Usually pretty stable
- `:nightly` Use at your own risk, suggest joining Discord to keep up to date with what is going on. Might not be able to hop back to develop or main!!

## Notification triggers

Expand All @@ -21,12 +26,13 @@ No database required. All settings are stored locally in a volume mount.
## Notification platforms

- Notifiarr
- Telegram (*coming soon*)

## Update options

- Ignore
- Auto update
- Check for updates
- Auto update

## Additional features

Expand Down
30 changes: 14 additions & 16 deletions root/app/www/public/ajax/commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<div class="col-sm-12 mb-2">
<select class="form-select" id="command">
<optgroup label="docker">
<option value="dockerInspect">inspect {container}</option>
<option value="dockerNetworks">network {params}</option>
<option value="dockerPort">port {container}</option>
<option value="dockerProcessList">ps</option>
<option value="docker-inspect">inspect {container}</option>
<option value="docker-networks">network {params}</option>
<option value="docker-port">port {container}</option>
<option value="docker-processList">ps</option>
</optgroup>
</select>
</div>
Expand All @@ -42,10 +42,10 @@
</thead>
<tbody>
<?php
foreach ($serversFile as $serverIndex => $serverData) {
foreach ($serversTable as $serverId => $serverData) {
?>
<tr>
<td><input type="checkbox" class="form-check-input" id="command-<?= $serverIndex ?>"></td>
<td><input type="checkbox" class="form-check-input" id="command-<?= $serverId ?>"></td>
<td><?= $serverData['name'] ?></td>
</tr>
<?php
Expand All @@ -72,21 +72,19 @@
$servers = explode(',', $_POST['servers']);
$params = $_POST['params'];

foreach ($serversFile as $serverIndex => $serverData) {
if (in_array($serverIndex, $servers)) {
$serverOverride = $serverData;
$apiResponse = apiRequest($_POST['command'], ['name' => $_POST['container'], 'params' => $_POST['parameters']]);
foreach ($serversTable as $serverId => $serverData) {
if (in_array($serverId, $servers)) {
apiSetActiveServer($serverData['id'], $serversTable);

if ($apiResponse['code'] == 200) {
$apiResponse = $apiResponse['response']['docker'];
} else {
$apiResponse = $apiResponse['code'] .': '. $apiResponse['error'];
}
$apiResponse = apiRequest($_POST['command'], ['name' => $_POST['container'], 'params' => $_POST['parameters']]);
$apiResponse = $apiResponse['code'] == 200 ? $apiResponse['result'] : $apiResponse['code'] . ': ' . $apiResponse['error'];

?>
<h4><?= $serverData['name'] ?></h4>
<h4 class="d-inline-block"><?= $serverData['name'] ?></h4> <span class="small-text d-inline-block"><?= $serverData['url'] ?></span>
<pre style="max-height: 500px; overflow: auto;"><?= htmlspecialchars($apiResponse) ?></pre>
<?php
}
}

apiSetActiveServer(APP_SERVER_ID, $serversTable);
}
6 changes: 3 additions & 3 deletions root/app/www/public/ajax/compose.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
container_name: dockwatch
image: ghcr.io/notifiarr/dockwatch:main
ports:
- 9999:80/tcp
- ' . APP_PORT . ':80/tcp
environment:
- PGID=999
- TZ=America/New_York
Expand All @@ -35,7 +35,7 @@
closedir($dir);

if ($_POST['m'] == 'init') {
if ($_SESSION['serverIndex'] != 0) {
if ($_SESSION['activeServerId'] != APP_SERVER_ID) {
echo 'Remote compose management is not supported. Please do that on the Dockwatch instance directly.';
} else {
?>
Expand Down Expand Up @@ -176,4 +176,4 @@
} else {
echo $up;
}
}
}
Loading

0 comments on commit 66427a8

Please sign in to comment.