DiscordGSM / GameServerMonitor

📺 A discord bot that monitors your game server and tracks the live data of your game servers. Supports over 260 game servers.
https://discordgsm.com
MIT License
139 stars 63 forks source link

Update Dockerfile #18

Closed ChongZhiJie0216 closed 1 year ago

ChongZhiJie0216 commented 1 year ago

fix restart server lost issue

BattlefieldDuck commented 1 year ago

The volume is optional in discordgsm. Volume is required only when sqlite (default) is used. Using -v in docker run command or adding a volume option in docker-compose.yml did solve the problem.

ChongZhiJie0216 commented 1 year ago

The volume is optional in discordgsm. Volume is required only when sqlite (default) is used. Using -v in docker run command or adding a volume option in docker-compose.yml did solve the problem.

However, what I found on my side is that whether it is in Docker Compose or docker run without adding volume to the dockerfile, the logs and db in the data folder in the container do not exist on the host, which leads to the loss of the container in some cases. The logs and db files in the dockerfile and the path of the volume are added. The result is that the files logs and db in the container will be stored on the host, and there is no need to worry about the loss of logs and db in the data, although the loss of logs files is not a big problem. , but if server.db is lost, it will be more troublesome, which means that if you restart/update, you will have to reset the server.

The following is the gsm path I downloaded and set on the unriad Apps side, there is nothing in it image

The following is the result of I cloned the Dockerfile on github and added VOLUME [/usr/src/app] The db in data is successfully read at each startup image

BattlefieldDuck commented 1 year ago

docker run and docker-compose.yml will overwrite Dockerfile default settings.

Since you are using Unraid, show me your docker run command on Unraid thanks.

ChongZhiJie0216 commented 1 year ago
docker run
  -d
  --name='DiscordGSM'
  --net='bridge'
  -e TZ="Asia/Singapore"
  -e HOST_OS="Unraid"
  -e HOST_HOSTNAME="Jiecloud"
  -e HOST_CONTAINERNAME="DiscordGSM"
  -e 'APP_TOKEN'=''
  -e 'WHITELIST_GUILDS'=''
  -l net.unraid.docker.managed=dockerman
  -l net.unraid.docker.icon='https://raw.githubusercontent.com/DiscordGSM/DiscordGSM/master/images/discordgsm.png'
  -v '/mnt/user/appdata/discordgsm/':'/usr/src/app/data':'rw' 'discordgsm/discord-game-server-monitor:latest' python3
  -u main.py

But some thime the bot will stopped by connection error so i use docker compose to fix it

BattlefieldDuck commented 1 year ago

that should work. Show me your docker-compose.yml too thanks.

ChongZhiJie0216 commented 1 year ago
version: '3.8'
services:
  DiscordGSM:
    container_name: DiscordGSM
    image: discordgsm/discord-game-server-monitor:2.9.1
    command: /bin/sh -c "gunicorn --bind 0.0.0.0:8000 --workers=2 --worker-class=gthread app:app --timeout 90 & python -u main.py"
    ports:
      - 8000:8000
    env_file:
      - ./.env
    restart: always
    volumes :
      - ./data:/usr/src/app/data
    networks:
      vlan-net:
          ipv4_address: 192.168.1.63

networks:
  vlan-net:
    name: br0.10
    driver: macvlan
    driver_opts:
      parent: eth0

network is control by my opnsense so i will set vlan

BattlefieldDuck commented 1 year ago

Try using latest version instead of 2.9.1

image: discordgsm/discord-game-server-monitor:latest

The latest one fixed the logs folder not created issue.

ChongZhiJie0216 commented 1 year ago

Okay,Thanks It Fix IT

BattlefieldDuck commented 1 year ago

good to hear! Thanks for your testing and using discordgsm, have a nice day.