change db into a StatefulSet - #89
Closed
SimoneLazzaris wants to merge 1 commit into
Closed
Conversation
Changed the DB component into a stateful set. This avoid having two instances of the DB running *on the same data*, which can happen with a deployment (i.e., during an update/reconfiguration). Also, added a shutdown command to properly shut down the database, to prevent data corruption.
|
Any updates on this? @SimoneLazzaris |
Author
|
Unfortunately, no news from the supabase development team. I'd like to have this patch applied |
|
yep, it should be merged. I did the same with my fork. :) |
|
I agree. |
kastakhov
added a commit
to wiseinfotec/helm-charts
that referenced
this pull request
Jul 27, 2025
Merging some pull requests from [original](https://github.com/supabase-community/supabase-kubernetes) repository. - supabase-community/supabase-kubernetes#62 - supabase-community/supabase-kubernetes#89 - supabase-community/supabase-kubernetes#91 - supabase-community/supabase-kubernetes#94 - supabase-community/supabase-kubernetes#95 - supabase-community/supabase-kubernetes#96 - supabase-community/supabase-kubernetes#101 - supabase-community/supabase-kubernetes#106 - supabase-community/supabase-kubernetes#107 - supabase-community/supabase-kubernetes#113 --------- Co-authored-by: Varantha <sam@kiessler.co.uk> Co-authored-by: naki3004 <45875285+naki3004@users.noreply.github.com> Co-authored-by: jingyu <francismajere@gmail.com> Co-authored-by: Chris Alfano <chris@jarv.us> Co-authored-by: Simone Lazzaris <slazzaris@gmail.com> Co-authored-by: Mikey032 <26899585+Mikey032@users.noreply.github.com> Co-authored-by: Upik Saleh <upxsal@gmail.com> Co-authored-by: Scott Beardsley <scott@beards.ly>
Contributor
|
Hey @SimoneLazzaris, thanks a lot for the contribution 🙏 Apologies that this important fix wasn’t merged earlier. This has now been addressed in PR #131, which also brings the key updates aligned with the 2025 Supabase setup. Going forward, we’ll make a conscious effort to keep this repository as up to date as possible, using the official docker-compose.yml as the reference: Cc @aantti |
Contributor
|
As mentioned, hopefully this was finally resolved. Closing :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changed the DB component into a stateful set. This avoid having two instances of the DB running on the same data, which can happen with a deployment (i.e., during an update/reconfiguration).
Also, added a shutdown command to properly shut down the database, to prevent data corruption.
What kind of change does this PR introduce?
The DB deployment is changed into a StatefulSet. Since there can only be one pod mounting and using the data volume at a time, the correct semantic is to use a StatefulSet.
What is the current behavior?
Using a deployment allows kubernetes to do rolling updates, which mean that a new pod is started on the same Persistent Volume while the old one is shutting down.
That can cause data corruption - which I've personally observed - when upgrading the helm chart.
What is the new behavior?
In the statefulset semantic, at most only one pod can be scheduled to run, so you don't have this issue.
I've also add a lifecycle command so that when the pod is shut down, postgres is commanded to shut down as well, so that it can close in a controlled fashion.