- Add ollama role for local LLM inference (install, service, models) - Add searxng container for private search - Migrate hostname from home.bdebyl.net to home.debyl.io (inventory, awsddns, zomboid entrypoint, home_server_name) - Update vault with new secrets Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
90 lines
2.9 KiB
Django/Jinja
90 lines
2.9 KiB
Django/Jinja
#!/bin/bash
|
|
# Project Zomboid Build 42 Server Entrypoint
|
|
# Based on IndifferentBroccoli/projectzomboid-server-docker
|
|
set -e
|
|
|
|
# Configuration
|
|
INSTALL_DIR="/project-zomboid"
|
|
CONFIG_DIR="/project-zomboid-config"
|
|
STEAMCMD="/home/steam/steamcmd/steamcmd.sh"
|
|
SERVER_NAME="${SERVER_NAME:-zomboid}"
|
|
PUID="${PUID:-1000}"
|
|
PGID="${PGID:-1000}"
|
|
MIN_RAM="${MIN_RAM:-4g}"
|
|
MAX_RAM="${MAX_RAM:-8g}"
|
|
|
|
echo "=== Project Zomboid Build 42 Server ==="
|
|
echo "Server Name: ${SERVER_NAME}"
|
|
echo "RAM: ${MIN_RAM} - ${MAX_RAM}"
|
|
|
|
# Set user permissions (IndifferentBroccoli approach)
|
|
echo "=== Setting file permissions ==="
|
|
usermod -o -u "${PUID}" steam
|
|
groupmod -o -g "${PGID}" steam
|
|
chown -R steam:steam "${INSTALL_DIR}" "${CONFIG_DIR}"
|
|
# Only chown writable parts of /home/steam (not read-only mounts)
|
|
chown steam:steam /home/steam
|
|
chown -R steam:steam /home/steam/steamcmd 2>/dev/null || true
|
|
chown -R steam:steam /home/steam/Steam 2>/dev/null || true
|
|
|
|
# Create required directories
|
|
mkdir -p "${CONFIG_DIR}/Server"
|
|
mkdir -p "${CONFIG_DIR}/Saves"
|
|
mkdir -p "${CONFIG_DIR}/db"
|
|
|
|
# Update/Install PZ dedicated server with Build 42 unstable branch
|
|
if [ "${AUTO_UPDATE:-true}" = "true" ]; then
|
|
echo "=== Updating Project Zomboid Server (Build 42 unstable) ==="
|
|
su -c "${STEAMCMD} +runscript /home/steam/install.scmd" steam
|
|
echo "=== Update complete ==="
|
|
fi
|
|
|
|
# Configure JVM memory settings in ProjectZomboid64.json (Build 42 uses JSON config)
|
|
configure_memory() {
|
|
local json_file="${INSTALL_DIR}/ProjectZomboid64.json"
|
|
|
|
if [ ! -f "$json_file" ]; then
|
|
echo "=== ProjectZomboid64.json not found, skipping memory config ==="
|
|
return 0
|
|
fi
|
|
|
|
echo "=== Configuring JVM memory: Xms=${MIN_RAM}, Xmx=${MAX_RAM} ==="
|
|
|
|
# Update Xmx
|
|
sed -i "s/-Xmx[0-9]*[gGmM]*/-Xmx${MAX_RAM}/g" "$json_file"
|
|
|
|
# Update or add Xms
|
|
if grep -q "\-Xms" "$json_file"; then
|
|
sed -i "s/-Xms[0-9]*[gGmM]*/-Xms${MIN_RAM}/g" "$json_file"
|
|
else
|
|
# Insert -Xms before -Xmx
|
|
sed -i "s/\"-Xmx/\"-Xms${MIN_RAM}\",\n\t\t\"-Xmx/g" "$json_file"
|
|
fi
|
|
|
|
echo "=== Memory configuration complete ==="
|
|
}
|
|
configure_memory
|
|
|
|
# Check if first run (no admin DB)
|
|
ADMIN_DB="${CONFIG_DIR}/db/${SERVER_NAME}.db"
|
|
|
|
# Build server arguments
|
|
# Note: -modfolders is NOT used - mods are configured via INI only
|
|
# Reference: IndifferentBroccoli/projectzomboid-server-docker
|
|
SERVER_ARGS="-cachedir=${CONFIG_DIR} -servername ${SERVER_NAME}"
|
|
|
|
# Add admin password for first run
|
|
if [ ! -f "${ADMIN_DB}" ] && [ -n "${ADMIN_PASSWORD}" ]; then
|
|
echo "=== First run: setting admin password ==="
|
|
SERVER_ARGS="${SERVER_ARGS} -adminpassword ${ADMIN_PASSWORD}"
|
|
fi
|
|
|
|
# Note: Server password is set via INI file, not command line args
|
|
|
|
# Start server
|
|
cd "${INSTALL_DIR}"
|
|
echo "=== Starting Project Zomboid Server ==="
|
|
echo "Connect to: home.debyl.io:16261"
|
|
|
|
exec su -c "export LD_LIBRARY_PATH=${INSTALL_DIR}/jre64/lib:\${LD_LIBRARY_PATH} && ./start-server.sh ${SERVER_ARGS}" steam
|