City of Arabel
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. DoctorDeth
    • Profile
    • Following 0
    • Followers 0
    • Topics 7
    • Posts 21
    • Groups 0

    DoctorDeth

    @DoctorDeth

    1.2k
    Profile views
    21
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online
    Age 56
    Location Ocean Springs, MS

    DoctorDeth Unfollow Follow

    Latest posts made by DoctorDeth

    • Updating NWN (and NWNX)

      Updating NWN

      Note: I would recommend doing this in aradev first. Updating the NWN server is not a big deal, but NWNX is a bigger deal. It's easier to get it right in aradev and just copy the files up when you're ready to migrate the main module.

      Get the new version of the server from https://nwn.beamdog.net/downloads/

      This is named "nwnee-dedicated-81xx-xx" (where xx-xx is currently 37-15).

      # As the aradev user
      cd $HOME
      wget https://nwn.beamdog.net/downloads/nwnee-dedicated-8193.37-15.zip
      mkdir nwnee-dedicated-8193.37-15
      cd nwnee-dedicated-8193.37-15
      unzip ../nwnee-dedicated-8193.37-15.zip
      

      You can do this on a running server. A softlink in $HOME called server points to the currently active server. At cutover time, you would remove this link and link it to the new folder.

      $ cd $HOME
      $ ls -l server
      lrwxrwxrwx 1 aradev aradev 26 Mar  3 22:13 server -> nwnee-dedicated-8193.37-15
      # In this example, you're already on the latest version, but just to show what it looks like.
      $ rm server
      $ ln -s nwnee-dedicated-8193.37-15 server
      

      Updating NWNX

      Finding the right tag is the hard part. If they're in the middle of working on an update, there will be new tags that are a version ahead of what you may be installing.

      get fetch --prune               # pull new branches from the server
      git tag | sort -V | less        # list all the available tags (new at the bottom)
      ... < omitted stuff > ..
      build8193.36.10-HEAD
      build8193.36.11
      build8193.36.11-HEAD
      build8193.36.12
      build8193.36.12-HEAD
      build8193.37.13
      build8193.37.13-HEAD
      build8193.37.14-HEAD
      build8193.37.15-HEAD
      latest
      

      You need to find the tag that matches the same minor version number as the server you are migrating to (in this example, 8193.37.15). Check out that tag.

      Postgres started requiring SSL for connecting to the database a couple of versions ago, and I haven't had a chance (laziness, mostly) to update the DB driver.

      Check around line 47 in Plugins/SQL/Targets/PostgreSQL.cpp and make sure that line adds " sslmode=disable" on the end.

          // before
          const std::string port = "port=" + Config::Get<std::string>("PORT", "5432");
          // after
          const std::string port = "port=" + Config::Get<std::string>("PORT", "5432") + " sslmode=disable";
      

      Usually, when you're switching branches and not much has changed, it will just show that the PostgreSQL.cpp file is modified. This is good and means you probably don't have to change the file, but it's good to check.

      # Checkout the new tag
      $ git checkout build8193.37.15-HEAD
      M	Plugins/SQL/Targets/PostgreSQL.cpp
      Previous HEAD position was 2f18b7c48f Player: add GetOpenStore() (#1816)
      branch 'build8193.37' set up to track 'origin/build8193.37'.
      Switched to a new branch 'build8193.37'
      

      If you get conflicts or errors, stop and figure out why. A foolproof method is to wipe out the nwnx folder and just clone the nwnxee.unified repo locally and make the Postgres change listed above.

      Build the binaries.

      build_nwnx.sh   # this is in the bin folder of aradev.  Arabel isn't set up for building.
      

      You don't have to copy or move anything. The ~/bin/server script points directly to the build folder so building and restarting aradev makes it instantly available.

      Go find the NWNX release notes and see if there are any structural changes, or check with the NWNX Developers Discord channels.

      Fixing up the Module

      cd $HOME/nwnx
      Scripts/packageNWScript.sh 
      

      This will create a file called NWScript.zip in $HOME/nwnx/Binaries. Download that to your local computer and unzip it somewhere. You can use a diff utility or copy all the files from there into the Temp0 folder while you have the module open, then recompile and save the module.

      Some files you don't need like the redis stuff. You can prune them out if you want, but it doesn't hurt to have them.

      Upload the module to Dev and make sure it works.

      Updating Aradev

      When it's time to switch, you have to do three things:

      1. Switch the soft link from the old server directory to the new one.
      2. Copy the nwnx binaries from aradev to arabel
      3. Dump the new NWNX scripts into the current module and upload it.

      Something like:

      # As the Arabel user
      $ cd $HOME  # or just "cd" with no arguments
      $ rm server
      $ ln -s nwnee-dedicated-8193.37-15 server
      
      # Clean out the old binaries
      $ rm nwnx/Binaries/*
      # Copy the new ones
      $ cp /home/aradev/nwnx/Binaries/* nwnx/Binaries
      

      Upload the new module and restart the server.

      posted in Server Management
      DoctorDethD
      DoctorDeth
    • RE: forum links changing (pictures)

      @Darlene-Te-len Nothing is getting deleted. Links to Discord attachments will start to expire if you access them from services other than the Discord client. E.g., if you post a link to a message attachment in this comment thread, it will eventually return an error when accessed. The announcement is in a recent message in #api-announcements in the /discord-developers official server.

      Solution: Upload the images to a more permanent storage space (e.g. Google Photos, Flicker, lmgur, etc.) or the forums themselves.

      posted in Closed Bugs
      DoctorDethD
      DoctorDeth
    • RE: Brainstorming Git-Style Development

      @puffy Also no.

      posted in Server Management
      DoctorDethD
      DoctorDeth
    • RE: Brainstorming Git-Style Development

      @puffy No. NWN files are horrendously complex and have relationships between multiple files in a lot of cases (are, git, gic files, for example). Nested arrays of nested arrays. Trying to merge two people's changes to the same area/item/creature (anything but NSC or 2DA files, really) is not possible.

      posted in Server Management
      DoctorDethD
      DoctorDeth
    • Brainstorming Git-Style Development

      Requirements

      NOTE!!

      None of this has been validated yet. Just brain-dumping the main outline of the process.

      Users would be required to install at least the following:

      Software(link) Description
      GitBash manages pushing and pulling information from the global repo
      nasher manages unpacking/packing/compiling module locally
      neverwinter.nim tools for unpacking/packing module resources (required by nasher)
      nwnsc command line NWScript compiler (required by nasher)

      Installation

      Nasher requires a separate directory outside the Neverwinter Nights folder. It uses the resources there to unpack and pack the module/haks and therefore needs to be stored somewhere else.

      Tools (nasher, gitbash, etc.) should be installed and made available in the PATH environment variable.

      Open a PowerShell window or ISE.

      cd $home
      mkdir nasher
      cd nasher
      mkdir tools
      mkdir downloads
      mkdir Arabel
      cd downloads
      wget https://github.com/git-for-windows/git/releases/download/v2.41.0.windows.1/Git-2.41.0-64-bit.exe -OutFile Git-2.41.0-64-bit.exe
      wget https://github.com/squattingmonk/nasher/releases/download/latest/nasher_windows.zip -OutFile nasher_windows.zip
      wget https://github.com/niv/neverwinter.nim/releases/latest/download/neverwinter.windows.i386.zip -OutFile neverwinter.windows.i386.zip 
      wget https://github.com/nwneetools/nwnsc/releases/latest/download/nwnsc-win-v1.1.5.zip -OutFile nwnsc-win-v1.1.5.zip
      
      cd ..\tools
      Expand-Archive -Path ..\nwnsc-win-v1.1.5.zip
      Expand-Archive -Path ..\neverwinter.windows.i386.zip
      
      # Nasher has to be different
      Expand-Archive -Path '..\nasher_windows.zip'
      Move-Item -Path 'nasher_windows\nasher.exe' -Destination '.\nasher.exe'
      Remove-Item '.\nasher_windows' -Recurse
      

      Note to self: Need to come up with an "update all the tools" script, also.

      Run the Git installer in the downloads folder.

      Add %USERPROFILE%\nasher\tools to the Windows System PATH or User PATH environment variable (Google is your friend).

      Development Process

      !!WIP!! This is still being developed. !!WIP!!

      Note: This assumes a very simplistic approach where everybody is directly using the master branch and not doing any type of pull requests or dev/master/release strategy. This is not ideal, but probably easier for most folks.

      You don't have to "check out" or "reserve" the module for work when using a Git-style development process. Everybody works on a local copy and pushes/pulls the contents around between their local repository and the "one true source" (the master branch at "origin" in git terms).

      Also, multiple people working on the same item or area will cause conflicts that cannot be resolved. This would have to be coordinated verbally - "Hey, I'm working on area XXX - Interior Blah for the next couple of hours." Conflicts with NWScript files can be dealt with since the files are easily understandable/modifiable.

      Conflicts can be reduced by COMMITTING YOUR CHANGES OFTEN. Small incremental changes are easier to deal with, less likely to cause conflicts, and generally promote sanity. The only painful thing is that because Windows is dumb, you must Save and Exit the toolset otherwise the module is locked and cannot be read by nasher.

      Storytellers and Builders would have to use this process as well.

      All examples below are run in Git Bash.

      First Time Setup For Nasher

      cd ~/nasher
      
      # nasher.cfg file is already in the repo.
      git clone HTTP://<link to repo here>
      

      Using Git Bash

      A typical session of development would look like this (with comments):

      cd ~/nasher/Arabel
      
      # Update the local repository with any changes from the global repo
      git pull
      
      # Build the module from any changes from upstream
      nasher install
      
      # At this point, you would open the module and do any changes/creation/scripting you like.
      # Once you are done, "Build module" and Save/Exit the toolset.
      
      # Pull any toolset changes into nasher
      nasher unpack
      
      # If any new elements (areas/scripts/etc.) were added, git needs to know.
      git add -A
      
      # Commit changes to the local repo
      # Descriptive (but short) commit comments (in quotes) are a must.
      git commit -a -m "Added new area.  Changed script abcd_xyz"
      
      # Push the changes from the local repo to the remote
      git push remote
      

      Deployment process

      On the server side, building the module is similar to the development process.

      Install all the required tools (Deth will handle)

      cd ~/nasher 
      
      # Pull remote changes
      git pull
      
      # Build/install the module
      nasher install
      
      # TBD - error handling?  Compile errors, etc.?
      

      Items For Discussion

      • Release management with dev/master/release branches?
        • Should builders have to submit pull requests?
        • Code reviews?
      • All users would need their own GitLab accounts. Period.
      • Conflict handling.

      Updating The Toolchain

      WIP - need to figure out how to handle nwnsc that puts it's stupid version number in the file name.

      cd $home\nasher\downloads
      Remove-Item * -Recurse -Force
      
      # Git needs to be handled separately.
      # wget https://github.com/git-for-windows/git/releases/download/v2.41.0.windows.1/Git-2.41.0-64-bit.exe -OutFile Git-2.41.0-64-bit.exe
      
      # These always pull the latest versions
      wget https://github.com/squattingmonk/nasher/releases/download/latest/nasher_windows.zip -OutFile nasher_windows.zip
      wget https://github.com/niv/neverwinter.nim/releases/latest/download/neverwinter.windows.i386.zip -OutFile neverwinter.windows.i386.zip 
      wget https://github.com/nwneetools/nwnsc/releases/latest/download/nwnsc-win-v1.1.5.zip -OutFile nwnsc-win-v1.1.5.zip
      
      cd ..\tools
      Remove-Item * -Recurse -Force
      Expand-Archive -Path ..\nwnsc-win-v1.1.5.zip
      Expand-Archive -Path ..\neverwinter.windows.i386.zip
      
      # Nasher has to be different
      Expand-Archive -Path '..\nasher_windows.zip'
      Move-Item -Path 'nasher_windows\nasher.exe' -Destination '.\nasher.exe'
      Remove-Item '.\nasher_windows' -Recurse
      
      posted in Server Management
      DoctorDethD
      DoctorDeth
    • RE: Restoring stuff from the server vault

      @zool Yes, you can do the restore part from FileZilla, but the initial "mount" and "unmount" commands must be done at the command line.

      posted in Server Management
      DoctorDethD
      DoctorDeth
    • Restoring stuff from the server vault
      1. Log in to the server as "arabel".

      2. Create a temporary directory:
        mkdir /tmp/restore
        (Directory already exists errors are OK.)

      3. Mount the backup on the newly-created directory.
        borg mount $BORG_REPO /tmp/restore
        cd /tmp/restore

      At this point, that directory contains a bunch of folders that look like:

      ...
      drwxr-xr-x 1 arabel arabel 0 Feb 27 20:00 arabel-2022-02-27T20:00:02
      drwxr-xr-x 1 arabel arabel 0 Feb 28 00:00 arabel-2022-02-28T00:00:02
      drwxr-xr-x 1 arabel arabel 0 Feb 28 04:00 arabel-2022-02-28T04:00:02
      drwxr-xr-x 1 arabel arabel 0 Feb 28 08:00 arabel-2022-02-28T08:00:01
      drwxr-xr-x 1 arabel arabel 0 Feb 28 12:00 arabel-2022-02-28T12:00:01
      drwxr-xr-x 1 arabel arabel 0 Feb 28 16:00 arabel-2022-02-28T16:00:02
      drwxr-xr-x 1 arabel arabel 0 Feb 28 20:00 arabel-2022-02-28T20:00:01
      drwxr-xr-x 1 arabel arabel 0 Mar  1 00:00 arabel-2022-03-01T00:00:02
      ...
      

      Pick a timestamp that looks good to you and cd into that directory. From there, it looks like the servervault tree. Find your file, copy it out to where it needs to go.

      Important!!

      Unmount the restore directory when you are done or backups will fail in the future until you do:

      borg umount /tmp/restore

      Enjoy!

      posted in Server Management
      DoctorDethD
      DoctorDeth
    • RE: Deth's Super PC Management Cheat Sheet

      @Zool Correct - this would only be colors assigned in scripts. Colors on NPC's, items, etc., in the module itself would be immune to this.

      posted in Server Management
      DoctorDethD
      DoctorDeth
    • Definitive Get/Put Arabel Scripts

      Assuming you've gone through the Putty SSH key setup, these are the last scripts you'll ever need.

      This also assumes you've correctly installed the 64-bit versions of 7-zip and PuTTY. And not just putty.exe, but the full archive at the top of the page (the MSI installer).

      These scripts go in your Documents\Neverwinter Nights\modules folder.

      Arabel Production

      GetArabel.bat

      @echo off
      REM Progra~1 is a shortcut for "Program Files" so we don't have to mess with quotes.
      set PATH=C:\Progra~1\7-Zip;%PATH%
      set PATH=C:\Progra~1\PuTTY;%PATH%
      
      IF NOT EXIST Arabel.mod GOTO :PostMove
      IF EXIST Arabel.bak del Arabel.bak
      move /-Y "Arabel.mod" "Arabel.bak" 
      
      :PostMove
      pscp -sftp -C -4 -P 8222 modprod@arabel.cityofarabel.com:/home/modprod/nwn/modules/Arabel.mod Arabel.mod
      
      :Exit
      
      pause
      

      PutArabel.bat

      @echo off
      REM Progra~1 is a shortcut for "Program Files" so we don't have to mess with quotes.
      set PATH=C:\Progra~1\7-Zip;%PATH%
      set PATH=C:\Progra~1\PuTTY;%PATH%
      
      ECHO Compressing Arabel.mod
      IF EXIST Arabel.7z DEL Arabel.7z
      7z a -t7z Arabel.7z Arabel.mod
      
      ECHO Transferring mod to server
      pscp -sftp -P 8222 Arabel.7z modprod@arabel.cityofarabel.com:/home/modprod/nwn/modules/Arabel.7z
      IF errorlevel 1 GOTO :Error
      
      :Extract
      plink -batch -x -a -2 -ssh -P 8222 modprod@arabel.cityofarabel.com /home/modprod/nwn/modules/autoextract.sh
      GOTO :Exit
      
      :Error
      echo There was an error transferring the file
      pause
      GOTO :Exit
      
      :Exit
      ECHO Exit, all done we think
      pause
      

      Arabel Development

      GetAraDev.bat

      @echo off
      REM Progra~1 is a shortcut for "Program Files" so we don't have to mess with quotes.
      set PATH=C:\Progra~1\7-Zip;%PATH%
      set PATH=C:\Progra~1\PuTTY;%PATH%
      
      IF NOT EXIST AraDev.mod GOTO :PostMove
      IF EXIST AraDev.bak del AraDev.bak
      move /-Y "AraDev.mod" "AraDev.bak" 
      
      :PostMove
      pscp -sftp -C -4 -P 8222 moddev@arabel.cityofarabel.com:/home/moddev/nwn/modules/AraDev.mod AraDev.mod
      
      REM IF NOT errorlevel 1 GOTO :Unzip
      REM del AraDev.mod
      REM echo There was an error transferring the file, the partially downloaded file has been deleted.
      REM pause
      REM GOTO :Exit
      
      REM :Unzip
      REM echo Extracting AraDev.7z
      REM 7z e -y AraDev.7z
      REM echo All done.
      REM GOTO :Exit
      
      :Exit
      
      pause
      

      PutAraDev.bat

      @echo off
      REM Progra~1 is a shortcut for "Program Files" so we don't have to mess with quotes.
      set PATH=C:\Progra~1\7-Zip;%PATH%
      set PATH=C:\Progra~1\PuTTY;%PATH%
      
      ECHO Compressing AraDev.mod
      IF EXIST AraDev.7z DEL AraDev.7z
      7z a -t7z AraDev.7z AraDev.mod
      
      ECHO Transferring mod to server
      pscp -sftp -P 8222 AraDev.7z moddev@arabel.cityofarabel.com:/home/moddev/nwn/modules/AraDev.7z
      IF errorlevel 1 GOTO :Error
      
      :Extract
      plink -batch -x -a -2 -ssh -P 8222 moddev@arabel.cityofarabel.com /home/moddev/nwn/modules/autoextract.sh
      GOTO :Exit
      
      :Error
      echo There was an error transferring the file
      pause
      GOTO :Exit
      
      :Exit
      ECHO Exit, all done we think
      pause
      
      posted in Server Management
      DoctorDethD
      DoctorDeth
    • RE: Deth's Super PC Management Cheat Sheet

      Re: https://nodebb.cityofarabel.com/topic/54485/make-some-npcs-brown/10

      Source management: http://www.ericladner.name:9090/HubbyCoA/arabel-v6/

      If the tools are used properly, it doesn't cause problems, but people copy/paste in bizarre characters that cause issues with the tools used to manage the source.

      Using the built-in constants via StringToRGBString are OK.

      posted in Server Management
      DoctorDethD
      DoctorDeth