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