From 2cd856d529c3f1c09eab8f401ead1826103bac4f Mon Sep 17 00:00:00 2001 From: Chip Wolf Date: Wed, 19 Jun 2019 20:16:53 +0000 Subject: [PATCH] :zap: fixed for <= 1101023 --- Dockerfile | 103 +++++++++++++++++++--------------------- README.md | 91 +++++++++++++++-------------------- install.sh | 2 +- space-engineers.service | 25 ---------- 4 files changed, 89 insertions(+), 132 deletions(-) delete mode 100644 space-engineers.service diff --git a/Dockerfile b/Dockerfile index 24732c4..475f5cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,80 +1,77 @@ -# Space Engineers on Linux -# Dockerfile based on original work by webanck. -# See https://github.com/webanck/docker-wine-steam +# Space Engineers Server +# Based on original work by webanck +# https://github.com/webanck/docker-wine-steam +# Adapted from work by marjacob +# https://github.com/marjacob/se-server -FROM ubuntu:14.04 -MAINTAINER Martin Røed Jacobsen +FROM ubuntu +MAINTAINER Chip Wolf # Creating the wine user and setting up dedicated non-root environment. -# Replace 1001 by your user id (id -u) for X sharing. RUN useradd -u 256 -d /home/wine -m -s /bin/bash wine ENV HOME /home/wine WORKDIR /home/wine -# Setting up the wineprefix to force 32 bit architecture. +# Setting up the wineprefix to force 64 bit architecture. ENV WINEPREFIX /home/wine/.wine -ENV WINEARCH win32 +ENV WINEARCH win64 # Disabling warning messages from wine, comment for debug purpose. ENV WINEDEBUG -all -######################### START INSTALLATIONS ########################## - # Disable interaction from package installation during the docker image building. ENV DEBIAN_FRONTEND noninteractive -# We want the 32 bits version of wine allowing winetricks. -RUN dpkg --add-architecture i386 && \ +RUN dpkg --add-architecture i386 && \ -# Set the time zone. - echo "Europe/Oslo" > /etc/timezone && \ - dpkg-reconfigure -f noninteractive tzdata && \ + # Updating and upgrading + apt-get update && \ + apt-get upgrade -y && \ -# Updating and upgrading a bit. - apt-get update && \ - apt-get upgrade -y && \ + apt-get install -y --no-install-recommends software-properties-common && \ + apt-get install -y --no-install-recommends unzip wget gpg-agent apt-transport-https && \ -# We need software-properties-common to add ppas. - apt-get install -y --no-install-recommends software-properties-common && \ + # Add the wine repo + wget -qO - https://dl.winehq.org/wine-builds/winehq.key | apt-key add - && \ + apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main' && \ + apt-get update && \ -# Add the wine PPA. - add-apt-repository ppa:ubuntu-wine/ppa && \ - apt-get update && \ + # Installation of wine, winetricks and temporary xvfb + apt-get install -y --install-recommends winehq-stable && \ + ln -s /opt/wine-stable/bin/wine64 /bin/wine && \ + apt-get install -y --no-install-recommends winetricks xvfb && \ -# Installation of win, winetricks and temporary xvfb to install winetricks tricks during docker build. - apt-get install -y --no-install-recommends wine1.7 winetricks xvfb && \ + # Installation of winbind to stop ntlm error messages + apt-get install -y --no-install-recommends winbind && \ -# Installation of winbind to stop ntlm error messages. - apt-get install -y --no-install-recommends winbind && \ + # Installation of winetricks tricks as wine user + su -p -l wine -c winecfg && \ + su -p -l wine -c 'xvfb-run -a winetricks -q corefonts' && \ + su -p -l wine -c 'xvfb-run -a winetricks -q vcrun2013' && \ + su -p -l wine -c 'xvfb-run -a winetricks -q dotnet20' ; \ + su -p -l wine -c 'xvfb-run -a winetricks -q dotnet461' ; \ + su -p -l wine -c 'xvfb-run -a winetricks -q xna40' && \ + su -p -l wine -c 'xvfb-run -a winetricks d3dx9' && \ + su -p -l wine -c 'xvfb-run -a winetricks -q directplay' && \ -# Installation of winetricks tricks as wine user. - su -p -l wine -c winecfg && \ - su -p -l wine -c 'xvfb-run -a winetricks -q corefonts' && \ - su -p -l wine -c 'xvfb-run -a winetricks -q dotnet20' && \ - su -p -l wine -c 'xvfb-run -a winetricks -q dotnet40' && \ - su -p -l wine -c 'xvfb-run -a winetricks -q xna40' && \ - su -p -l wine -c 'xvfb-run -a winetricks d3dx9' && \ - su -p -l wine -c 'xvfb-run -a winetricks -q directplay' && \ + # Installation of git, build tools, and sigmap + apt-get install -y --no-install-recommends build-essential git-core && \ + git clone https://github.com/marjacob/sigmap.git && \ + (cd sigmap && exec make) && \ + install sigmap/bin/sigmap /usr/local/bin/sigmap && \ + rm -rf sigmap/ && \ -# Installation of git, build tools and sigmap. - apt-get install -y --no-install-recommends build-essential git-core && \ - git clone https://github.com/marjacob/sigmap.git && \ - (cd sigmap && exec make) && \ - install sigmap/bin/sigmap /usr/local/bin/sigmap && \ - rm -rf sigmap/ && \ + # Cleaning up + apt-get autoremove -y --purge build-essential git-core && \ + apt-get autoremove -y --purge software-properties-common && \ + apt-get autoremove -y --purge wget gpg-agent apt-transport-https && \ + apt-get autoremove -y --purge xvfb && \ + apt-get autoremove -y --purge && \ + apt-get clean -y && \ + rm -rf /home/wine/.cache && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Cleaning up. - apt-get autoremove -y --purge build-essential git-core && \ - apt-get autoremove -y --purge software-properties-common && \ - apt-get autoremove -y --purge xvfb && \ - apt-get autoremove -y --purge && \ - apt-get clean -y && \ - rm -rf /home/wine/.cache && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -######################### END OF INSTALLATIONS ########################## - -# Add the dedicated server files. +# Add the dedicated server files ADD install.sh /install.sh RUN /install.sh && rm /install.sh diff --git a/README.md b/README.md index f26a72e..a381197 100644 --- a/README.md +++ b/README.md @@ -1,85 +1,70 @@ # Space Engineers on Linux -Docker container for running a Space Engineers server on a Linux machine. - -## Requirements -- Debian 8 (to use these files as-is) -- docker (this one is obvious) -- systemd (you can use System V init, but you will have to write your own startup script). +Docker container for running a Space Engineers server +There is no public prebuilt container image because of copyright restrictions +These instructions will guide you to configure the environment and build your own container ## Setup -Perform the following steps in the written order. - -- Create a new system user account which will own the container. The files in this repository assumes that the new user is named `saiban`. You can of course change this to whatever you prefer. Please note that the user ID must correspond to the ID specified in the Dockerfile. If you change it here, you should change it there. - -```bash -adduser --system --home /home/saiban --uid 256 --group --gecos "Space Engineers" saiban -``` - -- Change to the new user and move into its home directory by issuing the following commands. - -```bash -sudo -u saiban /bin/bash -cd - ``` - Create the required directory structure. ```bash -mkdir -p games/space-engineers/{docker,data} -mkdir -p games/space-engineers/data/Space\ Engineers/{Mods,Saves} +mkdir -p space-engineers/{docker,data,steam} +mkdir -p space-engineers/data/Space\ Engineers/{Mods,Saves} ``` - Clone this repository into the home directory of the new user account. ```bash -git clone git@github.com:marjacob/se-server.git games/space-engineers/docker +git clone https://github.com/ChipWolf/se-server.git space-engineers/docker ``` -- Obtain a copy of the most current `DedicatedServer.zip` and place it in `~/games/space-engineers/data`. You will usually find it in `[...]\SteamApps\SpaceEngineers\Tools\DedicatedServer.zip` (do not extract its contents). +- Obtain a copy of the most current `DedicatedServer.zip` and place it in `~/games/space-engineers/data`. You may use this method below. + + +```bash +docker run --rm -it -v $(pwd)/space-engineers/steam:/data wilkesystems/steamcmd + +# the following 4 commands are for the steamcmd terminal +login anonymous +force_install_dir /data +app_update 298740 validate +quit +``` + +- At this stage we need to patch a few .dlls to fix an issue with mods not downloading, thanks to [Thomas\_Jefferson](https://forum.keenswh.com/members/thomas_jefferson.3913080/) from the Keen Software House forum for this one. + +![](https://i.cwlf.uk/Jxav4.png) + +``` +cd space-engineers/steam +zip -r ../data/DedicatedServer.zip +cd ../.. +sudo chown -R 256:256 space-engineers +``` - Upload your `SpaceEngineers-Dedicated.cfg` and place it in `~/games/space-engineers/data/Space Engineers`. Use the one in this repository and edit it to your liking if you do not already have one. -- Copy `space-engineers.service` from this repository to `/etc/systemd/system`. Do not forget to change the `User` and `Group` setting in this file if you did not go with the defaults. +- **Build the image!** *(This will take a while)* ```bash -sudo cp games/space-engineers/docker/space-engineers.service /etc/systemd/system +space-engineers/docker/build.sh ``` -- **Build the image!** - -This will take a while. +#### Starting the server ```bash -games/space-engineers/docker/build.sh +docker run -it -p 27016:27016/udp -v $(pwd)/games/space-engineers/data:/host --rm --name space-engineers saiban/space-engineers ``` -## Updating -Update Space Engineers by replacing the `DedicatedServer.zip` with an updated version and restarting the server. +![](https://i.cwlf.uk/PPXyG.png) -## Managing the server - -### Starting the server - -```bash -sudo systemctl start space-engineers -``` - -### Stopping the server - -```bash -sudo systemctl stop space-engineers -``` - -### Monitoring the server -This will give you live output from the server, as if it was running locally in your terminal. - -```bash -sudo journalctl --no-tail -f -u space-engineeers -``` +--- ## Additional notes -Running Space Engineers this way requires a helper program called `sigmap` which I developed for this use specifically. It is cloned and built by the Dockerfile and should not add any additional overhead. Because Space Engineers ignores `SIGTERM` which is sent by Docker to shut down the service, `sigmap` catches that signal and forwards `SIGINT` to Space Engineers. +Running Space Engineers this way requires a helper program called `sigmap` which was developed for this use specifically. It is cloned and built by the Dockerfile and should not add any additional overhead. Because Space Engineers ignores `SIGTERM` which is sent by Docker to shut down the service, `sigmap` catches that signal and forwards `SIGINT` to Space Engineers. See [here](https://github.com/marjacob/sigmap "sigmap") for more information. ## Credits The original `Dockerfile` was written by [webanck](https://github.com/webanck "webanck") and can be found [here](https://github.com/webanck/docker-wine-steam "Steam with Docker"). + +This repo has been adapted from [marjacob](https://github.com/marjacob "marjacob")'s efforts. diff --git a/install.sh b/install.sh index 385fa99..3746a9d 100755 --- a/install.sh +++ b/install.sh @@ -5,7 +5,7 @@ wine_home="/home/wine/.wine/drive_c/users/wine" wine_appdata="${wine_home}/Application Data" # space engineers -se_home="${wine_home}/DedicatedServer" +se_home="${wine_home}/DedicatedServer64" se_appdata="${wine_appdata}/SpaceEngineersDedicated" # entry point diff --git a/space-engineers.service b/space-engineers.service deleted file mode 100644 index af40199..0000000 --- a/space-engineers.service +++ /dev/null @@ -1,25 +0,0 @@ -[Unit] -Description = Space Engineers -Requires = docker.service -After = docker.service - -[Service] -User = saiban -Group = saiban - -Restart = always -StandardInput = null -StandardOutput = journal -StandardError = journal - -ExecStart = /usr/bin/docker run -t \ - -p 27016:27016/udp \ - -v /home/saiban/games/space-engineers/data:/host \ - --name space_engineers_server \ - saiban/space-engineers -ExecStop = /usr/bin/docker stop space_engineers_server ; \ - /usr/bin/docker rm -f space_engineers_server ; \ - /bin/chmod 666 /dev/null - -[Install] -WantedBy = local.target