Skip to content

Commit c20add1

Browse files
authored
Updates
1 parent a0c006c commit c20add1

18 files changed

Lines changed: 140 additions & 57 deletions

.github/workflows/enginescript-build-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ jobs:
178178
179179
# Create EngineScript log files (already done in earlier step, but ensure completeness)
180180
echo "📊 Creating log files..." | sudo tee -a /tmp/ci-logs/setup.log
181-
sudo touch "/var/log/EngineScript/install-error-log.txt"
182-
sudo touch "/var/log/EngineScript/install-log.txt"
181+
sudo touch "/var/log/EngineScript/install-error-log.log"
182+
sudo touch "/var/log/EngineScript/install-log.log"
183183
sudo touch "/var/log/EngineScript/vhost-export.log"
184184
sudo touch "/var/log/EngineScript/vhost-import.log"
185185
sudo touch "/var/log/EngineScript/vhost-install.log"

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,31 @@ Changes are organized by date, with the most recent changes listed first.
3838
- **Testing Ready**: Preserved all logic with clear "DISABLED FOR TESTING" notation for future re-enabling
3939
- **WordPress Site Health**: May show cosmetic caching warning but no functional impact
4040

41+
### 🔄 AUTO-UPGRADE SYSTEM IMPLEMENTATION
42+
43+
- **Configuration Auto-Deployment**: Implemented comprehensive auto-upgrade system for EngineScript configuration updates
44+
- **Nginx Configuration Updates**: Auto-deployment of nginx.conf and global configuration files during upgrades
45+
- **SSL Header Cleanup**: Automatic wp-config.php SSL header cleanup to prevent Cloudflare conflicts
46+
- **Safe Installation Path**: Ensures upgrade system works from `/usr/local/bin/enginescript/` installation directory
47+
- **Future-Ready**: Infrastructure prepared for automated deployment of future configuration improvements
48+
49+
### 📋 INSTALL LOG STANDARDIZATION
50+
51+
- **File Extension Consistency**: Standardized all install log files to use `.log` extension instead of `.txt`
52+
- **Logrotate Compatibility**: Changed `install-log.txt` and `install-error-log.txt` to `.log` extensions
53+
- **System Integration**: Prevents install logs from being rotated by logrotate, preserving install state tracking
54+
- **Codebase-Wide Update**: Updated 50+ files across entire EngineScript system for consistency
55+
- **GitHub Workflow**: Updated CI/CD workflows to create `.log` files instead of `.txt`
56+
- **Documentation Sync**: Updated all documentation and configuration references to reflect new extensions
57+
58+
### 🚫 LOGROTATE SERVICE DISABLING
59+
60+
- **EngineScript Logrotate Removal**: Disabled installation of EngineScript-specific logrotate configuration
61+
- **Install Log Preservation**: Prevents important install tracking logs from being automatically rotated
62+
- **System Safety**: Avoids interference with critical system logs and installation state tracking
63+
- **Auto-Upgrade Cleanup**: Added automatic removal of existing EngineScript logrotate configurations during upgrades
64+
- **Selective Approach**: Maintains logrotate for nginx, domains, opcache, and PHP-FPM logs only
65+
4166
## 2025-08-30
4267

