mirror of
https://github.com/uprightbass360/AzerothCore-RealmMaster.git
synced 2026-01-29 00:13:47 +00:00
Compare commits
8 Commits
305da352c0
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74bbc464ac | ||
|
|
1edc675530 | ||
|
|
56769e81d5 | ||
|
|
654d81bb38 | ||
|
|
6a05fe785f | ||
|
|
c46f25a1a9 | ||
|
|
517adc4225 | ||
|
|
f4e88abde8 |
@@ -105,21 +105,21 @@ NETWORK_GATEWAY=172.20.0.1
|
||||
# =====================
|
||||
# Change this to your server's public IP or domain name
|
||||
SERVER_ADDRESS=127.0.0.1
|
||||
REALM_PORT=8215
|
||||
REALM_PORT=8085
|
||||
|
||||
# =====================
|
||||
# Ports
|
||||
# =====================
|
||||
# Authentication server
|
||||
AUTH_EXTERNAL_PORT=3784
|
||||
AUTH_EXTERNAL_PORT=3724
|
||||
AUTH_PORT=3724
|
||||
|
||||
# World server
|
||||
WORLD_EXTERNAL_PORT=8215
|
||||
WORLD_EXTERNAL_PORT=8085
|
||||
WORLD_PORT=8085
|
||||
|
||||
# SOAP/Remote access
|
||||
SOAP_EXTERNAL_PORT=7778
|
||||
SOAP_EXTERNAL_PORT=7878
|
||||
SOAP_PORT=7878
|
||||
|
||||
# MySQL database (for external access)
|
||||
|
||||
@@ -118,11 +118,11 @@ ALPINE_IMAGE=alpine:latest
|
||||
# =====================
|
||||
# Ports
|
||||
# =====================
|
||||
AUTH_EXTERNAL_PORT=3784
|
||||
AUTH_EXTERNAL_PORT=3724
|
||||
AUTH_PORT=3724
|
||||
WORLD_EXTERNAL_PORT=8215
|
||||
WORLD_EXTERNAL_PORT=8085
|
||||
WORLD_PORT=8085
|
||||
SOAP_EXTERNAL_PORT=7778
|
||||
SOAP_EXTERNAL_PORT=7878
|
||||
SOAP_PORT=7878
|
||||
|
||||
# =====================
|
||||
@@ -136,7 +136,7 @@ NETWORK_GATEWAY=172.20.0.1
|
||||
# Server address / realm
|
||||
# =====================
|
||||
SERVER_ADDRESS=127.0.0.1
|
||||
REALM_PORT=8215
|
||||
REALM_PORT=8085
|
||||
|
||||
# =====================
|
||||
# MySQL / Database Layer
|
||||
@@ -559,3 +559,7 @@ MODULE_MOD_PYTHON_ENGINE=0
|
||||
MODULE_WRATH_OF_THE_VANILLA_V2=0
|
||||
MODULE_DUELS=0
|
||||
MODULE_WOW_CORE=0
|
||||
MODULE_CLANCENTAUR=0
|
||||
MODULE_DELVES=0
|
||||
MODULE_MOD_DISABLE_ACHIEVEMENTS=0
|
||||
MODULE_LUA_BATTLEPASS=0
|
||||
|
||||
@@ -5517,6 +5517,62 @@
|
||||
"requires": [],
|
||||
"post_install_hooks": [],
|
||||
"config_cleanup": []
|
||||
},
|
||||
{
|
||||
"key": "MODULE_DELVES",
|
||||
"name": "Delves",
|
||||
"repo": "https://github.com/araxiaonline/Delves.git",
|
||||
"description": "List of the Custom Made Single Player Delves for Araxia Online",
|
||||
"type": "lua",
|
||||
"category": "scripting",
|
||||
"notes": "Discovered via GitHub topic 'azerothcore-module'",
|
||||
"status": "active",
|
||||
"order": 5000,
|
||||
"requires": [],
|
||||
"post_install_hooks": [],
|
||||
"config_cleanup": []
|
||||
},
|
||||
{
|
||||
"key": "MODULE_CLANCENTAUR",
|
||||
"name": "ClanCentaur",
|
||||
"repo": "https://github.com/araxiaonline/ClanCentaur.git",
|
||||
"description": "Custom SQL modifications and patch notes for new faction rewards, reputation items, and unique vendors on the Araxia WoW 3.3.5a server.",
|
||||
"type": "sql",
|
||||
"category": "database",
|
||||
"notes": "Discovered via GitHub topic 'azerothcore-module'",
|
||||
"status": "active",
|
||||
"order": 5000,
|
||||
"requires": [],
|
||||
"post_install_hooks": [],
|
||||
"config_cleanup": []
|
||||
},
|
||||
{
|
||||
"key": "MODULE_MOD_DISABLE_ACHIEVEMENTS",
|
||||
"name": "mod-disable-achievements",
|
||||
"repo": "https://github.com/olive-spore-734/mod-disable-achievements.git",
|
||||
"description": "SQL with a long list of WotLK Achievements and their IDs, which should make it much easier to find and disable some. Made for AzerothCore.",
|
||||
"type": "sql",
|
||||
"category": "database",
|
||||
"notes": "Discovered via GitHub topic 'azerothcore-module'",
|
||||
"status": "active",
|
||||
"order": 5000,
|
||||
"requires": [],
|
||||
"post_install_hooks": [],
|
||||
"config_cleanup": []
|
||||
},
|
||||
{
|
||||
"key": "MODULE_LUA_BATTLEPASS",
|
||||
"name": "lua-battlepass",
|
||||
"repo": "https://github.com/Shonik/lua-battlepass.git",
|
||||
"description": "Battle Pass System for AzerothCore",
|
||||
"type": "lua",
|
||||
"category": "scripting",
|
||||
"notes": "Discovered via GitHub topic 'azerothcore-lua'",
|
||||
"status": "active",
|
||||
"order": 5000,
|
||||
"requires": [],
|
||||
"post_install_hooks": [],
|
||||
"config_cleanup": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
"MODULE_ARAC",
|
||||
"MODULE_ASSISTANT",
|
||||
"MODULE_REAGENT_BANK",
|
||||
"MODULE_BLACK_MARKET_AUCTION_HOUSE",
|
||||
"MODULE_ELUNA",
|
||||
"MODULE_AIO",
|
||||
"MODULE_ELUNA_SCRIPTS",
|
||||
"MODULE_LUA_AH_BOT",
|
||||
"MODULE_EVENT_SCRIPTS",
|
||||
"MODULE_ACTIVE_CHAT",
|
||||
"MODULE_GUILDHOUSE",
|
||||
|
||||
13
config/systemd/docker.service.d/nfs-dependencies.conf
Normal file
13
config/systemd/docker.service.d/nfs-dependencies.conf
Normal file
@@ -0,0 +1,13 @@
|
||||
# AzerothCore RealmMaster - Docker NFS Dependencies
|
||||
# Ensures Docker waits for NFS mounts before starting to prevent race conditions
|
||||
# where containers create local directories before NFS mounts are ready
|
||||
|
||||
[Unit]
|
||||
# Wait for NFS mounts to be active before starting Docker
|
||||
After=nfs-azerothcore.mount nfs-containers.mount
|
||||
|
||||
# Require the primary backup NFS mount (critical for data integrity)
|
||||
Requires=nfs-azerothcore.mount
|
||||
|
||||
# Prefer the containers NFS mount but don't fail if unavailable
|
||||
Wants=nfs-containers.mount
|
||||
33
deploy.sh
33
deploy.sh
@@ -891,6 +891,24 @@ apply_server_config(){
|
||||
fi
|
||||
}
|
||||
|
||||
update_realmlist(){
|
||||
info "Updating realmlist in database with current SERVER_ADDRESS and REALM_PORT..."
|
||||
|
||||
local update_script="$ROOT_DIR/scripts/bash/update-realmlist.sh"
|
||||
if [ ! -x "$update_script" ]; then
|
||||
warn "Realmlist update script not found or not executable: $update_script"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Run the update script
|
||||
if bash "$update_script"; then
|
||||
ok "Realmlist updated successfully"
|
||||
else
|
||||
warn "Could not update realmlist - this is normal if database is still initializing"
|
||||
info "The realmlist will be updated on next deployment or you can run: ./scripts/bash/update-realmlist.sh"
|
||||
fi
|
||||
}
|
||||
|
||||
main(){
|
||||
if [ "$ASSUME_YES" -ne 1 ]; then
|
||||
if [ -t 0 ]; then
|
||||
@@ -947,29 +965,32 @@ main(){
|
||||
fi
|
||||
fi
|
||||
|
||||
show_step 1 4 "Checking build requirements"
|
||||
show_step 1 7 "Checking build requirements"
|
||||
if ! prompt_build_if_needed; then
|
||||
err "Build required but not completed. Deployment cancelled."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$KEEP_RUNNING" -ne 1 ]; then
|
||||
show_step 2 4 "Stopping runtime stack"
|
||||
show_step 2 7 "Stopping runtime stack"
|
||||
stop_runtime_stack
|
||||
fi
|
||||
|
||||
show_step 3 5 "Importing user database files"
|
||||
show_step 3 7 "Importing user database files"
|
||||
info "Checking for database files in ./import/db/ and ./database-import/"
|
||||
bash "$ROOT_DIR/scripts/bash/import-database-files.sh"
|
||||
|
||||
show_step 4 6 "Bringing your realm online"
|
||||
show_step 4 7 "Bringing your realm online"
|
||||
info "Pulling images and waiting for containers to become healthy; this may take a few minutes on first deploy."
|
||||
stage_runtime
|
||||
|
||||
show_step 5 6 "Applying server configuration"
|
||||
show_step 5 7 "Applying server configuration"
|
||||
apply_server_config
|
||||
|
||||
show_step 6 6 "Finalizing deployment"
|
||||
show_step 6 7 "Updating realmlist"
|
||||
update_realmlist
|
||||
|
||||
show_step 7 7 "Finalizing deployment"
|
||||
mark_deployment_complete
|
||||
|
||||
show_realm_ready
|
||||
|
||||
96
scripts/bash/install-docker-nfs-fix.sh
Normal file
96
scripts/bash/install-docker-nfs-fix.sh
Normal file
@@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
# AzerothCore RealmMaster - Install Docker NFS Dependencies Fix
|
||||
# This script installs a systemd drop-in configuration to ensure Docker
|
||||
# waits for NFS mounts before starting, preventing backup folder deletion issues
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
DROP_IN_SOURCE="$PROJECT_ROOT/config/systemd/docker.service.d/nfs-dependencies.conf"
|
||||
DROP_IN_TARGET="/etc/systemd/system/docker.service.d/nfs-dependencies.conf"
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
log_info() { echo -e "${BLUE}ℹ️ $*${NC}"; }
|
||||
log_ok() { echo -e "${GREEN}✅ $*${NC}"; }
|
||||
log_warn() { echo -e "${YELLOW}⚠️ $*${NC}"; }
|
||||
log_err() { echo -e "${RED}❌ $*${NC}"; }
|
||||
|
||||
# Check if running as root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
log_err "This script must be run as root (use sudo)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if source file exists
|
||||
if [ ! -f "$DROP_IN_SOURCE" ]; then
|
||||
log_err "Source configuration file not found: $DROP_IN_SOURCE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if NFS mounts exist
|
||||
log_info "Checking NFS mount configuration..."
|
||||
if ! systemctl list-units --type=mount | grep -q "nfs-azerothcore.mount"; then
|
||||
log_warn "nfs-azerothcore.mount not found. This fix requires NFS mounts to be configured."
|
||||
log_warn "Continue anyway? (y/n)"
|
||||
read -r response
|
||||
if [[ ! "$response" =~ ^[Yy]$ ]]; then
|
||||
log_info "Installation cancelled."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create drop-in directory
|
||||
log_info "Creating systemd drop-in directory..."
|
||||
mkdir -p "$(dirname "$DROP_IN_TARGET")"
|
||||
log_ok "Drop-in directory ready: $(dirname "$DROP_IN_TARGET")"
|
||||
|
||||
# Install configuration file
|
||||
log_info "Installing NFS dependencies configuration..."
|
||||
cp "$DROP_IN_SOURCE" "$DROP_IN_TARGET"
|
||||
chmod 644 "$DROP_IN_TARGET"
|
||||
log_ok "Configuration installed: $DROP_IN_TARGET"
|
||||
|
||||
# Show what was installed
|
||||
echo ""
|
||||
log_info "Installed configuration:"
|
||||
echo "---"
|
||||
cat "$DROP_IN_TARGET"
|
||||
echo "---"
|
||||
echo ""
|
||||
|
||||
# Reload systemd
|
||||
log_info "Reloading systemd daemon..."
|
||||
systemctl daemon-reload
|
||||
log_ok "Systemd daemon reloaded"
|
||||
|
||||
# Verify configuration
|
||||
log_info "Verifying Docker service dependencies..."
|
||||
echo ""
|
||||
systemctl show -p After,Requires,Wants docker.service | grep -E '^(After|Requires|Wants)='
|
||||
echo ""
|
||||
|
||||
# Check if Docker is running
|
||||
if systemctl is-active --quiet docker.service; then
|
||||
log_warn "Docker is currently running"
|
||||
log_warn "The new configuration will take effect on next Docker restart or system reboot"
|
||||
echo ""
|
||||
log_info "To apply immediately, restart Docker (WARNING: will stop all containers):"
|
||||
echo " sudo systemctl restart docker.service"
|
||||
echo ""
|
||||
log_info "Or reboot the system:"
|
||||
echo " sudo reboot"
|
||||
else
|
||||
log_ok "Docker is not running - configuration will apply on next start"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
log_ok "Docker NFS dependencies fix installed successfully!"
|
||||
log_info "Docker will now wait for NFS mounts before starting"
|
||||
log_info "This prevents backup folders from being deleted during server restarts"
|
||||
@@ -253,7 +253,15 @@ STAGE_SQL_PATH_RAW="$(read_env_value STAGE_PATH_MODULE_SQL "${LOCAL_STORAGE_ROOT
|
||||
if [ -z "${STORAGE_PATH_LOCAL:-}" ]; then
|
||||
STORAGE_PATH_LOCAL="$LOCAL_STORAGE_ROOT"
|
||||
fi
|
||||
# Expand any env references (e.g., ${STORAGE_PATH_LOCAL})
|
||||
# Ensure STORAGE_PATH is defined to avoid set -u failures during expansion
|
||||
if [ -z "${STORAGE_PATH:-}" ]; then
|
||||
STORAGE_PATH="$(read_env_value STORAGE_PATH "./storage")"
|
||||
fi
|
||||
# Ensure STORAGE_MODULE_SQL_PATH is defined to avoid set -u failures during expansion
|
||||
if [ -z "${STORAGE_MODULE_SQL_PATH:-}" ]; then
|
||||
STORAGE_MODULE_SQL_PATH="$(read_env_value STORAGE_MODULE_SQL_PATH "${STORAGE_PATH}/module-sql-updates")"
|
||||
fi
|
||||
# Expand any env references (e.g., ${STORAGE_PATH_LOCAL}, ${STORAGE_MODULE_SQL_PATH})
|
||||
STAGE_SQL_PATH_RAW="$(eval "echo \"$STAGE_SQL_PATH_RAW\"")"
|
||||
LOCAL_STAGE_SQL_DIR="$(resolve_path_relative_to_project "$STAGE_SQL_PATH_RAW" "$PROJECT_ROOT")"
|
||||
REMOTE_STAGE_SQL_DIR="$(resolve_path_relative_to_project "$STAGE_SQL_PATH_RAW" "$PROJECT_DIR")"
|
||||
|
||||
177
scripts/bash/setup-user-environment.sh
Normal file
177
scripts/bash/setup-user-environment.sh
Normal file
@@ -0,0 +1,177 @@
|
||||
#!/bin/bash
|
||||
# Setup user environment with sudo access and bash completion
|
||||
set -e
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
log_info() { echo -e "${BLUE}ℹ️ $*${NC}"; }
|
||||
log_ok() { echo -e "${GREEN}✅ $*${NC}"; }
|
||||
log_warn() { echo -e "${YELLOW}⚠️ $*${NC}"; }
|
||||
|
||||
TARGET_USER="${1:-${USER}}"
|
||||
|
||||
# Check if running as root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "This script must be run as root (use sudo)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
log_info "Setting up environment for user: $TARGET_USER"
|
||||
echo ""
|
||||
|
||||
# 1. Add user to sudo group
|
||||
log_info "Step 1/4: Adding $TARGET_USER to sudo group..."
|
||||
if groups "$TARGET_USER" | grep -q "\bsudo\b"; then
|
||||
log_ok "User already in sudo group"
|
||||
else
|
||||
usermod -aG sudo "$TARGET_USER"
|
||||
log_ok "Added $TARGET_USER to sudo group"
|
||||
fi
|
||||
|
||||
# 2. Change default shell to bash
|
||||
log_info "Step 2/4: Setting default shell to bash..."
|
||||
CURRENT_SHELL=$(getent passwd "$TARGET_USER" | cut -d: -f7)
|
||||
if [ "$CURRENT_SHELL" = "/bin/bash" ]; then
|
||||
log_ok "Default shell already set to bash"
|
||||
else
|
||||
chsh -s /bin/bash "$TARGET_USER"
|
||||
log_ok "Changed default shell from $CURRENT_SHELL to /bin/bash"
|
||||
fi
|
||||
|
||||
# 3. Create .bashrc with bash completion
|
||||
log_info "Step 3/4: Setting up bash completion..."
|
||||
USER_HOME=$(getent passwd "$TARGET_USER" | cut -d: -f6)
|
||||
BASHRC="$USER_HOME/.bashrc"
|
||||
|
||||
if [ -f "$BASHRC" ]; then
|
||||
log_warn ".bashrc already exists, checking for bash completion..."
|
||||
if grep -q "bash_completion" "$BASHRC"; then
|
||||
log_ok "Bash completion already configured in .bashrc"
|
||||
else
|
||||
log_info "Adding bash completion to existing .bashrc..."
|
||||
cat >> "$BASHRC" << 'EOF'
|
||||
|
||||
# Enable bash completion
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
EOF
|
||||
chown "$TARGET_USER:$TARGET_USER" "$BASHRC"
|
||||
log_ok "Bash completion added to .bashrc"
|
||||
fi
|
||||
else
|
||||
log_info "Creating new .bashrc with bash completion..."
|
||||
cat > "$BASHRC" << 'EOF'
|
||||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# History settings
|
||||
HISTCONTROL=ignoreboth
|
||||
HISTSIZE=10000
|
||||
HISTFILESIZE=20000
|
||||
shopt -s histappend
|
||||
|
||||
# Check window size after each command
|
||||
shopt -s checkwinsize
|
||||
|
||||
# Make less more friendly for non-text input files
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# Set a fancy prompt
|
||||
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
||||
|
||||
# Enable color support for ls and grep
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# Some more ls aliases
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
|
||||
# Enable bash completion
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
|
||||
# Docker completion (if docker is installed)
|
||||
if [ -f /usr/share/bash-completion/completions/docker ]; then
|
||||
. /usr/share/bash-completion/completions/docker
|
||||
fi
|
||||
EOF
|
||||
chown "$TARGET_USER:$TARGET_USER" "$BASHRC"
|
||||
chmod 644 "$BASHRC"
|
||||
log_ok "Created .bashrc with bash completion"
|
||||
fi
|
||||
|
||||
# 4. Create .bash_profile to source .bashrc for login shells
|
||||
log_info "Step 4/4: Setting up bash_profile for login shells..."
|
||||
BASH_PROFILE="$USER_HOME/.bash_profile"
|
||||
|
||||
if [ -f "$BASH_PROFILE" ]; then
|
||||
if grep -q "\.bashrc" "$BASH_PROFILE"; then
|
||||
log_ok ".bash_profile already sources .bashrc"
|
||||
else
|
||||
log_info "Adding .bashrc sourcing to existing .bash_profile..."
|
||||
cat >> "$BASH_PROFILE" << 'EOF'
|
||||
|
||||
# Source .bashrc if it exists
|
||||
if [ -f ~/.bashrc ]; then
|
||||
. ~/.bashrc
|
||||
fi
|
||||
EOF
|
||||
chown "$TARGET_USER:$TARGET_USER" "$BASH_PROFILE"
|
||||
log_ok ".bash_profile updated to source .bashrc"
|
||||
fi
|
||||
else
|
||||
log_info "Creating .bash_profile..."
|
||||
cat > "$BASH_PROFILE" << 'EOF'
|
||||
# ~/.bash_profile: executed by bash(1) for login shells.
|
||||
|
||||
# Source .bashrc if it exists
|
||||
if [ -f ~/.bashrc ]; then
|
||||
. ~/.bashrc
|
||||
fi
|
||||
EOF
|
||||
chown "$TARGET_USER:$TARGET_USER" "$BASH_PROFILE"
|
||||
chmod 644 "$BASH_PROFILE"
|
||||
log_ok "Created .bash_profile"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
log_ok "Environment setup complete for $TARGET_USER!"
|
||||
echo ""
|
||||
echo "Changes applied:"
|
||||
echo " ✓ Added to sudo group (password required)"
|
||||
echo " ✓ Default shell changed to /bin/bash"
|
||||
echo " ✓ Bash completion enabled (.bashrc)"
|
||||
echo " ✓ Login shell configured (.bash_profile)"
|
||||
echo ""
|
||||
log_warn "Important: You need to log out and log back in for shell changes to take effect"
|
||||
log_info "To test sudo: sudo -v (will prompt for password)"
|
||||
log_info "To test tab completion: type 'systemctl rest' and press TAB"
|
||||
log_info "To verify shell: echo \$SHELL (should show /bin/bash)"
|
||||
echo ""
|
||||
80
scripts/bash/update-realmlist.sh
Normal file
80
scripts/bash/update-realmlist.sh
Normal file
@@ -0,0 +1,80 @@
|
||||
#!/bin/bash
|
||||
# Updates the realmlist table in the database with current SERVER_ADDRESS and REALM_PORT from .env
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
|
||||
# Source colors and functions
|
||||
BLUE='\033[0;34m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
info() { printf '%b\n' "${BLUE}ℹ️ $*${NC}"; }
|
||||
ok() { printf '%b\n' "${GREEN}✅ $*${NC}"; }
|
||||
warn() { printf '%b\n' "${YELLOW}⚠️ $*${NC}"; }
|
||||
err() { printf '%b\n' "${RED}❌ $*${NC}"; }
|
||||
|
||||
# Load environment variables from .env
|
||||
if [ -f "$ROOT_DIR/.env" ]; then
|
||||
# shellcheck disable=SC1091
|
||||
set -a
|
||||
source "$ROOT_DIR/.env"
|
||||
set +a
|
||||
else
|
||||
err "No .env file found at $ROOT_DIR/.env"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check required variables
|
||||
if [ -z "$SERVER_ADDRESS" ]; then
|
||||
err "SERVER_ADDRESS not set in .env"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$REALM_PORT" ]; then
|
||||
err "REALM_PORT not set in .env"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$MYSQL_HOST" ]; then
|
||||
err "MYSQL_HOST not set in .env"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$MYSQL_USER" ]; then
|
||||
err "MYSQL_USER not set in .env"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$MYSQL_ROOT_PASSWORD" ]; then
|
||||
err "MYSQL_ROOT_PASSWORD not set in .env"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$DB_AUTH_NAME" ]; then
|
||||
err "DB_AUTH_NAME not set in .env"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
info "Updating realmlist table..."
|
||||
info " Address: $SERVER_ADDRESS"
|
||||
info " Port: $REALM_PORT"
|
||||
|
||||
# Try to update the database
|
||||
if mysql -h "${MYSQL_HOST}" -u"${MYSQL_USER}" -p"${MYSQL_ROOT_PASSWORD}" --skip-ssl-verify "${DB_AUTH_NAME}" \
|
||||
-e "UPDATE realmlist SET address='${SERVER_ADDRESS}', port=${REALM_PORT} WHERE id=1;" 2>/dev/null; then
|
||||
ok "Realmlist updated successfully"
|
||||
|
||||
# Show the current realmlist entry
|
||||
mysql -h "${MYSQL_HOST}" -u"${MYSQL_USER}" -p"${MYSQL_ROOT_PASSWORD}" --skip-ssl-verify "${DB_AUTH_NAME}" \
|
||||
-e "SELECT id, name, address, port FROM realmlist WHERE id=1;" 2>/dev/null || true
|
||||
|
||||
exit 0
|
||||
else
|
||||
warn "Could not update realmlist table"
|
||||
warn "This is normal if the database is not yet initialized or MySQL is not running"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user