Harden hosted deploy script
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## 0.1.24 - 2026-07-12
|
||||
|
||||
- Fixed the hosted deploy script to use a separate `dist-hosted` output, user-writable remote runtime paths, reliable WSL path conversion, explicit rsync/PM2 failure checks, and rsynced deploy metadata.
|
||||
|
||||
## 0.1.23 - 2026-07-12
|
||||
|
||||
- Added the hosted web build path for the private online alpha.
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "libre-study",
|
||||
"version": "0.1.23",
|
||||
"version": "0.1.24",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "libre-study",
|
||||
"version": "0.1.23",
|
||||
"version": "0.1.24",
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2.11.1",
|
||||
"react": "^19.2.7",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "libre-study",
|
||||
"private": true,
|
||||
"version": "0.1.23",
|
||||
"version": "0.1.24",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite --host 127.0.0.1",
|
||||
|
||||
+22
-7
@@ -1,16 +1,21 @@
|
||||
param(
|
||||
[string]$HostName = "christunscripted",
|
||||
[string]$RemoteRoot = "/sites/libre-study",
|
||||
[string]$RemoteBibleDataRoot = "/sites/libre-bible-data/packages/json",
|
||||
[string]$RemoteRoot = "/home/jbird/libre-study",
|
||||
[string]$RemoteBibleDataRoot = "/home/jbird/libre-bible-data/packages/json",
|
||||
[int]$Port = 9174
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function ConvertTo-WslPath([string]$Path) {
|
||||
$resolved = (Resolve-Path $Path).Path.Replace("\", "/")
|
||||
return (wsl wslpath -a "$resolved").Trim()
|
||||
}
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$dataRepo = Resolve-Path (Join-Path $repoRoot "..\libre-bible-data")
|
||||
$repoRootWsl = (wsl wslpath -a "$repoRoot").Trim()
|
||||
$dataRepoWsl = (wsl wslpath -a "$dataRepo").Trim()
|
||||
$repoRootWsl = ConvertTo-WslPath $repoRoot
|
||||
$dataRepoWsl = ConvertTo-WslPath $dataRepo
|
||||
$commit = (git -C $repoRoot rev-parse HEAD).Trim()
|
||||
$deployedAt = (Get-Date).ToUniversalTime().ToString("o")
|
||||
|
||||
@@ -33,12 +38,20 @@ $deployInfo = @{
|
||||
deployedAt = $deployedAt
|
||||
source = "libre-study"
|
||||
} | ConvertTo-Json -Compress
|
||||
$deployInfoPath = Join-Path $env:TEMP "libre-study-deploy-info.json"
|
||||
Set-Content -Path $deployInfoPath -Value $deployInfo -NoNewline
|
||||
$deployInfoPathWsl = ConvertTo-WslPath $deployInfoPath
|
||||
|
||||
$escapedDeployInfo = $deployInfo.Replace("'", "'\''")
|
||||
wsl ssh $HostName "mkdir -p '$RemoteRoot/app' '$RemoteRoot/server' '$RemoteRoot/state' '$RemoteBibleDataRoot' && printf '%s' '$escapedDeployInfo' > '$RemoteRoot/deploy-info.json'"
|
||||
wsl ssh $HostName "mkdir -p '$RemoteRoot/app' '$RemoteRoot/server' '$RemoteRoot/state' '$RemoteBibleDataRoot'"
|
||||
if ($LASTEXITCODE -ne 0) { throw "Remote directory preparation failed." }
|
||||
wsl rsync -az "$deployInfoPathWsl" "${HostName}:$RemoteRoot/deploy-info.json"
|
||||
if ($LASTEXITCODE -ne 0) { throw "Deploy info rsync failed." }
|
||||
wsl rsync -az --delete "$repoRootWsl/dist-hosted/" "${HostName}:$RemoteRoot/app/"
|
||||
if ($LASTEXITCODE -ne 0) { throw "App rsync failed." }
|
||||
wsl rsync -az --delete "$repoRootWsl/server/" "${HostName}:$RemoteRoot/server/"
|
||||
if ($LASTEXITCODE -ne 0) { throw "Server rsync failed." }
|
||||
wsl rsync -az --delete "$dataRepoWsl/packages/json/" "${HostName}:$RemoteBibleDataRoot/"
|
||||
if ($LASTEXITCODE -ne 0) { throw "LibreBible rsync failed." }
|
||||
|
||||
$pm2Command = @"
|
||||
cd '$RemoteRoot' &&
|
||||
@@ -51,4 +64,6 @@ pm2 save
|
||||
"@
|
||||
|
||||
wsl ssh $HostName $pm2Command
|
||||
Write-Output "Deployed Libre Study web commit $commit to $HostName:$RemoteRoot on port $Port."
|
||||
if ($LASTEXITCODE -ne 0) { throw "PM2 start/restart failed." }
|
||||
Remove-Item $deployInfoPath -Force -ErrorAction SilentlyContinue
|
||||
Write-Output "Deployed Libre Study web commit $commit to ${HostName}:$RemoteRoot on port $Port."
|
||||
|
||||
Generated
+1
-1
@@ -77,7 +77,7 @@ checksum = "2a4385e2e34eb35d6b3efe798b9eb88096925d87726c0798709bf56d9ed84af3"
|
||||
|
||||
[[package]]
|
||||
name = "app"
|
||||
version = "0.1.23"
|
||||
version = "0.1.24"
|
||||
dependencies = [
|
||||
"log",
|
||||
"rusqlite",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "app"
|
||||
version = "0.1.23"
|
||||
version = "0.1.24"
|
||||
description = "A Tauri App"
|
||||
authors = ["you"]
|
||||
license = ""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "Libre Study",
|
||||
"version": "0.1.23",
|
||||
"version": "0.1.24",
|
||||
"identifier": "org.librestudy.desktop",
|
||||
"build": {
|
||||
"frontendDist": "../dist",
|
||||
|
||||
Reference in New Issue
Block a user