Compare commits

...

5 Commits

14 changed files with 121 additions and 15 deletions

View File

@@ -119,6 +119,7 @@ const main = async () => {
if (!process.env.WEBHOOK_URL) {
// await sendEmail(emailData);
} else {
log.fatal({ stack: err.stack }, err.message);
await sendNotify({
module: "system",
subModule: "fatalCrash",

12
drizzle-dev.config.ts Normal file
View File

@@ -0,0 +1,12 @@
import { defineConfig } from "drizzle-kit";
const dbURL = `postgres://${process.env.DATABASE_USER}:${process.env.DATABASE_PASSWORD}@${process.env.DATABASE_HOST}:${process.env.DATABASE_PORT}/${process.env.DATABASE_DB}`;
export default defineConfig({
dialect: "postgresql",
schema: "./app/src/pkg/db/schema",
out: "./migrations",
dbCredentials: { url: dbURL },
// verbose: true, // optional, logs more details
//strict: true, // optional, prevents unsafe operations
});

View File

@@ -4,7 +4,7 @@ const dbURL = `postgres://${process.env.DATABASE_USER}:${process.env.DATABASE_PA
export default defineConfig({
dialect: "postgresql",
schema: "./app/src/pkg/db/schema",
schema: "./dist/pkg/db/schema",
out: "./migrations",
dbCredentials: { url: dbURL },
// verbose: true, // optional, logs more details

View File

@@ -9,3 +9,71 @@ This is the Approved way of running via windows and utlizing HTTPS
This process is optional and not needed to run the app.
Please note that if you plan to utlize the scanner app you must use IIS to run as PWA apps requires ssl
## Creating the application
1. Open IIS
2. Expand the plant and select application pools
![](./img/applicationPools.png)
3. Right click and create application
![](./img/createApplicationPool.png)
4. Name is Logistics Support Tool
- Change .NET CLR verion to not managed
- leave the rest as default
![](./img/pool.png)
## Create the website
1. Expand the Sites
![](./img/defaultsite.png)
2. Right click on default site and click "Add Application..."
![](./img/addApplication.png)
3. Fill out the form like below
- For the Alias Enter LST
- Change the Application pool to Logistics Support Tool
- Change the phycical path to the path that you have the lst wrapper in, below is the example we used to install the app from the install instructions.
```bash
E:\LST\lstWrapper
```
![](./img/application.png)
## Making sure websocket is enabled
By default websocket is disbabled and we need this in order to run the app.
Open:
```bash
C:\Windows\System32\inetsrv\config\applicationHost.config
```
Search inside for the section definition:
```xml
<section name="webSocket" overrideModeDefault="Deny" />
```
Change it to:
```xml
<section name="webSocket" overrideModeDefault="Allow" />
```
Save and restart IIS:
```bash
iisreset
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -30,6 +30,19 @@ Get the latest build **From Azure**.
- [Postgres](https://www.postgresql.org/download/);
- This is the DB of choice.
## Other Items
### Firewall rules
If you will be using lst app on a tablet or scanner you will need to have 443 open
please request this from IT
- Logistics network as the source
- Alpla prod server ip as the destination
- ports to open
- 443 # to access via https://
- 3000 # This is in case you need to go direct to the app utlizing an ip:port
## Creating the app
Create a new directory where all you will host the app recommeneded
@@ -52,6 +65,7 @@ LST/
│ ├── main.js
├── frontend/
│ ├── dist # Frontend app
│ ├── public
├── lstDocs/
│ ├── build # Docs on the entire app
├── lstWrapper/
@@ -67,6 +81,11 @@ LST/
├── package-lock.json
├── README.md
├── CHANGELOG.md
├── Dockerfile
├── docker-compose.yml
├── drizzle.config.ts
├── migrations # for all the db migrations
├── LICENSE
```
## Doing the intial setup

View File

@@ -1,40 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<!-- Enable WebSockets -->
<!-- Enable WebSockets (may require unlocking at host level) -->
<webSocket enabled="true" receiveBufferLimit="4194304" pingInterval="00:01:00" />
<rewrite>
<rules>
<!-- Proxy all requests starting with /lst/ to the .NET wrapper (port 4000) -->
<rule name="Proxy to Wrapper" stopProcessing="true">
<match url="^lst/(.*)" />
<conditions>
<!-- Skip this rule if it's a WebSocket request -->
<add input="{HTTP_UPGRADE}" pattern="^WebSocket$" negate="true" />
</conditions>
<add input="{HTTP_UPGRADE}" pattern="^WebSocket$" negate="true" />
</conditions>
<action type="Rewrite" url="http://localhost:4000/{R:1}" />
<serverVariables>
<set name="HTTP_X_FORWARDED_FOR" value="{REMOTE_ADDR}" />
<set name="HTTP_X_REAL_IP" value="{REMOTE_ADDR}" />
</serverVariables>
<set name="HTTP_X_FORWARDED_FOR" value="{REMOTE_ADDR}" />
<set name="HTTP_X_REAL_IP" value="{REMOTE_ADDR}" />
</serverVariables>
</rule>
</rules>
</rewrite>
<staticContent>
<remove fileExtension=".js" />
<mimeMap fileExtension=".js" mimeType="application/javascript" />
<remove fileExtension=".mjs" />
<mimeMap fileExtension=".mjs" mimeType="application/javascript" />
<remove fileExtension=".css" />
<mimeMap fileExtension=".css" mimeType="text/css" />
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
<handlers>
<!-- Let AspNetCoreModule handle all requests -->
<remove name="WebSocketHandler" />
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\lstWrapper.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
<aspNetCore processPath="dotnet"
arguments=".\lstWrapper.dll"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
hostingModel="inprocess" />
</system.webServer>
</configuration>
</configuration>

View File

@@ -24,8 +24,8 @@
"docker": "docker compose up --build --force-recreate -d",
"commit": "cz",
"deploy": "standard-version --conventional-commits && npm run build",
"db:migrate": "npx drizzle-kit push",
"db:generate": "npx drizzle-kit generate"
"db:migrate": "npx drizzle-kit push --config=drizzle-dev.config.ts",
"db:generate": "npx drizzle-kit generate --config=drizzle-dev.config.ts"
},
"repository": {
"type": "git",

View File

@@ -11,7 +11,8 @@ param (
)
# Example string to run with the parameters in it.
# .\scripts\services.ps1 -serviceName "LST_app" -option "install" -appPath "E:\LST" -description "Logistics Support Tool in go" -command "E:\LST\app\lst_app.exe"
# .\scripts\services.ps1 -serviceName "LST_ctl" -option "install" -appPath "E:\LST" -description "Logistics Support Tool controller" -command "E:\LST\controller\lst_app.exe"
# .\scripts\services.ps1 -serviceName "LST_app" -option "install" -appPath "E:\LST" -description "Logistics Support Tool" -command "run start"
$nssmPath = $AppPath + "\nssm.exe"
$npmPath = "C:\Program Files\nodejs\npm.cmd" # Path to npm.cmd