diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..dd84ea7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 0000000..7c261c8 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,15 @@ +## Context + +* + +## Choices + +* + +## Test instructions + +1. + +## Documentation + +* [ ] I have written documentation for this change. \ No newline at end of file diff --git a/.github/workflows/docker-hub.yml b/.github/workflows/docker-hub.yml new file mode 100644 index 0000000..bbe7cad --- /dev/null +++ b/.github/workflows/docker-hub.yml @@ -0,0 +1,36 @@ +name: Docker-Image-Dev +on: + push: + branches: [ main ] + +jobs: + push: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + # list of Docker images to use as base name for tags + images: | + ${{ github.repository }} + # generate Docker tags based on the following events/attributes + tags: | + type=raw,value=dev + # always generate latest tag on push + + - name: Build and push to DockerHub + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + tags: | + ${{ steps.meta.outputs.tags }} \ No newline at end of file diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 0000000..ce8188d --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,30 @@ +name: Linting +on: [pull_request] + +jobs: + shellcheck: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Run Shellcheck + uses: azohra/shell-linter@latest + with: + severity: "error" + dockerlint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - uses: hadolint/hadolint-action@v2.0.0 + with: + dockerfile: Dockerfile + lint: 'hadolint' + failure-threshold: error + test-build: + runs-on: ubuntu-latest + steps: + - name: Build the Image + uses: docker/build-push-action@v2 + with: + push: false \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..12bd120 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release +on: + release: + types: [published] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + # list of Docker images to use as base name for tags + images: | + ${{ github.repository }} + # generate Docker tags based on the following events/attributes + tags: | + type=semver,pattern=v{{version}} + type=semver,pattern=v{{major}}.{{minor}} + type=semver,pattern=v{{major}} + # always generate latest tag on push + flavor: | + latest=true + - name: Build and push to DockerHub & GitHub Packages + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d1a7b7f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +palworld \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7ebe636 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM cm2network/steamcmd:root +LABEL maintainer="thijs@loef.dev" + +RUN apt-get update && apt-get install -y \ + xdg-user-dirs + + +ENV PORT=8211 \ + PLAYERS=16 \ + MULTITHREADING=FALSE + +COPY ./scripts/* /home/steam/server/ +RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh + +WORKDIR /home/steam/server + +EXPOSE ${PORT} +ENTRYPOINT ["/home/steam/server/init.sh"] \ No newline at end of file diff --git a/README.md b/README.md index ee25701..5f721f3 100644 --- a/README.md +++ b/README.md @@ -1 +1,74 @@ -# palworld-server-docker \ No newline at end of file +# Palworld server docker + +![Release](https://img.shields.io/github/v/release/thijsvanloef/palworld-server-docker) +![Docker Pulls](https://img.shields.io/docker/pulls/thijsvanloef/palworld-server-docker) +![Docker Stars](https://img.shields.io/docker/stars/thijsvanloef/palworld-server-docker) +![Image Size](https://img.shields.io/docker/image-size/thijsvanloef/palworld-server-docker/latest) + +[View on Docker Hub](https://hub.docker.com/repository/docker/thijsvanloef/palworld-server-docker) + +This is a Dockerized version of the [Palworld](https://store.steampowered.com/app/1623730/Palworld/) dedicated server. + +## How to use + +Keep in mind that you'll need to change the [environment variables](##Environment-variables). + +### Docker Compose + +This repository includes an example [docker-compose.yml](example/docker-compose.yml) file you can use to setup your server. + +```yml +services: + palworld: + image: thijsvanloef/palworld-server-docker + restart: unless-stopped + container_name: palworld-server + ports: + - 8211:8211 + environment: + - PORT=8221 + - PLAYERS=16 + - MULTITHREADING=FALSE + volumes: + - /path/to/your/palworld/folder:/palworld/ +``` + +### Docker Run + +Change every <> to your own configuration + +```bash +docker run -d \ + --name palworld-server \ + -p 8211:8211/udp \ + -p 27015:27015/udp \ + -v ./:/palworld/ \ + -e PLAYERS=16 \ + -e PORT=8211 \ + --restart unless-stopped \ + thijsvanloef/palworld-server-docker + +``` + +### Environment variables + +You can use the following values to change the settings of the server on boot. +It is highly recommended you set the following environment values before starting the server: + +* PLAYERS +* PORT +* MULTITHREADING + +| Variable | Info | Default Values | Allowed Values | +|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|----------------| +| PLAYERS* | Max amount of players that are able to join the server | 16 | 1-31 | +| PORT* | UDP port that the server will expose | 8211 | 1024-65535 | +| MULTITHREADING** | Improves performance in multi-threaded CPU environments. It is effective up to a maximum of about 4 threads, and allocating more than this number of threads does not make much sense. | false | true/false | + +*highly recommended to set + +** Make sure you know what you are doing when running this this option enabled + +## Reporting Issues/Feature Requests + +Issues/Feature requests can be submitted by using [this link](https://github.com/thijsvanloef/palworld-server-docker/issues/new/choose). diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..caa2572 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +services: + palworld: + image: thijsvanloef/palworld-server-docker + restart: unless-stopped + container_name: palworld-server + ports: + - 8211:8211 + environment: + - PORT=8221 + - PLAYERS=16 + - MULTITHREADING=FALSE + volumes: + - /path/to/your/palworld/folder:/palworld/ \ No newline at end of file diff --git a/scripts/init.sh b/scripts/init.sh new file mode 100644 index 0000000..3188541 --- /dev/null +++ b/scripts/init.sh @@ -0,0 +1,10 @@ +#!/bin/sh +printf "\e[0;32m*****STARTING INSTALL/UPDATE*****\e[0m" +mkdir -p /palworld + +chown -R steam:steam /palworld +/home/steam/steamcmd/steamcmd.sh +force_install_dir "/palworld" +login anonymous +app_update 2394010 validate +quit + +# ln -s /home/steam/server/palworld /palworld + +./start.sh \ No newline at end of file diff --git a/scripts/start.sh b/scripts/start.sh new file mode 100644 index 0000000..413f61e --- /dev/null +++ b/scripts/start.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +STARTCOMMAND="./PalServer.sh -port ${PORT} -players ${PLAYERS}" + +printf "\e[0;32m*****STARTING SERVER*****\e[0m" +cd /palworld || exit + + +if [ "${MULTITHREADING}" = true ]; then + su steam -c "${STARTCOMMAND} -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS" +else + su steam -c "${STARTCOMMAND}" +fi \ No newline at end of file