🛡️ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!
Container startup loop fixed
sassanix9f123776e8f9
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6378351..9ea2005 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,4 +1,13 @@# Changelog++## 1.0.1 - 2025-10-26++### Fixed+- Container startup loop caused by insufficient PostgreSQL privileges in the startup permissions script.+ - Wrapped the `ALTER ROLE ... CREATEROLE` in a safe DO block with exception handling so missing privilege is logged as a NOTICE and startup continues.+ - No feature changes; service now starts normally without elevated DB privileges.+ - _Files: `backend/fix_permissions.sql`_+## 1.0.0 - 2025-10-24### Addeddiff --git a/backend/fix_permissions.sql b/backend/fix_permissions.sqlindex 7337a66..1eaed33 100644--- a/backend/fix_permissions.sql+++ b/backend/fix_permissions.sql@@ -1,7 +1,18 @@-- Script to fix PostgreSQL permissions for db_user--- Grant role management privileges (removed SUPERUSER)-ALTER ROLE %(db_user)s WITH CREATEROLE;+DO $$+BEGIN+ -- Try to grant CREATEROLE, but continue if it fails+ BEGIN+ ALTER ROLE %(db_user)s WITH CREATEROLE;+ RAISE NOTICE 'Successfully granted CREATEROLE to %(db_user)s';+ EXCEPTION WHEN insufficient_privilege THEN+ RAISE NOTICE 'Insufficient privileges to grant CREATEROLE to %(db_user)s - this is optional and the application will work without it';+ WHEN OTHERS THEN+ RAISE NOTICE 'Could not grant CREATEROLE to %(db_user)s - this is optional and the application will work without it';+ END;+END+$$;-- Ensure all database objects are accessibleGRANT ALL PRIVILEGES ON DATABASE %(db_name)s TO %(db_user)s;@@ -45,4 +56,4 @@ BEGINRAISE NOTICE 'Error changing ownership of function %%: %%', rec.proname, SQLERRM;END;END LOOP;-END $$;+END $$;