Skip to content

Commit

Permalink
Merge branch 'main' into removed-root-processes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dashboy1998 committed Feb 1, 2024
2 parents b5980bf + 689674b commit 2bf64ba
Show file tree
Hide file tree
Showing 23 changed files with 599 additions and 184 deletions.
140 changes: 70 additions & 70 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
TZ="UTC"
PLAYERS="16"
PORT="8211"
PUID="1000"
PGID="1000"
MULTITHREADING="false"
COMMUNITY="false"
PUBLIC_IP=""
PUBLIC_PORT=""
SERVER_NAME=""
SERVER_DESCRIPTION=""
SERVER_PASSWORD=""
ADMIN_PASSWORD=""
UPDATE_ON_BOOT="true"
RCON_ENABLED="true"
RCON_PORT="25575"
QUERY_PORT="27015"
TZ=UTC
PLAYERS=16
PORT=8211
PUID=1000
PGID=1000
MULTITHREADING=false
COMMUNITY=false
PUBLIC_IP=
PUBLIC_PORT=
SERVER_NAME=World of Pals
SERVER_DESCRIPTION=palworld-server-docker by Thijs van Loef
SERVER_PASSWORD=worldofpals
ADMIN_PASSWORD=adminPasswordHere
UPDATE_ON_BOOT=true
RCON_ENABLED=true
RCON_PORT=25575
QUERY_PORT=27015


