diff --git a/Dockerfile b/Dockerfile index 2378586..815547c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,9 @@ ENV PORT= \ SERVER_PASSWORD= \ SERVER_NAME= \ ADMIN_PASSWORD= \ - UPDATE_ON_BOOT=true + UPDATE_ON_BOOT=true \ + RCON_ENABLED=true \ + RCON_PORT=25575 COPY ./scripts/* /home/steam/server/ RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh diff --git a/README.md b/README.md index 5216249..a70ac90 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,9 @@ services: - PORT=8211 # Optional but recommended - PLAYERS=16 # Optional but recommended - MULTITHREADING=false + - ENABLE_RCON=true + - RCON_PORT=25575 + - ADMIN_PASSWORD="adminPasswordHere" - COMMUNITY=false # Enable this if you want your server to show up in the community servers tab, USE WITH SERVER_PASSWORD! # Enable the environment variables below if you have COMMUNITY=true # - SERVER_PASSWORD="worldofpals" @@ -48,6 +51,10 @@ services: # - ADMIN_PASSWORD="someAdminPassword" volumes: - ./palworld:/palworld/ + rcon: + image: outdead/rcon:latest + entrypoint: ['/rcon', '-a', 'palworld:25575', '-p', 'adminPasswordHere'] + profiles: ['rcon'] ``` ### Docker Run @@ -79,7 +86,7 @@ It is highly recommended you set the following environment values before startin * PORT | 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 | | PUID* | The uid of the user the server should run as | 1000 | !0 | @@ -92,6 +99,8 @@ It is highly recommended you set the following environment values before startin | SERVER_PASSWORD | Secure your community server with a password | | "string" | | ADMIN_PASSWORD | Secure administration access in the server with a password | | "string" | | UPDATE_ON_BOOT** | Update/Install the server when the docker container starts (THIS HAS TO BE ENABLED THE FIRST TIME YOU RUN THE CONTAINER) | true | true/false | +| RCON_ENABLED | Enable RCON for the Palworld server | true | true/false | +| RCON_PORT | RCON port to connect to | 25575 | 1024-65535 | *highly recommended to set @@ -100,9 +109,36 @@ It is highly recommended you set the following environment values before startin ### Game Ports | Port | Info | note | -| ----- | ---------------- | ---------------------------------------------- | +|-------|------------------|------------------------------------------------| | 8211 | Game Port (UDP) | | | 27015 | Query Port (UDP) | You are not able to change this port as of now | +| 25575 | RCON Port (TCP) | | + +## Using RCON + +RCON is enabled by default for the palworld-server-docker image. +Using the RCON commands is quite easy: + +```bash +docker compose run --rm rcon +``` + +### List of server commands + +| Command | Info | +|-----------------------------------|-----------------------------------------------------| +| /Shutdown {Seconds} {MessageText} | The server is shut down after the number of Seconds | +| /DoExit | Force stop the server. | +| /Broadcast | Send message to all player in the server | +| /KickPlayer {SteamID}t | Kick player from the server.. | +| /BanPlayer {SteamID} | BAN player from the server. | +| /TeleportToPlayer {SteamID} | Teleport to current location of target player. | +| /TeleportToMe {SteamID} | Target player teleport to your current location | +| /ShowPlayers | Show information on all connected players. | +| /Info | Show server information. | +| /Save | Save the world data. | + +For a full list of commands go to: [https://tech.palworldgame.com/server-commands](https://tech.palworldgame.com/server-commands) ## Reporting Issues/Feature Requests diff --git a/docker-compose.yml b/docker-compose.yml index 58e3262..447e622 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: palworld: - image: thijsvanloef/palworld-server-docker:latest + image: thijsvanloef/palworld-test restart: unless-stopped container_name: palworld-server ports: @@ -11,11 +11,17 @@ services: - PGID=1000 - PORT=8211 # Optional but recommended - PLAYERS=16 # Optional but recommended - - MULTITHREADING=false + - MULTITHREADING=true + - ENABLE_RCON=true + - RCON_PORT=25575 + - ADMIN_PASSWORD="adminPasswordHere" - COMMUNITY=false # Enable this if you want your server to show up in the community servers tab, USE WITH SERVER_PASSWORD! # Enable the environment variables below if you have COMMUNITY=true # - SERVER_PASSWORD="worldofpals" # - SERVER_NAME="World of Pals" - # - ADMIN_PASSWORD="someAdminPassword" volumes: - ./palworld:/palworld/ + rcon: + image: outdead/rcon:latest + entrypoint: ['/rcon', '-a', 'palworld:25575', '-p', 'adminPasswordHere'] + profiles: ['rcon'] \ No newline at end of file diff --git a/scripts/start.sh b/scripts/start.sh index 8dc9704..f4e8cda 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -40,8 +40,29 @@ fi cd /palworld || exit -echo "${STARTCOMMAND}" +printf "\e[0;32m*****CHECKING FOR EXISTING CONFIG*****\e[0m\n" + +if [ ! -f /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini ]; then + + printf "\e[0;32m*****GENERATING CONFIG*****\e[0m\n" + + # Server will generate all ini files after first run. + su steam -c "timeout --preserve-status 15s ./PalServer.sh 1> /dev/null " + + # Wait for shutdown + sleep 5 + cp /palworld/DefaultPalWorldSettings.ini /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini +fi + +if [ -n "${RCON_ENABLED}" ]; then + echo "RCON_ENABLED=${RCON_ENABLED}" + sed -i "s/RCONEnabled=[a-zA-Z]*/RCONEnabled=$RCON_ENABLED/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini +fi +if [ -n "${RCON_PORT}" ]; then + echo "RCON_PORT=${RCON_PORT}" + sed -i "s/RCONPort=[0-9]*/RCONPort=$RCON_PORT/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini +fi printf "\e[0;32m*****STARTING SERVER*****\e[0m\n" - +echo "${STARTCOMMAND}" su steam -c "${STARTCOMMAND}"