Skip to content

fix(DVLSForLinux): fix DatabaseName parameter and add multi-instance support#19

Open
Alexandre Martigny (AlexMartigny) wants to merge 5 commits intomainfrom
fix/database-name-parameter
Open

fix(DVLSForLinux): fix DatabaseName parameter and add multi-instance support#19
Alexandre Martigny (AlexMartigny) wants to merge 5 commits intomainfrom
fix/database-name-parameter

Conversation

@AlexMartigny
Copy link

@AlexMartigny Alexandre Martigny (AlexMartigny) commented Mar 2, 2026

Summary

Five fixes to install-dvls.ps1 and install-dvls.sh enabling multi-instance DVLS installations on Linux. All fixes tested end-to-end — second instance installed successfully at /opt/devolutions/dvls2 (port 5001, service dvls2, DB dvls-linux-2).

1. DatabaseName parameter ignored (commit 1)

$DVLSVariables.DVLSAPP (hardcoded 'dvls') was passed to New-DPSInstallConfiguration instead of $DVLSVariables.DatabaseName, causing all installations to use Initial Catalog=dvls regardless of user input.

2. Multi-instance parameters (commit 2)

Parameter Default Purpose
-DpsPath /opt/devolutions/dvls Install directory
-Port 5000 Kestrel listening port
-ServiceName dvls systemd service name and syslog identifier

All previously hardcoded references now use these parameters. Bash wrapper updated with matching --dps-path, --port, --service-name options. Backward compatible.

3. Property name mismatch + DatabasePort (commit 3)

  • UseEncryptedConnection / TrustServerCertificate read from non-existent keys ($DVLSVariables.UseEncryptedConnection instead of $DVLSVariables.DatabaseEncryptedConnection), passing $null and causing NullReferenceException in New-DPSAppsettings
  • Added -DatabasePort parameter (default: 1433) — host and port combined as "host,port" for New-DPSInstallConfiguration

4. CWD permission denied after chmod 550 (commit 4)

After chmod 550 on the target directory, subsequent commands (sg, id, getent) failed with "Permission denied" if the user ran the script from inside that directory. Fix: Push-Location /tmp before the permission block, Pop-Location after validation. Also made useradd/groupadd idempotent for multi-instance installs.

5. DPS cmdlets as sudo (commit 5)

sg cannot activate group membership in a parent PowerShell process — it only applies to the subprocess it spawns. This means the current user cannot access the 550 DVLS directory, and all DPS cmdlets (New-DPSInstallConfiguration, New-DPSAppsettings, New-DPSDatabase, etc.) fail with NullReferenceException. Fix: wrapped the entire DPS cmdlet section in sudo pwsh -Command { ... } blocks with Import-Module.

Test plan

  • Run with -DatabaseName "dvls-linux-2" — verified appsettings.json contains correct catalog
  • Run with -DpsPath /opt/devolutions/dvls2 -Port 5001 -ServiceName dvls2 — second instance installs without affecting first
  • Run with default parameters — backward compatible (first instance unaffected)
  • Verify bash wrapper passes new options correctly
  • Service starts and responds on configured port
  • Fresh install on clean machine (no existing dvls user/group)

🤖 Generated with Claude Code

…LSAPP constant

The `-DatabaseName` parameter was accepted and stored in
`$DVLSVariables.DatabaseName` but never used when calling
`New-DPSInstallConfiguration`. Instead, `$DVLSVariables.DVLSAPP`
(hardcoded to 'dvls') was passed, causing all installations to use
'dvls' as the database name regardless of what the user specified.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… multi-instance support

New parameters allow installing multiple DVLS instances on the same
machine without collisions:

- `-DpsPath` (default: /opt/devolutions/dvls) — install directory
- `-Port` (default: 5000) — Kestrel listening port
- `-ServiceName` (default: dvls) — systemd service name and syslog identifier

All previously hardcoded references to '/opt/devolutions/dvls', port
5000, and 'dvls.service' now use these parameters. Bash wrapper
updated with matching --dps-path, --port, --service-name options.

Backward compatible — all defaults match previous behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@AlexMartigny Alexandre Martigny (AlexMartigny) changed the title fix(DVLSForLinux): use DatabaseName parameter instead of hardcoded DVLSAPP constant fix(DVLSForLinux): fix DatabaseName parameter and add multi-instance support Mar 2, 2026
…rameter

- UseEncryptedConnection and TrustServerCertificate were reading from
  non-existent keys ($DVLSVariables.UseEncryptedConnection instead of
  $DVLSVariables.DatabaseEncryptedConnection), passing $null to
  New-DPSInstallConfiguration and causing NullReferenceException in
  New-DPSAppsettings.

- Add -DatabasePort parameter (default: 1433) so users don't need to
  embed the port in the host string. Host and port are combined as
  "host,port" when calling New-DPSInstallConfiguration. Interactive
  mode prompts for port separately.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When the user runs the script from the target directory (e.g. /opt/devolutions/dvls2),
chmod 550 makes the CWD inaccessible to the current user, causing all subsequent
commands (sg, id, getent) to fail with "Permission denied".

Fix: Push-Location /tmp before the sudo block, Pop-Location after validation.
Also made useradd/groupadd idempotent to suppress "already exists" errors
on multi-instance installs.
The sg command cannot activate group membership in the parent PowerShell
process — it only activates it for the subprocess it spawns. This means
the current user (alexm) never gains effective dvls group access, causing
all DPS cmdlet calls to fail with NullReferenceException because they
cannot access the 550-permission DVLS directory.

Fix: wrap DPS install cmdlets and cert appsettings update in sudo pwsh
blocks with Import-Module, matching the existing pattern used for user
creation, extraction, and systemd sections.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant