docs(install): added more env params and an install install stuff
This commit is contained in:
@@ -1,37 +1,56 @@
|
|||||||
# Install
|
# Install
|
||||||
|
|
||||||
## Files needed to be downloaded before install.
|
## Files needed to be downloaded before install.
|
||||||
|
|
||||||
### To run the server
|
### To run the server
|
||||||
* [PostgresSQL](https://www.postgresql.org/download/windows/) - current version using is 17
|
|
||||||
* [NodeJS](https://nodejs.org)
|
- [PostgresSQL](https://www.postgresql.org/download/windows/) - current version using is 17
|
||||||
* [NSSM](https://nssm.cc/)
|
- [NodeJS](https://nodejs.org)
|
||||||
|
- [NSSM](https://nssm.cc/)
|
||||||
|
|
||||||
### To manage the server
|
### To manage the server
|
||||||
* [VSCODE](https://code.visualstudio.com/)
|
|
||||||
* [Postman](https://www.postman.com/downloads/)
|
- [VSCODE](https://code.visualstudio.com/)
|
||||||
|
- [Postman](https://www.postman.com/downloads/)
|
||||||
|
|
||||||
## Creating directories needed
|
## Creating directories needed
|
||||||
* Create a new folder where we will host the server files.
|
|
||||||
* Copy the nssm.exe into this folder
|
- Create a new folder where we will host the server files.
|
||||||
* Copy the build files to the server (only needed for intial install).
|
- Copy the nssm.exe into this folder
|
||||||
* This will house all the compiles and minified files needed to start the server up, this includes the frontend.
|
- Copy the build files to the server (only needed for intial install).
|
||||||
* Save the nssm.exe into this folder as well, this will be used to control the service.
|
- 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
|
## Do the intial install
|
||||||
|
|
||||||
### DB instal setup
|
### DB instal setup
|
||||||
|
|
||||||
1. Install postgres
|
1. Install postgres
|
||||||
2. Open pgAdmin
|
2. Open pgAdmin
|
||||||
3. create a new Database named lst_db
|
3. create a new Database named lst_db
|
||||||
|
|
||||||
### Intial server setup
|
### Intial server setup
|
||||||
|
|
||||||
1. Open VSCode and navigate to the folder where you extracted the files.
|
1. Open VSCode and navigate to the folder where you extracted the files.
|
||||||
2. Click trusted when it pops up.
|
2. Click trusted when it pops up.
|
||||||
3. Open a terminal window inside vscode.
|
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
|
4. Run the install script this will install all dependaceys needed as well as do all the database migrations
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run prodinstall
|
npm run prodinstall
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Next we want to do an intial build for the db
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
### Create the .env file
|
### Create the .env file
|
||||||
|
|
||||||
In the root of the folder create a new .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
|
add in the below and change each setting area that says change me to something that suits your needs
|
||||||
|
|
||||||
```env
|
```env
|
||||||
# PORTS
|
# PORTS
|
||||||
# To keep it all simple we will pass VITE to the ports that are used on both sides.
|
# To keep it all simple we will pass VITE to the ports that are used on both sides.
|
||||||
@@ -39,7 +58,9 @@ VITE_SERVER_PORT=4400
|
|||||||
|
|
||||||
# logLevel
|
# logLevel
|
||||||
LOG_LEVEL=debug
|
LOG_LEVEL=debug
|
||||||
|
PROD_PORT=4000
|
||||||
|
# DUE to lstv1 we need 3000
|
||||||
|
SEC_PORT=3000
|
||||||
# Auth stuff
|
# Auth stuff
|
||||||
SALTING=12
|
SALTING=12
|
||||||
SECRET=CHANGEME
|
SECRET=CHANGEME
|
||||||
@@ -64,62 +85,80 @@ MAXLOTS=3
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Run the start command to get all the basic settings and modules installed
|
### Run the start command to get all the basic settings and modules installed
|
||||||
|
|
||||||
1. Run the below
|
1. Run the below
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
This command will start up the server and seed the database.
|
This command will start up the server and seed the database.
|
||||||
* Settings will be set here.
|
|
||||||
* All modules will be added.
|
- Settings will be set here.
|
||||||
|
- All modules will be added.
|
||||||
|
|
||||||
2. Press CTRL + C to stop the server.
|
2. Press CTRL + C to stop the server.
|
||||||
3. Reopen postgres and review the settings make the changes to match the server your going to be running in.
|
3. Reopen postgres and review the settings make the changes to match the server your going to be running in.
|
||||||
* Change the server
|
- Change the server
|
||||||
* change the dbServer
|
- change the dbServer
|
||||||
* change plantToken
|
- change plantToken
|
||||||
* then the remaining settings confirm if you need on or want to leave as default.
|
- then the remaining settings confirm if you need on or want to leave as default.
|
||||||
|
|
||||||
### Creating first user.
|
### Creating first user.
|
||||||
|
|
||||||
1. Start the server back up.
|
1. Start the server back up.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Open http://[SERVER]:[PORT]/api/docs or postman and create a user.
|
2. 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.
|
- 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.
|
- Change the server and port to what you changed in the DB.
|
||||||
3. Stop the server again with CTRL + C.
|
3. Stop the server again with CTRL + C.
|
||||||
|
|
||||||
### Running as a serivice.
|
### Running as a serivice.
|
||||||
|
|
||||||
You want to CD into the scripts folder.
|
You want to CD into the scripts folder.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd .\dist\server\scripts\
|
cd .\dist\server\scripts\
|
||||||
```
|
```
|
||||||
|
|
||||||
Next use the example command below to get the service up and running.
|
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
|
- Options legend
|
||||||
* option = use install for the install, but you can use this script later to stop, start, restart the service.
|
- serviceName = not recommended to change to reduce issues with the update process
|
||||||
* appPath = where did you extract the server files
|
- option = use install for the install, but you can use this script later to stop, start, restart the service.
|
||||||
* description = no need to change this unless you want it to be something else
|
- appPath = where did you extract the server files
|
||||||
* command = do not change this unless you know what your doing and really need to change this.
|
- 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.
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
.\services.ps1 -serviceName "LSTV2" -option "install" -appPath "E:\LST\lstV2" -description "Logistics Support Tool V2" -command "run start"
|
.\services.ps1 -serviceName "LSTV2" -option "install" -appPath "E:\LST\lstV2" -description "Logistics Support Tool V2" -command "run start"
|
||||||
```
|
```
|
||||||
|
|
||||||
# Migrating From V1 to V2
|
# Migrating From V1 to V2
|
||||||
|
|
||||||
## User migration
|
## User migration
|
||||||
|
|
||||||
1. Open the sqlite db and export to sql the users table
|
1. Open the sqlite db and export to sql the users table
|
||||||
2. OPen the sql in notepad++ or your editor of choice and change the query to be similar to below.
|
2. OPen the sql in notepad++ or your editor of choice and change the query to be similar to below.
|
||||||
* we only need to have save the username, role, email, password
|
- we only need to have save the username, role, email, password
|
||||||
|
|
||||||
An example new query will look like
|
An example new query will look like
|
||||||
* Below is how it looks when exported from sqlite
|
|
||||||
|
- Below is how it looks when exported from sqlite
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
INSERT INTO "User" ("id", "username", "email", "role", "password", "passwordToken", "tokenExpire", "active", "pinCode", "lastLogin", "add_user", "add_date", "upd_user", "upd_date") VALUES
|
INSERT INTO "User" ("id", "username", "email", "role", "password", "passwordToken", "tokenExpire", "active", "pinCode", "lastLogin", "add_user", "add_date", "upd_user", "upd_date") VALUES
|
||||||
(1, 'matthes01', 'blake.matthes@alpla.com', 'admin', 'JDJiJDEMUJEdGtL', NULL, NULL, '1', NULL, '1721075647687', 'LST_System', '1721075647687', 'LST_System', '1721075647687');
|
(1, 'matthes01', 'blake.matthes@alpla.com', 'admin', 'JDJiJDEMUJEdGtL', NULL, NULL, '1', NULL, '1721075647687', 'LST_System', '1721075647687', 'LST_System', '1721075647687');
|
||||||
```
|
```
|
||||||
|
|
||||||
The way we want to put recreate the query to work with the new db
|
The way we want to put recreate the query to work with the new db
|
||||||
* Below example
|
|
||||||
|
- Below example
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
INSERT INTO "users" ("username", "email", "role", "password") VALUES
|
INSERT INTO "users" ("username", "email", "role", "password") VALUES
|
||||||
('matthes01','blake.matthes@alpla.com','admin','JDJiJDE1FuNFpkYlk4NGdHUXpEMzlHR1BD'),
|
('matthes01','blake.matthes@alpla.com','admin','JDJiJDE1FuNFpkYlk4NGdHUXpEMzlHR1BD'),
|
||||||
@@ -127,11 +166,12 @@ INSERT INTO "users" ("username", "email", "role", "password") VALUES
|
|||||||
('brandon001','brandon.harry@alpla.com','manager','wdm1RSXJlZnJDYTZP');
|
('brandon001','brandon.harry@alpla.com','manager','wdm1RSXJlZnJDYTZP');
|
||||||
;
|
;
|
||||||
```
|
```
|
||||||
* You could have many users and just add like above with the identical info from the db
|
|
||||||
|
|
||||||
|
- You could have many users and just add like above with the identical info from the db
|
||||||
|
|
||||||
## Running v1 along Side V2 for the interm
|
## Running v1 along Side V2 for the interm
|
||||||
* change v2 prod port to 4000 in the env and db
|
|
||||||
* change v1 env to 4400 in the env. and in the db you will need to change the auth server to 4000 and the serverPort to 4400
|
- change v2 prod port to 4000 in the env and db
|
||||||
|
- change v1 env to 4400 in the env. and in the db you will need to change the auth server to 4000 and the serverPort to 4400
|
||||||
|
|
||||||
This will change so that v2 is the main server now, this is needed for ocme mainly.
|
This will change so that v2 is the main server now, this is needed for ocme mainly.
|
||||||
Reference in New Issue
Block a user