From cdbc91048a5cf1c9acbd2df1862b4ed9022a8a86 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 30 Apr 2026 00:01:54 -0400 Subject: [PATCH] fix: chown the storage registry tree to the dokku user The install trigger created /var/lib/dokku/data/storage-registry and its entries / migrations subdirectories as root with mode 0755, so the dokku user that runs storage:create couldn't write entry JSON files or migration flag files into them. Mirrors what PropertySetup does for config/storage by calling SetPermissions on each registry path. This unblocks the bats coverage that was failing at the first storage:create call. --- plugins/storage/triggers.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/storage/triggers.go b/plugins/storage/triggers.go index 1d6cf9279..270b00812 100644 --- a/plugins/storage/triggers.go +++ b/plugins/storage/triggers.go @@ -35,6 +35,21 @@ func TriggerInstall() error { return err } + // The install trigger runs as root; the directories it just made are + // root-owned, but the dokku user is the one that runs storage:create + // and writes entry / migration-flag files into them. + for _, dir := range []string{RegistryDirectory(), EntriesDirectory(), migrationFlagDir()} { + if err := os.MkdirAll(dir, 0755); err != nil { + return fmt.Errorf("Unable to create %s: %s", dir, err.Error()) + } + if err := common.SetPermissions(common.SetPermissionInput{ + Filename: dir, + Mode: 0755, + }); err != nil { + return fmt.Errorf("Unable to set permissions on %s: %s", dir, err.Error()) + } + } + if err := MigrateLegacyMounts(); err != nil { return fmt.Errorf("storage migration failed: %w", err) }