docker-palworld-dedicated-server icon indicating copy to clipboard operation
docker-palworld-dedicated-server copied to clipboard

[Feature Request] Auto-restart

Open MeteorSkyOne opened this issue 1 year ago • 6 comments

Have you read the Important information text above

  • [X] Yes i did

Describe the feature

This game server has a giant memory leak that all my server memory is occupied, so I need to restart server like every 3-4 hours. So can we support this auto-restart feature to keep server running stably?

Additional information

  • [ ] Would you be willing to help implement this feature?

Final checks

  • [X] I understand that this is a feature request function. I also unterstand that if i use this to report a bug report, that my issue might be un-answered closed.

MeteorSkyOne avatar Jan 26 '24 01:01 MeteorSkyOne

You can try adding a line to crontab like

0 0,6,12,18 * * * docker compose -f <your compose file location> restart

This command makes it restart at 6am/pm and 12am/pm. Use a crontab generator(https://crontab.guru/) to figure out your frequency

Wistelle avatar Jan 26 '24 06:01 Wistelle

Here's some a gist of a shell script that does it and announces it via RCON: https://gist.github.com/Bluefissure/b0fcb05c024ee60cad4e23eb55463062

patriq avatar Jan 26 '24 10:01 patriq

Here's some a gist of a shell script that does it and announces it via RCON: https://gist.github.com/Bluefissure/b0fcb05c024ee60cad4e23eb55463062

That shell-script is very interesting, thanks for sharing that! ❤️ 👍

jammsen avatar Jan 26 '24 11:01 jammsen

Here's some a gist of a shell script that does it and announces it via RCON: https://gist.github.com/Bluefissure/b0fcb05c024ee60cad4e23eb55463062

It's a much needed, helpful solution.

doodoori2 avatar Jan 27 '24 16:01 doodoori2

@jammsen hi jammsen, I Inspired by this thread, I wrote the some code.

Actually, I'm not very experienced with dockers. so how did I make a separate repo, I hope this will help

https://github.com/doodoori2/palworld-admin-bashscripts

doodoori2 avatar Jan 28 '24 03:01 doodoori2

@jammsen hi jammsen, I Inspired by this thread, I wrote the some code.

Actually, I'm not very experienced with dockers. so how did I make a separate repo, I hope this will help

https://github.com/doodoori2/palworld-admin-bashscripts

I might add something similar too down the line, as you can see we have very creative FR open in here.

jammsen avatar Jan 28 '24 10:01 jammsen

Any updates?

dakeeper avatar Jan 30 '24 06:01 dakeeper

For those interested, you can use the following configuration in docker-compose. I added a limit on the ram usage to auto kill the container if too much ram is used, then always restart the container

version: '3.9'
services:
  palworld-dedicated-server:
    #build: .
    container_name: palworld-dedicated-server
    image: jammsen/palworld-dedicated-server:latest
    restart: unless-stopped
    deploy:
      resources:
        limits:
          memory: 11gb
      restart_policy:
        condition: any
    ports:
      - target: 8211 # Gamerserver port inside of the container
        published: 8211 # Gamerserver port on your host
        protocol: udp
        mode: host
      - target: 25575 # RCON port inside of the container
        published: 25575 # RCON port on your host
        protocol: tcp
        mode: host
    env_file:
      - ./default.env
    volumes:
      - ./game:/palworld

keskydi avatar Jan 31 '24 00:01 keskydi

Any updates?

@thejcpalma is working on a solution, Soon ™

jammsen avatar Jan 31 '24 23:01 jammsen

Yes! xD Will implement auto restart, but with some protections so will be a change in the next PR, stay tuned ✨😊

thejcpalma avatar Feb 01 '24 16:02 thejcpalma

Feature

Restart the server process to avoid memory leaks and reduce resource usage. Objectively to use in other scenarios like auto-restart, server auto-update, backup restore... Avoid container restart, just process restart.

Looking at this for reference on some things:

  • https://github.com/doodoori2/palworld-admin-bashscripts

Feature is implemented, pending https://github.com/jammsen/docker-palworld-dedicated-server/pull/179

thejcpalma avatar Feb 08 '24 17:02 thejcpalma

This is fix in the release on latest from 5 minutes ago. See Changelogs or Discord message regarding the new release and what to lookout for.

Im closing this issue as resolved, feel free to reach out again if you need help.

If you like this project, please consider giving this repo and the Docker-Hub-Repo a Star.

jammsen avatar Feb 13 '24 18:02 jammsen