Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Install & update scripts out of sync for BRANCH variable #117

Closed
irobot73 opened this issue Jun 17, 2022 · 21 comments
Closed

[BUG] Install & update scripts out of sync for BRANCH variable #117

irobot73 opened this issue Jun 17, 2022 · 21 comments
Assignees
Labels
bug Something isn't working

Comments

@irobot73
Copy link

Describe the bug
BRANCH variable used for SteamCMD is generated in a different file than it's read from during the update process

To Reproduce
Steps to reproduce the behavior:

  1. Install server using 'stable' version & ensure all is working. Then stop server
  2. Set version to 'latest_experimental' & START_MODE to 3
  3. Start container to attempt to update to correct game files base
  4. Note failure to update (remains at STABLE

Expected behavior
Should pull down/verify the correct VERSION requested

Screenshots
If applicable, add screenshots to help explain your problem.

Versions:

  • "3"
  • vinanrra/7dtd-server

Docker/Docker-compose

version: "3"
services:
7dtdserver:
image: vinanrra/7dtd-server # https://github.com/vinanrra/Docker-7DaysToDie
container_name: 7dtdserver
environment:
- ALLOC_FIXES=NO # Optional - Install Allocs Fixes
- ALLOC_FIXES_UPDATE=NO # Optional - Update Allocs Fixes, depending of your 7 days to die version, on server install
- BACKUP=YES # Optional - Backup server at 5 AM
- MONITOR=YES # Optional - Keeps server up if crash
- PUID=1000
- PGID=1000
- START_MODE=3 # REQUIRED - Change between START MODES
#
# Start Modes
#
# 0 Install server
# 1 Start server
# 2 Update server
# 3 Update server and start, useful if you have already a 7 Days To Die server installed
# 4 Backup server and STOP the container
#
- TEST_ALERT=YES # Test alerts at start of server
- TimeZone=America/New_York
- VERSION=stable # Change between 7 days to die versions
# 'stable' or 'latest_experimental' or...
# https://steamdb.info/app/251570/depots/
volumes:
- /nas/Data/steam/[Games]/7days2die/svr:/home/sdtdserver/serverfiles/ # 7DaysToDie server config files.
- /nas/Data/steam/[Games]/7days2die/userData:/home/sdtdserver/.local/share/7DaysToDie/ # 7DaysToDie saves, where maps are store.
- /nas/Data/steam/LGSM/Logs:/home/sdtdserver/log/ # 7DaysToDie server log files.
- /nas/Data/steam/LGSM/Backup:/home/sdtdserver/lgsm/backup/ # 7DaysToDie server backups files.
- /nas/Data/steam/LGSM/Config:/home/sdtdserver/lgsm/config-lgsm/sdtdserver/ # LGSM config files.
- /nas:/media
ports:
- 80:80/tcp # EAC/EOS (testing)
- 443:443/tcp # EAC/EOS (testing)
- 26900:26900/tcp # PC
- 26900-26905:26900-26905/udp # PC (added few 'extra' ports to CYA)
- 27015-27050:27015-27050/udp # Valve (server registration)
# [added more ports via https://7dtd.illy.bz/wiki/Ports]
- 1935:1935/tcp # Playstation
- 3478-3480:3478-3480/udp # Playstation
- 3074:3074/tcp # X-Box
- 3074:3076:3074:3076/udp # X-Box
# (all the above via https://portforward.com/7-days-to-die/)
- 8083:8083/tcp # OPTIONAL WEBADMIN [NOTE: match server's CFG file]
- 8084:8084/tcp # OPTIONAL TELNET [NOTE: match server's CFG file]
- 8085:8085/tcp # OPTIONAL WEBSERVER https://7dtd.illy.bz/wiki/Server%20fixes
- 8087:8087/tcp # OPTIONAL WEBSERVER https://github.com/dmustanger/7dtd-ServerTools
restart: unless-stopped # NEVER USE WITH START_MODE=0, 2 or 4
# "no"
# always
# on-failure
# unless-stopped
#
# https://developer.valvesoftware.com/wiki/SteamCMD

Additional context
FIRST_INSTALL.SH will create/update (LSGMSDTDSERVERCFG=${BASEPATH}/lgsm/config-lgsm/sdtdserver/sdtdserver.cfg) & put the BRANCH variable within.

SERVER_UPDATE.SH on the other hand attempts to read the BRANCH variable from '/home/sdtdserver/lgsm/config-lgsm/sdtdserver/common.cfg'

@irobot73 irobot73 added the bug Something isn't working label Jun 17, 2022
@vinanrra
Copy link
Owner

Could you test the new version?

@irobot73
Copy link
Author

irobot73 commented Jun 17, 2022

Could you test the new version?

Not successful

Believe the problem now is that since the FIRST_INSTALL doesn't write out a BRANCH 100% of the time, the UPDATE script cannot find to change it & the INFO notification is simply a fall through instead of proper validation IOW: The FIRST_INSTALL & UPDATE scripts should always write out a proper version into the BRANCH variable in the sdtdserver.cfg file (my $.02)

Fresh install using STABLE branch of 7D2D:

- START_MODE=0
- sdtdserver.cfg does not contain a BRANCH variable
- "Success! App '294420' fully installed." (current STABLE version successfully installed)

UPDATE to 'latest_experimental' attempt:

- START_MODE=2
- VERSION=latest_experimental
- sdtdserver.cfg does not contain a BRANCH variable 
- No update made though INFO says it was changed

Install:

First_install

Update:

Update_attempt

@irobot73
Copy link
Author

irobot73 commented Jun 17, 2022

I note the FIRST_INSTALL script doesn't ensure the BRANCH variable is created if/when STABLE/PUBLIC (there's no line 43 for the STABLE/PUBLIC check)

