fixup! chore: move directory setup from Helm initContainers to Dockerfiles

This commit is contained in:
2026-01-03 08:39:34 +00:00
parent e6fe925dcb
commit 72143ecd3d
3 changed files with 16 additions and 5 deletions
+3 -1
View File
@@ -285,7 +285,9 @@ metadata:
size: "10Gi" size: "10Gi"
accessMode: "ReadWriteOnce" accessMode: "ReadWriteOnce"
existingClaim: "" existingClaim: ""
walMode: true # WAL mode provides better concurrency but doesn't work on network filesystems (SMB, NFS)
# Set to false when using network storage for the metadata volume
walMode: false
# PostgreSQL configuration # PostgreSQL configuration
postgresql: postgresql:
+4 -2
View File
@@ -120,7 +120,8 @@ func (a *App) initializeComponents() error {
switch a.config.Metadata.Backend { switch a.config.Metadata.Backend {
case "sqlite": case "sqlite":
a.metadata, err = metasqlite.New(metasqlite.Config{ a.metadata, err = metasqlite.New(metasqlite.Config{
Path: a.config.Metadata.Connection, Path: a.config.Metadata.Connection,
WALMode: a.config.Metadata.SQLite.WALMode,
}) })
case "file": case "file":
a.metadata, err = metafile.New(metafile.Config{ a.metadata, err = metafile.New(metafile.Config{
@@ -128,7 +129,8 @@ func (a *App) initializeComponents() error {
}) })
default: default:
a.metadata, err = metasqlite.New(metasqlite.Config{ a.metadata, err = metasqlite.New(metasqlite.Config{
Path: "gohoarder.db", Path: "gohoarder.db",
WALMode: false, // Default to DELETE mode for compatibility
}) })
} }
if err != nil { if err != nil {
+9 -2
View File
@@ -27,6 +27,7 @@ type Config struct {
Path string // Database file path Path string // Database file path
MaxOpenConns int // Maximum open connections MaxOpenConns int // Maximum open connections
MaxIdleConns int // Maximum idle connections MaxIdleConns int // Maximum idle connections
WALMode bool // Enable WAL mode (should be false for network filesystems)
} }
const schema = ` const schema = `
@@ -134,8 +135,14 @@ func New(cfg Config) (*SQLiteStore, error) {
cfg.MaxIdleConns = 5 cfg.MaxIdleConns = 5
} }
// Open database with WAL mode for better concurrency // Build DSN with journal mode based on configuration
dsn := fmt.Sprintf("%s?_journal_mode=WAL&_busy_timeout=5000&_synchronous=NORMAL&_cache_size=2000", cfg.Path) // WAL mode is better for concurrency but doesn't work on network filesystems (SMB, NFS)
// Use DELETE mode for network filesystems for compatibility
journalMode := "DELETE"
if cfg.WALMode {
journalMode = "WAL"
}
dsn := fmt.Sprintf("%s?_journal_mode=%s&_busy_timeout=5000&_synchronous=NORMAL&_cache_size=2000", cfg.Path, journalMode)
db, err := sql.Open("sqlite", dsn) db, err := sql.Open("sqlite", dsn)
if err != nil { if err != nil {
return nil, errors.Wrap(err, errors.ErrCodeStorageFailure, "failed to open SQLite database") return nil, errors.Wrap(err, errors.ErrCodeStorageFailure, "failed to open SQLite database")