Skip to content

Modern Docker Management, Designed for Everyone

feat: change port to 3552, cleanup old code

Kyle Mendell970527767b11
diff --git a/.env.example b/.env.example
index c5f1fe573..dfe112db2 100644
--- a/.env.example
+++ b/.env.example
@@ -1,14 +1,9 @@
# Server Configuration
-APP_URL="http://localhost:8080"
-PORT=8080
+APP_URL="http://localhost:3552"
ENVIRONMENT=production
-DATABASE_URL=sqlite://data/arcane.db
-
# Encryption key for sensitive data (must be exactly 32 characters)
# Generate a secure key for production: openssl rand -base64 32 | head -c 32
ENCRYPTION_KEY=f00V7L3pqj+yMtfUkpFAyaRTxoGo+600
-
-# JWT Secret (generate a secure one in production)
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
OIDC_ENABLED=true
diff --git a/Dockerfile b/Dockerfile
index 3309efc76..5e189c699 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,10 +1,8 @@
-# This file uses multi-stage builds to build the application from source, including the front-end
-
# Tags passed to "go build"
ARG BUILD_TAGS=""
# Stage 1: Build Frontend
-FROM node:22-alpine AS frontend-builder
+FROM node:24-alpine AS frontend-builder
WORKDIR /build
COPY ./frontend/package*.json ./
RUN npm ci
@@ -16,7 +14,6 @@ FROM golang:1.25-alpine AS backend-builder
ARG BUILD_TAGS
WORKDIR /build
-# Install build dependencies
RUN apk add --no-cache git ca-certificates tzdata gcc musl-dev
COPY ./backend/go.mod ./backend/go.sum ./
@@ -35,7 +32,7 @@ RUN CGO_ENABLED=1 \
./cmd/main.go
# Stage 3: Production Image
-FROM alpine:3.21 AS runner
+FROM alpine:3 AS runner
RUN apk upgrade && apk --no-cache add ca-certificates tzdata curl shadow su-exec docker docker-compose
@@ -43,7 +40,7 @@ RUN delgroup ping && apk del iputils
ENV DOCKER_GID=998 PUID=2000 PGID=2000
ENV GIN_MODE=release
-ENV PORT=8080
+ENV PORT=3552
WORKDIR /app
@@ -53,7 +50,7 @@ COPY --from=backend-builder /build/arcane .
COPY --chmod=755 scripts/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
-EXPOSE 8080
+EXPOSE 3552
VOLUME ["/app/data"]
ARG VERSION="0.15.1"
diff --git a/backend/internal/config/config.go b/backend/internal/config/config.go
index 785fa5690..6ce7cbc72 100644
--- a/backend/internal/config/config.go
+++ b/backend/internal/config/config.go
@@ -30,9 +30,9 @@ func Load() *Config {
oidcEnabled, _ := strconv.ParseBool(os.Getenv("OIDC_ENABLED"))
return &Config{
- AppUrl: getEnvOrDefault("APP_URL", "http://localhost:8080"),
+ AppUrl: getEnvOrDefault("APP_URL", "http://localhost:3552"),
DatabaseURL: getEnvOrDefault("DATABASE_URL", defaultSqliteString),
- Port: getEnvOrDefault("PORT", "8080"),
+ Port: getEnvOrDefault("PORT", "3552"),
Environment: getEnvOrDefault("ENVIRONMENT", "production"),
JWTSecret: getEnvOrDefault("JWT_SECRET", "default-jwt-secret-change-me"),
EncryptionKey: getEnvOrDefault("ENCRYPTION_KEY", "arcane-dev-key-32-characters!!!"),
diff --git a/backend/internal/database/database.go b/backend/internal/database/database.go
index 4344e419a..5e9dbafdb 100644
--- a/backend/internal/database/database.go
+++ b/backend/internal/database/database.go
@@ -65,7 +65,7 @@ func Initialize(databaseURL string, environment string) (*DB, error) {
}
// Run migrations with backup on failure
- if err := migrateDatabase(driver, dbProvider, databaseURL); err != nil {
+ if err := migrateDatabase(driver, dbProvider); err != nil {
slog.Error("Failed to run migrations", "error", err)
// If migration fails and it's SQLite, try to backup and retry
@@ -96,7 +96,7 @@ func Initialize(databaseURL string, environment string) (*DB, error) {
return nil, fmt.Errorf("failed to create migration driver after backup: %w", err)
}
- if retryErr := migrateDatabase(driver, dbProvider, databaseURL); retryErr != nil {
+ if retryErr := migrateDatabase(driver, dbProvider); retryErr != nil {
return nil, fmt.Errorf("failed to run migrations even after backup: %w", retryErr)
}
} else {
@@ -155,8 +155,7 @@ func connectDatabase(databaseURL string, environment string) (*DB, error) {
return nil, err
}
-func migrateDatabase(driver database.Driver, dbProvider string, databaseURL string) error {
- // Use the embedded migrations
+func migrateDatabase(driver database.Driver, dbProvider string) error {
source, err := iofs.New(resources.FS, "migrations/"+dbProvider)
if err != nil {
return fmt.Errorf("failed to create embedded migration source: %w", err)
@@ -182,7 +181,6 @@ func migrateDatabase(driver database.Driver, dbProvider string, databaseURL stri
}
func backupSQLiteDatabase(databaseURL string) error {
- // Extract file path from SQLite URL
connStringUrl, err := url.Parse(databaseURL)
if err != nil {
return fmt.Errorf("failed to parse database URL: %w", err)
@@ -193,23 +191,19 @@ func backupSQLiteDatabase(databaseURL string) error {
return fmt.Errorf("empty database path in URL")
}
- // Check if database file exists
if _, err := os.Stat(dbPath); os.IsNotExist(err) {
- // Database doesn't exist, no need to backup
slog.Info("Database file doesn't exist, no backup needed")
return nil
}
backupPath := strings.TrimSuffix(dbPath, ".db") + ".old"
- // Remove existing backup if it exists
if _, err := os.Stat(backupPath); err == nil {
if err := os.Remove(backupPath); err != nil {
return fmt.Errorf("failed to remove existing backup: %w", err)
}
}
- // Move current database to backup
if err := os.Rename(dbPath, backupPath); err != nil {
return fmt.Errorf("failed to backup database: %w", err)
}
@@ -264,7 +258,6 @@ func getLogger(environment string) logger.Interface {
case "development":
lvl = logger.Info
case "production":
- // Be quiet in prod by default; change to Warn for some visibility
lvl = logger.Warn
default:
lvl = logger.Warn
diff --git a/backend/internal/database/gorm_slog_logger.go b/backend/internal/database/gorm_slog_logger.go
index 0919f2c20..5a5e050ef 100644
--- a/backend/internal/database/gorm_slog_logger.go
+++ b/backend/internal/database/gorm_slog_logger.go
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"log/slog"
+ "strings"
"time"
"gorm.io/gorm"
@@ -48,6 +49,20 @@ func (l *slogGormLogger) Error(ctx context.Context, msg string, data ...interfac
slog.ErrorContext(ctx, msg, slog.Any("data", data))
}
+const maxSQLLen = 500
+
+func sanitizeSQL(s string) string {
+ if s == "" {
+ return s
+ }
+ // Trim and convert any whitespace/newlines/tabs to single spaces
+ oneLine := strings.Join(strings.Fields(s), " ")
+ if len(oneLine) > maxSQLLen {
+ return oneLine[:maxSQLLen] + "…"
+ }
+ return oneLine
+}
+
func (l *slogGormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) {
if l.level == logger.Silent {
return
@@ -55,33 +70,38 @@ func (l *slogGormLogger) Trace(ctx context.Context, begin time.Time, fc func() (
elapsed := time.Since(begin)
sql, rows := fc()
+ sql = sanitizeSQL(sql)
+
+ attrs := []slog.Attr{
+ slog.Int64("elapsed_ms", elapsed.Milliseconds()),
+ }
+ if rows >= 0 {
+ attrs = append(attrs, slog.Int64("rows", rows))
+ }
+ if sql != "" {
+ attrs = append(attrs, slog.String("sql", sql))
+ }
+
+ // convert []slog.Attr to []any for slog.*Context variadic parameter
+ anyAttrs := make([]any, len(attrs))
+ for i, a := range attrs {
+ anyAttrs[i] = a
+ }
if err != nil && l.level <= logger.Error {
if !l.ignoreRecordNotFoundError || !errors.Is(err, gorm.ErrRecordNotFound) {
- slog.ErrorContext(ctx, "gorm.trace",
- slog.Duration("elapsed", elapsed),
- slog.Int64("rows", rows),
- slog.String("sql", sql),
- slog.String("error", err.Error()),
- )
+ anyAttrs = append(anyAttrs, slog.String("error", err.Error()))
+ slog.ErrorContext(ctx, "gorm.error", anyAttrs...)
}
return
}
if l.slowThreshold > 0 && elapsed > l.slowThreshold && l.level <= logger.Warn {
- slog.WarnContext(ctx, "gorm.slow_query",
- slog.Duration("elapsed", elapsed),
- slog.Int64("rows", rows),
- slog.String("sql", sql),
- )
+ slog.WarnContext(ctx, "gorm.slow_query", anyAttrs...)
return
}
if l.level <= logger.Info {
- slog.InfoContext(ctx, "gorm.query",
- slog.Duration("elapsed", elapsed),
- slog.Int64("rows", rows),
- slog.String("sql", sql),
- )
+ slog.InfoContext(ctx, "gorm.query", anyAttrs...)
}
}
diff --git a/backend/internal/services/image_update_service.go b/backend/internal/services/image_update_service.go
index 1427da5f8..6d37d0adb 100644
--- a/backend/internal/services/image_update_service.go
+++ b/backend/internal/services/image_update_service.go
@@ -517,13 +517,9 @@ func (s *ImageUpdateService) getImageRefByID(ctx context.Context, imageID string
return "", fmt.Errorf("image not found: %w", err)
}
- fmt.Printf("DEBUG: RepoTags: %v\n", inspectResponse.RepoTags)
- fmt.Printf("DEBUG: RepoDigests: %v\n", inspectResponse.RepoDigests)
-
if len(inspectResponse.RepoTags) > 0 {
for _, tag := range inspectResponse.RepoTags {
if tag != "<none>:<none>" {
- fmt.Printf("DEBUG: Using RepoTag: %s\n", tag)
return tag, nil
}
}
@@ -535,7 +531,6 @@ func (s *ImageUpdateService) getImageRefByID(ctx context.Context, imageID string
digestParts := strings.Split(digest, "@")
if len(digestParts) == 2 {
imageRef := digestParts[0] + ":latest"
- fmt.Printf("DEBUG: Using RepoDigest as: %s\n", imageRef)
return imageRef, nil
}
}
diff --git a/backend/internal/services/settings_service.go b/backend/internal/services/settings_service.go
index d7a1cfd28..a1857523a 100644
--- a/backend/internal/services/settings_service.go
+++ b/backend/internal/services/settings_service.go
@@ -102,8 +102,6 @@ func (s *SettingsService) SyncOidcEnvToDatabase(ctx context.Context) ([]models.S
return nil, fmt.Errorf("failed to marshal OIDC config from env: %w", err)
}
- fmt.Printf("DEBUG: OIDC config JSON being saved: %s\n", string(oidcConfigBytes))
-
// Force update the settings directly to bypass empty value checks
err = s.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
// Force update AuthOidcEnabled
diff --git a/docker-compose.yml b/docker-compose.yml
index 6d0f08e58..094a173d0 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -3,44 +3,17 @@ services:
image: ghcr.io/ofkm/arcane:latest
container_name: arcane
ports:
- - '3000:3000' # Exposes Arcane's web interface on port 3000 of the host.
+ - '3552:3552'
volumes:
- # Mount the Docker socket to allow Arcane to manage Docker.
- /var/run/docker.sock:/var/run/docker.sock
- # Mount a volume for Arcane's persistent data (stacks, settings, etc.).
- # Replace './arcane-data' with your preferred host path.
- - ./arcane-data:/app/data
- # This is where you existing stack files are located if you want to import them, when arcane tries
- # to import it it will need to read from the path the compose file is at, hence why onl read only is needed.
- - /opt/my-docker-stacks:/opt/my-docker-stacks:ro # Host path : Container path
+ - arcane-data:/app/data
+ - /host/path/to/stacks:/app/data/stacks
environment:
- - APP_ENV=production # Sets the application environment to production.
+ - PUID=1000
+ - PGID=1000
+ - ENCRYPTION_KEY=xxxxxxxxxxxxxxxxxxxxxx
+ - JWT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxx
+ restart: unless-stopped
- # --- User and Group ID Configuration (Optional but Recommended for Volume Permissions) ---
- # These variables control the user and group Arcane runs as inside the container.
- # Matching these to your host user's UID/GID can help avoid permission issues
- # with the mounted /app/data volume.
- - PUID=1000 # User ID for the 'arcane' user inside the container. Defaults to 1000.
- - PGID=1000 # Group ID for the 'arcane' group inside the container. Defaults to 1000.
-
- # --- Docker Group ID (Usually Handled Automatically) ---
- # - DOCKER_GID=998 # GID for the 'docker' group inside the container.
- # The entrypoint script typically auto-detects and sets this based on the
- # GID of the mounted /var/run/docker.sock.
- # Only set this if you have a specific need or the auto-detection fails.
-
- # --- Session Configuration ---
- # Generate a strong secret using: openssl rand -base64 32
- - PUBLIC_SESSION_SECRET=your-secure-random-32-character-string-here
-
- # --- Advanced/Debugging (Uncomment if needed) ---
- # - PUBLIC_ALLOW_INSECURE_COOKIES=true # Uncomment only for local HTTP testing without SSL/TLS.
- # - NODE_ENV=development # For development-specific behaviors (not recommended for production).
-
- restart: unless-stopped # Ensures the container restarts automatically unless manually stopped.
-
-# Optional: Define the volume if you want Docker to manage it explicitly.
-# This allows for easier management with `docker volume` commands.
-# volumes:
-# arcane-data:
-# driver: local # Or your preferred volume driver
+volumes:
+ arcane-data:
diff --git a/frontend/.env.example b/frontend/.env.example
index a904f4a9f..922897167 100644
--- a/frontend/.env.example
+++ b/frontend/.env.example
@@ -1 +1,2 @@
-APP_ENV=production
+APP_ENV=development
+DEV_BACKEND_URL=http://localhost:3552
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index 9a1cf171a..0a3a257d3 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -8,7 +8,7 @@ export default defineConfig({
host: process.env.HOST,
proxy: {
'/api': {
- target: process.env.DEV_BACKEND_URL || 'http://localhost:8080'
+ target: process.env.DEV_BACKEND_URL || 'http://localhost:3552'
}
}
}