-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
fix: evtrigs ownership #1489
fix: evtrigs ownership #1489
Conversation
279b824
to
3ca8994
Compare
@steve-chavez left a couple of comments, but looks good overall + thanks for tackling this. @staaldraad might be worth reviewing this from security perspective in case you see some issue we don't here. |
@steve-chavez I guess the other review point on this PR is that we should definitely run through thorough testing in a local infra context to make sure everything works as expected. I'll follow up with you directly on it. |
hi @steve-chavez, @samrose, I want to ask if this MR breaks the self-hosted version. https://github.com/supabase/supabase/blob/884743ac306461b2ac6389bbf15e963679d911c4/docker/docker-compose.yml#L392 And there is a 00-schema.sql which copied in ansible playbook, located inside Dockerfile-15 and Dockerfile-orioledb-17 files. |
Hi @nthtrung09it folks who self host need some form of self-created upgrade support. We don't provide self-hosted upgrade support across our versions, and don't have it on our roadmap. So it is up to people who self host to create a pathway to migrate between versions. We do open source the fundamentals of our own upgrade path. You may be able to adapt those to your approach, and they are found here https://github.com/supabase/postgres/tree/develop/ansible/files/admin_api_scripts/pg_upgrade_scripts the tool being used is |
If you question is just about making the docker-compose.yml file in |
@samrose Yes, it's very cool to update Dockerfile and compose files for the self-hosted version. As I mentioned above, there are 3 files (98-webhooks.sql, 99-roles.sql, 99-jwt.sql) in docker-compose.yml in supabase/supabase and 1 file (00-schema.sql) in the Dockerfile. |
We'll take a look thanks @nthtrung09it |
3ca8994
to
f0f2d12
Compare
f0f2d12
to
ab132c4
Compare
Fixes #1437 + Moves migrations/db/init-scripts to migrations/db/migrations. + Make initial migrations idempotent. + Adds test for event triggers.
ab132c4
to
2db5569
Compare
Previously the pgtap tests on postgres/migrations/tests/database/privs.sql Lines 11 to 19 in 2db5569
Hid the reason of the failure, which was uncovered thanks to #1496:
See ci logs. This means that the |
@nthtrung09it It doesn't look like it does. Those The migrations should be preserved given the following: Line 190 in 2db5569
postgres/Dockerfile-orioledb-17 Line 199 in 2db5569
That being said, ideally we should build the Dockerfile directly from Nix, so tests passing would ensure the docker image builds. |
-- These are required so that the users receive grants whenever "postgres" creates tables/function | ||
grant usage on schema public to postgres, anon, authenticated, service_role; | ||
alter default privileges in schema public grant all on tables to postgres, anon, authenticated, service_role; | ||
alter default privileges in schema public grant all on functions to postgres, anon, authenticated, service_role; | ||
alter default privileges in schema public grant all on sequences to postgres, anon, authenticated, service_role; | ||
alter default privileges for role postgres in schema public grant all on tables to postgres, anon, authenticated, service_role; | ||
alter default privileges for role postgres in schema public grant all on functions to postgres, anon, authenticated, service_role; | ||
alter default privileges for role postgres in schema public grant all on sequences to postgres, anon, authenticated, service_role; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was missing before, now it's much cleaner and explicit.
echo "Running migrations tests" | ||
pg_prove -p 5435 -U supabase_admin -h localhost -d postgres -v ${./migrations/tests}/test.sql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving this after the regression tests, which offer better error reporting.
2. Run all `db/migrations` with `supabase_admin` superuser role. | ||
3. Finalize role passwords with `/etc/postgresql.schema.sql` if present. | ||
1. Run all `db/migrations` with `supabase_admin` superuser role. | ||
2. Finalize role passwords with `/etc/postgresql.schema.sql` if present. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there is a way to test that these ownerships won't regress toward the end of the AMI build too? That kind of testing has proven valuable over time/worth covering usually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you covered this now
Fixes #1437 (comment).
Moves migrations/db/init-scripts to migrations/db/migrations.