& the UPDATE script (IMO) shouldn't blank out the BRANCH if/when STABLE/PUBLIC is wanted. If STABLE/PUBLIC is there & STABLE/PUBLIC used in the compose file, no update will be done anyway.

Again, just my $.02 :)

Valid svr code DEPOTS
https://steamdb.info/app/251570/depots

Screenshot from 2022-06-17 09-18-46
/

@irobot73
Copy link
Author

Possible fix for 1st_install & update (after reading more of the LinuxGSM & SteamCMD documentation, seems an empty branch defaults to STABLE)

if grep -R "branch" "$LSGMSDTDSERVERCFG"
    then
        if [ "${VERSION,,}" == 'stable'  ] || [ "${VERSION,,}" == 'public'  ]
            then
                sed -i "s/branch=.*/branch=\"\"/" $LSGMSDTDSERVERCFG
                echo "[INFO] Updated 7D2D version to ${VERSION,,}"
            else
                echo branch='"-beta $VERSION"' >> $LSGMSDTDSERVERCFG
                echo "[INFO] Updated 7D2D version to beta ${VERSION,,}"
        fi
    else
        if [ "${VERSION,,}" == 'stable'  ] || [ "${VERSION,,}" == 'public'  ]
            then
                echo branch='""' >> $LSGMSDTDSERVERCFG
                echo "[INFO] Setting 7D2D version to ${VERSION,,}"
            else
                echo branch='"-beta $VERSION"' >> $LSGMSDTDSERVERCFG
                echo "[INFO] Setting 7D2D version to beta ${VERSION,,}"
        fi
fi

@vinanrra
Copy link
Owner

Did you pull the latest image?, because at this issue #115 he was able to update.

@vinanrra vinanrra self-assigned this Jun 17, 2022
@irobot73
Copy link
Author

irobot73 commented Jun 17, 2022

Did you pull the latest image?, because at this issue #115 he was able to update.

