add docker command for restarting containers over ssh

This commit is contained in:
Justin Oros
2026-09-25 18:17:24 -07:00
parent 20b3e514a0
commit 22298e91d2
4 changed files with 175 additions and 23 deletions
+20 -12
View File
@@ -1,6 +1,5 @@
param(
[switch]$LinkSteamProfiles,
[switch]$BackfillRoles,
[string]$BulkOwn,
[switch]$SyncRoles
)
@@ -19,17 +18,6 @@ if ($LinkSteamProfiles) {
exit 0
}
if ($BackfillRoles) {
if (-not (Test-Path ".env")) {
Write-Host "No .env found yet. Run install.ps1 (with no flag) first to set up your keys."
exit 1
}
Write-Host "Installing dependencies..."
npm install --silent
node backfill-roles.js
exit 0
}
if ($BulkOwn) {
if (-not (Test-Path ".env")) {
Write-Host "No .env found yet. Run install.ps1 (with no flag) first to set up your keys."
@@ -182,6 +170,26 @@ if ([string]::IsNullOrWhiteSpace((Get-EnvValue "ITAD_COUNTRY"))) {
Set-EnvValue "ITAD_COUNTRY" $itadCountryInput
}
if ([string]::IsNullOrWhiteSpace((Get-EnvValue "DOCKER_SSH_HOST"))) {
Write-Host ""
Write-Host "Optional - lets people with a specific Discord role run !docker ps and !docker restart CONTAINER to manage Docker containers on a remote server over SSH (e.g. an Unraid box running your game servers). Requires SSH key access to that server already set up:"
Write-Host ""
$dockerHostInput = Read-Host "SSH host for the Docker server (e.g. chappie.local), or press Enter to skip"
if (-not [string]::IsNullOrWhiteSpace($dockerHostInput)) {
Set-EnvValue "DOCKER_SSH_HOST" $dockerHostInput
$dockerUserInput = Read-Host "SSH username (e.g. root)"
Set-EnvValue "DOCKER_SSH_USER" $dockerUserInput
$dockerKeyInput = Read-Host "Path to the SSH private key to use"
Set-EnvValue "DOCKER_SSH_KEY_PATH" $dockerKeyInput
$dockerRoleInput = Read-Host "Discord role ID allowed to use !docker (right-click the role in Discord, Copy Role ID)"
Set-EnvValue "DOCKER_ROLE_ID" $dockerRoleInput
$dockerProtectedInput = Read-Host "Container names to protect from !docker restart, comma-separated (e.g. Plex-Media-Server), or press Enter for none"
Set-EnvValue "DOCKER_PROTECTED_CONTAINERS" $dockerProtectedInput
} else {
Write-Host "Skipping - !docker won't be available. Run this script again any time to set it up."
}
}
if (-not (Test-CommandExists ollama)) {
Write-Host ""
$aiAnswer = Read-Host "Want the bot to use AI to give smarter, in-character answers when people chat with it? This is free - it installs Ollama and runs a small AI model locally on this machine, no API key or cost involved. [y/N]"