Closed irobot73 closed 7 months ago
This is an issue with the docker container. Backup does need some changes made to work better with the container. however in general I recommend using 3rd party tools for regular backups like rsync as they are more efficient than the LinuxGSM just compress it solution š
This is an issue with the docker container. Backup does need some changes made to work better with the container. however in general I recommend using 3rd party tools for regular backups like rsync as they are more efficient than the LinuxGSM just compress it solution š
I understand the BACKUP script needs some tweaking, but the script execution (esp. via CRON) believes the SERVERFILES exist in the '/app' folder & NOT the '/data'.
Compose YML: compose.txt
Server install & running:
My CRON changes (using Portainer):
The CRON log: crontab.log
/data/serverfiles (proper) vs. CRON /app/serverfiles :
[K[[32m OK [0m] Updating LinuxGSM pzserver: Updating modules
[K[ .... ] Backing up pzserver:
[K[[31m FAIL [0m] Backing up pzserver: Cannot access /app/serverfiles: No such directory
[K[ .... ] Backing up pzserver:
[K[[31m FAIL [0m] Backing up pzserver: Cannot access /app/serverfiles: No such directory
[K[ .... ] Stopping pzserver:
[K[[31m FAIL [0m] Stopping pzserver: Cannot access /app/serverfiles: No such directory
[K[[31m FAIL [0m] Stopping pzserver: Cannot access /app/serverfiles: No such directory
[K[ .... ] Backing up pzserver:
[K[[31m FAIL [0m] Backing up pzserver: Cannot access /app/serverfiles: No such directory
[K[ .... ] Backing up pzserver:
[K[[31m FAIL [0m] Backing up pzserver: Cannot access /app/serverfiles: No such directory
I created another instance & set the SERVERFILES ENV variable
services:
lgsm-test:
image: gameservermanagers/gameserver:pz # https://github.com/GameServerManagers/docker-gameserver
container_name: lgsm-test
environment:
- LGSM_SERVERFILES=/data/serverfiles
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- ./:/data
ports:
- 16264-16265:16261-16262/udp
- 27017:27015
restart: unless-stopped
Brought up the container & initial logs sees/creates
Setup the CRON w/ logging:
linuxgsm@a1d50ab924ee:/app$ whoami
linuxgsm
linuxgsm@a1d50ab924ee:/app$ crontab -l
# */60 * * * * /app/pzserver update > /dev/null 2>&1
*/15 * * * * /app/*server update-lgsm >> /data/log/crontab.log 2>&1 # EVERY SUN @ 1:30
*/10 * * * * /app/*server restart >> /data/log/crontab.log 2>&1 # EVERY Tu/Th/Sa @ 3:30
*/5 * * * * /app/*server backup >> /data/log/crontab.log 2>&1 # EVERY DAY @ 4:00
linuxgsm@a1d50ab924ee:/app$
& note the log. Scripts don't recognize variable:
[K[ .... ] Backing up pzserver:
[K[[31m FAIL [0m] Backing up pzserver: Cannot access /app/serverfiles: No such directory
[K[ .... ] Backing up pzserver:
[K[ .... ] Stopping pzserver:
[K[[31m FAIL [0m] Backing up pzserver: Cannot access /app/serverfiles: No such directory
[K[[31m FAIL [0m] Stopping pzserver: Cannot access /app/serverfiles: No such directory
[K[[31m FAIL [0m] Stopping pzserver: Cannot access /app/serverfiles: No such directory
[K[ .... ] Backing up pzserver:
[K[ .... ] Updating LinuxGSM pzserver:
[K[[31m FAIL [0m] Backing up pzserver: Cannot access /app/serverfiles: No such directory
[K[ .... ] Updating LinuxGSM pzserver: Checking for log files
[K[[36m INFO [0m] Updating LinuxGSM pzserver: Checking for log files: Creating log files
installing log dir: /app/log...[32mOK[0m
installing LinuxGSM log dir: /app/log/script...[32mOK[0m
creating LinuxGSM log: /app/log/script/pzserver-script.log...[32mOK[0m
installing console log dir: /app/log/console...[32mOK[0m
creating console log: /app/log/console/pzserver-console.log...[32mOK[0m
creating symlink to game log dir: /app/log/server -> /data/Zomboid/Logs...[32mOK[0m
creating symlink to steam log dir: /app/log/steam -> /data/.steam/steam/logs...[32mOK[0m
[K[ .... ] Updating LinuxGSM pzserver: Selecting repo
[K[[32m OK [0m] Updating LinuxGSM pzserver: Selecting repo: GitHub
I ended up rolling my own, for now. Again, I did redirect, via CONFIG-LGSM, the BACKUP location so it too existed in the /DATA folder.
## Backup Directory
backupdir="${HOME}/backup"
Could have changed the LSGM COMMAND_BACKUP script but every 'update-lgsm' would wipe it out & need to be redone. But you'd get the auto-rolling, purge & notifications (shrug)
tar -czf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "${excludedir}"...
to
tar -czf "${backupdir}/${backupname}.tar.gz" -C / -T /data/bkup_include.txt
Cut down the (expected via LGSM) 15GB backup, as it was grabbing /SERVERFILES+, to ~420MB by removing the 'bloat' (no TMP, LOGs & SteamCMD files+)
Create & add the file/folder(s) I needed to '/data/bkup_include.txt'.
/app/lgsm/config-default/
/app/lgsm/config-lgsm/
/app/lgsm/data/
/app/lgsm/modules/
/app/entrypoint.sh
/app/entrypoint-healthcheck.sh
/app/entrypoint-user.sh
/app/linuxgsm.sh
/app/sdtdserver
/data/config-lgsm/
/data/serverfiles/sdtdserver.xml
/data/userData/
/data/bkup_exclude.txt
/data/bkup_include.txt
Reference the same file via new script that I could add to CRONTAB (chmod +x!!) [my_backup.sh]:
#!/bin/sh
FILENAME=lgsm_$(date -d "today" +"%A").tar.gz
BACKUP="/data/backup/${FILENAME}"
# echo ${BACKUP}
tar -czf "${BACKUP}" -C / -T /data/bkup_include.txt
exitcode=$?
echo "Completed: '${BACKUP}', Exit Code: ${exitcode}, Size $(du -sh "${BACKUP}" | awk '{print $1}')"
Crontab:
#*/60 * * * * /app/sdtdserver update > /dev/null 2>&1
#
30 0 * * 0 cat /dev/null > /data/log/crontab.log # EVERY SUN @ 00:30
0 1 * * 0 /app/*server update-lgsm >> /data/log/crontab.log 2>&1 # EVERY SUN @ 1:00
0 3 * * 1,3,5 /app/*server restart >> /data/log/crontab.log 2>&1 # EVERY M,W,F @ 3:00
0 4 * * * /data/my_backup.sh >> /data/log/crontab.log 2>&1 # EVERY DAY @ 4:00
7 day rolling backup w/ any other logic/work:
Crontab.log
/data/backup/lgsm_Friday.tar.gz
tar: Removing leading `/' from member names
tar: Removing leading `/' from hard link targets
Completed: '/data/backup/lgsm_Friday.tar.gz', Exit Code: 0, Size 401M
vs. Docker container where /DATA is mapped (IE: Only getting what I need)
volumes:...
- ./:/data
- ./userData:/data/userData # Utilized in the game's SERVER.XML.CFG file
I have since added a symlink from /app/serverfiles
to /data/serverfiles
this should help resolve these issues. But I think more work may be required
User story
As a server admin I want the included scripts to utilize the proper paths to execute properly & successfully
Game
SDTDServer
Linux distro
Ubuntu 22.04
Command
command: update, command: backup
Further information
Part of #4384 ??
(Some) Scripts/commands, when executed via console, would successfully execute & complete (though incomplete [backup])
Appears they are pointing to the /app folder & ignoring the /data
In the cron jobs screenshot, you can see I manually exec. one of the same scripts & it was successful in the log (last entry) while the same script via cron failed (top of log file)
Cron jobs & manual execution attempts:
Cron output: crontab.log
Server setup:
Duped log files. Script creates new LOG paths, these exist under /DATA already (NOTE the symlink path):
Relevant log output
Steps to reproduce