Skip to content

Commit 13dba62

Browse files
authored
Merge pull request #25 from rfxn/codex/update-readme-and-bump-version
Bump version to 1.20.0 and refresh docs
2 parents 04e9c90 + 3d10d8a commit 13dba62

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ chmod +x apache-tuner
2626

2727
### Flags
2828
```
29-
./apache-tuner [--analyze] [--locate] [--apply] [--json] [--no-reload] [--version] [--budget <0.x>] [--log-file <path|none>]
29+
./apache-tuner [--analyze] [--locate] [--apply] [--json] [--export <path>] [--no-reload] [--mpm <type>] [--budget <0.x>] [--log-file <path|none>] [--version]
3030
```
3131
- `--json`: Return analysis as JSON (for monitoring/CM pipelines). Only valid with analyze mode.
32+
- `--export`: Write only the tuned config block to a file without editing Apache configs.
3233
- `--no-reload`: When combined with `--apply`, write the config but skip the reload/restart.
34+
- `--mpm`: Force the assumed MPM type (`prefork`, `worker`, or `event`) when detection is blocked.
3335
- `--version`: Print the current Apache Smart Tuner release.
3436
- `--budget`: Override the tier-derived Apache RAM budget with a decimal percentage (e.g., `0.40`).
3537
- `--log-file`: Send tuner logs to a custom file or `none` to disable filesystem logging.
@@ -47,6 +49,12 @@ Produce JSON suitable for automation or dashboards:
4749
./apache-tuner --json
4850
```
4951

52+
Export only the recommended block for review or CM pipelines:
53+
54+
```bash
55+
./apache-tuner --export /tmp/apache-smart-tuner.conf
56+
```
57+
5058
Inspect where existing MPM settings live:
5159

5260
```bash
@@ -66,7 +74,7 @@ Text analysis output includes environment detection, an error log & stability re
6674
------------------------------------------------
6775
Apache Smart Tuner Analysis
6876
------------------------------------------------
69-
Detected MPM: prefork
77+
Detected MPM: prefork (source: binary -V)
7078
Tier: LOW-MID
7179
Total RAM: 8192 MB
7280
CPU Cores: 4
@@ -76,7 +84,7 @@ Avg httpd proc size: 10 MB
7684
------------------------------------------------
7785
Error log & stability review
7886
------------------------------------------------
79-
[--] Log source /var/log/apache2/error.log (last 24 hours)
87+
[--] Log source /var/log/apache2/error.log (last 15000 lines)
8088
[OK] Worker saturation No MaxRequestWorkers saturation observed
8189
[OK] ServerLimit warnings No ServerLimit notices detected
8290
[OK] Process crashes/segfaults No Process crashes/segfaults observed in sampled lines.
@@ -93,7 +101,7 @@ Avg httpd proc size: 10 MB
93101
MaxConnectionsPerChild 0 => 4000
94102
------------------------------------------------
95103
# BEGIN APACHE_SMART_TUNER
96-
# Apache Smart Tuner v1.19.1 (Tier: LOW-MID, MPM: prefork)
104+
# Apache Smart Tuner v1.20.0 (Tier: LOW-MID, MPM: prefork)
97105
Timeout 120
98106
KeepAlive On
99107
MaxKeepAliveRequests 100
@@ -115,9 +123,10 @@ JSON output mirrors the same data structure for pipelines:
115123

