Repository: mmmaxwwwell/space-engineers-dedicated-docker-linux Branch: main Commit: 174d1a877200 Files: 13 Total size: 12.7 KB Directory structure: gitextract_gjwrf51d/ ├── .dockerignore ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── docker-compose.yml ├── entrypoint-space_engineers.bash ├── entrypoint.bash ├── install-winetricks ├── restart ├── start ├── stop └── test ================================================ FILE CONTENTS ================================================ ================================================ FILE: .dockerignore ================================================ appdata/ ================================================ FILE: .gitignore ================================================ appdata/ ================================================ FILE: Dockerfile ================================================ FROM mmmaxwwwell/wine6:latest COPY install-winetricks /scripts/ RUN \ mkdir /wineprefix &&\ chown -R wine:wine /wineprefix &&\ chmod +x /scripts/install-winetricks WORKDIR /scripts RUN runuser wine bash -c ./install-winetricks RUN \ mkdir -p /appdata/space-engineers/bin &&\ mkdir -p /appdata/space-engineers/config COPY entrypoint.bash /entrypoint.bash COPY entrypoint-space_engineers.bash /entrypoint-space_engineers.bash RUN chmod +x /entrypoint.bash && chmod +x /entrypoint-space_engineers.bash CMD /entrypoint.bash ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2020 mmmaxwwwell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # [mmmaxwwwell/space-engineers-dedicated-docker-linux](https://github.com/mmmaxwwwell/space-engineers-dedicated-docker-linux) All of the space engineers dedicated server on wine containers I found wouldn't build, and I embarked on a journey to create my own. ## Features: * Wine 6 * Debian Buster * Installs default star system world on first run * Automatically updates `````` element in ```SpaceEngineers-Dedicated.cfg``` * Supports plugins. * Image built and [available on dockerhub](https://hub.docker.com/r/mmmaxwwwell/space-engineers-dedicated-docker-linux) * Easy to implement offsite backups, just copy everything in ```./appdata/space-engineers/config``` with your favorite backup tool. * Reduced container size (~4gb decompressed). Thank you to: * [7thCore](https://github.com/7thCore) for [7thCore/sesrv-script](https://github.com/7thCore/sesrv-script) * [Devidian](https://github.com/Devidian) for advancing the docker implementation to a working state! * @Inflex for * @Tsu, @Aedis, @ebbit, @data, @ReAn, @BloodyIron, @spawnAjak for all around helping when testing and getting this started * [@UseAfterFreee](https://github.com/UseAfterFreee), [@woeisme](https:/github.com/woeisme), [@kennethx](https://github.com/kennethx), [@MarkL4YG](https://github.com/MarkL4YG), [@BaIthamel](https://github.com/BaIthamel), [@Tetrino](https://github.com/Tetrino), [@Teacay1](https://github.com/Teacay1), [@Fischchen](https://github.com/Fischchen), [@whodat](https://github.com/whodat), [@msansen](https://github.com/msansen), [@IndexOutOfMJ](https://github.com/IndexOutOfMJ) for opening issues or contributing to an issue conversation that improved the repo. ## Prerequisites: * docker * docker-compose (recommended, not required to run container) * unzip ## Tips: * You can copy the entire contents of ./appdata/space-engineers/config to make a backup, including the SpaceEngineers-Dedicated.cfg file. * The ```./start``` script will start the server using docker-compose in detached mode, and then attaches to the log output. You can press ctrl+c to detach from the logs and keep the server running. * If you are running plugins, the first time your run this, check your SpaceEngineers-Dedicated.cfg file for the Plugins element. If it spans multiple lines, you must replace it with ``````, exactly like that. The server will query ./appdata/space-engineers/config/Plugins and update the config file as needed from then on. * If you start the docker container without placing SpaceEngineers-Dedicated.cfg in the correct location, docker will create an empty folder where it should be. The container won't run until you stop the container, delete the empty SpaceEngineers-Dedicated.cfg folder, and replace it with the actual file. ## Usage: ### -RECOMENDED- Pull from dockerhub and run with docker-compose * Clone this repo with ```git clone https://github.com/mmmaxwwwell/space-engineers-dedicated-docker-linux.git```. * Change directory into the cloned repo with ```cd space-engineers-dedicated-docker-linux```. * Run the start script with ```./start```. This will initialize the ./appdata folder, unzip an empty star system from star-system.zip and start the server. ### Pull and run from dockerhub without docker-compose: From this directory run : ``` docker run --restart always -p "27016:27016/udp" \ -v $(pwd)/appdata/space-engineers/config/World:/appdata/space-engineers/World\ -v $(pwd)/appdata/space-engineers/bins/SpaceEngineersDedicated:/appdata/space-engineers/SpaceEngineersDedicated\ -v $(pwd)/appdata/space-engineers/bins/steamcmd:/home/se/.steam\ -v $(pwd)/appdata/space-engineers/config/SpaceEngineers-Dedicated.cfg:/appdata/space-engineers/SpaceEngineersDedicated/SpaceEngineers-Dedicated.cfg\ mmmaxwwwell/space-engineers-dedicated-docker-linux:latest ``` ## Exit Codes: | Exit Code | Reason | | - | - | | 129 | Container is missing /appdata/space-engineers/World folder, volume mounts are mounted incorrectly. | | 130 | Container is missing /appdata/space-engineers/World/Sandbox.sbc, World is not placed in the right folder, or the volume mounts are mounted incorrectly. Ensure your world is in ```./appdata/space-engineers/config/World/```.| | 131 | Container is missing the dedicated server config file SpaceEngineers-Dedicated.cfg. Ensure that you have placed SpaceEngineers-Dedicated.cfg at ```./appdata/space-engineers/config/SpaceEngineers-Dedicated.cfg```. | ## Directory Structure: ``` SpaceEngineersDedicated contains the dedicated server files steamcmd contains steamcmd config contains all the user configurable files for the game instance World contains the world files appdata └── space-engineers ├── bins │   ├── SpaceEngineersDedicated │   └── steamcmd └── config ├── SpaceEngineers-Dedicated.cfg └── World ├── Alien-291759539d120000.vx2 ├── EarthLike-1779144428d120000.vx2 ├── Europa-595048092d19000.vx2 ├── Mars-2044023682d120000.vx2 ├── Moon-1353915701d19000.vx2 ├── SANDBOX_0_0_0_.sbs ├── Sandbox.sbc ├── Sandbox_config.sbc ├── Titan-2124704365d19000.vx2 ├── Triton-12345d80253.vx2 └── thumb.jpg ``` ================================================ FILE: docker-compose.yml ================================================ version: '3' services: se-server: image: mmmaxwwwell/space-engineers-dedicated-docker-linux:latest container_name: space-engineers-dedicated-docker-linux restart: unless-stopped volumes: - ./appdata/space-engineers/config/World:/appdata/space-engineers/World - ./appdata/space-engineers/config/Plugins:/appdata/space-engineers/Plugins - ./appdata/space-engineers/config/SpaceEngineers-Dedicated.cfg:/appdata/space-engineers/SpaceEngineersDedicated/SpaceEngineers-Dedicated.cfg - ./appdata/space-engineers/bins/SpaceEngineersDedicated:/appdata/space-engineers/SpaceEngineersDedicated - ./appdata/space-engineers/bins/steamcmd:/home/wine/.steam ports: - "27016:27016/udp" ================================================ FILE: entrypoint-space_engineers.bash ================================================ #!/bin/bash source ~/.profile source ~/.bash_profile cd /appdata/space-engineers/SpaceEngineersDedicated/DedicatedServer64/ env WINEARCH=win64 WINEDEBUG=-all WINEPREFIX=/wineprefix wine /appdata/space-engineers/SpaceEngineersDedicated/DedicatedServer64/SpaceEngineersDedicated.exe -noconsole -path Z:\\appdata\\space-engineers\\SpaceEngineersDedicated -ignorelastsession ================================================ FILE: entrypoint.bash ================================================ #!/bin/bash # #check if /appdata/space-engineers/config/World is a folder if [ ! -d "/appdata/space-engineers/World" ]; then echo "World folder does not exist, exiting" exit 129 fi # #check if /appdata/space-engineers/config/World/Sandbox.sbc exists and is a file if [ ! -f "/appdata/space-engineers/World/Sandbox.sbc" ]; then echo "Sandbox.sbc file does not exist, exiting." exit 130 fi # #check if /appdata/space-engineers/config/SpaceEngineers-Dedicated.cfg is a file if [ ! -f "/appdata/space-engineers/SpaceEngineersDedicated/SpaceEngineers-Dedicated.cfg" ]; then echo "SpaceEngineers-Dedicated.cfg file does not exist, exiting." exit 131 fi #set to the correct value cat /appdata/space-engineers/SpaceEngineersDedicated/SpaceEngineers-Dedicated.cfg | sed -E '/.*LoadWorld.*/c\ Z:\\appdata\\space-engineers\\World' > /tmp/SpaceEngineers-Dedicated.cfg && cat /tmp/SpaceEngineers-Dedicated.cfg > /appdata/space-engineers/SpaceEngineersDedicated/SpaceEngineers-Dedicated.cfg #set game port to the correct value #cat /appdata/space-engineers/SpaceEngineersDedicated/SpaceEngineers-Dedicated.cfg | sed -E '/.*ServerPort.*/c\ 27016' > /tmp/SpaceEngineers-Dedicated.cfg && cat /tmp/SpaceEngineers-Dedicated.cfg > /appdata/space-engineers/SpaceEngineersDedicated/SpaceEngineers-Dedicated.cfg #configure plugins section in SpaceEngineers-Dedicated.cfg #get new plugins string if [ "$(ls -1 /appdata/space-engineers/Plugins/*.dll | wc -l)" -gt "0" ]; then PLUGINS_STRING=$(ls -1 /appdata/space-engineers/Plugins/*.dll |\ awk '{ print "" $0 "" }' |\ tr -d '\n' |\ awk '{ print "" $0 "" }' ) else PLUGINS_STRING="" fi SED_EXPRESSION_EMPTY="s//${PLUGINS_STRING////\\/} /g" SED_EXPRESSION_FULL="s/.*<\/Plugins>/${PLUGINS_STRING////\\/} /g" #find and replace in SpaceEngineers-Dedicated.cfg for empty "" element cat /appdata/space-engineers/SpaceEngineersDedicated/SpaceEngineers-Dedicated.cfg | sed -E "$SED_EXPRESSION_EMPTY" > /tmp/SpaceEngineers-Dedicated.cfg && cat /tmp/SpaceEngineers-Dedicated.cfg > /appdata/space-engineers/SpaceEngineersDedicated/SpaceEngineers-Dedicated.cfg #find and replace in SpaceEngineers-Dedicated.cfg for filled out "..." element # sed can't handle multiple lines easily, so everything needs to be on a single line. cat /appdata/space-engineers/SpaceEngineersDedicated/SpaceEngineers-Dedicated.cfg | sed -E "$SED_EXPRESSION_FULL" > /tmp/SpaceEngineers-Dedicated.cfg && cat /tmp/SpaceEngineers-Dedicated.cfg > /appdata/space-engineers/SpaceEngineersDedicated/SpaceEngineers-Dedicated.cfg runuser -l wine bash -c 'steamcmd +login anonymous +@sSteamCmdForcePlatformType windows +force_install_dir /appdata/space-engineers/SpaceEngineersDedicated +app_update 298740 +quit' runuser -l wine bash -c '/entrypoint-space_engineers.bash' ================================================ FILE: install-winetricks ================================================ #!/bin/bash Xvfb :5 -screen 0 1024x768x16 & env WINEARCH=win64 WINEDEBUG=-all WINEDLLOVERRIDES="mscoree=d" WINEPREFIX=/wineprefix wineboot --init /nogui env WINEARCH=win64 WINEDEBUG=-all WINEPREFIX=/wineprefix ./winetricks corefonts env DISPLAY=:5.0 WINEARCH=win64 WINEDEBUG=-all WINEPREFIX=/wineprefix ./winetricks -q vcrun2017 env DISPLAY=:5.0 WINEARCH=win64 WINEDEBUG=-all WINEPREFIX=/wineprefix ./winetricks -q --force dotnet48 env WINEARCH=win64 WINEDEBUG=-all WINEPREFIX=/wineprefix ./winetricks sound=disabled env DISPLAY=:5.0 WINEARCH=win64 WINEDEBUG=-all WINEPREFIX=/wineprefix ./winetricks -q vcrun2013 rm -rf ~/.cache ================================================ FILE: restart ================================================ #!/bin/bash ./stop ./start ================================================ FILE: start ================================================ #!/bin/bash sudo mkdir -p appdata/space-engineers/bins/SpaceEngineersDedicated sudo mkdir -p appdata/space-engineers/bins/steamcmd sudo mkdir -p appdata/space-engineers/config/World sudo mkdir -p appdata/space-engineers/config/Plugins if [ ! -f ./appdata/space-engineers/config/World/Sandbox.sbc ]; then echo "World not found, initalizing empty star system..." sudo unzip -n star-system.zip -d ./appdata/space-engineers/config fi #container executes server as 1000:1000 if [ "$(stat -c '%u' appdata)" != "1000" ]; then echo "Setting owner of appdata to UID 1000" sudo chown -R 1000:1000 appdata fi sudo docker-compose up -d sudo docker-compose logs -f ================================================ FILE: stop ================================================ #/bin/bash sudo docker-compose stop ================================================ FILE: test ================================================ #!/bin/bash #docker run -it --rm --entrypoint /bin/bash -p "27016:27016/udp" \ docker run -p "27016:27016/udp" \ -v $(pwd)/appdata/space-engineers/config/World:/appdata/space-engineers/World\ -v $(pwd)/appdata/space-engineers/config/Plugins:/appdata/space-engineers/Plugins\ -v $(pwd)/appdata/space-engineers/bins/SpaceEngineersDedicated:/appdata/space-engineers/SpaceEngineersDedicated\ -v $(pwd)/appdata/space-engineers/bins/steamcmd:/home/se/.steam\ -v $(pwd)/appdata/space-engineers/config/SpaceEngineers-Dedicated.cfg:/appdata/space-engineers/SpaceEngineersDedicated/SpaceEngineers-Dedicated.cfg\ mmmaxwwwell/space-engineers-dedicated-docker-linux:wine6-plugins