DIFFICULTY="None"
DAYTIME_SPEEDRATE="1.000000"
NIGHTTIME_SPEEDRATE="1.000000"
EXP_RATE="1.000000"
PAL_CAPTURE_RATE="1.000000"
PAL_SPAWN_NUM_RATE="1.000000"
PAL_DAMAGE_RATE_ATTACK="1.000000"
PAL_DAMAGE_RATE_DEFENSE="1.000000"
PLAYER_DAMAGE_RATE_ATTACK="1.000000"
PLAYER_DAMAGE_RATE_DEFENSE="1.000000"
PLAYER_STOMACH_DECREASE_RATE="1.000000"
PLAYER_STAMINA_DECREASE_RATE="1.000000"
PLAYER_AUTO_HP_REGEN_RATE="1.000000"
PLAYER_AUTO_HP_REGEN_RATE_IN_SLEEP="1.000000"
PAL_STOMACH_DECREASE_RATE="1.000000"
PAL_STAMINA_DECREASE_RATE="1.000000"
PAL_AUTO_HP_REGEN_RATE="1.000000"
PAL_AUTO_HP_REGEN_RATE_IN_SLEEP="1.000000"
BUILD_OBJECT_DAMAGE_RATE="1.000000"
BUILD_OBJECT_DETERIORATION_DAMAGE_RATE="1.000000"
COLLECTION_DROP_RATE="1.000000"
COLLECTION_OBJECT_HP_RATE="1.000000"
COLLECTION_OBJECT_RESPAWN_SPEED_RATE="1.000000"
ENEMY_DROP_ITEM_RATE="1.000000"
DEATH_PENALTY="All"
ENABLE_PLAYER_TO_PLAYER_DAMAGE="False"
ENABLE_FRIENDLY_FIRE="False"
ENABLE_INVADER_ENEMY="True"
ACTIVE_UNKO="False"
ENABLE_AIM_ASSIST_PAD="True"
ENABLE_AIM_ASSIST_KEYBOARD="False"
DROP_ITEM_MAX_NUM="3000"
DROP_ITEM_MAX_NUM_UNKO="100"
BASE_CAMP_MAX_NUM="128"
BASE_CAMP_WORKER_MAXNUM="15"
DROP_ITEM_ALIVE_MAX_HOURS="1.000000"
AUTO_RESET_GUILD_NO_ONLINE_PLAYERS="False"
AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS="72.00000"
GUILD_PLAYER_MAX_NUM="20"
PAL_EGG_DEFAULT_HATCHING_TIME="72.00000"
WORK_SPEED_RATE="1.000000"
IS_MULTIPLAY="False"
IS_PVP="False"
CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP="False"
ENABLE_NON_LOGIN_PENALTY="True"
ENABLE_FAST_TRAVEL="True"
IS_START_LOCATION_SELECT_BY_MAP="True"
EXIST_PLAYER_AFTER_LOGOUT="False"
ENABLE_DEFENSE_OTHER_GUILD_PLAYER="False"
COOP_PLAYER_MAX_NUM="4"
REGION=""
USEAUTH="True"
BAN_LIST_URL="https://api.palworldgame.com/api/banlist.txt"
DIFFICULTY=None
DAYTIME_SPEEDRATE=1.000000
NIGHTTIME_SPEEDRATE=1.000000
EXP_RATE=1.000000
PAL_CAPTURE_RATE=1.000000
PAL_SPAWN_NUM_RATE=1.000000
PAL_DAMAGE_RATE_ATTACK=1.000000
PAL_DAMAGE_RATE_DEFENSE=1.000000
PLAYER_DAMAGE_RATE_ATTACK=1.000000
PLAYER_DAMAGE_RATE_DEFENSE=1.000000
PLAYER_STOMACH_DECREASE_RATE=1.000000
PLAYER_STAMINA_DECREASE_RATE=1.000000
PLAYER_AUTO_HP_REGEN_RATE=1.000000
PLAYER_AUTO_HP_REGEN_RATE_IN_SLEEP=1.000000
PAL_STOMACH_DECREASE_RATE=1.000000
PAL_STAMINA_DECREASE_RATE=1.000000
PAL_AUTO_HP_REGEN_RATE=1.000000
PAL_AUTO_HP_REGEN_RATE_IN_SLEEP=1.000000
BUILD_OBJECT_DAMAGE_RATE=1.000000
BUILD_OBJECT_DETERIORATION_DAMAGE_RATE=1.000000
COLLECTION_DROP_RATE=1.000000
COLLECTION_OBJECT_HP_RATE=1.000000
COLLECTION_OBJECT_RESPAWN_SPEED_RATE=1.000000
ENEMY_DROP_ITEM_RATE=1.000000
DEATH_PENALTY=All
ENABLE_PLAYER_TO_PLAYER_DAMAGE=False
ENABLE_FRIENDLY_FIRE=False
ENABLE_INVADER_ENEMY=True
ACTIVE_UNKO=False
ENABLE_AIM_ASSIST_PAD=True
ENABLE_AIM_ASSIST_KEYBOARD=False
DROP_ITEM_MAX_NUM=3000
DROP_ITEM_MAX_NUM_UNKO=100
BASE_CAMP_MAX_NUM=128
BASE_CAMP_WORKER_MAXNUM=15
DROP_ITEM_ALIVE_MAX_HOURS=1.000000
AUTO_RESET_GUILD_NO_ONLINE_PLAYERS=False
AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS=72.00000
GUILD_PLAYER_MAX_NUM=20
PAL_EGG_DEFAULT_HATCHING_TIME=72.00000
WORK_SPEED_RATE=1.000000
IS_MULTIPLAY=False
IS_PVP=False
CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP=False
ENABLE_NON_LOGIN_PENALTY=True
ENABLE_FAST_TRAVEL=True
IS_START_LOCATION_SELECT_BY_MAP=True
EXIST_PLAYER_AFTER_LOGOUT=False
ENABLE_DEFENSE_OTHER_GUILD_PLAYER=False
COOP_PLAYER_MAX_NUM=4
REGION=
USEAUTH=True
BAN_LIST_URL=https://api.palworldgame.com/api/banlist.txt
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,17 @@ ENV PORT= \
TZ=UTC \
SERVER_DESCRIPTION= \
BACKUP_ENABLED=true \
BACKUP_CRON_EXPRESSION="0 0 * * *"
DELETE_OLD_BACKUPS=false \
OLD_BACKUP_DAYS=30 \
BACKUP_CRON_EXPRESSION="0 0 * * *" \
AUTO_UPDATE_ENABLED=false \
AUTO_UPDATE_CRON_EXPRESSION="0 * * * *" \
AUTO_UPDATE_WARN_MINUTES=30

