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