Fixes2
This commit is contained in:
@@ -6,9 +6,9 @@
|
||||
#
|
||||
# This function enables and disables additional modules
|
||||
#
|
||||
#----------------------------------------------------------#
|
||||
#------------------------------------------#
|
||||
# Variables & Functions #
|
||||
#----------------------------------------------------------#
|
||||
#------------------------------------------#
|
||||
|
||||
# Argument definition
|
||||
|
||||
@@ -22,8 +22,8 @@ require "modules"
|
||||
require "HestiaBunkerWebApi"
|
||||
require "securerandom"
|
||||
require "socket"
|
||||
|
||||
require 'json' unless defined?(JSON)
|
||||
require 'etc'
|
||||
|
||||
hestia_check_privileged_user
|
||||
|
||||
@@ -35,20 +35,16 @@ end
|
||||
|
||||
load_global_bash_variables "#{$HESTIA}/conf/hestia.conf"
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Perform verification if read-only mode is enabled
|
||||
check_hestia_demo_mode
|
||||
|
||||
#----------------------------------------------------------#
|
||||
#------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
#------------------------------------------#
|
||||
|
||||
puts "=========================================="
|
||||
puts "========================================================"
|
||||
puts "=== AUTOMATED BUNKERWEB SETUP SCRIPT ==="
|
||||
puts "=========================================="
|
||||
puts "========================================================"
|
||||
puts ""
|
||||
|
||||
# Parse command line arguments for SSL cert and key paths
|
||||
@@ -61,7 +57,6 @@ ADMIN_PASSWORD = SecureRandom.alphanumeric(24) + "!@#"
|
||||
|
||||
puts "[INFO] Get server IP address"
|
||||
|
||||
|
||||
server_ip_addr = "127.0.0.1" # default fallback
|
||||
# Attempt to retrieve server IP via Hestia utility
|
||||
begin
|
||||
@@ -82,6 +77,9 @@ end
|
||||
|
||||
puts ""
|
||||
|
||||
# Compute nginx group ID once
|
||||
nginx_gid = Etc.getgrnam('nginx').gid
|
||||
|
||||
# Step 1: Create /etc/bunkerweb/api.env configuration file
|
||||
puts "[INFO] Creating API configuration at /etc/bunkerweb/api.env..."
|
||||
api_env_content = <<~APIENV
|
||||
@@ -197,6 +195,8 @@ api_env_content = <<~APIENV
|
||||
APIENV
|
||||
|
||||
File.write("/etc/bunkerweb/api.env", api_env_content)
|
||||
File.chmod(0o660, "/etc/bunkerweb/api.env")
|
||||
File.chown(0, nginx_gid, "/etc/bunkerweb/api.env")
|
||||
puts "[SUCCESS] API configuration file created at /etc/bunkerweb/api.env"
|
||||
puts ""
|
||||
|
||||
@@ -214,10 +214,11 @@ USE_SERVE_FILES=no
|
||||
VENV
|
||||
|
||||
File.write("/etc/bunkerweb/variables.env", variables_env_content)
|
||||
File.chmod(0o660, "/etc/bunkerweb/variables.env")
|
||||
File.chown(0, nginx_gid, "/etc/bunkerweb/variables.env")
|
||||
puts "[SUCCESS] Variables configuration file created at /etc/bunkerweb/variables.env"
|
||||
puts ""
|
||||
|
||||
|
||||
# Step 2: Enable and start bunkerweb-api service, wait for it to be running
|
||||
puts "[INFO] Enabling bunkerweb-api service..."
|
||||
system("systemctl enable bunkerweb-api")
|
||||
@@ -246,7 +247,6 @@ while attempt < max_attempts
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if attempt >= max_attempts
|
||||
puts ""
|
||||
puts "[ERROR] bunkerweb-api service did not become active within timeout"
|
||||
@@ -305,6 +305,8 @@ ui_env_content += <<~UIENV2
|
||||
UIENV2
|
||||
|
||||
File.write("/etc/bunkerweb/ui.env", ui_env_content)
|
||||
File.chmod(0o660, "/etc/bunkerweb/ui.env")
|
||||
File.chown(0, nginx_gid, "/etc/bunkerweb/ui.env")
|
||||
puts "[SUCCESS] UI configuration file created at /etc/bunkerweb/ui.env"
|
||||
puts ""
|
||||
|
||||
@@ -406,9 +408,9 @@ begin
|
||||
system("systemctl restart bunkerweb-scheduler")
|
||||
|
||||
puts ""
|
||||
puts "=========================================="
|
||||
puts "======================================================"
|
||||
puts "=== SETUP COMPLETED SUCCESSFULLY ==="
|
||||
puts "=========================================="
|
||||
puts "======================================================"
|
||||
puts ""
|
||||
puts "Web UI is now accessible at:"
|
||||
if ui_ssl_enabled == "yes"
|
||||
|
||||
Reference in New Issue
Block a user