COPY ./scripts/* /home/steam/server/
RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh /home/steam/server/backup.sh && \
mv /home/steam/server/backup.sh /usr/local/bin/backup
RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh /home/steam/server/backup.sh /home/steam/server/update.sh && \
mv /home/steam/server/backup.sh /usr/local/bin/backup && \
mv /home/steam/server/update.sh /usr/local/bin/update

WORKDIR /home/steam/server
RUN touch rcon.yaml crontab && \
Expand Down
50 changes: 40 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
[![Docker Pulls](https://img.shields.io/docker/pulls/thijsvanloef/palworld-server-docker)](https://hub.docker.com/r/thijsvanloef/palworld-server-docker)
[![Docker Stars](https://img.shields.io/docker/stars/thijsvanloef/palworld-server-docker)](https://hub.docker.com/r/thijsvanloef/palworld-server-docker)
[![Image Size](https://img.shields.io/docker/image-size/thijsvanloef/palworld-server-docker/latest)](https://hub.docker.com/r/thijsvanloef/palworld-server-docker/tags)
[![Static Badge](https://img.shields.io/badge/readme-0.19.1-blue?link=https%3A%2F%2Fgithub.com%2Fthijsvanloef%2Fpalworld-server-docker%2Fblob%2Fmain%2FREADME.md)](https://github.com/thijsvanloef/palworld-server-docker?tab=readme-ov-file#palworld-dedicated-server-docker)
[![Discord](https://img.shields.io/discord/1200397673329594459?logo=discord&label=Discord&link=https%3A%2F%2Fdiscord.gg%2FUxBxStPAAE)](https://discord.com/invite/UxBxStPAAE)
[![Static Badge](https://img.shields.io/badge/README-0.16.0-blue?link=https%3A%2F%2Fgithub.com%2Fthijsvanloef%2Fpalworld-server-docker%2Fblob%2Fmain%2FREADME.md)](https://github.com/thijsvanloef/palworld-server-docker?tab=readme-ov-file#palworld-dedicated-server-docker)

[View on Docker Hub](https://hub.docker.com/r/thijsvanloef/palworld-server-docker)
[![Docker Hub](https://img.shields.io/badge/Docker_Hub-palworld-blue?logo=docker)](https://hub.docker.com/r/thijsvanloef/palworld-server-docker)
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/palworld)](https://artifacthub.io/packages/search?repo=palworld)

[Chat with the community on Discord](https://discord.gg/UxBxStPAAE)

Expand Down Expand Up @@ -57,15 +58,15 @@ services:
- PGID=1000
- PORT=8211 # Optional but recommended
- PLAYERS=16 # Optional but recommended
- SERVER_PASSWORD="worldofpals" # Optional but recommended
- SERVER_PASSWORD=worldofpals # Optional but recommended
- MULTITHREADING=true
- RCON_ENABLED=true
- RCON_PORT=25575
- TZ=UTC
- ADMIN_PASSWORD="adminPasswordHere"
- ADMIN_PASSWORD=adminPasswordHere
- COMMUNITY=false # Enable this if you want your server to show up in the community servers tab, USE WITH SERVER_PASSWORD!
- SERVER_NAME="World of Pals"
- SERVER_DESCRIPTION="Awesome World of Pal"
- SERVER_NAME=World of Pals
- SERVER_DESCRIPTION=palworld-server-docker by Thijs van Loef
volumes:
- ./palworld:/palworld/
```
Expand Down Expand Up @@ -108,11 +109,11 @@ docker run -d \
-e RCON_ENABLED=true \
-e RCON_PORT=25575 \
-e TZ=UTC \
-e ADMIN_PASSWORD="adminPasswordHere" \
-e SERVER_PASSWORD="worldofpals" \
-e ADMIN_PASSWORD=adminPasswordHere \
-e SERVER_PASSWORD=worldofpals \
-e COMMUNITY=false \
-e SERVER_NAME="World of Pals" \
-e SERVER_DESCRIPTION="Awesome World of Pal" \
-e SERVER_NAME=World of Pals \
-e SERVER_DESCRIPTION=palworld-server-docker by Thijs van Loef \
--restart unless-stopped \
--stop-timeout 30 \
thijsvanloef/palworld-server-docker:latest
Expand Down Expand Up @@ -207,6 +208,9 @@ It is highly recommended you set the following environment values before startin
| BACKUP_ENABLED | Enables automatic backups | true | true/false |
| DELETE_OLD_BACKUPS | Delete backups after a certain number of days | false | true/false |
| OLD_BACKUP_DAYS | How many days to keep backups | 30 | any positive integer |
| AUTO_UPDATE_CRON_EXPRESSION | Setting affects frequency of automatic updates. | 0 \* \* \* \* | Needs a Cron-Expression - See [Configuring Automatic Backups with Cron](#configuring-automatic-backups-with-cron) |
| AUTO_UPDATE_ENABLED | Enables automatic updates | false | true/false |
| AUTO_UPDATE_WARN_MINUTES | How long to wait to update the server, after the player were informed. | 30 | !0 |

*highly recommended to set

Expand Down Expand Up @@ -290,6 +294,32 @@ BACKUP_CRON_EXPRESSION is a cron expression, in a Cron-Expression you define an
Set BACKUP_CRON_EXPRESSION to change the default schedule.
Example Usage: If BACKUP_CRON_EXPRESSION to `0 2 * * *`, the backup script will run every day at 2:00 AM.

## Configuring Automatic Updates with Cron

To be able to use automatic Updates with this Server the following environment variables **have** to be set to `true`:

* RCON_ENABLED
* UPDATE_ON_BOOT

> [!IMPORTANT]
>
> If docker restart is not set to policy `always` or `unless-stopped` then the server will shutdown and will need to be
> manually restarted.
>
> The example docker run command and docker compose file in [How to Use](#how-to-use) already use the needed policy

Set AUTO_UPDATE_ENABLED enable or disable automatic backups (Default is disabled)

AUTO_UPDATE_CRON_EXPRESSION is a cron expression, in a Cron-Expression you define an interval for when to run jobs.

> [!TIP]
> This image uses Supercronic for crons
> see [supercronic](https://github.com/aptible/supercronic#crontab-format)
> or
> [Crontab Generat](https://crontab-generator.org).

Set AUTO_UPDATE_CRON_EXPRESSION to change the default schedule.

## Editing Server Settings

### With Environment Variables
Expand Down
34 changes: 24 additions & 10 deletions charts/palworld/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
apiVersion: v2
name: palworld
version: 0.0.2
description: This chart will provide a Palworld server installation on a kubernetes cluster.
description: This chart will provide a Palworld server installation on a kubernetes cluster
type: application
keywords:
- palworld
- server
- kubernetes
- helm
- palworld
- server
- kubernetes
- helm
home: https://github.com/thijsvanloef/palworld-server-docker
sources:
- https://github.com/thijsvanloef/palworld-server-docker
- https://github.com/thijsvanloef/palworld-server-docker
maintainers:
- name: Filipe Souza
email: [email protected]
url: https://github.com/Filipe-Souza
- name: Filipe Souza
email: [email protected]
url: https://github.com/Filipe-Souza
- name: Twinki
url: https://github.com/Twinki14
icon: https://cdn.akamai.steamstatic.com/steam/apps/1623730/header.jpg
appVersion: "latest"
deprecated: false
deprecated: false
annotations:
artifacthub.io/alternativeName: palworld-server
artifacthub.io/license: MIT
artifacthub.io/links: |
- name: Chart source
url: https://github.com/thijsvanloef/palworld-server-docker/tree/main/charts/palworld
- name: Docker image source
url: https://github.com/thijsvanloef/palworld-server-docker
artifacthub.io/images: |
- name: palworld-server-docker
image: thijsvanloef/palworld-server-docker:latest
artifacthub.io/screenshots: https://cdn.akamai.steamstatic.com/steam/apps/1623730/header.jpg
4 changes: 4 additions & 0 deletions charts/palworld/VALUES_SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ This chart will provide a Palworld server installation on a kubernetes cluster.
| server.config.annotations | object | `{}` | Additional annotations to the resources |
| server.config.community.enable | bool | `true` | Enables/disables the visibility of this server on Steam community servers list. |
| server.config.community.password | string | `""` | If not provided, a random password will be generated and stored on the secret. |
| server.config.daily_reboot.enable | bool | `false` | Enable daily reboot. Disabled by default |
| server.config.daily_reboot.role | string | `"daily-reboot"` | The name of the role performing the daily reboot. |
| server.config.daily_reboot.serviceAccount | string | `"daily-reboot"` | The name of the Service Account used to perform the reboot. |
| server.config.daily_reboot.time | string | `"30 9 * * *"` | The time (UTC) the server will perform the reboot. By default, this schedules the restart at 9:30am UTC. Please note, this is using cron syntax. |
| server.config.labels | object | `{}` | Additional labels to the resources |
| server.config.max_players | int | `16` | The max number of players supported. |
| server.config.multithreading | bool | `true` | Enables the multithreading, allowing the usage of up to 4 cores (needs citation) |
Expand Down
28 changes: 27 additions & 1 deletion charts/palworld/templates/configmaps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,30 @@ data:
{{- with .Values.server.config.world_parameters }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{ end }}
{{ if .Values.server.config.daily_reboot.enable }}
restart-deployment.sh: |
#!/bin/bash
cont=$(kubectl -n {{ .Values.namespace }} get pods -o=jsonpath='{.items[?(@.metadata.labels.app\.kubernetes\.io/name=="{{ .Release.Name }}-server")].metadata.name}')
function exec_rcon_cmd() {
kubectl exec -n {{ .Values.namespace }} -i pod/$cont rcon-cli "$1"
}
exec_rcon_cmd "Broadcast Saving_Server_Data..."
exec_rcon_cmd save
sleep 30
exec_rcon_cmd "Broadcast Backing_up_Server_Data..."
exec_rcon_cmd backup
sleep 30
step=5
for i in $(seq 30 -$step 1); do
exec_rcon_cmd "Broadcast Rebooting_in_$i_seconds..."
sleep $step
done
exec_rcon_cmd "Shutdown 1"
sleep 30
kubectl -n {{ .Values.namespace }} rollout restart deployment/{{ .Release.Name }}-server
{{ end }}
{{ end }}
37 changes: 37 additions & 0 deletions charts/palworld/templates/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{{ if .Values.server.config.daily_reboot.enable }}
apiVersion: batch/v1
kind: CronJob
metadata:
name: "{{ .Values.server.config.daily_reboot.serviceAccount }}"
namespace: {{ .Values.namespace }}
spec:
concurrencyPolicy: Forbid
schedule: "{{ .Values.server.config.daily_reboot.time }}"
jobTemplate:
spec:
backoffLimit: 1
activeDeadlineSeconds: 600
template:
spec:
serviceAccountName: "{{ .Values.server.config.daily_reboot.serviceAccount }}"
restartPolicy: Never
containers:
- name: kubectl
image: bitnami/kubectl
command:
- /bin/sh
- -c
- /restart-script/restart-deployment.sh
volumeMounts:
- name: restart-script
mountPath: "/restart-script"
readOnly: true
volumes:
- name: restart-script
configMap:
name: "{{ .Release.Name }}-env-config"
defaultMode: 0777
items:
- key: "restart-deployment.sh"
path: "restart-deployment.sh"
{{ end }}
Loading

0 comments on commit 2bf64ba

Please sign in to comment.