116124
```json
117125
{
118-
"version": "1.19.1",
126+
"version": "1.20.0",
119127
"mode": "analyze",
120128
"mpm": "prefork",
129+
"mpm_source": "binary -V",
121130
"tier": "LOW-MID",
122131
"total_ram_mb": 8192,
123132
"cpu_cores": 4,
@@ -128,10 +137,11 @@ JSON output mirrors the same data structure for pipelines:
128137
"apache_budget_pct": 0.35,
129138
"apache_budget_source": "tier",
130139
"log_file": "/var/log/apache-smart-tuner.log",
131-
"recommended_block": "# BEGIN APACHE_SMART_TUNER\n# Apache Smart Tuner v1.19.1 (Tier: LOW-MID, MPM: prefork)\nTimeout 120\nKeepAlive On\nMaxKeepAliveRequests 100\nKeepAliveTimeout 5\n\n<IfModule prefork.c>\n ServerLimit 272\n MaxRequestWorkers 256\n StartServers 2\n MinSpareServers 2\n MaxSpareServers 8\n MaxConnectionsPerChild 4000\n</IfModule>\n# END APACHE_SMART_TUNER\n",
140+
"export_path": "",
141+
"recommended_block": "# BEGIN APACHE_SMART_TUNER\n# Apache Smart Tuner v1.20.0 (Tier: LOW-MID, MPM: prefork)\nTimeout 120\nKeepAlive On\nMaxKeepAliveRequests 100\nKeepAliveTimeout 5\n\n<IfModule prefork.c>\n ServerLimit 272\n MaxRequestWorkers 256\n StartServers 2\n MinSpareServers 2\n MaxSpareServers 8\n MaxConnectionsPerChild 4000\n</IfModule>\n# END APACHE_SMART_TUNER\n",
132142
"log_review": {
133143
"status": "ready",
134-
"message": "Analyzed last 15000 lines",
144+
"message": "Analyzed the last 24 hours (15000 lines)",
135145
"error_log_path": "/var/log/apache2/error.log",
136146
"sampled_lines": 15000,
137147
"scoreboard_hits": 0,
@@ -180,7 +190,7 @@ Apache keeps old children alive long enough to finish in-flight requests during
180190
- **Reload control:** When Apache is running, the tuner reloads automatically unless `--no-reload` is set; if Apache is stopped, it writes the config and logs the pending start.
181191

182192
## Versioning
183-
The project follows semantic versioning. The current release is **1.19.1**.
193+
The project follows semantic versioning. The current release is **1.20.0**.
184194

185195
## License
186196
GPL-3.0-or-later. Authored by **Ryan MacDonald <[email protected]>**.

apache-tuner

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# ==============================================================================
3-
# Apache Smart Tuner v1.19.1 for cPanel / WHM & generic Apache
3+
# Apache Smart Tuner v1.20.0 for cPanel / WHM & generic Apache
44
# Author: Ryan MacDonald <[email protected]>
55
# License: GPL-3.0-or-later
66
#
@@ -31,8 +31,8 @@
3131
set -u # keep "undefined var" safety; avoid -e/pipefail to prevent silent exits
3232

3333
VERSION_MAJOR=1
34-
VERSION_MINOR=19
35-
VERSION_PATCH=1
34+
VERSION_MINOR=20
35+
VERSION_PATCH=0
3636
VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
3737
VERSION_NAME="Apache Smart Tuner v${VERSION}"
3838

@@ -578,6 +578,7 @@ detect_configtest_cmd() {
578578
APACHE_CONFIGTEST_CMD="$FALLBACK_HTTPD"
579579
}
580580

581+
# Pin down which httpd process name to monitor before sampling memory.
581582
detect_apache_process_name() {
582583
for candidate in httpd apache2; do
583584
if ps -C "$candidate" -o pid= >/dev/null 2>&1; then
@@ -589,6 +590,7 @@ detect_apache_process_name() {
589590
APACHE_PROC_NAME="httpd"
590591
}
591592

593+
# Gather layout, platform, and MPM facts ahead of analysis or apply actions.
592594
bootstrap_environment() {
593595
detect_apache_layout
594596
detect_cpanel
@@ -950,11 +952,12 @@ extract_tuner_block() {
950952
sed -n '/# BEGIN APACHE_SMART_TUNER/,/# END APACHE_SMART_TUNER/p' "$FILE"
951953
}
952954

955+
# Normalize whitespace so block comparisons ignore cosmetic drift.
953956
normalize_block_for_compare() {
954-
# normalize whitespace/newlines for reliable comparisons
955957
printf "%s" "$1" | sed 's/[[:space:]]*$//'
956958
}
957959

960+
# Drive the main analysis path that turns runtime inputs into a config block.
958961
run_analysis_pipeline() {
959962
set_tier_params
960963
measure_apache_procs
@@ -1303,6 +1306,7 @@ config_matches_recommendation() {
13031306
[[ "$(normalize_block_for_compare "$EXISTING_BLOCK")" == "$(normalize_block_for_compare "$RECOMMENDED_BLOCK")" ]]
13041307
}
13051308

1309+
# Decide how to respond after applying the block (rollback, log, or reload).
13061310
handle_post_apply() {
13071311
local configtest_status="$1"
13081312
local backup_file="$2"
@@ -1340,6 +1344,7 @@ handle_post_apply() {
13401344
fi
13411345
}
13421346

1347+
# Apply the recommended block with backups, cleanup, and optional reloads.
13431348
apply_recommended_config() {
13441349
if [[ "$EUID" -ne 0 ]]; then
13451350
echo "ERROR: --apply must be run as root."

0 commit comments

Comments
 (0)