From 52ee662d63cd5e97e16415395c86c10dbc6de033 Mon Sep 17 00:00:00 2001 From: Kadrim <8304331+kadrim@users.noreply.github.com> Date: Thu, 26 Dec 2024 01:39:54 +0100 Subject: [PATCH 1/4] optimize docker by using unprivileged users instead of root --- Docker/SSLv3Proxy/Dockerfile | 10 +++++++--- Docker/Xenia-WebServices/Dockerfile | 10 +++++++--- README.MD | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Docker/SSLv3Proxy/Dockerfile b/Docker/SSLv3Proxy/Dockerfile index da58e00..20acd8f 100644 --- a/Docker/SSLv3Proxy/Dockerfile +++ b/Docker/SSLv3Proxy/Dockerfile @@ -1,9 +1,13 @@ -FROM ubuntu:trusty - -WORKDIR /sslv3-proxy +FROM ubuntu:14.04 RUN apt-get update && apt-get install -y nodejs && apt-get clean +RUN useradd -ms /bin/bash appuser + +USER appuser + +WORKDIR /sslv3-proxy + COPY SSLv3Proxy/. . ENV LOCAL_FQDN=false diff --git a/Docker/Xenia-WebServices/Dockerfile b/Docker/Xenia-WebServices/Dockerfile index 3799ab4..405acd9 100644 --- a/Docker/Xenia-WebServices/Dockerfile +++ b/Docker/Xenia-WebServices/Dockerfile @@ -1,12 +1,16 @@ FROM node:20-alpine +RUN addgroup -S appgroup && adduser -S appuser -G appgroup + WORKDIR /xenia-web-service -COPY submodules/Xenia-WebServices/package*.json ./ +COPY submodules/Xenia-WebServices/. . -RUN npm install +RUN chown -R appuser:appgroup . -COPY submodules/Xenia-WebServices/. . +USER appuser + +RUN npm install RUN npm run build diff --git a/README.MD b/README.MD index 175c6b5..cb656ea 100644 --- a/README.MD +++ b/README.MD @@ -29,7 +29,7 @@ Edit the following files: Then open a terminal in the folder where you extracted the current release and run the following commands: ``` -docker compose build +docker compose build --no-cache docker compose up ``` From 3199b147db3c760b29fd5e6f96ed18782528d5e2 Mon Sep 17 00:00:00 2001 From: Kadrim <8304331+kadrim@users.noreply.github.com> Date: Thu, 26 Dec 2024 01:40:53 +0100 Subject: [PATCH 2/4] add container for linux --- Docker/Syndicate2012PSE/Dockerfile | 25 ++++++++++++++++++++++ Docker/Syndicate2012PSE/docker-compose.yml | 20 +++++++++++++++++ Docker/Syndicate2012PSE/startup.sh | 10 +++++++++ ME3Server_WV/ME3Server.cs | 4 ++-- ME3Server_WV/Properties/AssemblyInfo.cs | 6 +++--- 5 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 Docker/Syndicate2012PSE/Dockerfile create mode 100644 Docker/Syndicate2012PSE/docker-compose.yml create mode 100755 Docker/Syndicate2012PSE/startup.sh diff --git a/Docker/Syndicate2012PSE/Dockerfile b/Docker/Syndicate2012PSE/Dockerfile new file mode 100644 index 0000000..64e8ea5 --- /dev/null +++ b/Docker/Syndicate2012PSE/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:20.04 + +RUN dpkg --add-architecture i386 && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y wine32 winetricks xvfb && apt-get clean + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y net-tools && apt-get clean + +RUN useradd -ms /bin/bash appuser + +WORKDIR /syndicate2012-pse + +RUN chown -R appuser:appuser . + +USER appuser + +RUN winetricks -q dotnet452 + +COPY Docker/Syndicate2012PSE/startup.sh . + +COPY ME3Server_WV/bin/Debug/ ./ + +ENV HEADLESS=true + +EXPOSE 14219 42130 + +CMD [ "./startup.sh" ] diff --git a/Docker/Syndicate2012PSE/docker-compose.yml b/Docker/Syndicate2012PSE/docker-compose.yml new file mode 100644 index 0000000..acc5276 --- /dev/null +++ b/Docker/Syndicate2012PSE/docker-compose.yml @@ -0,0 +1,20 @@ +services: + syndicate2012-pse: + build: + context: ../.. + dockerfile: Docker/Syndicate2012PSE/Dockerfile + environment: + HEADLESS: true + DISPLAY: $DISPLAY + WAYLAND_DISPLAY: $WAYLAND_DISPLAY + XDG_RUNTIME_DIR: $XDG_RUNTIME_DIR + network_mode: host + volumes: + - /tmp/.X11-unix:/tmp/.X11-unix + - '../../ME3Server_WV/bin/Debug/cert:/syndicate2012-pse/cert' + - '../../ME3Server_WV/bin/Debug/conf:/syndicate2012-pse/conf' + - '../../ME3Server_WV/bin/Debug/http:/syndicate2012-pse/http' + - '../../ME3Server_WV/bin/Debug/logs:/syndicate2012-pse/logs' + - '../../ME3Server_WV/bin/Debug/patch:/syndicate2012-pse/patch' + - '../../ME3Server_WV/bin/Debug/player:/syndicate2012-pse/player' + - '../../ME3Server_WV/bin/Debug/replay:/syndicate2012-pse/replay' \ No newline at end of file diff --git a/Docker/Syndicate2012PSE/startup.sh b/Docker/Syndicate2012PSE/startup.sh new file mode 100755 index 0000000..36ffe80 --- /dev/null +++ b/Docker/Syndicate2012PSE/startup.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ "$HEADLESS" == "true" ] + then + echo "Running in headless mode" + xvfb-run wine Syndicate2012Server.exe + else + echo "Running in GUI mode" + wine Syndicate2012Server.exe +fi diff --git a/ME3Server_WV/ME3Server.cs b/ME3Server_WV/ME3Server.cs index 4a15212..7265dd1 100644 --- a/ME3Server_WV/ME3Server.cs +++ b/ME3Server_WV/ME3Server.cs @@ -245,9 +245,9 @@ public static void threadHttpListener(object objs) { string IP = Config.FindEntry("IP"); if (IP == "") - HttpListener = new TcpListener(IPAddress.Parse("127.0.0.1"), 80); + HttpListener = new TcpListener(IPAddress.Parse("127.0.0.1"), 8088); else - HttpListener = new TcpListener(IPAddress.Parse(IP), 80); + HttpListener = new TcpListener(IPAddress.Parse(IP), 8088); HttpListener.Start(); Logger.Log("[Http Listener] Started listening on " + EndpointToString(HttpListener.LocalEndpoint), Color.Black); int counter = 0; diff --git a/ME3Server_WV/Properties/AssemblyInfo.cs b/ME3Server_WV/Properties/AssemblyInfo.cs index 84af8fa..e6789f1 100644 --- a/ME3Server_WV/Properties/AssemblyInfo.cs +++ b/ME3Server_WV/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Syndicate2012Server")] -[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.0.0")] -[assembly: AssemblyFileVersion("0.1.0.0")] +[assembly: AssemblyVersion("0.2.0.0")] +[assembly: AssemblyFileVersion("0.2.0.0")] From 96aa92eaec2c6223edb1b7dd75246f4026caa898 Mon Sep 17 00:00:00 2001 From: kadrim <8304331+kadrim@users.noreply.github.com> Date: Thu, 26 Dec 2024 11:33:03 +0100 Subject: [PATCH 3/4] clarify usage on linux --- .gitignore | 1 + Docker/Syndicate2012PSE/Dockerfile | 6 +++-- Docker/Syndicate2012PSE/Dockerfile.debug | 27 ++++++++++++++++++++++ Docker/Syndicate2012PSE/docker-compose.yml | 2 +- README.MD | 17 +++++++++++++- linux/compose.override.yaml | 20 ++++++++++++++++ 6 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 Docker/Syndicate2012PSE/Dockerfile.debug create mode 100644 linux/compose.override.yaml diff --git a/.gitignore b/.gitignore index 76b545f..9868291 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ Thumbs.db ME3Server_WV/bin/Debug/logs/ /data/ +/compose.override.yaml diff --git a/Docker/Syndicate2012PSE/Dockerfile b/Docker/Syndicate2012PSE/Dockerfile index 64e8ea5..b1d4672 100644 --- a/Docker/Syndicate2012PSE/Dockerfile +++ b/Docker/Syndicate2012PSE/Dockerfile @@ -14,9 +14,11 @@ USER appuser RUN winetricks -q dotnet452 -COPY Docker/Syndicate2012PSE/startup.sh . +COPY --chown=appuser Docker/Syndicate2012PSE/startup.sh . -COPY ME3Server_WV/bin/Debug/ ./ +RUN chmod +x startup.sh + +COPY --chown=appuser ./ ./ ENV HEADLESS=true diff --git a/Docker/Syndicate2012PSE/Dockerfile.debug b/Docker/Syndicate2012PSE/Dockerfile.debug new file mode 100644 index 0000000..e0f7806 --- /dev/null +++ b/Docker/Syndicate2012PSE/Dockerfile.debug @@ -0,0 +1,27 @@ +FROM ubuntu:20.04 + +RUN dpkg --add-architecture i386 && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y wine32 winetricks xvfb && apt-get clean + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y net-tools && apt-get clean + +RUN useradd -ms /bin/bash appuser + +WORKDIR /syndicate2012-pse + +RUN chown -R appuser:appuser . + +USER appuser + +RUN winetricks -q dotnet452 + +COPY --chown=appuser Docker/Syndicate2012PSE/startup.sh . + +RUN chmod +x startup.sh + +COPY --chown=appuser ME3Server_WV/bin/Debug/ ./ + +ENV HEADLESS=true + +EXPOSE 14219 42130 + +CMD [ "./startup.sh" ] diff --git a/Docker/Syndicate2012PSE/docker-compose.yml b/Docker/Syndicate2012PSE/docker-compose.yml index acc5276..7f5353d 100644 --- a/Docker/Syndicate2012PSE/docker-compose.yml +++ b/Docker/Syndicate2012PSE/docker-compose.yml @@ -2,7 +2,7 @@ services: syndicate2012-pse: build: context: ../.. - dockerfile: Docker/Syndicate2012PSE/Dockerfile + dockerfile: Docker/Syndicate2012PSE/Dockerfile.debug environment: HEADLESS: true DISPLAY: $DISPLAY diff --git a/README.MD b/README.MD index cb656ea..0d54b2c 100644 --- a/README.MD +++ b/README.MD @@ -29,7 +29,7 @@ Edit the following files: Then open a terminal in the folder where you extracted the current release and run the following commands: ``` -docker compose build --no-cache +docker compose build docker compose up ``` @@ -68,6 +68,8 @@ Edit `docker-compose.yml` again and set the value of `LOCAL_FQDN` to `true`. Sto #### Known Issues +For help visit the official [Discord-Channel](https://discord.gg/6SmVQy8T) + ##### Timeout on Server and In-Game If you see the In-Game message `The request timed out. You are being returned to the main menu.` and also in the Server-Log the message: `[Main Server Handler #] Player Timed Out`, this is most likely due to an existing silentLogin in your game-client. @@ -93,6 +95,19 @@ Then open the file `player/tester.txt` and replace `UID` and `PID` with the Hex- - Edit the file `xenia-canary-netplay.config.toml` and set the value of `api_address` to `api_address = ":36000/"`, i.e. `api_address = "192.168.1.100:36000/"` - Then start xenia again and launch the game +### Linux Support + +The game itself runs pretty decent on `SteamOS` and `Ubuntu` using [Steam](https://store.steampowered.com/about/) (add Syndicate as a non-steam game) and by turning on the compatibility using `Proton` (i.e. Proton 9.0-4). + +To use the Server on a Linux machine you simply have to copy the file `linux/compose.override.yaml` to the root directory of this project (so one directory up). If you are running this on a desktop with GUI you can enable the GUI by editing the copied file and setting `HEADLESS` to `false`. + +Afterwards rebuild and rerun the services by executing: + +``` +docker compose build +docker compose up +``` + ## Todos - Fix Coop / Multiplayer for Xbox360 diff --git a/linux/compose.override.yaml b/linux/compose.override.yaml new file mode 100644 index 0000000..a92f1d0 --- /dev/null +++ b/linux/compose.override.yaml @@ -0,0 +1,20 @@ +services: + syndicate2012-pse: + build: + context: . + dockerfile: Docker/Syndicate2012PSE/Dockerfile + environment: + HEADLESS: true + DISPLAY: $DISPLAY + WAYLAND_DISPLAY: $WAYLAND_DISPLAY + XDG_RUNTIME_DIR: $XDG_RUNTIME_DIR + network_mode: host + volumes: + - /tmp/.X11-unix:/tmp/.X11-unix + - './cert:/syndicate2012-pse/cert' + - './conf:/syndicate2012-pse/conf' + - './http:/syndicate2012-pse/http' + - './logs:/syndicate2012-pse/logs' + - './patch:/syndicate2012-pse/patch' + - './player:/syndicate2012-pse/player' + - './replay:/syndicate2012-pse/replay' From 93a36361448ff48bb59157f9e367b9175f524789 Mon Sep 17 00:00:00 2001 From: Kadrim <8304331+kadrim@users.noreply.github.com> Date: Thu, 26 Dec 2024 11:51:01 +0100 Subject: [PATCH 4/4] fix cleanup --- ME3Server_WV/bin/Debug/cleanup.bat | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ME3Server_WV/bin/Debug/cleanup.bat b/ME3Server_WV/bin/Debug/cleanup.bat index 7e15d26..c9c62c4 100644 --- a/ME3Server_WV/bin/Debug/cleanup.bat +++ b/ME3Server_WV/bin/Debug/cleanup.bat @@ -2,14 +2,11 @@ del ME3PlayerDataEditor.pdb del ME3PlayerDataEditor.xml del PLAYER_FILES.txt del ME3Server_WV.pdb -del ME3Server_WV.vshost.exe -del ME3Server_WV.vshost.exe.config -del ME3Server_WV.vshost.exe.manifest +del Syndicate2012Server.exe +del Syndicate2012Server.exe.config +del Syndicate2012Server.manifest +del Syndicate2012Server.pdb del zlib.net.pdb cd logs del *.* /F /Q cd .. -cd player -del *.* /F /Q -cd gaw -del *.* /F /Q \ No newline at end of file