feat(lst): removed v1 from the update
This commit is contained in:
@@ -146,7 +146,7 @@ $plantFunness = {
|
||||
############################################################################
|
||||
Write-Host "Stopping the services to do the updates, pkgs and db changes."
|
||||
|
||||
Write-Host "Stopping services to update"
|
||||
#Write-Host "Stopping services to update"
|
||||
$serviceGateway = "LST-Gateway$(if ($token -eq "usiow2") { "_2" })"
|
||||
$serviceAuth = "LST-Auth$(if ($token -eq "usiow2") { "_2" })"
|
||||
$serviceSystem = "LST-System$(if ($token -eq "usiow2") { "_2" })"
|
||||
@@ -155,30 +155,30 @@ $plantFunness = {
|
||||
$serviceOcme = "LST-Ocme$(if ($token -eq "usiow2") { "_2" })"
|
||||
$serviceLstV2 = "LSTV2$(if ($token -eq "usiow2") { "_2" })"
|
||||
|
||||
if($token -eq "usday1"){
|
||||
Write-Host "Stopping $($serviceOcme)"
|
||||
Stop-Service -DisplayName $serviceOcme -Force
|
||||
}
|
||||
# if($token -eq "usday1"){
|
||||
# Write-Host "Stopping $($serviceOcme)"
|
||||
# Stop-Service -DisplayName $serviceOcme -Force
|
||||
# }
|
||||
|
||||
Write-Host "Stopping $($serviceGateway)"
|
||||
Stop-Service -DisplayName $serviceGateway -Force
|
||||
Start-Sleep -Seconds 1
|
||||
# Write-Host "Stopping $($serviceGateway)"
|
||||
# Stop-Service -DisplayName $serviceGateway -Force
|
||||
# Start-Sleep -Seconds 1
|
||||
|
||||
Write-Host "Stopping $($serviceAuth)"
|
||||
Stop-Service -DisplayName $serviceAuth -Force
|
||||
Start-Sleep -Seconds 1
|
||||
# Write-Host "Stopping $($serviceAuth)"
|
||||
# Stop-Service -DisplayName $serviceAuth -Force
|
||||
# Start-Sleep -Seconds 1
|
||||
|
||||
Write-Host "Stopping $($serviceSystem)"
|
||||
Stop-Service -DisplayName $serviceSystem -Force
|
||||
Start-Sleep -Seconds 1
|
||||
# Write-Host "Stopping $($serviceSystem)"
|
||||
# Stop-Service -DisplayName $serviceSystem -Force
|
||||
# Start-Sleep -Seconds 1
|
||||
|
||||
Write-Host "Stopping $($serviceApp)"
|
||||
Stop-Service -DisplayName $serviceApp -Force
|
||||
Start-Sleep -Seconds 1
|
||||
# Write-Host "Stopping $($serviceApp)"
|
||||
# Stop-Service -DisplayName $serviceApp -Force
|
||||
# Start-Sleep -Seconds 1
|
||||
|
||||
Write-Host "Stopping $($serviceFrontEnd)"
|
||||
Stop-Service -DisplayName $serviceFrontEnd -Force
|
||||
Start-Sleep -Seconds 1
|
||||
# Write-Host "Stopping $($serviceFrontEnd)"
|
||||
# Stop-Service -DisplayName $serviceFrontEnd -Force
|
||||
# Start-Sleep -Seconds 1
|
||||
|
||||
Write-Host "Stopping $($serviceLstV2)"
|
||||
Stop-Service -DisplayName $serviceLstV2 -Force
|
||||
@@ -194,11 +194,16 @@ $plantFunness = {
|
||||
Write-Host "Removing services that are no longer used."
|
||||
& $nssmPath remove "LogisticsSupportTool" confirm
|
||||
& $nssmPath remove $serviceAuth confirm
|
||||
& $nssmPath remove $serviceGateway confirm
|
||||
& $nssmPath remove $serviceSystem confirm
|
||||
& $nssmPath remove $serviceApp confirm
|
||||
& $nssmPath remove $serviceFrontEnd confirm
|
||||
& $nssmPath remove $serviceOcme confirm
|
||||
# & $nssmPath remove $serviceGateway confirm
|
||||
# if($token -eq "usday1"){
|
||||
# & $nssmPath remove $serviceOcme confirm
|
||||
# }
|
||||
Start-Sleep -Seconds 5
|
||||
Start-Sleep -Seconds 2
|
||||
|
||||
$service = Get-Service -Name $serviceLstV2 -ErrorAction SilentlyContinue
|
||||
|
||||
@@ -233,188 +238,188 @@ $plantFunness = {
|
||||
# Frontend env
|
||||
###########################################################
|
||||
|
||||
Write-Host "Creating the env file in the front end"
|
||||
$envContentTemplatef = @"
|
||||
NEXTAUTH_SECRET= "12348fssad5sdg2f2354afvfw34"
|
||||
NEXTAUTH_URL_INTERNAL= "http://localhost:3000"
|
||||
NEXTAUTH_URL="{url}"
|
||||
API_KEY= "E3ECD3619A943B98C6F33E3322362"
|
||||
"@
|
||||
# Write-Host "Creating the env file in the front end"
|
||||
# $envContentTemplatef = @"
|
||||
# NEXTAUTH_SECRET= "12348fssad5sdg2f2354afvfw34"
|
||||
# NEXTAUTH_URL_INTERNAL= "http://localhost:3000"
|
||||
# NEXTAUTH_URL="{url}"
|
||||
# API_KEY= "E3ECD3619A943B98C6F33E3322362"
|
||||
# "@
|
||||
|
||||
try {
|
||||
$url = "http://$($token)vms006:3000"
|
||||
# try {
|
||||
# $url = "http://$($token)vms006:3000"
|
||||
|
||||
if ($token -eq "usiow2") {
|
||||
$url = "http://usiow1vms006:3001"
|
||||
}
|
||||
# if ($token -eq "usiow2") {
|
||||
# $url = "http://usiow1vms006:3001"
|
||||
# }
|
||||
|
||||
if ($token -in @("test1", "test2", "test3")) {
|
||||
$url = "http://usmcd1vms036:3000"
|
||||
}
|
||||
# if ($token -in @("test1", "test2", "test3")) {
|
||||
# $url = "http://usmcd1vms036:3000"
|
||||
# }
|
||||
|
||||
# Replace {url} with the actual $url
|
||||
$envContentf = $envContentTemplatef -replace "{url}", $url
|
||||
# # Replace {url} with the actual $url
|
||||
# $envContentf = $envContentTemplatef -replace "{url}", $url
|
||||
|
||||
# Define the path where the .env file should be created
|
||||
$envFilePathf = $obslst + "\apps\frontend\.env"
|
||||
Write-Host "Final URL: $url"
|
||||
# Write the content to the .env file
|
||||
$envContentf | Out-File -FilePath $envFilePathf -Encoding UTF8 -Force
|
||||
# # Define the path where the .env file should be created
|
||||
# $envFilePathf = $obslst + "\apps\frontend\.env"
|
||||
# Write-Host "Final URL: $url"
|
||||
# # Write the content to the .env file
|
||||
# $envContentf | Out-File -FilePath $envFilePathf -Encoding UTF8 -Force
|
||||
|
||||
# Optional: Verify the file was created
|
||||
if (Test-Path $envFilePathf) {
|
||||
Write-Host "`.env` file created successfully on $env:COMPUTERNAME at $envFilePathf"
|
||||
} else {
|
||||
Write-Host "Failed to create `.env` file on $env:COMPUTERNAME"
|
||||
}
|
||||
# # Optional: Verify the file was created
|
||||
# if (Test-Path $envFilePathf) {
|
||||
# Write-Host "`.env` file created successfully on $env:COMPUTERNAME at $envFilePathf"
|
||||
# } else {
|
||||
# Write-Host "Failed to create `.env` file on $env:COMPUTERNAME"
|
||||
# }
|
||||
|
||||
} catch {
|
||||
Write-Host "Error: Failed to create `.env` file on $server - $_"
|
||||
}
|
||||
# } catch {
|
||||
# Write-Host "Error: Failed to create `.env` file on $server - $_"
|
||||
# }
|
||||
|
||||
###########################################################
|
||||
# DB env
|
||||
###########################################################
|
||||
|
||||
Write-Host "Creating the env file in the front end"
|
||||
$envContentTemplateb = @"
|
||||
DATABASE_URL="file:E:\LST\db\{dbLink}.db"
|
||||
"@
|
||||
# Write-Host "Creating the env file in the front end"
|
||||
# $envContentTemplateb = @"
|
||||
# DATABASE_URL="file:E:\LST\db\{dbLink}.db"
|
||||
# "@
|
||||
|
||||
try {
|
||||
# try {
|
||||
|
||||
$dbLink = "lstBackendDB"
|
||||
# $dbLink = "lstBackendDB"
|
||||
|
||||
if ($token -eq "usiow2") {
|
||||
$dbLink = "lstBackendDB_2"
|
||||
}
|
||||
# if ($token -eq "usiow2") {
|
||||
# $dbLink = "lstBackendDB_2"
|
||||
# }
|
||||
|
||||
if ($token -in @("test1", "test2", "test3")) {
|
||||
$dbLink = "lstBackendDB"
|
||||
}
|
||||
# if ($token -in @("test1", "test2", "test3")) {
|
||||
# $dbLink = "lstBackendDB"
|
||||
# }
|
||||
|
||||
# Replace {url} with the actual $url
|
||||
$envContentb = $envContentTemplateb -replace "{dbLink}", $dbLink
|
||||
# # Replace {url} with the actual $url
|
||||
# $envContentb = $envContentTemplateb -replace "{dbLink}", $dbLink
|
||||
|
||||
# Define the path where the .env file should be created
|
||||
$envFilePathb = $obslst + "\packages\database\.env"
|
||||
# # Define the path where the .env file should be created
|
||||
# $envFilePathb = $obslst + "\packages\database\.env"
|
||||
|
||||
# Write the content to the .env file
|
||||
$envContentb | Out-File -FilePath $envFilePathb -Encoding UTF8 -Force
|
||||
# # Write the content to the .env file
|
||||
# $envContentb | Out-File -FilePath $envFilePathb -Encoding UTF8 -Force
|
||||
|
||||
# Optional: Verify the file was created
|
||||
if (Test-Path $envFilePathb) {
|
||||
Write-Host "`.env` file created successfully on $env:COMPUTERNAME at $envFilePathb"
|
||||
} else {
|
||||
Write-Host "Failed to create `.env` file on $env:COMPUTERNAME"
|
||||
}
|
||||
# # Optional: Verify the file was created
|
||||
# if (Test-Path $envFilePathb) {
|
||||
# Write-Host "`.env` file created successfully on $env:COMPUTERNAME at $envFilePathb"
|
||||
# } else {
|
||||
# Write-Host "Failed to create `.env` file on $env:COMPUTERNAME"
|
||||
# }
|
||||
|
||||
} catch {
|
||||
Write-Host "Error: Failed to create `.env` file on $server - $_"
|
||||
}
|
||||
# } catch {
|
||||
# Write-Host "Error: Failed to create `.env` file on $server - $_"
|
||||
# }
|
||||
|
||||
###########################################################
|
||||
# backend env
|
||||
###########################################################
|
||||
|
||||
Write-Host "Creating the env file in the front end"
|
||||
$envContentTemplated = @"
|
||||
# Server env
|
||||
NODE_ENV = production
|
||||
# server apiKey
|
||||
API_KEY = E3ECD3619A943B98C6F33E3322362
|
||||
# Prisma DB link
|
||||
DATABASE_URL="file:E:\LST\db\{dbLink}.db"
|
||||
# if you still want the db in the same folder as the server install you need to do like the example below else use the relevent link
|
||||
DATEBASE_LOC="E:\LST\db\{dbLink}.db"
|
||||
DATABASE_BACKUP_LOC="E:\LST\backups"
|
||||
# Server port
|
||||
GATEWAY_PORT={gatewayport}
|
||||
AUTH_PORT=4100
|
||||
SYSTEM_APP_PORT={systemport}
|
||||
OCME_PORT={ocme}
|
||||
# Write-Host "Creating the env file in the front end"
|
||||
# $envContentTemplated = @"
|
||||
# # Server env
|
||||
# NODE_ENV = production
|
||||
# # server apiKey
|
||||
# API_KEY = E3ECD3619A943B98C6F33E3322362
|
||||
# # Prisma DB link
|
||||
# DATABASE_URL="file:E:\LST\db\{dbLink}.db"
|
||||
# # if you still want the db in the same folder as the server install you need to do like the example below else use the relevent link
|
||||
# DATEBASE_LOC="E:\LST\db\{dbLink}.db"
|
||||
# DATABASE_BACKUP_LOC="E:\LST\backups"
|
||||
# # Server port
|
||||
# GATEWAY_PORT={gatewayport}
|
||||
# AUTH_PORT=4100
|
||||
# SYSTEM_APP_PORT={systemport}
|
||||
# OCME_PORT={ocme}
|
||||
|
||||
# This should me removed once we have the entire app broke out to its own apps
|
||||
OLD_APP_PORT={appPort}
|
||||
# # This should me removed once we have the entire app broke out to its own apps
|
||||
# OLD_APP_PORT={appPort}
|
||||
|
||||
# Logging
|
||||
LOG_LEVEL = info
|
||||
LOG_LOC ="E:\\LST\\logs"
|
||||
# # Logging
|
||||
# LOG_LEVEL = info
|
||||
# LOG_LOC ="E:\\LST\\logs"
|
||||
|
||||
# authentication
|
||||
SALTING = 12
|
||||
SECRET = E3ECD3619A943B98C6F33E3322362
|
||||
JWT_SECRET = 12348fssad5sdg2f2354afvfw34
|
||||
JWT_EXPIRES_TIME = 1h
|
||||
# # authentication
|
||||
# SALTING = 12
|
||||
# SECRET = E3ECD3619A943B98C6F33E3322362
|
||||
# JWT_SECRET = 12348fssad5sdg2f2354afvfw34
|
||||
# JWT_EXPIRES_TIME = 1h
|
||||
|
||||
# cookie time is in min please take this into consideration when creating all the times
|
||||
COOKIE_EXPIRES_TIME = 60
|
||||
# # cookie time is in min please take this into consideration when creating all the times
|
||||
# COOKIE_EXPIRES_TIME = 60
|
||||
|
||||
# password token reset in mintues
|
||||
RESET_TOKEN = 330
|
||||
"@
|
||||
# # password token reset in mintues
|
||||
# RESET_TOKEN = 330
|
||||
# "@
|
||||
|
||||
try {
|
||||
# try {
|
||||
|
||||
$dbLink = "lstBackendDB"
|
||||
$gatewayport = "4400"
|
||||
$systemport = "4200"
|
||||
$ocmeport = "4300"
|
||||
$appport = "4400"
|
||||
# $dbLink = "lstBackendDB"
|
||||
# $gatewayport = "4400"
|
||||
# $systemport = "4200"
|
||||
# $ocmeport = "4300"
|
||||
# $appport = "4400"
|
||||
|
||||
if ($token -eq "usiow2") {
|
||||
$dbLink = "lstBackendDB_2"
|
||||
$gatewayport = "4401"
|
||||
$systemport = "4201"
|
||||
$ocmeport = "4301"
|
||||
$appport = "4401"
|
||||
}
|
||||
# if ($token -eq "usiow2") {
|
||||
# $dbLink = "lstBackendDB_2"
|
||||
# $gatewayport = "4401"
|
||||
# $systemport = "4201"
|
||||
# $ocmeport = "4301"
|
||||
# $appport = "4401"
|
||||
# }
|
||||
|
||||
if ($token -in @("test1", "test2", "test3")) {
|
||||
$dbLink = "lstBackendDB"
|
||||
}
|
||||
# if ($token -in @("test1", "test2", "test3")) {
|
||||
# $dbLink = "lstBackendDB"
|
||||
# }
|
||||
|
||||
#
|
||||
$port1 = $envContentTemplated -replace "{gatewayport}", $gatewayport
|
||||
$port2 = $port1 -replace "{systemport}", $systemport
|
||||
$port3 = $port2 -replace "{ocme}", $ocmeport
|
||||
$port4 = $port3 -replace "{appPort}", $appport
|
||||
$envContentd = $port4 -replace "{dbLink}", $dbLink
|
||||
# #
|
||||
# $port1 = $envContentTemplated -replace "{gatewayport}", $gatewayport
|
||||
# $port2 = $port1 -replace "{systemport}", $systemport
|
||||
# $port3 = $port2 -replace "{ocme}", $ocmeport
|
||||
# $port4 = $port3 -replace "{appPort}", $appport
|
||||
# $envContentd = $port4 -replace "{dbLink}", $dbLink
|
||||
|
||||
|
||||
# Define the path where the .env file should be created
|
||||
$envFilePathd = $obslst + "\.env"
|
||||
# # Define the path where the .env file should be created
|
||||
# $envFilePathd = $obslst + "\.env"
|
||||
|
||||
# Write the content to the .env file
|
||||
$envContentd | Out-File -FilePath $envFilePathd -Encoding UTF8 -Force
|
||||
# # Write the content to the .env file
|
||||
# $envContentd | Out-File -FilePath $envFilePathd -Encoding UTF8 -Force
|
||||
|
||||
# Optional: Verify the file was created
|
||||
if (Test-Path $envFilePathd) {
|
||||
Write-Host "`.env` file created successfully on $env:COMPUTERNAME at $envFilePathd"
|
||||
} else {
|
||||
Write-Host "Failed to create `.env` file on $env:COMPUTERNAME"
|
||||
}
|
||||
# # Optional: Verify the file was created
|
||||
# if (Test-Path $envFilePathd) {
|
||||
# Write-Host "`.env` file created successfully on $env:COMPUTERNAME at $envFilePathd"
|
||||
# } else {
|
||||
# Write-Host "Failed to create `.env` file on $env:COMPUTERNAME"
|
||||
# }
|
||||
|
||||
} catch {
|
||||
Write-Host "Error: Failed to create `.env` file on $server - $_"
|
||||
}
|
||||
# } catch {
|
||||
# Write-Host "Error: Failed to create `.env` file on $server - $_"
|
||||
# }
|
||||
|
||||
|
||||
Write-Host "Running install on obs server."
|
||||
Set-Location $obslst
|
||||
npm run newinstall # --omit=dev
|
||||
Write-Host "Update the frontend"
|
||||
npm run install:front
|
||||
npm run install:ui
|
||||
npm run install:db
|
||||
# Write-Host "Running install on obs server."
|
||||
# Set-Location $obslst
|
||||
# npm run newinstall # --omit=dev
|
||||
# Write-Host "Update the frontend"
|
||||
# npm run install:front
|
||||
# npm run install:ui
|
||||
# npm run install:db
|
||||
|
||||
Write-Host "Running db updates"
|
||||
npm run db:migrate
|
||||
Start-Sleep -Seconds 1
|
||||
npm run db:gen
|
||||
Start-Sleep -Seconds 1
|
||||
Write-Host "incase a new default setting was added we want to add it in."
|
||||
npm run db:init
|
||||
# Write-Host "Running db updates"
|
||||
# npm run db:migrate
|
||||
# Start-Sleep -Seconds 1
|
||||
# npm run db:gen
|
||||
# Start-Sleep -Seconds 1
|
||||
# Write-Host "incase a new default setting was added we want to add it in."
|
||||
# npm run db:init
|
||||
|
||||
###########################################################
|
||||
# Starting the services back up.
|
||||
|
||||
Reference in New Issue
Block a user