Files
lst/lstV2
..
2025-09-22 22:41:19 -05:00
2025-09-22 22:41:51 -05:00

lstV2

Logistics Support Tool V2

A support tool to alpla prod please see below for install.

Install

Files needed to be downloaded before install.

To run the server

To manage the server

Creating directories needed

  • Create a new folder where we will host the server files.
    • Copy the nssm.exe into this folder
  • Copy the build files to the server (only needed for intial install).
    • This will house all the compiles and minified files needed to start the server up, this includes the frontend.
  • Save the nssm.exe into this folder as well, this will be used to control the service.

Do the intial install

DB instal setup

  1. Install postgres
  2. Open pgAdmin
  3. create a new Database named lst_db

Intial server setup

  1. Open VSCode and navigate to the folder where you extracted the files.
  2. Click trusted when it pops up.
  3. Open a terminal window inside vscode.
  4. Run the install script this will install all dependaceys needed as well as do all the database migrations
npm run prodinstall

Next we want to do an intial build for the db

npm run build

Create the .env file

In the root of the folder create a new .env file add in the below and change each setting area that says change me to something that suits your needs

# PORTS
PROD_PORT=4000
# To keep it all simple we will pass VITE to the ports that are used on both sides.
VITE_SERVER_PORT=4000

# logLevel
LOG_LEVEL=info
# Auth stuff
SALTING=12
SECRET=CHANGEME
JWT_SECRET=CHANGEME
JWT_REFRESH_SECRET=CHANGEME

# Expire info plus refresh change as needed
JWT_EXPIRES=60
JWT_REFRESH_THRESHOLD=30
JWT_ACCESS_EXPIRATION="1h"
JWT_REFRESH_EXPIRATION="7d"

# this code will need to be used when a user needs to have access to everything.
SECRETOVERRIDECODE="supersecretKey"

# Database url - please change the password if this is all you changed
DATABASE_URL="postgresql://postgres:PASSWORD@localhost:5432/lst_db"

# This is for usday1 restrictions with the lgvs and customer constraints.
FIFO=100
MAXLOTS=3

Run the start command to get all the basic settings and modules installed

  1. Run the below
npm start

This command will start up the server and seed the database.

  • Settings will be set here.
  • All modules will be added.
  1. Press CTRL + C to stop the server.
  2. Reopen postgres and review the settings make the changes to match the server your going to be running in.
    • Change the server
    • change the dbServer
    • change plantToken
    • then the remaining settings confirm if you need on or want to leave as default.

Creating first user.

  1. Start the server back up.
npm start
  1. Open http://[SERVER]:[PORT]/api/docs or postman and create a user.
    • Please do not try to manually enter a new user this is due to how the password is hashed, as well as setting systemAdmin for the first user.
    • Change the server and port to what you changed in the DB.
  2. Stop the server again with CTRL + C.

Running as a serivice.

You want to CD into the scripts folder.

cd .\dist\server\scripts\

Next use the example command below to get the service up and running.

  • Options legend
    • serviceName = not recommended to change to reduce issues with the update process
    • option = use install for the install, but you can use this script later to stop, start, restart the service.
    • appPath = where did you extract the server files
    • description = no need to change this unless you want it to be something else
    • command = do not change this unless you know what your doing and really need to change this.
.\services.ps1 -serviceName "LSTV2" -option "install" -appPath "E:\LST\lstV2" -description "Logistics Support Tool V2" -command "run start"

Adding servers to the mix to update on from the front end

you will need to add your servers into the serverData.json. when the server starts up it will look at this file and make changes as needed. below is an example of the server

{
    "sName": "Kansas City",
    "serverDNS": "usksc1vms006",
    "plantToken": "usksc1",
    "idAddress": "10.42.9.26",
    "greatPlainsPlantCode": "85",
    "streetAddress": "1800 E 94th St Suite 300",
    "cityState": "Kansas City, MO",
    "zipcode": "64131",
    "contactEmail": "example@example.com",
    "contactPhone": "555-555-5555",
    "customerTiAcc": "ALPL01KCINT",
    "lstServerPort": "4000",
    "active": false,
    "serverLoc": "E:\\LST\\lstv2",
    "oldVersion": "E:\\LST\\lst_backend",
    "shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
    "tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
    "otherSettings": [{ "specialInstructions": "" }]
}