Skip to content

Modern Docker Management, Designed for Everyone

chore: remove docker host setting and only use local socket

Kyle Mendellf352383c911b
diff --git a/backend/internal/api/routes.go b/backend/internal/api/routes.go
index fe6366376..36e583ef0 100644
--- a/backend/internal/api/routes.go
+++ b/backend/internal/api/routes.go
@@ -45,7 +45,7 @@ func SetupRoutes(r *gin.Engine, services *Services, appConfig *config.Config) {
setupNetworkRoutes(api, services)
setupTemplateRoutes(api, services)
setupContainerRegistryRoutes(api, services)
- setupAutoUpdateRoutes(api, services.AutoUpdate)
+ setupAutoUpdateRoutes(api, services)
}
func setupContainerRegistryRoutes(api *gin.RouterGroup, services *Services) {
@@ -202,10 +202,11 @@ func setupSystemRoutes(api *gin.RouterGroup, dockerService *services.DockerClien
system.POST("/containers/stop-all", systemHandler.StopAllContainers)
}
-func setupAutoUpdateRoutes(api *gin.RouterGroup, autoUpdateService *services.AutoUpdateService) {
+func setupAutoUpdateRoutes(api *gin.RouterGroup, services *Services) {
autoUpdate := api.Group("/updates")
+ autoUpdate.Use(middleware.AuthMiddleware(services.Auth))
- autoUpdateHandler := NewAutoUpdateHandler(autoUpdateService)
+ autoUpdateHandler := NewAutoUpdateHandler(services.AutoUpdate)
autoUpdate.POST("/check/containers", autoUpdateHandler.CheckContainersForUpdates)
autoUpdate.POST("/check/compose", autoUpdateHandler.CheckStacksForUpdates)
diff --git a/backend/internal/api/settings_handler.go b/backend/internal/api/settings_handler.go
index 1fd71e03f..ea1a71fb2 100644
--- a/backend/internal/api/settings_handler.go
+++ b/backend/internal/api/settings_handler.go
@@ -54,9 +54,6 @@ func (h *SettingsHandler) UpdateSettings(c *gin.Context) {
return
}
- if req.DockerHost != nil {
- settings.DockerHost = *req.DockerHost
- }
if req.StacksDirectory != nil {
settings.StacksDirectory = *req.StacksDirectory
}
diff --git a/backend/internal/api/system_handler.go b/backend/internal/api/system_handler.go
index f5970c77e..d870dc37c 100644
--- a/backend/internal/api/system_handler.go
+++ b/backend/internal/api/system_handler.go
@@ -8,7 +8,6 @@ import (
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/image"
- "github.com/docker/docker/client"
"github.com/gin-gonic/gin"
"github.com/ofkm/arcane-backend/internal/dto"
"github.com/ofkm/arcane-backend/internal/services"
@@ -188,20 +187,7 @@ func (h *SystemHandler) GetDockerInfo(c *gin.Context) {
func (h *SystemHandler) TestDockerConnection(c *gin.Context) {
ctx := c.Request.Context()
- host := c.Query("host")
-
- var dockerClient *client.Client
- var err error
-
- if host != "" {
- dockerClient, err = client.NewClientWithOpts(
- client.WithHost(host),
- client.WithAPIVersionNegotiation(),
- )
- } else {
- dockerClient, err = h.dockerService.CreateConnection(ctx)
- }
-
+ dockerClient, err := h.dockerService.CreateConnection(ctx)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
diff --git a/backend/internal/models/settings.go b/backend/internal/models/settings.go
index cef86ec8f..5aa1f7721 100644
--- a/backend/internal/models/settings.go
+++ b/backend/internal/models/settings.go
@@ -45,7 +45,6 @@ type Onboarding struct {
type Settings struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
- DockerHost string `json:"dockerHost" gorm:"column:docker_host;not null"`
DockerTLSCert string `json:"dockerTLSCert" gorm:"column:docker_tls_cert"`
StacksDirectory string `json:"stacksDirectory" gorm:"column:stacks_directory;not null"`
AutoUpdate bool `json:"autoUpdate" gorm:"column:auto_update;default:false"`
diff --git a/backend/internal/services/docker_client_service.go b/backend/internal/services/docker_client_service.go
index 5942c1d5f..6873dde61 100644
--- a/backend/internal/services/docker_client_service.go
+++ b/backend/internal/services/docker_client_service.go
@@ -2,13 +2,10 @@ package services
import (
"context"
- "errors"
"fmt"
"github.com/docker/docker/client"
"github.com/ofkm/arcane-backend/internal/database"
- "github.com/ofkm/arcane-backend/internal/models"
- "gorm.io/gorm"
)
type DockerClientService struct {
@@ -20,38 +17,14 @@ func NewDockerClientService(db *database.DB) *DockerClientService {
}
func (s *DockerClientService) CreateConnection(ctx context.Context) (*client.Client, error) {
- dockerHost, err := s.getDockerHostFromSettings(ctx)
- if err != nil {
- return nil, fmt.Errorf("failed to get docker host from settings: %w", err)
- }
-
- var cli *client.Client
-
- if dockerHost != "" || dockerHost == "unix:///var/run/docker.sock" {
- cli, err = client.NewClientWithOpts(
- client.WithHost(dockerHost),
- client.WithAPIVersionNegotiation(),
- )
- } else {
- cli, err = client.NewClientWithOpts(
- client.FromEnv,
- client.WithAPIVersionNegotiation(),
- )
- }
-
- return cli, err
-}
-
-func (s *DockerClientService) getDockerHostFromSettings(ctx context.Context) (string, error) {
- var settings models.Settings
+ cli, err := client.NewClientWithOpts(
+ client.WithHost("unix:///var/run/docker.sock"),
+ client.WithAPIVersionNegotiation(),
+ )
- err := s.db.WithContext(ctx).First(&settings).Error
if err != nil {
- if errors.Is(err, gorm.ErrRecordNotFound) {
- return "", nil
- }
- return "", fmt.Errorf("failed to query settings: %w", err)
+ return nil, fmt.Errorf("failed to create Docker client: %w", err)
}
- return settings.DockerHost, nil
+ return cli, nil
}
diff --git a/backend/internal/services/settings_service.go b/backend/internal/services/settings_service.go
index 1c146fc20..79ea22296 100644
--- a/backend/internal/services/settings_service.go
+++ b/backend/internal/services/settings_service.go
@@ -52,7 +52,6 @@ func (s *SettingsService) createDefaultSettings(ctx context.Context) (*models.Se
defaultPruneMode := "dangling"
settings := &models.Settings{
- DockerHost: "unix:///var/run/docker.sock",
StacksDirectory: "data/stacks",
AutoUpdate: false,
AutoUpdateInterval: 300,
diff --git a/frontend/src/lib/services/api/autoupdate-api-service.ts b/frontend/src/lib/services/api/autoupdate-api-service.ts
index 1c6fa414d..ed9fdbbfc 100644
--- a/frontend/src/lib/services/api/autoupdate-api-service.ts
+++ b/frontend/src/lib/services/api/autoupdate-api-service.ts
@@ -10,8 +10,4 @@ export default class AutoUpdateAPIService extends BaseAPIService {
const response = await this.api.post('/updates/check/compose');
return response.data;
}
-
- async getStatus(): Promise<void> {
- await this.api.get('/updates/status');
- }
}
diff --git a/frontend/src/lib/stores/settings-store.ts b/frontend/src/lib/stores/settings-store.ts
index 0363fd7d7..ab8042163 100644
--- a/frontend/src/lib/stores/settings-store.ts
+++ b/frontend/src/lib/stores/settings-store.ts
@@ -27,8 +27,6 @@ function deepClone<T>(obj: T): T {
// Initialize with proper defaults that match the backend structure
export const settingsStore = writable<Settings>({
- dockerHost: 'unix:///var/run/docker.sock',
- dockerTLSCert: '',
stacksDirectory: 'data/stacks',
autoUpdate: false,
autoUpdateInterval: 60,
diff --git a/frontend/src/lib/types/settings.type.ts b/frontend/src/lib/types/settings.type.ts
index 8066b30c3..f4766a7a1 100644
--- a/frontend/src/lib/types/settings.type.ts
+++ b/frontend/src/lib/types/settings.type.ts
@@ -42,8 +42,6 @@ export interface TemplateRegistryConfig {
}
export interface Settings {
- dockerHost: string;
- dockerTLSCert: string;
stacksDirectory: string;
autoUpdate: boolean;
autoUpdateInterval: number;
@@ -51,15 +49,13 @@ export interface Settings {
pollingInterval: number;
pruneMode: 'all' | 'dangling' | undefined;
registryCredentials: RegistryCredential[];
- templateRegistries: TemplateRegistryConfig[]; // Add this new field
+ templateRegistries: TemplateRegistryConfig[];
auth: AuthSettings;
onboarding?: Onboarding;
baseServerUrl?: string;
maturityThresholdDays: number;
}
-// Add these to your existing settings.type.ts file
-
export interface OidcUserInfo {
sub: string;
email: string;
diff --git a/frontend/src/routes/images/+page.svelte b/frontend/src/routes/images/+page.svelte
index 95ccdf4de..a574cb17f 100644
--- a/frontend/src/routes/images/+page.svelte
+++ b/frontend/src/routes/images/+page.svelte
@@ -39,7 +39,6 @@
loadImageMaturityBatch
} from '$lib/stores/maturity-store';
-
let { data }: { data: PageData } = $props();
let images = $derived(data.images || []);
let error = $state(data.error);
@@ -412,7 +411,7 @@
/>
<ArcaneButton
action="inspect"
- label="Recheck Maturitys"
+ label="Recheck Maturities"
onClick={() => handleTriggerBulkMaturityCheck()}
loading={isLoading.checking}
loadingLabel="Checking..."
@@ -505,7 +504,7 @@
{/if}
</DropdownMenu.Item>
<DropdownMenu.Item
- class="text-red-500 focus:text-red-700!"
+ class="focus:text-red-700! text-red-500"
onclick={() => handleImageRemove(item.Id)}
>
<Trash2 class="size-4" />
diff --git a/frontend/src/routes/settings/docker/+page.svelte b/frontend/src/routes/settings/docker/+page.svelte
index 7220b6bd6..2dd7baa6d 100644
--- a/frontend/src/routes/settings/docker/+page.svelte
+++ b/frontend/src/routes/settings/docker/+page.svelte
@@ -2,17 +2,7 @@
import * as Card from '$lib/components/ui/card/index.js';
import type { FormInput as FormInputType } from '$lib/types/form.type';
import { Button } from '$lib/components/ui/button/index.js';
- import {
- RefreshCw,
- ImageMinus,
- Server,
- Save,
- Clock,
- Zap,
- Settings2,
- TestTube,
- InfoIcon
- } from '@lucide/svelte';
+ import { RefreshCw, ImageMinus, Server, Save, Clock, Zap, InfoIcon } from '@lucide/svelte';
import * as RadioGroup from '$lib/components/ui/radio-group/index.js';
import { Label } from '$lib/components/ui/label/index.js';
import * as Alert from '$lib/components/ui/alert/index.js';
@@ -43,8 +33,6 @@
function handleDockerSettingUpdates() {
isLoading.saving = true;
updateSettingsConfig({
- dockerHost: dockerHostInput.value,
- dockerTLSCert: dockerTLSCertInput.value,
pruneMode: 'all',
autoUpdate: autoUpdateSwitch.value,
pollingEnabled: pollingEnabledSwitch.value,
@@ -60,19 +48,6 @@
});
}
- async function testDockerConnection() {
- isLoading.testing = true;
- try {
- // Add your Docker connection test API call here
- // const result = await dockerAPI.testConnection();
- toast.success('Docker connection test successful');
- } catch (error) {
- toast.error('Docker connection test failed');
- } finally {
- isLoading.testing = false;
- }
- }
-
let pollingIntervalInput = $state<FormInputType<number>>({
value: 0,
valid: true,
@@ -105,32 +80,13 @@
errors: []
});
- let dockerHostInput = $state<FormInputType<string>>({
- value: '',
- valid: true,
- touched: false,
- error: null,
- errors: []
- });
-
- let dockerTLSCertInput = $state<FormInputType<string>>({
- value: '',
- valid: true,
- touched: false,
- error: null,
- errors: []
- });
-
$effect(() => {
pollingIntervalInput.value = currentSettings.pollingInterval;
pollingEnabledSwitch.value = currentSettings.pollingEnabled;
autoUpdateSwitch.value = currentSettings.autoUpdate;
autoUpdateIntervalInput.value = currentSettings.autoUpdateInterval;
- dockerHostInput.value = currentSettings.dockerHost;
- dockerTLSCertInput.value = currentSettings.dockerTLSCert || '';
});
- // Computed values for better UX
let isPollingConfigValid = $derived(
!pollingEnabledSwitch.value ||
(pollingIntervalInput.value >= 5 && pollingIntervalInput.value <= 1440)
@@ -141,7 +97,7 @@
(autoUpdateIntervalInput.value >= 5 && autoUpdateIntervalInput.value <= 1440)
);
- let canSave = $derived(isPollingConfigValid && isAutoUpdateConfigValid && dockerHostInput.valid);
+ let canSave = $derived(isPollingConfigValid && isAutoUpdateConfigValid);
</script>
<svelte:head>
@@ -149,31 +105,15 @@
</svelte:head>
<div class="space-y-6">
- <!-- Header Section -->
<div class="flex flex-col justify-between gap-4 sm:flex-row sm:items-center">
<div>
<h1 class="text-3xl font-bold tracking-tight">Docker Settings</h1>
<p class="text-muted-foreground mt-1 text-sm">
- Configure Docker daemon connection and automation behavior
+ Configure Docker automation behavior. Remote hosts should use agents.
</p>
</div>
<div class="flex gap-2">
- <Button
- onclick={() => testDockerConnection()}
- disabled={isLoading.testing || !dockerHostInput.value}
- variant="outline"
- class="h-10"
- >
- {#if isLoading.testing}
- <RefreshCw class="size-4 animate-spin" />
- Testing...
- {:else}
- <TestTube class="size-4" />
- Test Connection
- {/if}
- </Button>
-
<Button
onclick={() => handleDockerSettingUpdates()}
disabled={isLoading.saving || !canSave}
@@ -190,78 +130,18 @@
</div>
</div>
- <!-- Warning Alert for Important Settings -->
{#if currentSettings.autoUpdate && currentSettings.pollingEnabled}
- <Alert.Root class="border-amber-600">
- <Zap class="h-4 w-4 text-amber-600" />
- <Alert.Title class="text-amber-800">Auto-update Enabled</Alert.Title>
- <Alert.Description class="text-amber-700">
+ <Alert.Root variant="warning">
+ <Zap class="size-4" />
+ <Alert.Title>Auto-update Enabled</Alert.Title>
+ <Alert.Description>
Containers will be automatically updated when newer images are detected. Make sure you have
proper backup procedures in place.
</Alert.Description>
</Alert.Root>
{/if}
- <!-- Main Settings Grid -->
- <div class="grid grid-cols-1 gap-6 xl:grid-cols-2">
- <!-- Docker Connection Card -->
- <Card.Root class="border shadow-sm">
- <Card.Header class="pb-4">
- <div class="flex items-center gap-3">
- <div class="rounded-lg bg-blue-500/10 p-2.5">
- <Server class="size-5 text-blue-600" />
- </div>
- <div>
- <Card.Title class="text-lg">Docker Connection</Card.Title>
- <Card.Description>Configure how Arcane connects to the Docker daemon</Card.Description>
- </div>
- </div>
- </Card.Header>
- <Card.Content class="space-y-4">
- <FormInput
- bind:input={dockerHostInput}
- type="text"
- id="dockerHost"
- label="Docker Host"
- placeholder="unix:///var/run/docker.sock"
- description="For local Docker: unix:///var/run/docker.sock (Unix/Linux/macOS)"
- />
-
- <FormInput
- bind:input={dockerTLSCertInput}
- type="textarea"
- id="dockerTLSCert"
- label="TLS Certificate (Optional)"
- placeholder="-----BEGIN CERTIFICATE-----&#10;...&#10;-----END CERTIFICATE-----"
- description="Required for secure TCP connections. Paste the PEM-encoded certificate for TLS authentication."
- rows={4}
- />
-
- <div class="bg-muted/50 rounded-lg p-3 text-sm">
- <div class="mb-2 flex items-center gap-2 font-medium">
- <Settings2 class="size-4" />
- Common Docker Host Examples:
- </div>
- <ul class="text-muted-foreground ml-6 space-y-1">
- <li>
- • <code class="bg-background rounded px-1 py-0.5 text-xs"
- >unix:///var/run/docker.sock</code
- > - Local Unix socket
- </li>
- <li>
- • <code class="bg-background rounded px-1 py-0.5 text-xs">tcp://localhost:2376</code> -
- TCP with TLS (requires certificate)
- </li>
- <li>
- • <code class="bg-background rounded px-1 py-0.5 text-xs">tcp://localhost:2375</code> -
- TCP without TLS (not recommended)
- </li>
- </ul>
- </div>
- </Card.Content>
- </Card.Root>
-
- <!-- Image Automation Card -->
+ <div class="grid grid-cols-1 gap-6">
<Card.Root class="border shadow-sm">
<Card.Header class="pb-4">
<div class="flex items-center gap-3">
@@ -275,7 +155,6 @@
</div>
</Card.Header>
<Card.Content class="space-y-6">
- <!-- Polling Enabled Toggle -->
<div
class="from-background to-muted/30 flex items-center justify-between rounded-lg border bg-gradient-to-r p-4"
>
@@ -288,7 +167,6 @@
/>
</div>
- <!-- Polling Configuration -->
{#if currentSettings.pollingEnabled}
<div class="space-y-4 pl-4">
<FormInput
@@ -300,7 +178,6 @@
description="How often to check for new images (5-1440 minutes)"
/>
- <!-- Rate Limiting Warning -->
{#if pollingIntervalInput.value < 30}
<Alert.Root variant="warning">
<Zap class="size-4" />
@@ -313,7 +190,6 @@
</Alert.Root>
{/if}
- <!-- Auto Update Toggle -->
<div
class="from-background flex items-center justify-between rounded-lg border bg-gradient-to-r to-amber-50/50 p-4"
>
@@ -326,7 +202,6 @@
/>
</div>
- <!-- Auto Update Configuration -->
{#if currentSettings.autoUpdate}
<div class="pl-4">
<FormInput
@@ -341,7 +216,6 @@
{/if}
</div>
- <!-- Automation Summary -->
<Alert.Root>
<InfoIcon />
<Alert.Title>Automation Summary</Alert.Title>
@@ -360,7 +234,6 @@
</Card.Root>
</div>
- <!-- Image Pruning Card - Full Width -->
<Card.Root>
<Card.Header class="pb-4">
<div class="flex items-center gap-3">
@@ -433,6 +306,5 @@
</Card.Content>
</Card.Root>
- <!-- Hidden CSRF token if needed -->
<input type="hidden" id="csrf_token" value={data.csrf} />
</div>