From 569e45c93c28b025b344ea28dbdb24f91c3dfb1f Mon Sep 17 00:00:00 2001 From: Daniel Ceregatti Date: Mon, 26 Aug 2024 09:13:30 -0700 Subject: [PATCH] Implement much missing stuff: Login. Still WIP, but works. Install server files. Once logged in, this works. Add support for experimental in both web and scripts. WIP. Continuous streaming text web interface for long-running server processes. Large refactor of the config file. Use arrays instead of delimited strings. Large refactor of the express server to support the above. Add Steam API key to env for when we do mod searches. Customize the bash shell of the web container should we exec into it. Ignore the env file. --- .gitignore | 1 + docker-compose.yml | 2 + files/bin/dz-common | 5 +- web/Dockerfile | 6 +- web/bin/dz | 18 ++- web/bin/start.sh | 19 +++- web/docroot/src/components/Dialog.vue | 28 +++-- web/docroot/src/components/Files.vue | 38 ++++--- web/docroot/src/components/Status.vue | 12 +- web/docroot/src/components/Steam.vue | 101 ++++++++--------- web/docroot/src/config.js | 61 +++++++---- web/docroot/src/store.js | 26 +++-- web/index.js | 151 ++++++++++++++------------ 13 files changed, 269 insertions(+), 199 deletions(-) diff --git a/.gitignore b/.gitignore index 8efd66f..d137639 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .idea *.iml .env* +env.json node_modules/ web/client/bin web/client/obj diff --git a/docker-compose.yml b/docker-compose.yml index 925eef1..2d1f6d5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,7 @@ volumes: serverfiles_experimental: # Upstream mission files mpmissions: + mpmissions_experimental: services: @@ -27,6 +28,7 @@ services: - serverfiles:/serverfiles - serverfiles_experimental:/serverfiles_experimental - mpmissions:/serverfiles/mpmissions + - mpmissions_experimental:/serverfiles_experimental/mpmissions - mods:/serverfiles/steamapps/workshop/content - mods:/mods - ./files:/files diff --git a/files/bin/dz-common b/files/bin/dz-common index 2929578..4d2998c 100755 --- a/files/bin/dz-common +++ b/files/bin/dz-common @@ -29,14 +29,14 @@ export yellow="\e[93m" export lightblue="\e[94m" export blue="\e[34m" export magenta="\e[35m" -export cyan="\e[36m" +export cyan="\e[36m" # DayZ release server Steam app ID. # Now that the Linux server is released, the binaries will come from this ID. export release_server_appid=223350 # Leaving the experimental server appid here to allow for the use of the experimental server. -#export release_server_appid=1042420 +export experimental_server_appid=1042420 # DayZ release client SteamID. This is for mods, as only the release client has them. export release_client_appid=221100 @@ -47,6 +47,7 @@ export SERVER_PROFILE="/profiles" # Common container base directories export FILES="/files" export SERVER_FILES="/serverfiles" +export SERVER_FILES_EXPERIMENTAL="/serverfiles_experimental" # Used to check if dayZ is installed export SERVER_INSTALL_FILE="${SERVER_FILES}/DayZServer" diff --git a/web/Dockerfile b/web/Dockerfile index 76b7892..87c7dd5 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -131,8 +131,10 @@ ARG USER_ID RUN groupadd -g ${USER_ID} user && \ useradd -l -u ${USER_ID} -m -g user user && \ - mkdir -p /home/user /serverfiles/mpmissions /serverfiles/steamapps/workshop/content /web && \ - chown -R user:user /home/user /serverfiles /web + mkdir -p /home/user \ + /serverfiles/mpmissions /serverfiles/steamapps/workshop/content \ + /serverfiles_experimental/mpmissions /serverfiles_experimental/steamapps/workshop/content /web && \ + chown -R user:user /home/user /serverfiles /serverfiles_experimental /web # Use our non-privileged user USER user diff --git a/web/bin/dz b/web/bin/dz index b22d77d..242a735 100755 --- a/web/bin/dz +++ b/web/bin/dz @@ -180,7 +180,8 @@ login(){ dologin(){ if [ -f "${STEAM_LOGIN}" ] then - source "${STEAM_LOGIN}" + echo "Logging in to Steam" + steamlogin=$(cat ${STEAM_LOGIN}) else echo "No cached Steam credentials. Please configure this now: " login @@ -189,9 +190,16 @@ dologin(){ # Perform the installation of the server files. install(){ - if [ ! -f "${SERVER_INSTALL_FILE}" ] || [[ ${1} = "force" ]] + WHICH=${1} + if [[ ${WHICH} = "experimental" ]] then - printf "[ ${yellow}DayZ${default} ] Downloading DayZ Server-Files!\n" + SERVER_FILES=${SERVER_FILES_EXPERIMENTAL} + SERVER_INSTALL_FILE="${SERVER_FILES}/DayZServer" + release_server_appid=${experimental_server_appid} + fi + if [ ! -f "${SERVER_INSTALL_FILE}" ] || [[ ${2} = "force" ]] + then + printf "[ ${yellow}DayZ${default} ] Downloading ${WHICH} DayZ Server-Files!\n" dologin ${STEAMCMD} +force_install_dir ${SERVER_FILES} +login "${steamlogin}" +app_update "${release_server_appid}" validate +quit # This installs the mpmissions for charnarusplus and enoch (AKA Livonia) from github. The game once allowed the full server @@ -199,7 +207,7 @@ install(){ echo "Installing mpmissions for ChernarusPlus and Livonia from github..." map default else - printf "[ ${lightblue}DayZ${default} ] The server is already installed.\n" + printf "[ ${lightblue}DayZ${default} ] The ${WHICH} server is already installed.\n" fi } @@ -341,8 +349,6 @@ xml(){ installxml ${1} } -# Capture the first argument and shift it off so we can pass $@ to every function -C=${1} shift || { usage } diff --git a/web/bin/start.sh b/web/bin/start.sh index 7f5a0f5..209936c 100755 --- a/web/bin/start.sh +++ b/web/bin/start.sh @@ -7,16 +7,13 @@ trap ' ' SIGINT SIGTERM # Set PS1 so we know we're in the container -if ! grep -q "dz-web" .bashrc -then - echo "Adding PS1 to .bashrc..." - cat >> .bashrc < .bashrc < env.json < env.json +fi #export DEBUG=express:* npm run dev & wait $! diff --git a/web/docroot/src/components/Dialog.vue b/web/docroot/src/components/Dialog.vue index 040a3fc..81d572e 100644 --- a/web/docroot/src/components/Dialog.vue +++ b/web/docroot/src/components/Dialog.vue @@ -5,23 +5,24 @@ const store = useAppStore() diff --git a/web/docroot/src/components/Files.vue b/web/docroot/src/components/Files.vue index 33d50f4..fde4d07 100644 --- a/web/docroot/src/components/Files.vue +++ b/web/docroot/src/components/Files.vue @@ -1,34 +1,46 @@