From 41466ef2a64e1919eb8b89d512775781126d4c09 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt <2270806+jammsen@users.noreply.github.com> Date: Fri, 19 Jan 2024 12:57:55 +0100 Subject: [PATCH] Initial commit --- .dockerignore | 2 + .github/ISSUE_TEMPLATE/bug_report.yml | 77 +++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 1 + .github/workflows/docker-build-and-push.yml | 32 +++++++++ .gitignore | 2 + Dockerfile | 26 +++++++ README.md | 56 +++++++++++++++ docker-compose.yml | 22 ++++++ servermanager.sh | 51 ++++++++++++++ 9 files changed, 269 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/workflows/docker-build-and-push.yml create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 docker-compose.yml create mode 100644 servermanager.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0402eb6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.gitignore +game \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..200279d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,77 @@ +name: "Bug report" +description: Create a bug report or help us improve things +body: + - type: markdown + attributes: + value: | + ## Important information + Please understand you are asking for support for the Docker-Image and Docker-Container. I'm NOT the creator of the Dedicated-Game-Server itself, i'm not involved in programming that. If you need help for that, you might want to ask here for topics related to that: https://tech.palworldgame.com/dedicated-server-guide + - type: checkboxes + id: understand-important-info + attributes: + label: Have you read the Important information text above + options: + - label: Yes i did + required: true + - type: textarea + id: current-behavior + attributes: + label: Current behavior + description: A clear and concise description of what the problem is. + placeholder: Currently... + validations: + required: true + - type: textarea + id: desired-behavior + attributes: + label: Desired behavior + description: Remember, im not familiar with your setup, your permission, your Docker settings and all that kind of stuff, please provide a clear description of what your desired outcome is. + placeholder: Desried ... + validations: + required: true + - type: textarea + id: screenshot-links + attributes: + label: Links to screenshots + placeholder: ... + validations: + required: false + - type: textarea + id: reproduction + attributes: + label: To Reproduce + description: What steps can i do to reproduce your problem? + value: | + Steps to reproduce the behavior: + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + validations: + required: true + - type: textarea + id: software + attributes: + label: Software setup + value: | + - OS: + - Docker: + validations: + required: true + - type: textarea + id: hardware + attributes: + label: Hardware setup + value: | + - vCPU: + - RAM: + - Disk: + validations: + required: true + - type: textarea + id: more + attributes: + label: Additional context + placeholder: Add any other context about the problem here, in as much detail as possible. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..3ba13e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml new file mode 100644 index 0000000..f8c1d7d --- /dev/null +++ b/.github/workflows/docker-build-and-push.yml @@ -0,0 +1,32 @@ +name: docker-build-and-push-ci + +on: + push: + branches: + - 'master' + +jobs: + docker-build-gameserver-image: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v4 + with: + push: true + tags: jammsen/palworld-dedicated-server:latest diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a94a8ce --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea/ +game diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9779781 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM cm2network/steamcmd + +LABEL org.opencontainers.image.authors="Sebastian Schmidt" +LABEL org.opencontainers.image.source="https://github.com/jammsen/docker-palworld-dedicated-server" + +ENV TIMEZONE=Europe/Berlin \ + DEBIAN_FRONTEND=noninteractive \ + PUID=0 \ + PGID=0 \ + ALWAYS_UPDATE_ON_START=false \ + GAME_PORT=8211 \ + MAX_PLAYERS=16 \ + SERVER_NAME="jammsen-docker-generated" \ + SERVER_PASSWORD="test" \ + MULTITHREAD_ENABLED=true \ + COMMUNITY_SERVER=true \ + PUBLIC_IP=10.0.0.5 \ + PUBLIC_PORT=8211 + +VOLUME ["/palworld"} + +EXPOSE 8211/tcp 8211/udp + +ADD servermanager.sh /servermanager.sh + +CMD ["/servermanager.sh"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..2f062fc --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +## Docker - Palworld Dedicated Server + +[![Build Docker Image](https://github.com/jammsen/docker-palworld-dedicated-server/actions/workflows/docker-build-and-push.yml/badge.svg)](https://github.com/jammsen/docker-palworld-dedicated-server/actions/workflows/docker-build-and-push.yml) +![Docker Pulls](https://img.shields.io/docker/pulls/jammsen/palworld-dedicated-server) +![Docker Stars](https://img.shields.io/docker/stars/jammsen/palworld-dedicated-server) +![Image Size](https://img.shields.io/docker/image-size/jammsen/palworld-dedicated-server/latest) + +This includes a Palworld Dedicated Server based on Linux and Docker. + +## Do you need support for this Docker Image + +- What to do? + - Feel free to create a NEW issue + - It is okay to "reference" that you might have the same problem as the person in issue #number + - Follow the instructions and answer the questions of people who are willing to help you + - If your issue is done, close it + - I will Inactivity-Close any issue thats not been active for a week +- What NOT to do? + - Dont re-use issues / Necro! + - You are most likely to chat/spam/harrass thoose participants who didnt agree to be part of your / a new problem and might be totally out of context! + - If this happens, i reserve the rights to lock the issue or delete the comments, you have been warned! + +## What you need to run this + +- Basic understanding of Docker and Docker-Compose, Linux and Networking (Port-Forwarding/NAT) + +## Getting started + +1. Create `game` sub-directories on your Dockernode in your game-server-directory (`/srv/palworld`) +2. Setup Port-Forwarding or NAT for the ports in the Docker-Compose file +3. (Build if needed )Start via `docker-compose up -d` - See docker-compose.yml and next section for more infos + +## Environment-Variables +| Variable | Describe | Default Value | Allowed Value | +| ---------------------- | ---------------------------------------------------------------- | ------------- | ------------- | +| ALWAYS_UPDATE_ON_START | Updates the server on startup | true | false/true | +| GAME_PORT | Game port of the server | 8211 | 1024-65535 | +| MAX_PLAYERS | Maximum amout of players | 32 | 1-32 | +| SERVER_NAME | Name of the server | | string | +| SERVER_PASSWORD | Password of the server | | string | +| MULTITHREAD_ENABLED | Sets options for "Improved multi-threaded CPU performance" | true | false/true | +| COMMUNITY_SERVER | Sets the server to a "Community-Server", will appear in the list | false | false/true | +| PUBLIC_IP | Public ip, auto-detect if not specified | false | ip address | +| PUBLIC_PORT | Public port, auto-detect if not specified | false | 1024-65535 | +| | | | | +| | | | | +Look at https://tech.palworldgame.com/optimize-game-balance for more information + +## Planned features in the future + +- Feel free to suggest something + +## Software used + +- CM2Network SteamCMD (Officially recommended by Valve - https://developer.valvesoftware.com/wiki/SteamCMD#Docker) +- Palworld Dedicated Server (APP-ID: 2394010 - https://steamdb.info/app/2394010/config/) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..cdbffc9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.9' +services: + palworld-dedicated-server: + build: . + container_name: palworld-dedicated-server + image: jammsen/palworld-dedicated-server:latest + restart: always + network_mode: bridge + ports: + - 8211:8211 + environment: + - ALWAYS_UPDATE_ON_START=false + - GAME_PORT=8211 + - MAX_PLAYERS=16 + - SERVER_NAME=jammsen-docker-generated + - SERVER_PASSWORD= + - MULTITHREAD_ENABLED=true + - COMMUNITY_SERVER=true + - PUBLIC_IP= + - PUBLIC_PORT= + volumes: + - ./game:/palworld diff --git a/servermanager.sh b/servermanager.sh new file mode 100644 index 0000000..7b46d30 --- /dev/null +++ b/servermanager.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +GAME_PATH="/palworld/" + +function installServer() { + # force a fresh install of all + echo ">>> Doing a fresh install of the gameserver" + /home/steam/steamcmd/steamcmd.sh +force_install_dir "/palworld" +login anonymous +app_update 2394010 validate +quit +} + +function updateServer() { + # force an update and validation + echo ">>> Doing an update of the gameserver" + /home/steam/steamcmd/steamcmd.sh +force_install_dir "/palworld" +login anonymous +app_update 2394010 validate +quit +} + +function startServer() { + echo ">>> Starting the gameserver" + cd $GAME_PATH + START_OPTIONS="" + if [[ -n $COMMUNITY_SERVER ]] && [[ $COMMUNITY_SERVER == "true" ]]; then + START_OPTIONS="$START_OPTIONS EpicApp=PalServer" + fi + if [[ -n $MULTITHREAD_ENABLED ]] && [[ $MULTITHREAD_ENABLED == "true" ]]; then + START_OPTIONS="$START_OPTIONS -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS" + fi + if [[ -n $PUBLIC_IP ]]; then + START_OPTIONS="$START_OPTIONS -publicip=$PUBLIC_IP" + fi + if [[ -n $PUBLIC_PORT ]]; then + START_OPTIONS="$START_OPTIONS -publicport=$PUBLIC_PORT" + fi + if [[ -n $SERVER_PASSWORD ]]; then + START_OPTIONS="$START_OPTIONS -serverpassword=$SERVER_PASSWORD" + fi + + ./PalServer.sh port="$GAME_PORT" players="$MAX_PLAYERS" "$START_OPTIONS" -servername="$SERVER_NAME" +} + +function startMain() { + # Check if server is installed, if not try again + if [ ! -f "/palworld/PalServer.sh" ]; then + installServer + fi + if [ $ALWAYS_UPDATE_ON_START == "true" ]; then + updateServer + fi + startServer +} + +startMain