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.
This commit is contained in:
Jose Diaz-Gonzalez
2026-04-30 00:01:54 -04:00
parent 58042b9330
commit cdbc91048a

View File

@@ -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)
}