first working version

This commit is contained in:
Thijs van Loef
2024-01-19 14:58:51 +01:00
parent c98d992450
commit 85f0027f08
12 changed files with 306 additions and 1 deletions

38
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -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.

View File

@@ -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.

View File

@@ -0,0 +1,15 @@
## Context
* <!-- What do you want to achieve with this PR? -->
## Choices
* <!-- * Why did you solve it like this? -->
## Test instructions
1. <!-- 1. How did you test this PR? -->
## Documentation
* [ ] I have written documentation for this change.

36
.github/workflows/docker-hub.yml vendored Normal file
View File

@@ -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 }}

30
.github/workflows/linting.yml vendored Normal file
View File

@@ -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

38
.github/workflows/release.yml vendored Normal file
View File

@@ -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 }}

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
palworld

18
Dockerfile Normal file
View File

@@ -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"]

View File

@@ -1 +1,74 @@
# palworld-server-docker
# 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-folder>:/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).

13
docker-compose.yml Normal file
View File

@@ -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/

10
scripts/init.sh Normal file
View File

@@ -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

13
scripts/start.sh Normal file
View File

@@ -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