Skip to content
Discussion options

You must be logged in to vote

Hell @topfunet,
you can use MariaDB in Aspire by adding it as a generic container in your AppHost. Aspire doesn't have a built-in .AddMariaDb() helper yet, but you can define the container manually and pass the connection string via service discovery.
Something like:

var builder = DistributedApplication.CreateBuilder(args);

var mariadb = builder.AddContainer("mariadb", "mariadb", "version")
    .WithEnvironment("MARIADB_ROOT_PASSWORD", "rootpass")
    .WithEnvironment("MARIADB_DATABASE", "AppDb")
    .WithEnvironment("MARIADB_USER", "appuser")
    .WithEnvironment("MARIADB_PASSWORD", "apppass")
    .WithPort(3306);

builder.AddProject<Projects.WebApi>("webapi")
    .WithReference(mariadb)

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@davidfowl
Comment options

Answer selected by davidfowl
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #7383 on February 03, 2025 09:11.