diff --git a/README.md b/README.md index 619ff70..e67f03b 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,10 @@ This volume can get quite large. It will require at least 2G of disk space for t Some map mods are as large as 10G. Make sure you have that much disk space in the location where docker stores its volumes, usually `/var/lib/docker/volumes`. +## Goals + +* Provide a turnkey DayZ server with mod support. + ## Configure and Build Ensure [Docker](https://docs.docker.com/engine/install/) and [Docker compose](https://docs.docker.com/compose/install/) @@ -152,7 +156,7 @@ docker compose exec main dayzserver force When the server exits cleanly, i.e. exit code 0, the container also stops. Otherwise, a crash is presumed, and the server will be restarted. NOTE: As DayZ Experimental 1.19, the server is known to not exit upon SIGINT when mods are installed. This makes force stopping the server -required. This is not a clean exit, and will cause the server to restart. Manually take the server [down](#down) to stop the container. +required. This is not a clean exit, and will cause the server to restart. Manually take the server [down](#stop) to stop the container. ### Workshop - Add / List / Remove / Update mods diff --git a/web/root/favicon.png b/web/root/favicon.png new file mode 100644 index 0000000..bb3ae74 Binary files /dev/null and b/web/root/favicon.png differ diff --git a/web/root/index.css b/web/root/index.css index dbee6cb..2134262 100644 --- a/web/root/index.css +++ b/web/root/index.css @@ -1,23 +1,15 @@ body { - padding-top: 10px; + padding: 10px; background-color: black; } -.green { - color: green; - font-weight: bolder; -} -.yellow { - color: yellow; - font-weight: bolder; -} -.darkgrey { - background-color: darkgray; - font-weight: bolder; - margin-bottom: 10px; + +button { + padding: 5px; + margin: 10px; } -.modInfo { - background-color: aliceblue; +th, td { + padding-right: 10px } .result { @@ -32,7 +24,3 @@ body { cursor: pointer; text-underline: blue; } - -th, td { - padding-right: 10px -} diff --git a/web/root/index.html b/web/root/index.html index 9a882f7..d29c9d3 100644 --- a/web/root/index.html +++ b/web/root/index.html @@ -3,9 +3,10 @@ DayZ Docker Server + - + diff --git a/web/root/index.js b/web/root/index.js index 3c07c04..c0b279d 100644 --- a/web/root/index.js +++ b/web/root/index.js @@ -1,31 +1,48 @@ const template = ` -
-
-
-

DayZ Docker Server

+
+
+
+

DayZ Docker Server

+
+
+
+ + + +
+
+ +
-
+
-
-
- Server files installed: {{ installed }} +
+
+ Server files installed: + +
-
- Version: {{ version }} +
+ Version: {{ version }}
{{ fetchError }}
-
-
+
+

Mods

@@ -39,7 +56,7 @@ const template = `
{{ mod.id }} @@ -51,7 +68,40 @@ const template = `
-
+
+
+

{{ modInfo.name }}

+
+
+
+ ID: {{ modInfo.id }} +
+
+ Size: {{ modInfo.size.toLocaleString("en-US") }} +
+
+ Custom XML files: + +
+
+
+
+ +
+
+
+
+
+
@@ -65,9 +115,9 @@ const template = ` @@ -81,37 +131,6 @@ const template = `
Steam Link - + {{ result.title }}
-
-
-

{{ modInfo.name }} mod info:

-
-
-
-
- ID: {{ modInfo.id }} -
-
- Size: {{ modInfo.size.toLocaleString("en-US") }} -
-
- Custom XML files: - -
-
-
- -
-
-
` @@ -126,6 +145,7 @@ export default { mods: [], modInfo: "", searchResults: [], + steamURL: 'https://steamcommunity.com/sharedfiles/filedetails/?id=', version: "Unknown", XMLFile: "", XMLInfo: "", @@ -196,6 +216,17 @@ export default { this.fetchError = error.message }) }, + removeMod(modId) { + fetch('/remove/' + modId) + .then(response => response.text()) + .then(response => { + console.log(response) + }) + .catch((error) => { + console.error(error) + this.fetchError = error.message + }) + }, BKMG(val) { const units = ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'] let l = 0, n = parseInt(val, 10) || 0 diff --git a/web/web.js b/web/web.js index e54acd7..63d4e1a 100644 --- a/web/web.js +++ b/web/web.js @@ -1,3 +1,11 @@ +/* + A DayZ Linux server provisioning system. + + This is the web UI for provisioning a DayZ server running under Linux. + It manages the main container that installs and maintains the base DayZ server files + along with all mod base files. The goal being to keep all of these centralized and consistent, + but to also make them available for the creation of server containers. + */ import express from 'express' import path from 'path' import fs from 'fs' @@ -45,6 +53,49 @@ const configFiles = [ 'types.xml', ] +// From https://helpthedeadreturn.wordpress.com/2019/07/17/dayz-sa-mission-file +const allConfigFiles = { + "db": [ // global server config and core loot economy files + "events.xml", // dynamic events + "globals.xml", // global settings + "messages.xml", // server broadcast messages and shutdown + "types.xml" // loot table + ], + "env": [ // coordinates, static and dynamic spawns for each entity + "cattle_territories.xml", + "domestic_animals_territories.xml", + "hare_territories.xml", + "hen_territories.xml", + "pig_territories.xml", + "red_deer_territories.xml", + "roe_deer_territories.xml", + "sheep_goat_territories.xml", + "wild_boar_territories.xml", + "wolf_territories.xml", + "zombie_territories.xml" + ], + "root": [ + "cfgeconomycore.xml", // loot economy core settings and extensions + "cfgeffectarea.json", // static contaminated area coordinates and other properties + "cfgenvironment.xml", // includes env\* files and parameters + "cfgeventgroups.xml", // definitions of groups of objects that spawn together in a dynamic event + "cfgeventspawns.xml", // coordinates where events may occur + "cfggameplay.json", // gameplay configuration settings. + "cfgIgnoreList.xml", // list of items that won’t be loaded from the storage + "cfglimitsdefinition.xml", // list of valid categories, tags, usageflags and valueflags + "cfglimitsdefinitionuser.xml", // shortcut groups of usageflags and valueflags + "cfgplayerspawnpoints.xml", // new character spawn points + "cfgrandompresets.xml", // collection of groups of items + "cfgspawnabletypes.xml", // loot categorization (ie hoarder) as well as set of items that spawn as cargo or as attachment on weapons, vehicles or infected. + "cfgundergroundtriggers.json", // used for triggering light and sounds in the Livonia bunker, not used for Chernarus + "cfgweather.xml", // weather configuration + "init.c", // mission startup file (PC only) + "map*.xml", + "mapgroupproto.xml", // structures, tags, maxloot and lootpoints + "mapgrouppos.xml" // all valid lootpoints + ] +} + const config = { installFile: serverFiles + "/DayZServer", modDir: modDir + "/" + client_appid, @@ -52,6 +103,13 @@ const config = { steamAPIKey: process.env["STEAMAPIKEY"] } +const getVersion = (installed) => { + if(installed) { + return "1.20.bogus" + } + return "" +} + const getDirSize = (dirPath) => { let size = 0 const files = fs.readdirSync(dirPath) @@ -144,6 +202,23 @@ app.get(('/install/:modId'), (req, res) => { res.send(modId + " was installed") }) +// Remove a mod +app.get(('/remove/:modId'), (req, res) => { + const modId = req.params["modId"] + // Shell out to steamcmd, monitor the process, and display the output as it runs + res.send(modId + " was removed") +}) + +// Update base files +app.get('/updatebase', (req, res) => { + res.send("Base files were updates") +}) + +// Update mods +app.get('/updatemods', (req, res) => { + res.send("Mod files were updates") +}) + /* Get the status of things: If the base files are installed, the version of the server, a list of mods, etc. @@ -152,9 +227,10 @@ app.get('/status', (req, res) => { // FIXME Async/await this stuff... const installed = fs.existsSync(config.installFile) const mods = getMods() + const version = getVersion(installed) const ret = { "installed": installed, - "version": "1.20.bogus", + "version": version, "mods": mods } res.send(ret)