-
Notifications
You must be signed in to change notification settings - Fork 97
Adding initial Supabase support #722
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
base: main
Are you sure you want to change the base?
Conversation
…figuration options
…t and improved documentation
…mprove HTTP endpoint definitions
…nt variables for modules
…ent variables for Studio, Realtime, Storage, Meta, Image Proxy, Logflare, and Edge Runtime services
… and streamline Postgres container setup
examples/supabase/CommunityToolkit.Aspire.Supabase.Api/Program.cs
Outdated
Show resolved
Hide resolved
...ase/CommunityToolkit.Aspire.Supabase.AppHost/CommunityToolkit.Aspire.Supabase.AppHost.csproj
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Aspire.Hosting.Supabase/SupabaseBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Aspire.Hosting.Supabase/SupabaseBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Aspire.Hosting.Supabase/SupabaseBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Aspire.Hosting.Supabase/SupabaseBuilderExtensions.cs
Show resolved
Hide resolved
src/CommunityToolkit.Aspire.Hosting.Supabase/SupabaseBuilderExtensions.cs
Show resolved
Hide resolved
src/CommunityToolkit.Aspire.Hosting.Supabase/SupabaseResource.cs
Outdated
Show resolved
Hide resolved
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 assume the commented out tests are there to remind you of API coverage to tackle
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.
Yes, that's correct
.WithDbContext<MyDbContext>((sp, options) => | ||
options.UseNpgsql( | ||
supabase.ConnectionStringExpression.GetValueAsync().Result)); |
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.
??? Why is this in the hosting integration, this isn't what any other database does. Also Task.Result....no please
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 just AI slop when i asked it to reformat the README.md to a more readable markdown i will do a proof read when i convert from draft to a normal PR.
Thanks catching it
int? apiPort = 8080, | ||
int? dbPort = null) |
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.
Leave these out and add methods
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.
Dont hardcode host ports
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.
Will do, this is a WIP PR, there are many things that are temporary, but i imagine i will fix a lot of them today.
…nce password management. Always add Postgres, Kong and Studio with AddSupabase as they are kind of necessary and removes boilerplate.
I added postgres, kong and studio to the Supbase resource as they are kinda of mandatory to have a working supabase experience.(i might add logflare as a default resource as well in the future) |
One feedback that i would like @aaronpowell or @davidfowl if you could help me out with your opinion. |
… and enhance parameter management for database and dashboard credentials.
…variables for endpoints and enhance modularity.
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.
@MarioGK, I left some nit-pick comments.
I have some thoughts about the public API shape.
I don't like AddAllSupabase
or WithAll
. These methods can not describe the resource and do not expose an appropriate API to mutate the resource.
Each module should add to the application model by calling WithXXX
method and each of these methods should expose a configureContainer
param to expose ability to mutate resource like adding an environment variable or changing the host port.
Look at WithDbGate for instance:
Aspire/src/CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions/PostgresBuilderExtensions.cs
Line 38 in a19aff3
public static IResourceBuilder<PostgresServerResource> WithDbGate(this IResourceBuilder<PostgresServerResource> builder, Action<IResourceBuilder<DbGateContainerResource>>? configureContainer = null, string? containerName = null) |
This is what I like:
builder.AddSupabase("supabase")
.WithKong(c=>
{
c.WithHostPort(32525); // configure kong host port
c.WithDataVolume(); // configure kong container volume
})
.WithRest(c=>
{
// configure rest resource here
});
So you should create Resource
per container and expose IResourceBuilder<TResource>
for that resource in the WithXXX
method.
Also it's good to expose WithDataVolume
, WithDataBindMount
and WithHostPort
for each resource.
This is another example. Here RedisInsight
is sub resource of Redis and we can configure the RedisInsight host port and data volume.
<DefaultTargetFramework>net9.0</DefaultTargetFramework> | ||
<TargetFrameworks>$(DefaultTargetFramework)</TargetFrameworks> | ||
<AllTargetFrameworks>$(DefaultTargetFramework);net9.0</AllTargetFrameworks> | ||
<AllTargetFrameworks>$(DefaultTargetFramework);net8.0</AllTargetFrameworks> |
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.
Why this change?
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 was having some problems running in my machine, will rollback it before converting from draft.
Dont know why net8 was not being recognized correctly
…dling and enhance logging during database creation.
Co-authored-by: Alireza Baloochi <alireza.baloochi1380@gmail.com>
I agree, it makes more sense this way and being more declarative and more explicit as well. Just to add the default AddSupabase will setup the following services/modules as they are required for the basic functions of the Studio(AKA the dashboard) to work properly: AddSupabase() will setup:
The modules that are going to be optional are:
|
…figuration options
**Closes #417 **
PR Checklist
Other information
This is just an initial and highly work in progress as Supabase has so many container dependecies and environments to set to make everything work together.