No success still (I believe #115 would be 'fixed' via fresh start as 20.5 IS the new STABLE (default install))

I ran MODE0 to install the STABLE instance of 7D2D.

Then ran MODE2 using the 'testing_trunk' depot (https://steamdb.info/app/251570/depots/). No BRANCH written into the LGSM CONFIG file (folders & files are present), as it failed to parse the path:

[  OK  ] Updating sdtdserver: Checking for update: SteamCMD
7D2D-tester        | 
7D2D-tester        | No update available
7D2D-tester        | * Local build: 8673178
7D2D-tester        | * Remote build: 8673178
7D2D-tester        | * Branch: public
7D2D-tester        | https://steamdb.info/app/294420/
7D2D-tester        | 
7D2D-tester        | gr
![Screenshot from 2022-06-17 15-14-43](https://user-images.githubusercontent.com/7168597/174388253-6d84a8ab-eb52-4311-b96a-5dda70cdf102.png)
ep: /lgsm/config-lgsm/sdtdserver/sdtdserver.cfg: No such file or directory
7D2D-tester        | /home/sdtdserver/scripts/server_update.sh: line 20: /lgsm/config-lgsm/sdtdserver/sdtdserver.cfg: No such file or directory
7D2D-tester        | [INFO] Selecting 7 days to die testing_trunk version
[  OK  ] Updating sdtdserver: Checking for update: SteamCMD
7D2D-tester        | 
7D2D-tester        | No update available
7D2D-tester        | * Local build: 8673178
7D2D-tester        | * Remote build: 8673178
7D2D-tester        | * Branch: public
7D2D-tester        | https://steamdb.info/app/294420/
7D2D-tester        | 
7D2D-tester        | [INFO] The server have been updated to testing_trunk
7D2D-tester        | [INFO] Installing mods after first start
7D2D-tester        | [INFO] The server mods have been updated to latest version, if the server crash, check mod compatibilites

My COMPOSE file:

---
version: "3"
services:
  7dtdserver-TEST:
    image: vinanrra/7dtd-server         # https://github.com/vinanrra/Docker-7DaysToDie
    container_name: 7D2D-tester
    environment:
      - ALLOC_FIXES=NO                  # Optional - Install Allocs Fixes
      - ALLOC_FIXES_UPDATE=NO           # Optional - Update Allocs Fixes, depending of your 7 days to die version, on server install
      - BACKUP=YES                      # Optional - Backup server at 5 AM
      - MONITOR=YES                     # Optional - Keeps server up if crash
      - PUID=1000
      - PGID=1000
      - START_MODE=2                    # REQUIRED - Change between START MODES
                                        #
                                        # Start Modes
                                        #
                                        # 0 Install server
                                        # 1 Start server
                                        # 2 Update server
                                        # 3 Update server and start, useful if you have already a 7 Days To Die server installed
                                        # 4 Backup server and STOP the container
                                        #
      - TEST_ALERT=NO                   # Test alerts at start of server
      - TimeZone=America/New_York
      - VERSION=testing_trunk                  # Change between 7 days to die versions
                                        #    'stable' or 'latest_experimental' or...
                                        #    https://steamdb.info/app/251570/depots/
    volumes:
      - /nas/Data/test/[Games]/7days2die/svr:/home/sdtdserver/serverfiles/                  # 7DaysToDie server config files.
      - /nas/Data/test/[Games]/7days2die/userData:/home/sdtdserver/.local/share/7DaysToDie/ # 7DaysToDie saves, where maps are store.
      - /nas/Data/test/LGSM/Logs:/home/sdtdserver/log/                                      # 7DaysToDie server log files.
      - /nas/Data/test/LGSM/Backup:/home/sdtdserver/lgsm/backup/                            # 7DaysToDie server backups files.
      - /nas/Data/test/LGSM/Config:/home/sdtdserver/lgsm/config-lgsm/sdtdserver/            # LGSM config files.
      - /nas/Data/test/Steam/logs:/home/sdtdserver/.local/share/Steam/logs
      - /nas:/media
    ports:
      - 26800:26800/tcp             # PC
      - 26800-26805:26800-26805/udp # PC (added few 'extra' ports to CYA)
    restart: "no"         # NEVER USE WITH START_MODE=0, 2 or 4
                                    #    "no"
                                    #    always
                                    #    on-failure
                                    #    unless-stopped
                                    # 
                                    # https://developer.valvesoftware.com/wiki/SteamCMD

Screenshot from 2022-06-17 15-16-35

Screenshot from 2022-06-17 15-14-43

@vinanrra
Copy link
Owner

I will check it tomorrow today it's my birthday and I'm gonna be out :)

@irobot73
Copy link
Author

I will check it tomorrow today it's my birthday and I'm gonna be out :)

Happy b-day & have a good time (offline) :D

@irobot73
Copy link
Author

I will check it tomorrow today it's my birthday and I'm gonna be out :)

