Add hosted login persistence

This commit is contained in:
2026-07-15 15:33:47 -05:00
parent 02ffa1dfc4
commit e62ec49c59
9 changed files with 508 additions and 38 deletions
+11 -1
View File
@@ -2,7 +2,9 @@ param(
[string]$HostName = "christunscripted",
[string]$RemoteRoot = "/home/jbird/libre-study",
[string]$RemoteBibleDataRoot = "/home/jbird/libre-bible-data/packages/json",
[int]$Port = 9174
[int]$Port = 9174,
[string]$BootstrapUser = $env:LIBRESTUDY_BOOTSTRAP_USER,
[string]$BootstrapPassword = $env:LIBRESTUDY_BOOTSTRAP_PASSWORD
)
$ErrorActionPreference = "Stop"
@@ -12,6 +14,10 @@ function ConvertTo-WslPath([string]$Path) {
return (wsl wslpath -a "$resolved").Trim()
}
function ConvertTo-BashSingleQuoted([string]$Value) {
return "'" + $Value.Replace("'", "'\''") + "'"
}
$repoRoot = Split-Path -Parent $PSScriptRoot
$dataRepo = Resolve-Path (Join-Path $repoRoot "..\libre-bible-data")
$repoRootWsl = ConvertTo-WslPath $repoRoot
@@ -41,6 +47,8 @@ $deployInfo = @{
$deployInfoPath = Join-Path $env:TEMP "libre-study-deploy-info.json"
Set-Content -Path $deployInfoPath -Value $deployInfo -NoNewline
$deployInfoPathWsl = ConvertTo-WslPath $deployInfoPath
$bootstrapUserQuoted = ConvertTo-BashSingleQuoted $BootstrapUser
$bootstrapPasswordQuoted = ConvertTo-BashSingleQuoted $BootstrapPassword
wsl ssh $HostName "mkdir -p '$RemoteRoot/app' '$RemoteRoot/server' '$RemoteRoot/state' '$RemoteBibleDataRoot'"
if ($LASTEXITCODE -ne 0) { throw "Remote directory preparation failed." }
@@ -55,6 +63,8 @@ if ($LASTEXITCODE -ne 0) { throw "LibreBible rsync failed." }
$pm2Command = @"
cd '$RemoteRoot' &&
export LIBRESTUDY_BOOTSTRAP_USER=$bootstrapUserQuoted &&
export LIBRESTUDY_BOOTSTRAP_PASSWORD=$bootstrapPasswordQuoted &&
if pm2 describe libre-study-web >/dev/null 2>&1; then
PORT=$Port PUBLIC_DIR='$RemoteRoot/app' LIBREBIBLE_DATA_DIR='$RemoteBibleDataRoot' STATE_DIR='$RemoteRoot/state' DB_PATH='$RemoteRoot/state/libre-study-web.sqlite3' DEPLOY_INFO_PATH='$RemoteRoot/deploy-info.json' pm2 restart libre-study-web --update-env;
else