diff --git a/README.md b/README.md index e77979e9..f3bff3f2 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,58 @@ # Stardew Valley Multiplayer Docker Compose -Update: Previous versions provided game files to create the server with the Docker container. To respect ConcernedApe's work and follow -intellectual property law, this will no longer be the case. Users will still be allowed to use their own copy of the game, however. For now, -I will simply be disabling the sharing of game files which will render the Dockerfile incomplete. Those with more advanced Docker -knowledge will be able to make alterations. Life is busy so I appreciate patience while I work to update instructions on how to use -your own game files. I welcome pull requests to aid in this effort. See Steam Setup section for running through Steam. - This project aims to autostart a Stardew Valley Multiplayer Server as easy as possible. ## Notes -- Although I'm trying to put out updates, I don't have the time for testing thoroughly, so if you find issues, including - game updates, please put in an issue request and I will try to help. -- Thanks printfuck for the base code and baolatui for helping with hosting files. +- Previous versions provided game files to create the server with the Docker container. To respect ConcernedApe's work and follow +intellectual property law, this will no longer be the case. Users will now be required to use their own copy of the game. +- Although I'm trying to put out updates, I don't have the time for testing thoroughly, so if you find issues, please put +in an issue request and I will try to help. +- Thanks printfuck for the base code. + +Buy Me A Coffee -Buy Me A Coffee ## Setup +### Steam + +This image will download the game from Steam server using [steamcmd](https://developer.valvesoftware.com/wiki/SteamCMD) if you own the game. For that, it requires your Steam login. + +The credential variables are required only during building, not during game runtime. + +``` +## Set these variables only during the first build or during updates +export STEAM_USER= +export STEAM_PASS= +export STEAM_GUARD= # If you account is not protected, don't set + +docker compose -f docker-compose-steam.yml up +``` + +#### Steam Guard + +If your account is protected by Steam Guard, the build is a little time sensitive. You must open your app and +export the current Steam Guard to `STEAM_GUARD` environment variable code right before building. + +**Note: the code lasts a little longer than shown but not much.** + +After starting build, pay attention to your app. Even with the code, it will request for authorization which must be granted. + +If the build fails or when you want to update with `docker compose -f docker-compose-steam.yml build --no-cache`, you should set the newer `STEAM_GUARD` again. + +``` +## Remove env variables after build +unset STEAM_USER STEAM_PASS STEAM_GUARD +``` +### GOG + +To my knowledge there is no way to automate this. To use game files from GOG, you will need to download the Linux installer. +Sign in, go to Games, find Stardew, change the system to Linux, and download the game installer. The file will look something +like `stardew_valley_x.x.x.xxx.sh`. Unzip this file (using Git Bash if you are on Windows), and copy the files within the +`data/noarch/` directory to `docker/game_data/`. Start the container using `docker compose -f docker-compose-gog.yml up`. To +rebuild the container after updating the files, use `docker compose -f docker-compose-gog.yml build --no-cache`. + ### Configuration Edit the docker-compose.yml with your desired configuration settings. Setting values are quite descriptive as to what @@ -172,7 +207,7 @@ the port to the outside world. ## Accessing the server - Direct IP: You will need to set a up direct IP access over the internet "Join LAN Game" by opening (or forwarding) - port 24642. Or use Server Port Changer to choose a different port. People can then "Join LAN Game" via your external IP. + port 24642. Feel free to change this mapping in the compose file. People can then "Join LAN Game" via your external IP. (Taken from mod description. See [Always On Server](https://www.nexusmods.com/stardewvalley/mods/2677?tab=description) for more info.) @@ -188,38 +223,6 @@ for more info.) - [Remote Control](https://github.com/Novex/stardew-remote-control) (Default: On) - [TimeSpeed](https://www.nexusmods.com/stardewvalley/mods/169) (Default: Off) - -## Steam Setup - -This image will download the game from Steam server using [steamcmd](https://developer.valvesoftware.com/wiki/SteamCMD) if you own the game, for that it requires your steam login. - -The credential variables are required only during building, not during game run. - -``` -## Setup those variable only during the first build or updates -export STEAM_USER= -export STEAM_PASS= -export STEAM_GUARD= # If you account is not protected don't set - -docker-compose -f docker-compose-steam.yml up -``` - -### Steam Guard - -If your account is protected by steam Guard the build is a little time sensitive. You must open your app and -export the current Steam Guard to `STEAM_GUARD` environment variable code right before building. - -**Note: the code lasts a little longer than shown but not much.** - -After start building pay attention to your app, even with the code it will request for authorization, which must be granted. - -If the build fails or when you want to update with `docker-compose build --no-cache` you should set the newers `STEAM_GUARD` again. - -``` -## Remove env variables after build -unset STEAM_USER STEAM_PASS STEAM_GUARD -``` - ## Troubleshooting ### Waiting for Day to End @@ -233,16 +236,5 @@ for messages like "cannot open display", which would most likely indicate permis ### VNC -Access the game via VNC to initially load or start a pre-generated savegame. You can control the server from there or +Access the game via VNC to initially load or start a pre-generated game save. You can control the server from there or edit the config.json files in the configs folder. - -## Disclaimer - -This multiplayer server container is designed to distribute game files for the purpose of facilitating multiplayer -gaming experiences. By utilizing this server container, you acknowledge and agree that you are expected to possess a -legal copy of the game for which the files are being distributed. These files are intended solely for the purpose of -running a multiplayer server and should not be used in any other manner. The distributed game files are to be strictly -used for the operation of multiplayer servers. Any other use, including but not limited to reproduction, modification, -or distribution for personal or commercial gain, is strictly prohibited. The distribution of these game files does not -imply endorsement or sponsorship by the creators or owners of the game. We are solely providing a platform for -multiplayer gaming experiences. diff --git a/docker-compose.yml b/docker-compose-gog.yml similarity index 95% rename from docker-compose.yml rename to docker-compose-gog.yml index 1e7ee253..b6927038 100644 --- a/docker-compose.yml +++ b/docker-compose-gog.yml @@ -2,7 +2,9 @@ version: '2.2' services: valley: - build: docker + build: + context: docker + dockerfile: Dockerfile-gog container_name: stardew environment: # VNC @@ -128,5 +130,10 @@ services: - ./valley_saves:/config/xdg/config/StardewValley/Saves # If you'd like to set an existing savegame before the first start otherwise this file will be edited when starting the first game - ./configs/autoload.json:/data/Stardew/game/Mods/AutoLoadGame/config.json - + # deploy: + # ## The container is CPU hungry, you can limit using this block + # ## If you don't plan to play using VNC, 1 core should be enough to host for others + # resources: + # limits: + # cpus: "1" diff --git a/docker-compose-steam.yml b/docker-compose-steam.yml index 5fb1ffa8..30ff9623 100644 --- a/docker-compose-steam.yml +++ b/docker-compose-steam.yml @@ -6,10 +6,14 @@ services: context: docker dockerfile: Dockerfile-steam args: - STEAM_USER: ${STEAM_USER} ## Recommended: set as env_variable during build - STEAM_PASS: ${STEAM_PASS} ## Recommended: set as env_variable during build - STEAM_GUARD: ${STEAM_GUARD} ## Recommended: set as env_variable during build - SRCDS_APPID: 413150 ## Stardew steamId + ## Recommended: set as env_variable during build + STEAM_USER: ${STEAM_USER} + ## Recommended: set as env_variable during build + STEAM_PASS: ${STEAM_PASS} + ## Recommended: set as env_variable during build + STEAM_GUARD: ${STEAM_GUARD} + ## Stardew steamId + SRCDS_APPID: 413150 container_name: stardew environment: # VNC diff --git a/docker/Dockerfile b/docker/Dockerfile-gog similarity index 76% rename from docker/Dockerfile rename to docker/Dockerfile-gog index 3c40d39c..ee607a95 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile-gog @@ -4,17 +4,23 @@ FROM jlesage/baseimage-gui:debian-11 # Set the name of the application. ENV APP_NAME="StardewValley" +# Uses a distinct PATH from Stardew/game/ that GOG has. +ENV GAME_PATH="/data/Stardew" + RUN apt-get update && apt-get install -y wget unzip tar strace mono-complete xterm gettext-base jq netcat procps && apt-get clean -# TODO: Copy local user game files +RUN mkdir -p ${GAME_PATH} && \ + mkdir -p /data/nexus + +COPY game_data /data/Stardew RUN wget -qO dotnet.tar.gz https://download.visualstudio.microsoft.com/download/pr/d4b71fac-a2fd-4516-ac58-100fb09d796a/e79d6c2a8040b59bf49c0d167ae70a7b/dotnet-sdk-5.0.408-linux-arm64.tar.gz &&\ tar -zxf dotnet.tar.gz -C /usr/share/dotnet &&\ rm dotnet.tar.gz &&\ ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet -RUN wget --user-agent="Mozilla" https://mirror.cloudcraft.info/SMAPI_latest.tar.gz -qO /data/nexus.tar.gz && \ - tar xf /data/nexus.tar.gz -C /data/nexus && \ +RUN wget --user-agent="Mozilla" https://github.com/Pathoschild/SMAPI/releases/download/4.0.8/SMAPI-4.0.8-installer.zip -qO /data/nexus.zip && \ + unzip /data/nexus.zip -d /data/nexus/ && \ SMAPI_INSTALLER=$(find /data/nexus -name 'SMAPI*.*Installer' -type f -path "*/SMAPI * installer/internal/linux/*" | head -n 1) && \ /bin/bash -c "SMAPI_NO_TERMINAL=true SMAPI_USE_CURRENT_SHELL=true echo -e '2\n\n' | \"$SMAPI_INSTALLER\" --install --game-path '/data/Stardew/game'" || : @@ -31,5 +37,5 @@ RUN mkdir /etc/services.d/utils && touch /etc/services.d/app/utils.dep COPY run /etc/services.d/utils/run RUN chmod +x /etc/services.d/utils/run -COPY docker-entrypoint.sh /startapp.sh +COPY docker-entrypoint-gog.sh /startapp.sh RUN chmod +x /startapp.sh diff --git a/docker/Dockerfile-steam b/docker/Dockerfile-steam index dea7ce8f..c840e9b7 100644 --- a/docker/Dockerfile-steam +++ b/docker/Dockerfile-steam @@ -3,7 +3,8 @@ FROM jlesage/baseimage-gui:debian-11 ARG STEAM_USER ARG STEAM_PASS -ARG SRCDS_APPID # Steam appId +# Steam appId +ARG SRCDS_APPID # Set the name of the application. ENV APP_NAME="StardewValley" @@ -43,8 +44,8 @@ RUN wget -qO dotnet.tar.gz https://download.visualstudio.microsoft.com/download/ rm dotnet.tar.gz &&\ ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet -RUN wget --user-agent="Mozilla" https://mirror.cloudcraft.info/SMAPI_latest.tar.gz -qO /data/nexus.tar.gz && \ - tar xf /data/nexus.tar.gz -C /data/nexus && \ +RUN wget --user-agent="Mozilla" https://github.com/Pathoschild/SMAPI/releases/download/4.0.8/SMAPI-4.0.8-installer.zip -qO /data/nexus.zip && \ + unzip /data/nexus.zip -d /data/nexus/ && \ SMAPI_INSTALLER=$(find /data/nexus -name 'SMAPI*.*Installer' -type f -path "*/SMAPI * installer/internal/linux/*" | head -n 1) && \ /bin/bash -c "SMAPI_NO_TERMINAL=true SMAPI_USE_CURRENT_SHELL=true echo -e '2\n\n' | \"$SMAPI_INSTALLER\" --install --game-path \"$GAME_PATH\"" || : diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint-gog.sh similarity index 100% rename from docker/docker-entrypoint.sh rename to docker/docker-entrypoint-gog.sh diff --git a/docker/game_data/.gitignore b/docker/game_data/.gitignore new file mode 100644 index 00000000..9c3f9e45 --- /dev/null +++ b/docker/game_data/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +.gitignore +# Except this file +!.gitignore \ No newline at end of file