Your UPDATE script doesn't have a BASEPATH variable like FIRST_INSTALL

@vinanrra
Copy link
Owner

Could you test:

vinanrra/7dtd-server:test

@irobot73
Copy link
Author

irobot73 commented Jun 19, 2022

NOT quite 100%

[36m7D2D-tester        |[0m 
[36m7D2D-tester        |[0m No update available
[36m7D2D-tester        |[0m * Local build: [32m8673178[0m
[36m7D2D-tester        |[0m * Remote build: [32m8673178[0m
[36m7D2D-tester        |[0m * Branch: public
[36m7D2D-tester        |[0m https://steamdb.info/app/294420/
[36m7D2D-tester        |[0m 
[36m7D2D-tester        |[0m fetching GitHub core_exit.sh...[32mOK[0m[2K
[INFO] Selecting 7 days to die testing_trunk version
[36m7D2D-tester        |[0m 
[K[ .... ] Updating sdtdserver: 
[K[ .... ] Updating sdtdserver: SteamCMD
[K[ .... ] Updating sdtdserver: Checking local build: SteamCMD
[K[[32m  OK  [0m] Updating sdtdserver: Checking local build: SteamCMD
[K[ .... ] Updating sdtdserver: Checking remote build: SteamCMD
[K[[31m FAIL [0m] Updating sdtdserver: Checking remote build: SteamCMD[INFO] The server have been updated to testing_trunk
[36m7D2D-tester        |[0m [INFO] Installing mods after first start
[36m7D2D-tester        |[0m [INFO] The server mods have been updated to latest version, if the server crash, check mod compatibilites
[36m7D2D-tester exited with code 0
[0m

The CONFIG though didn't write out correctly:

Screenshot from 2022-06-19 15-11-38

All the LOGS+
test.zip

@irobot73
Copy link
Author

UPDATE script (& FIRST_INSTALL too, no?) on non-STABLE/PUBLIC isn't escaping the quotations?

Line 19: sed -i 's/branch=.*/branch="$VERSION"/' $LSGMSDTDSERVERCFG

@vinanrra
Copy link
Owner

vinanrra commented Jun 19, 2022

UPDATE script (& FIRST_INSTALL too, no?) on non-STABLE/PUBLIC isn't escaping the quotations?

Line 19: sed -i 's/branch=.*/branch="$VERSION"/' $LSGMSDTDSERVERCFG

It should be updated with last commit, I forgot to change that line when doing the changes :(

Pull latest version and should be working

@irobot73
Copy link
Author

irobot73 commented Jun 20, 2022

Same.
Pulled latest/greatest

Mode 0 BETA (1st test attempt). SDTDSERVER.CFG:

##################################
####### Instance Settings ########
##################################
# PLACE INSTANCE SETTINGS HERE
## These settings will apply to a specific instance.
branch="-beta $VERSION"
---
version: "3"
services:
  7dtdserver-TEST:
    image: vinanrra/7dtd-server    # https://github.com/vinanrra/Docker-7DaysToDie
    container_name: 7D2D-tester
    environment:
      - ALLOC_FIXES=NO                  # Optional - Install Allocs Fixes
      - ALLOC_FIXES_UPDATE=NO           # Optional - Update Allocs Fixes, depending of your 7 days to die version, on server install
      - BACKUP=YES                      # Optional - Backup server at 5 AM
      - MONITOR=YES                     # Optional - Keeps server up if crash
      - PUID=1000
      - PGID=1000
      - START_MODE=0                    # REQUIRED - Change between START MODES
                                        #
                                        # Start Modes
                                        #
                                        # 0 Install server
                                        # 1 Start server
                                        # 2 Update server
                                        # 3 Update server and start, useful if you have already a 7 Days To Die server installed
                                        # 4 Backup server and STOP the container
                                        #
      - TEST_ALERT=NO                   # Test alerts at start of server
      - TimeZone=America/New_York
      - VERSION=testing_trunk                  # Change between 7 days to die versions
                                        #    'stable' or 'latest_experimental' or...
                                        #    https://steamdb.info/app/251570/depots/
    volumes:
      - /nas/Data/test/[Games]/7days2die/svr:/home/sdtdserver/serverfiles/                  # 7DaysToDie server config files.
      - /nas/Data/test/[Games]/7days2die/userData:/home/sdtdserver/.local/share/7DaysToDie/ # 7DaysToDie saves, where maps are store.
      - /nas/Data/test/LGSM/Logs:/home/sdtdserver/log/                                      # 7DaysToDie server log files.
      - /nas/Data/test/LGSM/Backup:/home/sdtdserver/lgsm/backup/                            # 7DaysToDie server backups files.
      - /nas/Data/test/LGSM/Config:/home/sdtdserver/lgsm/config-lgsm/sdtdserver/            # LGSM config files.

      - /nas/Data/test/Steam/logs:/home/sdtdserver/.local/share/Steam/logs
      - /nas:/media
    ports:
      - 26800:26800/tcp             # PC
      - 26800-26805:26800-26805/udp # PC (added few 'extra' ports to CYA)
    restart: "no"         # NEVER USE WITH START_MODE=0, 2 or 4
                                    #    "no"
                                    #    always
                                    #    on-failure
                                    #    unless-stopped
                                    # 
                                    # https://developer.valvesoftware.com/wiki/SteamCMD

0-BETA.log
SAUCV5~0.LOG

@irobot73
Copy link
Author

irobot73 commented Jun 20, 2022

UPDATE script, line 21 (& same in FIRST_INSTALL) needs escaping as well. Quick shell test gives me the expected outcome:

echo branch=\"-beta $VERSION\" >> test.cfg

Maybe default to an empty BRANCH in the CFG (branch="") & skip the whole check all around :P

@vinanrra
Copy link
Owner

Fixed, I have tested and was working without problem

@irobot73
Copy link
Author

Fixed, I have tested and was working without problem

Same would be needed for same area/line in FIRST_INSTALL too, no?

I'll give it a whirl when I get a chance. TY

@vinanrra
Copy link
Owner

Fixed, I have tested and was working without problem

Same would be needed for same area/line in FIRST_INSTALL too, no?

I'll give it a whirl when I get a chance. TY

Edited and released a new version

@irobot73
Copy link
Author

Initial run 1:

  • Mode 0 - Stable: nothing in .CFG, as expected
  • Mode 2 - Beta: branch="-beta testing_trunk", as expected
  • Mode 2 - Stable: branch="", as expected

Initial run 2:

  • Mode 0 - Beta: branch="-beta testing_trunk", as expected
  • Mode 2 - Stable: branch="", as expected

Seems to be working as expected now, TY.

@vinanrra
Copy link
Owner

Initial run 1:

* Mode 0 - Stable:  nothing in .CFG, as expected

* Mode 2 - Beta:  branch="-beta testing_trunk", as expected

* Mode 2 - Stable: branch="", as expected

Initial run 2:

* Mode 0 - Beta:  branch="-beta testing_trunk", as expected

* Mode 2 - Stable:  branch="", as expected

Seems to be working as expected now, TY.

Thanks for testing and for the help :)

@irobot73
Copy link
Author

Initial run 1:

* Mode 0 - Stable:  nothing in .CFG, as expected

* Mode 2 - Beta:  branch="-beta testing_trunk", as expected

* Mode 2 - Stable: branch="", as expected

Initial run 2:

* Mode 0 - Beta:  branch="-beta testing_trunk", as expected

* Mode 2 - Stable:  branch="", as expected

Seems to be working as expected now, TY.

Thanks for testing and for the help :)

Happy to assist & apprec. the container

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants