feat(installer): install WSL with Nod on Windows and offer a restart (#1720)
This commit is contained in:
1 parent
970e015748
commit
770add6754
6 files changed
+64
-15
No files matched your search
@@ -49,12 +49,12 @@
|
||||
}
|
||||
}
|
||||
$assets = "$releases/download/$tag/"
|
||||
$arguments = '/S'
|
||||
$arguments = '/S /WSL'
|
||||
$existing = (Get-ItemProperty -Path 'HKCU:\Software\nod' -ErrorAction SilentlyContinue).InstallDir
|
||||
$target = Join-Path $env:LOCALAPPDATA 'Programs\nod'
|
||||
if ($existing) {
|
||||
$target = $existing
|
||||
$arguments = "/S /D=$existing"
|
||||
$arguments = "/S /WSL /D=$existing"
|
||||
}
|
||||
$installedPackage = Join-Path $target 'resources\app\package.json'
|
||||
if (Test-Path -LiteralPath $installedPackage -PathType Leaf) {
|
||||
@@ -84,9 +84,10 @@
|
||||
if ($signature.Status -ne 'Valid' -or -not $certificate -or $certificate.GetNameInfo('SimpleName', $false) -ne 'n8n GmbH' -or @($certificate.EnhancedKeyUsageList.ObjectId) -notcontains '1.3.6.1.4.1.311.97.516399124.569093350.771684794.174905458' -or -not $signature.TimeStamperCertificate) {
|
||||
throw 'The Nod installer signature is invalid.'
|
||||
}
|
||||
Write-Host "Installing Nod $version..."
|
||||
Write-Host "Installing Nod $version. If Windows Subsystem for Linux (WSL) is missing, Windows asks for administrator approval to install it for Nod's browser and workspace."
|
||||
$process = Start-Process -FilePath (Join-Path $directory $files.installer) -ArgumentList $arguments -Wait -PassThru
|
||||
if ($process.ExitCode -ne 0) { throw 'The Nod installer did not finish.' }
|
||||
if ($process.ExitCode -ne 0 -and $process.ExitCode -ne 3010) { throw 'The Nod installer did not finish.' }
|
||||
$restart = $process.ExitCode -eq 3010
|
||||
$installed = (Get-ItemProperty -Path 'HKCU:\Software\nod' -ErrorAction SilentlyContinue).InstallDir
|
||||
if (-not $installed -or [IO.Path]::GetFullPath($installed) -ne [IO.Path]::GetFullPath($target)) {
|
||||
throw 'The Nod installation destination could not be verified.'
|
||||
@@ -99,6 +100,7 @@
|
||||
} finally {
|
||||
Remove-Item -LiteralPath $directory -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
if ($restart) { Write-Host "Restart your PC to finish installing WSL. Nod's browser and workspace start after the restart; you can chat with Nod before that." }
|
||||
Write-Host "Nod $version is installed. Opening Nod..."
|
||||
try {
|
||||
Start-Process -FilePath $application -WorkingDirectory $installed
|
||||
|
||||
@@ -471,7 +471,7 @@ function Start-Process { param($FilePath, $ArgumentList, $WorkingDirectory, [swi
|
||||
if (-not $Wait -or -not $PassThru) { throw 'Installer must finish before launch' }
|
||||
$runtime = Join-Path (Split-Path $FilePath) 'nod-Runtime-win32-x64.tar.gz'
|
||||
Add-Content $env:NOD_LOG "install $ArgumentList runtime=$([IO.File]::Exists($runtime))"
|
||||
if ($fixture.exitCode -eq 0) {
|
||||
if ($fixture.exitCode -in 0, 3010) {
|
||||
$script:installed = $true
|
||||
$package = Join-Path $fixture.target 'resources/app'
|
||||
New-Item -ItemType Directory -Path $package -Force | Out-Null
|
||||
@@ -524,12 +524,17 @@ test(
|
||||
{ legacyUpdateSource: true },
|
||||
{ ps7Redirect: true },
|
||||
{ arrayRedirect: true },
|
||||
{ exitCode: 3010 },
|
||||
].flatMap((options) => powershellCommands.map((powershell) => ({ ...options, powershell })))) {
|
||||
const installed = await windowsInstall(options);
|
||||
assert.equal(installed.result.status, 0, installed.output);
|
||||
assert.deepEqual(
|
||||
installed.calls.filter((call) => call.startsWith('install')),
|
||||
[`install /S${options.existing ? ` /D=${installed.target}` : ''} runtime=True`],
|
||||
[`install /S /WSL${options.existing ? ` /D=${installed.target}` : ''} runtime=True`],
|
||||
);
|
||||
assert.equal(
|
||||
/Restart your PC to finish installing WSL/.test(installed.output),
|
||||
options.exitCode === 3010,
|
||||
);
|
||||
assert.deepEqual(
|
||||
installed.calls.filter((call) => call.startsWith('launch')),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
Unicode true
|
||||
!include "MUI2.nsh"
|
||||
!include "x64.nsh"
|
||||
!include "FileFunc.nsh"
|
||||
Name "Nod"
|
||||
OutFile "${OUTPUT}"
|
||||
InstallDir "$LOCALAPPDATA\Programs\nod"
|
||||
@@ -37,11 +38,49 @@ Function .onInit
|
||||
FunctionEnd
|
||||
|
||||
Function .onInstSuccess
|
||||
IfRebootFlag 0 launch
|
||||
IfSilent 0 restart_question
|
||||
SetErrorLevel 3010
|
||||
Goto installed
|
||||
restart_question:
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Nod is installed. Restart your PC now to finish installing WSL?$\r$\n$\r$\nNod's browser and workspace start after the restart. Until then, you can already chat with Nod." IDNO launch
|
||||
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\RunOnce" "Nod" '"$INSTDIR\nod.exe"'
|
||||
Reboot
|
||||
launch:
|
||||
IfSilent installed
|
||||
Exec '"$INSTDIR\nod.exe"'
|
||||
installed:
|
||||
FunctionEnd
|
||||
|
||||
Function .onRebootFailed
|
||||
Exec '"$INSTDIR\nod.exe"'
|
||||
FunctionEnd
|
||||
|
||||
Function InstallWsl
|
||||
IfSilent 0 wsl_check
|
||||
${GetParameters} $0
|
||||
ClearErrors
|
||||
${GetOptions} $0 "/WSL" $1
|
||||
IfErrors wsl_done
|
||||
wsl_check:
|
||||
nsExec::Exec `"$WINDIR\Sysnative\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -NonInteractive -Command "$$p=Start-Process -FilePath (Join-Path $$env:SYSTEMROOT 'System32\wsl.exe') -ArgumentList '--status' -WindowStyle Hidden -PassThru; $$null=$$p.Handle; if (-not $$p.WaitForExit(15000)) { exit 0 }; exit $$p.ExitCode"`
|
||||
Pop $0
|
||||
StrCmp $0 "error" wsl_done
|
||||
StrCmp $0 "0" wsl_done
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Nod runs its private browser and workspace in Windows Subsystem for Linux (WSL), which isn't on this PC yet.$\r$\n$\r$\nInstall it now? Windows asks for administrator approval, and you restart your PC afterwards." /SD IDYES IDNO wsl_done
|
||||
DetailPrint "Installing Windows Subsystem for Linux..."
|
||||
nsExec::Exec `"$WINDIR\Sysnative\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -NonInteractive -Command "$$ErrorActionPreference='Stop'; try { $$p=Start-Process -FilePath (Join-Path $$env:SYSTEMROOT 'System32\wsl.exe') -ArgumentList '--install','--no-distribution','--web-download' -Verb RunAs -Wait -PassThru } catch { exit 1223 }; exit $$p.ExitCode"`
|
||||
Pop $0
|
||||
StrCmp $0 "0" 0 wsl_done
|
||||
SetRebootFlag true
|
||||
CreateDirectory "$APPDATA\nod"
|
||||
FileOpen $1 "$APPDATA\nod\wsl-installer.json" w
|
||||
FileWrite $1 '{"trigger":"installer"}'
|
||||
FileClose $1
|
||||
wsl_done:
|
||||
ClearErrors
|
||||
FunctionEnd
|
||||
|
||||
Function CheckInstallDirectory
|
||||
IfFileExists "$INSTDIR\.nod-installation" directory_ready
|
||||
FindFirst $0 $1 "$INSTDIR\*"
|
||||
@@ -147,6 +186,7 @@ Section "nod"
|
||||
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\nod" "UninstallString" '"$INSTDIR\Uninstall.exe"'
|
||||
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\nod" "NoModify" 1
|
||||
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\nod" "NoRepair" 1
|
||||
Call InstallWsl
|
||||
SectionEnd
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
@@ -277,12 +277,12 @@ If a manual update check fails, choose **Try again** or **Not now** and keep usi
|
||||
|
||||
The Windows app has a few extra needs.
|
||||
|
||||
| Need | Detail |
|
||||
| ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| System | Windows 11 x64 with hardware virtualization |
|
||||
| WSL | WSL 2 for the workspace and browser. When it's missing, Nod installs it once after setup; approve the administrator request and restart the PC. Chat works without it. |
|
||||
| Disk | At least 20 GB free |
|
||||
| Signing | Signed by n8n GmbH. SmartScreen can still warn about a new release. |
|
||||
| Need | Detail |
|
||||
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| System | Windows 11 x64 with hardware virtualization |
|
||||
| WSL | WSL 2 for the workspace and browser. If missing, the installer offers it, then Nod tries once after setup; approve the admin request and restart. Chat works without it. |
|
||||
| Disk | At least 20 GB free |
|
||||
| Signing | Signed by n8n GmbH. SmartScreen can still warn about a new release. |
|
||||
|
||||
Inside Nod's distribution, drive mounts and Windows process access are turned off. Closing the window keeps Nod in the tray. **Turn Off Nod** stops only its own distribution.
|
||||
|
||||
|
||||
@@ -82,9 +82,11 @@ The desktop app does not support Windows on Arm. You can open a [self-hosted Nod
|
||||
|
||||
2. Run `nod-Setup-x64.exe`. Windows shows n8n GmbH as the publisher, though SmartScreen can still warn about a new release. Choose the app's install folder, then select **Install**. Use an empty folder or the current Nod folder. The installer installs Nod for your Windows account, adds it to the Start menu, and opens it. An existing installation starts with its current folder selected. Automatic updates keep that folder.
|
||||
|
||||
If the installer finds that Windows Subsystem for Linux (WSL) isn't set up on your PC, it offers to install it, because Nod's browser and workspace run in it. Select **Yes** and approve the administrator request. When Nod is installed, select **Yes** to restart now. Nod opens after the restart. Select **No** to restart later, and Nod opens right away. Chat works before the restart.
|
||||
|
||||
3. At Welcome, choose **Connect to a server** to use an existing assistant, or **Get started** to start a local one. Local setup offers an optional email connection, a few optional questions about you, a model if none works yet, a choice about notifications, a choice about conversation traces, which also says basic usage data is shared by default for new owners and can be turned off in **Settings → Privacy & data**, and an optional email address for updates about Nod and other n8n products, with its own consent checkbox. Discord and forum links are also in **Settings → General**. Other apps can be connected later from the first chat or **Apps**. Nod tries to turn on **Open at login** when local setup finishes. If the operating system blocks this setting, setup still finishes. Windows notification settings control delivery. You can change these preferences later in Settings.
|
||||
|
||||
4. If WSL is missing, Nod starts installing it after setup. Approve the administrator request and restart Windows when it's convenient; chat keeps working until then, and your saved connections and settings are kept.
|
||||
4. If WSL is still missing, for example because you skipped it in the installer, Nod starts installing it once after setup. Approve the administrator request and restart Windows when it's convenient; chat keeps working until then, and your saved connections and settings are kept.
|
||||
|
||||
5. Keep your internet connection on. When setup is ready, Nod opens your chat with your saved connections. See [Your first conversation](/get-started/first-conversation/).
|
||||
|
||||
@@ -101,7 +103,7 @@ Choose **Turn Off Nod** in the tray, then run this command in Windows PowerShell
|
||||
irm https://raw.githubusercontent.com/n8n-io/nod/main/deployment/n8n/install.ps1 | iex
|
||||
```
|
||||
|
||||
Use a normal PowerShell window, not **Run as administrator**. It finds the latest published GitHub release, verifies the installer and runtime file, installs Nod, and opens it. An existing installation keeps its current path. Your existing data stays in place. You don't need a GitHub account.
|
||||
Use a normal PowerShell window, not **Run as administrator**. It finds the latest published GitHub release, verifies the installer and runtime file, installs Nod, and opens it. If WSL is missing, Windows asks for administrator approval to install it. When that install finishes, the script tells you to restart your PC. An existing installation keeps its current path. Your existing data stays in place. You don't need a GitHub account.
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ flowchart TD
|
||||
1. **The database opens first.** PostgreSQL runs on Windows itself, in the profile's `database` folder, and listens only on `127.0.0.1`.
|
||||
2. **The background service starts.** On a profile that's already set up, chat opens when it's ready. The first start after an install or update is the slowest, because Microsoft Defender scans each file the service loads.
|
||||
3. **The private computer gets ready at the same time.** Nod checks WSL, then locks the profile folder so only the user, SYSTEM, and Administrators can open it. On first setup, Nod installs the runtime pack as the private computer. Later starts reuse it. Docker then starts the workspace and browser containers. Tools that need them wait until they're ready.
|
||||
4. **Without WSL, chat still works.** Nod starts installing WSL once by itself. Windows asks for administrator approval, and the PC must restart. If that fails or the user declines, the error screen offers **Install WSL**. With usage sharing on, Nod records each attempt's progress and result as [`wsl_install_changed`](/deploy/analytics/#setup-and-app-interaction).
|
||||
4. **Without WSL, chat still works.** The installer offers to install WSL and restart. If it's still missing after setup, Nod starts installing it once by itself. Windows asks for administrator approval, and the PC must restart. If that fails or the user declines, the error screen offers **Install WSL**. With usage sharing on, Nod records each attempt's progress and result as [`wsl_install_changed`](/deploy/analytics/#setup-and-app-interaction).
|
||||
|
||||
## How updates install
|
||||
|
||||
|
||||
Reference in new issue
Block a user