Files
siftlode/install.ps1
T
peter bf99444ded feat(files): every file sits in a library folder, and keeps its own expiry
The Files library starts here. A user's every download, clip and upload now
lands in a source folder made per origin (YouTube, Plex clips, uploads, one per
other site), decided once in downloads/folders.py at every place a job is made.
How long a file stays moves from the shared asset to the user's job: stamped
from its folder when it is done, never for a file the user keeps. The GC warns
each user once, then takes the expired file out of their library; the cache cap
never evicts a kept file, and an evicted one leaves every holder's library.

The media mount is /files now (FILES_ROOT, FILES_HOST_PATH, volume
siftlode_files); docs/self-hosting.md says how to carry an old volume over.
Migration 0102 places every existing job and carries each done file's expiry
over from its asset.

safe_abs_path takes a missing path and answers None, which drops one baselined
type error.
2026-10-11 03:30:34 +02:00

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: store Download Center media 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 "==================================================================="