4368
### 🔒 UBUNTU PRO SECURITY ENHANCEMENTS
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/var/log/EngineScript/*.log /var/log/EngineScript/*.txt {
1+
/var/log/EngineScript/*.log {
22
monthly
33
missingok
44
rotate 6
@@ -8,13 +8,6 @@
88
create 0644 root root
99
sharedscripts
1010

11-
prerotate
12-
if [ "$1" = "/var/log/EngineScript/install-log.txt" ] || [ "$1" = "/var/log/EngineScript/install-error-log.txt" ]; then
13-
# Skip rotation for install log and install error log
14-
exit 0
15-
fi
16-
endscript
17-
1811
postrotate
1912
endscript
2013
}

config/home/enginescript-install-options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# EngineScript Install Debug Mode
2020
# Prompts the user to continue or exit after each portion of the install script has run.
2121
# Debug mode will print any errors that each install script encounters.
22-
# Regardless of whether debug mode is enabled, EngineScript will generate a complete log of the script errors will be located at touch /var/log/EngineScript/install-error-log.txt
22+
# Regardless of whether debug mode is enabled, EngineScript will generate a complete log of the script errors will be located at touch /var/log/EngineScript/install-error-log.log
2323
# Run command es.debug to generate a complete server and error log. This is useful when submitting a GitHub issue.
2424
DEBUG_INSTALL=0
2525

scripts/functions/alias/alias-debug.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ GREEN="\e[32m"
3030
YELLOW="\e[33m"
3131

3232
# Persistent error log path
33-
ERROR_LOG="/var/log/EngineScript/install-error-log.txt"
33+
ERROR_LOG="/var/log/EngineScript/install-error-log.log"
3434

3535
# Function to log errors to persistent error log
3636
log_error() {
@@ -407,7 +407,7 @@ cat << 'EOF' >> "$DEBUG_FILE"
407407
EOF
408408

409409
# Append install error log if it exists
410-
if [[ -f /var/log/EngineScript/install-error-log.txt ]]; then
410+
if [[ -f /var/log/EngineScript/install-error-log.log ]]; then
411411
echo -e "\n## EngineScript Install Error Log (Full Contents)\n" >> "$DEBUG_FILE"
412-
cat /var/log/EngineScript/install-error-log.txt >> "$DEBUG_FILE"
412+
cat /var/log/EngineScript/install-error-log.log >> "$DEBUG_FILE"
413413
fi

scripts/functions/auto-upgrade/normal-auto-upgrade.sh

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,79 @@ source /home/EngineScript/enginescript-install-options.txt
1414
# Source shared functions library
1515
source /usr/local/bin/enginescript/scripts/functions/shared/enginescript-common.sh
1616

17+
# Verify EngineScript installation is complete before proceeding
18+
verify_installation_completion
1719

1820
#----------------------------------------------------------------------------------
1921
# Start Main Script
2022

2123
# Upgrade Scripts will be found below:
2224

23-
# Fix MariaDB configuration - replace MySQL-specific log_error_verbosity with MariaDB log_warnings
24-
if [[ -f "/etc/mysql/my.cnf" ]]; then
25-
sed -i 's/log_error_verbosity/log_warnings/g' /etc/mysql/my.cnf
25+
# Update Nginx configuration files with security and performance improvements (September 2025)
26+
echo "Updating Nginx configuration files with latest security enhancements..."
27+
28+
# Fix nginx.conf redirect caching - replace separate 301/302 lines with combined line
29+
if [[ -f "/etc/nginx/nginx.conf" ]]; then
30+
sed -i '/fastcgi_cache_valid 301 1d;/c\ fastcgi_cache_valid 301 302 0;' /etc/nginx/nginx.conf
31+
sed -i '/fastcgi_cache_valid 302 1h;/d' /etc/nginx/nginx.conf
32+
echo "✓ Updated nginx.conf (redirect loop prevention)"
33+
fi
34+
35+
# FastCGI modified config - WordPress HTTPS detection for Cloudflare
36+
if [[ -f "/etc/nginx/globals/fastcgi-modified.conf" ]]; then
37+
cp "/usr/local/bin/enginescript/config/etc/nginx/globals/fastcgi-modified.conf" "/etc/nginx/globals/fastcgi-modified.conf"
38+
echo "✓ Updated fastcgi-modified.conf (WordPress HTTPS detection)"
39+
fi
40+
41+
# PHP-FPM config - WooCommerce session bleeding prevention
42+
if [[ -f "/etc/nginx/globals/php-fpm.conf" ]]; then
43+
cp "/usr/local/bin/enginescript/config/etc/nginx/globals/php-fpm.conf" "/etc/nginx/globals/php-fpm.conf"
44+
echo "✓ Updated php-fpm.conf (WooCommerce session security)"
45+
fi
46+
47+
# Map cache config - X-Cache-Enabled logic optimization
48+
if [[ -f "/etc/nginx/globals/map-cache.conf" ]]; then
49+
cp "/usr/local/bin/enginescript/config/etc/nginx/globals/map-cache.conf" "/etc/nginx/globals/map-cache.conf"
50+
echo "✓ Updated map-cache.conf (performance optimization)"
51+
fi
52+
53+
# Response headers config - X-Cache-Enabled header cleanup
54+
if [[ -f "/etc/nginx/globals/response-headers.conf" ]]; then
55+
cp "/usr/local/bin/enginescript/config/etc/nginx/globals/response-headers.conf" "/etc/nginx/globals/response-headers.conf"
56+
echo "✓ Updated response-headers.conf (header optimization)"
57+
fi
58+
59+
# Remove deprecated SSL defines from wp-config.php files
60+
if [[ -f "/home/EngineScript/sites-list/sites.sh" ]]; then
61+
source /home/EngineScript/sites-list/sites.sh
62+
echo "Removing deprecated SSL defines from wp-config.php files..."
63+
64+
for site in "${SITES[@]}"
65+
do
66+
wp_config_file="/var/www/sites/$site/html/wp-config.php"
67+
if [[ -f "$wp_config_file" ]]; then
68+
# Remove the SSL comment and defines (lines that were removed from template)
69+
sed -i '/\/\* SSL \*\//d' "$wp_config_file"
70+
sed -i "/define( 'FORCE_SSL_ADMIN', true );/d" "$wp_config_file"
71+
sed -i "/define( 'FORCE_SSL_LOGIN', true );/d" "$wp_config_file"
72+
echo "✓ Updated wp-config.php for site: $site"
73+
fi
74+
done
75+
else
76+
echo "Sites list not found - skipping wp-config.php updates"
77+
fi
78+
79+
# Test nginx configuration and reload if valid
80+
if nginx -t > /dev/null 2>&1; then
81+
systemctl reload nginx
82+
echo "✓ Nginx configuration updated and reloaded successfully"
83+
else
84+
echo "✗ Nginx configuration test failed - please check nginx logs"
85+
fi
86+
87+
# Remove EngineScript logrotate configuration to preserve install logs (September 2025)
88+
if [[ -f "/etc/logrotate.d/enginescript" ]]; then
89+
rm -f "/etc/logrotate.d/enginescript"
90+
echo "✓ Removed EngineScript logrotate configuration (preserves install logs)"
2691
fi
2792

scripts/functions/shared/enginescript-common.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function debug_pause() {
3232
function print_last_errors() {
3333
# Always append errors to persistent log if any
3434
if [[ -s /tmp/enginescript_install_errors.log ]]; then
35-
cat /tmp/enginescript_install_errors.log >> /var/log/EngineScript/install-error-log.txt
35+
cat /tmp/enginescript_install_errors.log >> /var/log/EngineScript/install-error-log.log
3636
fi
3737
# Only show errors to user if debug mode is enabled
3838
if [[ "${DEBUG_INSTALL}" == "1" ]] && [[ -s /tmp/enginescript_install_errors.log ]]; then
@@ -304,7 +304,7 @@ function set_php_permissions() {
304304
# Check if all required EngineScript installation components are completed
305305
# Returns 0 if all components are installed, exits with error if incomplete
306306
function check_installation_completion() {
307-
local install_log="/var/log/EngineScript/install-log.txt"
307+
local install_log="/var/log/EngineScript/install-log.log"
308308
local missing_components=()
309309
local quiet_mode="${1:-false}" # Optional parameter for quiet mode
310310

@@ -354,7 +354,7 @@ function check_installation_completion() {
354354
echo ""
355355
echo "RESOLUTION:"
356356
echo "1. Run the full EngineScript installation script to complete setup"
357-
echo "2. Check /var/log/EngineScript/install-error-log.txt for specific errors"
357+
echo "2. Check /var/log/EngineScript/install-error-log.log for specific errors"
358358
echo "3. Use 'es.debug' command to generate a complete diagnostic report"
359359
echo ""
360360
fi

scripts/install/depends/depends-install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,4 @@ update-alternatives --set editor /bin/nano
174174
#chmod +x /usr/local/bin/cht.sh
175175

176176
# Mark the installation as complete
177-
echo "DEPENDS=1" >> /var/log/EngineScript/install-log.txt
177+
echo "DEPENDS=1" >> /var/log/EngineScript/install-log.log

scripts/install/enginescript-install.sh

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,15 @@ if [[ "$WP_ADMIN_PASSWORD" = PLACEHOLDER ]];
218218
fi
219219

220220
# Install Check
221-
source /var/log/EngineScript/install-log.txt
221+
source /var/log/EngineScript/install-log.log
222222

223223
# Repositories
224224
if [[ "${REPOS}" = 1 ]];
225225
then
226226
echo "REPOS script has already run"
227227
else
228228
/usr/local/bin/enginescript/scripts/install/repositories/repositories-install.sh 2>> /tmp/enginescript_install_errors.log
229-
echo "REPOS=1" >> /var/log/EngineScript/install-log.txt
229+
echo "REPOS=1" >> /var/log/EngineScript/install-log.log
230230
fi
231231
print_last_errors
232232
debug_pause "Install Repositories"
@@ -237,7 +237,7 @@ if [[ "${REMOVES}" = 1 ]];
237237
echo "REMOVES script has already run"
238238
else
239239
/usr/local/bin/enginescript/scripts/install/removes/remove-preinstalled.sh 2>> /tmp/enginescript_install_errors.log
240-
echo "REMOVES=1" >> /var/log/EngineScript/install-log.txt
240+
echo "REMOVES=1" >> /var/log/EngineScript/install-log.log
241241
fi
242242
print_last_errors
243243
debug_pause "Remove Preinstalled Software"
@@ -248,7 +248,7 @@ if [[ "${BLOCK}" = 1 ]];
248248
echo "BLOCK script has already run"
249249
else
250250
/usr/local/bin/enginescript/scripts/install/block/package-block.sh 2>> /tmp/enginescript_install_errors.log
251-
echo "BLOCK=1" >> /var/log/EngineScript/install-log.txt
251+
echo "BLOCK=1" >> /var/log/EngineScript/install-log.log
252252
fi
253253
print_last_errors
254254
debug_pause "Block Unwanted Packages"
@@ -259,7 +259,7 @@ if [[ "${UBUNTU_PRO}" = 1 ]];
259259
echo "UBUNTU_PRO script has already run"
260260
else
261261
/usr/local/bin/enginescript/scripts/install/ubuntu-pro/ubuntu-pro-install.sh 2>> /tmp/enginescript_install_errors.log
262-
echo "UBUNTU_PRO=1" >> /var/log/EngineScript/install-log.txt
262+
echo "UBUNTU_PRO=1" >> /var/log/EngineScript/install-log.log
263263
fi
264264
print_last_errors
265265
debug_pause "Ubuntu Pro Setup"
@@ -285,7 +285,7 @@ if [[ "${CRON}" = 1 ]];
285285
echo "CRON script has already run."
286286
else
287287
/usr/local/bin/enginescript/scripts/install/cron/cron-install.sh 2>> /tmp/enginescript_install_errors.log
288-
echo "CRON=1" >> /var/log/EngineScript/install-log.txt
288+
echo "CRON=1" >> /var/log/EngineScript/install-log.log
289289
fi
290290
print_last_errors
291291
debug_pause "Cron"
@@ -296,7 +296,7 @@ if [[ "${ACME}" = 1 ]];
296296
echo "ACME.sh script has already run"
297297
else
298298
/usr/local/bin/enginescript/scripts/install/acme/acme-install.sh 2>> /tmp/enginescript_install_errors.log
299-
echo "ACME=1" >> /var/log/EngineScript/install-log.txt
299+
echo "ACME=1" >> /var/log/EngineScript/install-log.log
300300
fi
301301
print_last_errors
302302
debug_pause "ACME.sh"
@@ -307,7 +307,7 @@ if [[ "${GCC}" = 1 ]];
307307
echo "GCC script has already run."
308308
else
309309
/usr/local/bin/enginescript/scripts/install/gcc/gcc-install.sh 2>> /tmp/enginescript_install_errors.log
310-
echo "GCC=1" >> /var/log/EngineScript/install-log.txt
310+
echo "GCC=1" >> /var/log/EngineScript/install-log.log
311311
fi
312312
print_last_errors
313313
debug_pause "GCC"
@@ -318,7 +318,7 @@ if [[ "${OPENSSL}" = 1 ]];
318318
echo "OPENSSL script has already run."
319319
else
320320
/usr/local/bin/enginescript/scripts/install/openssl/openssl-install.sh 2>> /tmp/enginescript_install_errors.log
321-
echo "OPENSSL=1" >> /var/log/EngineScript/install-log.txt
321+
echo "OPENSSL=1" >> /var/log/EngineScript/install-log.log
322322
fi
323323
print_last_errors
324324
debug_pause "OpenSSL"
@@ -329,7 +329,7 @@ if [[ "${SWAP}" = 1 ]];
329329
echo "SWAP script has already run."
330330
else
331331
/usr/local/bin/enginescript/scripts/install/swap/swap-install.sh 2>> /tmp/enginescript_install_errors.log
332-
echo "SWAP=1" >> /var/log/EngineScript/install-log.txt
332+
echo "SWAP=1" >> /var/log/EngineScript/install-log.log
333333
fi
334334
print_last_errors
335335
debug_pause "Swap"
@@ -340,7 +340,7 @@ if [[ "${KERNEL_TWEAKS}" = 1 ]];
340340
echo "KERNEL TWEAKS script has already run."
341341
else
342342
/usr/local/bin/enginescript/scripts/install/kernel/kernel-tweaks-install.sh 2>> /tmp/enginescript_install_errors.log
343-
echo "KERNEL_TWEAKS=1" >> /var/log/EngineScript/install-log.txt
343+
echo "KERNEL_TWEAKS=1" >> /var/log/EngineScript/install-log.log
344344
fi
345345
print_last_errors
346346
debug_pause "Kernel Tweaks"
@@ -351,7 +351,7 @@ if [[ "${KSM}" = 1 ]];
351351
echo "KSM script has already run."
352352
else
353353
/usr/local/bin/enginescript/scripts/install/kernel/ksm.sh 2>> /tmp/enginescript_install_errors.log
354-
echo "KSM=1" >> /var/log/EngineScript/install-log.txt
354+
echo "KSM=1" >> /var/log/EngineScript/install-log.log
355355
fi
356356
print_last_errors
357357
debug_pause "Kernel Samepage Merging"
@@ -362,7 +362,7 @@ if [[ "${SFL}" = 1 ]];
362362
echo "SYSTEM FILE LIMITS script has already run."
363363
else
364364
/usr/local/bin/enginescript/scripts/install/system-misc/file-limits.sh 2>> /tmp/enginescript_install_errors.log
365-
echo "SFL=1" >> /var/log/EngineScript/install-log.txt
365+
echo "SFL=1" >> /var/log/EngineScript/install-log.log
366366
fi
367367
print_last_errors
368368
debug_pause "Raising System File Limits"
@@ -373,7 +373,7 @@ if [[ "${NTP}" = 1 ]];
373373
echo "NTP script has already run."
374374
else
375375
/usr/local/bin/enginescript/scripts/install/systemd/timesyncd.sh 2>> /tmp/enginescript_install_errors.log
376-
echo "NTP=1" >> /var/log/EngineScript/install-log.txt
376+
echo "NTP=1" >> /var/log/EngineScript/install-log.log
377377
fi
378378
print_last_errors
379379
debug_pause "NTP"
@@ -384,7 +384,7 @@ if [[ "${PCRE}" = 1 ]];
384384
echo "PCRE script has already run."
385385
else
386386
/usr/local/bin/enginescript/scripts/install/pcre/pcre-install.sh 2>> /tmp/enginescript_install_errors.log
387-
echo "PCRE=1" >> /var/log/EngineScript/install-log.txt
387+
echo "PCRE=1" >> /var/log/EngineScript/install-log.log
388388
fi
389389
print_last_errors
390390
debug_pause "PCRE"
@@ -395,7 +395,7 @@ if [[ "${ZLIB}" = 1 ]];
395395
echo "ZLIB script has already run."
396396
else
397397
/usr/local/bin/enginescript/scripts/install/zlib/zlib-install.sh 2>> /tmp/enginescript_install_errors.log
398-
echo "ZLIB=1" >> /var/log/EngineScript/install-log.txt
398+
echo "ZLIB=1" >> /var/log/EngineScript/install-log.log
399399
fi
400400
print_last_errors
401401
debug_pause "zlib"
@@ -406,7 +406,7 @@ if [[ "${LIBURING}" = 1 ]];
406406
echo "LIBURING script has already run."
407407
else
408408
/usr/local/bin/enginescript/scripts/install/liburing/liburing-install.sh 2>> /tmp/enginescript_install_errors.log
409-
echo "LIBURING=1" >> /var/log/EngineScript/install-log.txt
409+
echo "LIBURING=1" >> /var/log/EngineScript/install-log.log
410410
fi
411411
print_last_errors
412412
debug_pause "liburing"
@@ -417,7 +417,7 @@ if [[ "${UFW}" = 1 ]];
417417
echo "UFW script has already run."
418418
else
419419
/usr/local/bin/enginescript/scripts/install/ufw/ufw-install.sh 2>> /tmp/enginescript_install_errors.log
420-
echo "UFW=1" >> /var/log/EngineScript/install-log.txt
420+
echo "UFW=1" >> /var/log/EngineScript/install-log.log
421421
fi
422422
print_last_errors
423423
debug_pause "UFW"
@@ -468,7 +468,7 @@ if [[ "${TOOLS}" = 1 ]];
468468
echo "TOOLS script has already run."
469469
else
470470
/usr/local/bin/enginescript/scripts/install/tools/tools-install.sh 2>> /tmp/enginescript_install_errors.log
471-
echo "TOOLS=1" >> /var/log/EngineScript/install-log.txt
471+
echo "TOOLS=1" >> /var/log/EngineScript/install-log.log
472472
fi
473473
print_last_errors
474474
debug_pause "Tools"
@@ -498,7 +498,7 @@ else
498498
echo "⚠️ This may indicate errors during installation that need attention."
499499
echo ""
500500
echo "RECOMMENDATION:"
501-
echo "1. Review /var/log/EngineScript/install-error-log.txt for any errors"
501+
echo "1. Review /var/log/EngineScript/install-error-log.log for any errors"
502502
echo "2. Use 'es.debug' command after reboot to generate a diagnostic report"
503503
echo "3. Consider re-running the installation script to complete missing components"
504504
echo ""

scripts/install/mariadb/mariadb-install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fi
104104
STATUS="$(systemctl is-active mysql)"
105105
if [[ "${STATUS}" == "active" ]]; then
106106
echo "PASSED: MySQL is running."
107-
echo "MARIADB=1" >> /var/log/EngineScript/install-log.txt
107+
echo "MARIADB=1" >> /var/log/EngineScript/install-log.log
108108
else
109109
echo "FAILED: MySQL not running. Please diagnose this issue before proceeding."
110110
exit 1

0 commit comments

Comments
 (0)