Skip to content
Merged

Dev #14

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.

---

## [v1.0.5] - 2026-01-07 16:00

### Added
- v1 service monitoring
- docs
- code cleaning
- other optimizations
- v1 public page added

---

## [v1.0.4] - 2025-12-18 20:46

### Added
Expand All @@ -12,6 +23,7 @@ All notable changes to this project will be documented in this file.
- Discord alerts
- New server page (graphs, ecc)
- New servers page (delete option)

---

## [v1.0.3] - 2025-12-18 20:46
Expand Down
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM php:8.4-apache

# SQLite support
RUN apt-get update && apt-get install -y --no-install-recommends \
libsqlite3-dev \
&& docker-php-ext-install pdo_sqlite \
&& rm -rf /var/lib/apt/lists/*

# Apache rewrite + .htaccess
RUN a2enmod rewrite \
&& sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf

# App
COPY php/ /var/www/html/

# Permissions:
# 1) Make everything owned by www-data so Apache can write anywhere
# 2) Set sane default perms (dirs 755, files 644)
# 3) Lock down sensitive folders: storage/db and storage/sessions
RUN set -eux; \
chown -R www-data:www-data /var/www/html; \
find /var/www/html -type d -exec chmod 0755 {} \;; \
find /var/www/html -type f -exec chmod 0644 {} \;; \
mkdir -p /var/www/html/storage/db /var/www/html/storage/sessions; \
chown -R www-data:www-data /var/www/html/storage; \
chmod 0700 /var/www/html/storage/db /var/www/html/storage/sessions; \
find /var/www/html/storage/db -type f -exec chmod 0600 {} \; || true; \
find /var/www/html/storage/sessions -type f -exec chmod 0600 {} \; || true

EXPOSE 80
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Upload all project files (from php or nodejs, ecc. directory) to your web server
Open the installer in your browser:

```
https://your-website-url/install
https://your-website-url/install/web/
```

The installer will:
Expand All @@ -83,8 +83,16 @@ Once the web interface is installed, you can start monitoring servers by install

Run the following command on each server you want to monitor:

Linux
```bash
curl -fsSL https://your-website-url/install.sh | sudo bash -s -- https://your-website-url
curl -fsSLo servermonitor-install.sh "http://localhost/install/machine/?os=linux"
sudo bash servermonitor-install.sh
```

Windows
```bash
iwr -UseBasicParsing "http://localhost/install/machine/?os=windows" -OutFile servermonitor-install.ps1
powershell -NoProfile -ExecutionPolicy Bypass -File .\servermonitor-install.ps1
```

The agent will:
Expand Down Expand Up @@ -123,14 +131,15 @@ Your setup consists of the following components:
## Latest Release

<!-- CHANGELOG:START -->
## [v1.0.4] - 2025-12-18 20:46
## [v1.0.5] - 2026-01-07 16:00

### Added
- Simple Login
- Windows support
- Discord alerts
- New server page (graphs, ecc)
- New servers page (delete option)
- v1 service monitoring
- docs
- code cleaning
- other optimizations
- v1 public page added

---

<!-- CHANGELOG:END -->
Expand Down
25 changes: 25 additions & 0 deletions php/app/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,31 @@
$db->exec('PRAGMA synchronous = NORMAL;');
$db->exec('PRAGMA busy_timeout = 5000;');

/**
* Redirect user to installer when DB is missing / schema not ready.
*/
$installerUrl = '/install/web/index.php';

// Avoid redirect loop if we're already in installer
$requestUri = $_SERVER['REQUEST_URI'] ?? '';
if (str_starts_with($requestUri, '/install/')) {
// continue bootstrap without guarding
} else {
try {
// If table doesn't exist, this will throw (with ERRMODE_EXCEPTION)
$stmt = $db->query('SELECT 1 FROM servers LIMIT 1');

// Extra safety: some wrappers/drivers may still return false
if ($stmt === false) {
header('Location: ' . $installerUrl, true, 302);
exit;
}
} catch (Throwable) {
header('Location: ' . $installerUrl, true, 302);
exit;
}
}

// Enforce secure session behavior to reduce fixation and hijacking risk.
ini_set('session.use_strict_mode', '1');
ini_set('session.use_only_cookies', '1');
Expand Down
25 changes: 16 additions & 9 deletions php/public/index.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?php

require_once __DIR__ . '/../App/Bootstrap.php';

use Auth\Guard;

Guard::protect();

/**
Expand Down Expand Up @@ -166,7 +164,7 @@
<div class="d-flex min-vh-100">

<!-- SIDEBAR -->
<aside class="sidebar p-3 bg-body-tertiary">
<aside class="sidebar p-3 bg-body-tertiary d-flex flex-column">

<div class="fw-semibold mb-3">
<i class="fa-solid fa-gauge-high me-1"></i>
Expand Down Expand Up @@ -213,15 +211,24 @@

</nav>

<hr class="mt-4">
<!-- PUSHES BUTTONS TO BOTTOM -->
<div class="mt-auto">

<a href="/logout.php" class="btn btn-sm btn-outline-secondary w-100">
<i class="fa-solid fa-right-from-bracket me-1"></i>
Logout
</a>
<hr>

</aside>
<a href="/docs" class="btn btn-sm btn-outline-secondary w-100 mb-2">
<i class="fa-solid fa-book me-1"></i>
Docs
</a>

<a href="/logout.php" class="btn btn-sm btn-outline-secondary w-100">
<i class="fa-solid fa-right-from-bracket me-1"></i>
Logout
</a>

</div>

</aside>

<!-- CONTENT -->
<main class="flex-grow-1 p-4">
Expand Down
Loading