- The queue keeps a done job by when it became done (ready_at), not by its last write: renaming, keeping or moving an old file, or the GC's expiry warning, no longer brings it back as just finished. - GC expiry and eviction re-read each file under the asset→job locks the user routes take, and commit one file at a time: a delete, a re-download or a keep made while the GC runs is honoured, never a second release that frees a file another user still holds. - A file records the origin it was placed under (download_jobs.source_key, migration 0105): an edit whose parent expired still goes back to its folder, not to Uploads. - A folder a file is being put in is held (FOR SHARE) until it lands; a delete of it waits and takes that file home too, instead of failing on the foreign key. - The hash route reads at most two files at once (429 past that) and holds no connection meanwhile. - 0104's backfill dates old files by their request date only: no notice prod wrote names its job. - The old DOWNLOAD_ROOT still finds the files; a files root that is not a mounted volume stops the worker and is logged by the API; the volume-copy recipe looks the project-prefixed names up. - Stale comments about the /downloads mount and the Downloads page.
57 lines
2.6 KiB
PowerShell
57 lines
2.6 KiB
PowerShell
# Siftlode self-host installer (Windows / PowerShell). Generates secrets into .env, starts the
|
|
# stack from the prebuilt image, and prints the first-run setup-wizard URL. Re-running is safe: an
|
|
# existing .env is left untouched. Requires Docker Desktop (with the compose plugin).
|
|
$ErrorActionPreference = "Stop"
|
|
$Port = if ($env:HTTP_PORT) { $env:HTTP_PORT } else { "8080" }
|
|
|
|
function New-RandBytes([int]$n) {
|
|
$b = New-Object byte[] $n
|
|
$rng = [System.Security.Cryptography.RandomNumberGenerator]::Create()
|
|
$rng.GetBytes($b)
|
|
return $b
|
|
}
|
|
|
|
if (Test-Path .env) {
|
|
Write-Host ".env already exists — leaving it untouched (delete it to re-generate)."
|
|
} else {
|
|
$url = Read-Host "Public URL where this instance will be reached [http://localhost:$Port]"
|
|
if ([string]::IsNullOrWhiteSpace($url)) { $url = "http://localhost:$Port" }
|
|
$url = $url.TrimEnd('/')
|
|
|
|
$secretKey = (New-RandBytes 32 | ForEach-Object { $_.ToString("x2") }) -join ""
|
|
$fernet = [Convert]::ToBase64String((New-RandBytes 32)).Replace('+', '-').Replace('/', '_')
|
|
$pgPass = (New-RandBytes 16 | ForEach-Object { $_.ToString("x2") }) -join ""
|
|
|
|
@"
|
|
# Generated by install.ps1 — keep secret, never commit. Re-run after deleting to reset.
|
|
POSTGRES_PASSWORD=$pgPass
|
|
SECRET_KEY=$secretKey
|
|
TOKEN_ENCRYPTION_KEY=$fernet
|
|
OAUTH_REDIRECT_URL=$url/auth/callback
|
|
|
|
# Optional: keep the Files library in a host folder (e.g. one your Plex server reads) instead
|
|
# of a Docker volume. Must be writable by uid 1000 (chown -R 1000:1000 <dir>).
|
|
# FILES_HOST_PATH=/mnt/media/youtube
|
|
"@ | Set-Content -Path .env -Encoding ascii
|
|
Write-Host "Wrote .env (secrets generated)."
|
|
}
|
|
|
|
Write-Host "Pulling and starting Siftlode..."
|
|
docker compose -f docker-compose.selfhost.yml pull
|
|
docker compose -f docker-compose.selfhost.yml up -d
|
|
|
|
Write-Host "Waiting for the app to come up..."
|
|
foreach ($i in 1..30) {
|
|
try { Invoke-WebRequest "http://localhost:$Port/healthz" -UseBasicParsing -TimeoutSec 3 | Out-Null; break } catch { Start-Sleep 2 }
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "==================================================================="
|
|
Write-Host " Siftlode is up. Open the first-run setup wizard at:"
|
|
$logs = docker compose -f docker-compose.selfhost.yml logs api 2>$null
|
|
$match = ($logs | Select-String -Pattern "https?://\S*setup\?token=[A-Za-z0-9_-]+" -AllMatches |
|
|
ForEach-Object { $_.Matches.Value } | Select-Object -Last 1)
|
|
if ($match) { Write-Host " $match" }
|
|
else { Write-Host " (not found yet — run: docker compose -f docker-compose.selfhost.yml logs api | Select-String 'setup?token=')" }
|
|
Write-Host "==================================================================="
|