Skip to content

[WIP] Major Upgrading of Supabase Postgres #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 95 commits into from
Jul 26, 2021

Conversation

dragarcia
Copy link
Contributor

@dragarcia dragarcia commented May 19, 2021

Primary Objectives

Secondary/ Resultant Objectives

  • Shift away from ANXS/postgresql
    • Inevitable if we want to reap the benefits of LSE on Graviton 2 instances
    • It does however open up the following long-term benefits:
      • Increased granularity in modifying PostgreSQL given that we are now building it from source.
      • Able to immediately upgrade to the most up-to-date versions of Postgres
        • Before, we would need to wait for the above role to ensure that the newest version is available under them.
        • Now, we can upgrade as soon as the newest Postgres version is out
    • Configure building Postgres from source
      • Arm
      • x86
    • Add checks to verify Postgres installation
    • Perform regression testing against other, existing tasks
      • Arm
      • x86
  • Ensure existing extensions are supported for Postgres 13
    • Arm
    • x86
  • Re-establish versioning policy
    • After much thinking, I've changed my mind and realised that following the versioning policy of PostgreSQL could potentially simplify things.
      • Major would be dictated by Postgres
        • Would therefore only change whenever there is a new major of Postgres (eg. Postgres 13, Postgres 14, etc.)
      • Minor would be dictated by Postgres
        • Would therefore only change whenever there is a new minor of Postgres (eg. Postgres 13.2, Postgres 13.3, etc.)
      • Patch would be dictated by us
        • Would change whenever other updates other than the above are made to the image (eg. new extensions, system enhancements, etc.)
      • With this PR, the next version could potentially be 13.3.0

dragarcia added 11 commits May 17, 2021 10:59
- LSE included
- Need additional changes before it is close to ANXS Postgres
- pg_hba.conf
- pg_ident.conf
- postgresql.conf
- postgresql.service
- Remove  values now handled by template files
- Add vars for Postgres building
- This is pre-installed in Ubuntu 20.04 images
- Installation of dependencies
- Compilation & Building
- Installation
- Init of DB
- Starting of DB upon boot
- will be re-enabled after testing for regressions
@dragarcia dragarcia mentioned this pull request Jun 3, 2021
@dragarcia dragarcia self-assigned this Jun 3, 2021
@heliumbrain
Copy link

@dragarcia any specifics I could help out with here? Using your image for most of my Postgres-usage, would love to see a 13 version :) I could help you look in to the compatability of exisiting extension if you'd like

@dragarcia
Copy link
Contributor Author

Hey @heliumbrain! 👋

I could help you look in to the compatability of exisiting extension if you'd like

I'm finishing up bumping the current versions of the existing extensions and testing them against Postgres 13. Should be pushing up the changes to this branch in the next few days. Would always be great to have another pair of eyes to see if everything is working 😄 .

Just wondering, how are you currently using the Supabase Postgres image? Do you build it yourself with this repository, or do you get it from either the AWS/ DO marketplace?

@heliumbrain
Copy link

Cool @dragarcia!

Sounds great. Happy to have a look once that is done.

I'm using the image as-is for a few projects and I'm building my own based on yours for some. Never tried it from one of the marketplaces

@dragarcia
Copy link
Contributor Author

Alright, great! I'll update you again once I get these changes in so you can build the latest version yourself and try it out.

dragarcia added 13 commits June 7, 2021 19:41
- Make sure they can run in PG13
- Ensure configurations are the same as the current version
- Ensure configurations for arm and x86 are correct respectively
- Open up new task mainly for starting postgres and running tests [WIP]
- Everything appears to have been installed without a problem
- now done and set in setup-system.yml
- also, starting of Postgres DB will be done here
dragarcia and others added 27 commits July 10, 2021 22:47
* feat: add queries for additional metrics

* chore: filter for realtime replication lag

* chore: add realtime replication slot active status

Co-authored-by: Wen Bo Xie <[email protected]>
feat: add queries for additional metrics (#59)
- make sure it's not there if pgbouncer is not installed
- Returns an error since internal build does not use postgrest
- allows to build in stages
* fix: update log rotation location

* fix: set up logrotation to execute every hour

This helps avoid situation where postgres logs would fill up the disk
under heavy usage conditions. Technically, it can still happen, but
should be exceedingly rare outside of abusive conditions.
- DB was not starting immediately
fix: pg_stat_statements column names changed in PG13
- includes tweaking of fail2ban settings
- This one would take hours to complete and would just burn credits
@dragarcia
Copy link
Contributor Author

Hi @heliumbrain, this took longer to complete than expected. I'll be merging this into develop now.

If you're still keen on building and trying out the image yourself (while we're in the midst of preparing the images for the AWS and Digital Ocean Marketplaces), you can always do so from the develop branch. Here are the steps to build your own image:

@dragarcia dragarcia merged commit 982ef70 into develop Jul 26, 2021
@dragarcia dragarcia deleted the feature/supabasePostgresV1.0 branch July 26, 2021 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants