Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download scripts/setup.ps1 from DanielKretschmer/lighting-mvp: direct link, hf CLI and curl.
- Browser
- Download file 2.85 kB
-
https://huggingface.co/spaces/DanielKretschmer/lighting-mvp/resolve/main/scripts/setup.ps1
- Command line
-
hf download hf://spaces/DanielKretschmer/lighting-mvp/scripts/setup.ps1
-
curl -L -o setup.ps1 https://huggingface.co/spaces/DanielKretschmer/lighting-mvp/resolve/main/scripts/setup.ps1
2.85 kB
| # Lighting MVP one-time setup script (PowerShell, Windows equivalent of setup.sh). | |
| # | |
| # Generates a .env file with the minimum required environment variables. | |
| # Read HANDOVER.md before running this; it explains what the values mean. | |
| # | |
| # Usage: | |
| # .\scripts\setup.ps1 # writes .env if missing | |
| # .\scripts\setup.ps1 -Force # overwrite existing .env (regenerates password) | |
| # .\scripts\setup.ps1 -Print # print to stdout, don't write | |
| param( | |
| [switch]$Force, | |
| [switch]$Print | |
| ) | |
| $ErrorActionPreference = "Stop" | |
| $RepoRoot = Split-Path -Parent $PSScriptRoot | |
| $EnvFile = Join-Path $RepoRoot ".env" | |
| if ((Test-Path $EnvFile) -and -not $Force -and -not $Print) { | |
| Write-Host "$EnvFile already exists. Pass -Force to overwrite, or -Print to dump a fresh template to stdout." -ForegroundColor Yellow | |
| exit 1 | |
| } | |
| # Strong random password using .NET RNG, base64-encoded, sanitised to URL-safe characters. | |
| $bytes = New-Object byte[] 24 | |
| $rng = [System.Security.Cryptography.RandomNumberGenerator]::Create() | |
| $rng.GetBytes($bytes) | |
| $rng.Dispose() | |
| $AccessPassword = ([Convert]::ToBase64String($bytes) -replace '[/+=]', '').Substring(0, 24) | |
| $Timestamp = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ") | |
| $EnvContents = @" | |
| # Lighting MVP environment configuration. | |
| # Generated by scripts/setup.ps1 on $Timestamp. | |
| # Re-run with -Force to regenerate the password. | |
| # | |
| # REQUIRED | |
| # -------- | |
| # Shared password protecting the UI and all API endpoints. Anyone with | |
| # this password can use the tool, so treat it like a service password: | |
| # share over a secure channel, rotate if leaked. | |
| LIGHTING_MVP_ACCESS_GATE_PASSWORD=$AccessPassword | |
| # OPTIONAL | |
| # -------- | |
| # Postgres connection string. Leave unset to use a local SQLite DB | |
| # (lighting_mvp.db). Set to a Neon / RDS / hosted Postgres URL for any | |
| # shared or persistent deployment. | |
| # LIGHTING_MVP_DATABASE_URL=postgresql://user:pass@host:5432/dbname | |
| # Where transient pipeline files are staged. Default is /tmp (ephemeral). | |
| # Mount a persistent volume and point this at it for prod. | |
| # LIGHTING_MVP_STORAGE_ROOT=/data | |
| # Which LLM provider to use. Can also be changed live from the gear icon. | |
| # LIGHTING_MVP_AGENT_PROVIDER=anthropic | |
| "@ | |
| if ($Print) { | |
| Write-Output $EnvContents | |
| exit 0 | |
| } | |
| Set-Content -Path $EnvFile -Value $EnvContents -Encoding UTF8 -NoNewline | |
| Write-Host "Wrote $EnvFile." | |
| Write-Host "" | |
| Write-Host "Next steps:" | |
| Write-Host " 1. docker build -t lighting-mvp ." | |
| Write-Host " 2. docker run --rm -p 7860:7860 --env-file .env lighting-mvp" | |
| Write-Host " 3. Open http://localhost:7860 and log in with the password in .env" | |
| Write-Host " 4. Click the gear icon to complete the Claude or Codex login flow." | |
| Write-Host "" | |
| Write-Host "Or just run .\run.ps1 from the repo root to do all of that in one step." | |
| Write-Host "" | |
| Write-Host "Full walkthrough: HANDOVER.md" | |