OPC # 0007: Patch FDEV provisioning for local aspire development

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
amadzarak
2026-04-26 12:48:02 -04:00
parent af573a8aff
commit 25c937e41c
3 changed files with 22 additions and 38 deletions
+8 -35
View File
@@ -3,53 +3,27 @@ using Scalar.Aspire;
var builder = DistributedApplication.CreateBuilder(args);
#region MINIO
var minio = builder.AddMinioContainer("minio");
#region EXTERNAL CONNECTIONS OPC infra (postgres, minio)
// Connection strings are declared in appsettings.Development.json and point at the
// fdev tenant on the shared OPC platform infra running via OPC/infra/docker-compose.yml.
var postgresdb = builder.AddConnectionString("postgresdb");
var minio = builder.AddConnectionString("minio");
#endregion
#region REDIS
var cache = builder.AddRedis("cache");
#endregion
#region POSTGRESQL AND PGADMIN
var postgres = builder.AddPostgres("postgres")
.WithLifetime(ContainerLifetime.Persistent)
.WithHostPort(5432)
.WithPgAdmin();
var postgresdb = postgres.AddDatabase("postgresdb");
#endregion
#region KEYCLOAK
var keycloakDb = postgres.AddDatabase("authdb");
var keycloak = builder.AddKeycloak("keycloak", 8080)
.WithEnvironment(async ctx =>
{
var connString = await keycloakDb.Resource.ConnectionStringExpression.GetValueAsync(CancellationToken.None);
var conn = new Npgsql.NpgsqlConnectionStringBuilder(connString);
ctx.EnvironmentVariables["KC_DB"] = "postgres";
ctx.EnvironmentVariables["KC_DB_URL"] = $"jdbc:postgresql://postgres:5432/{keycloakDb.Resource.DatabaseName}";
ctx.EnvironmentVariables["KC_DB_USERNAME"] = conn.Username!;
ctx.EnvironmentVariables["KC_DB_PASSWORD"] = conn.Password!;
})
.WaitFor(keycloakDb)
.WithRealmImport("KeycloakConfig/");
#endregion
#region EFCORE MIGRATION WORKER
var migrations = builder.AddProject<Projects.Clarity_MigrationService>("clarity-migrationservice")
.WithReference(postgresdb)
.WaitFor(postgresdb);
.WithReference(postgresdb);
#endregion
#region REST API
var server = builder.AddProject<Projects.Clarity_Server>("server")
.WaitFor(keycloak)
.WithReference(cache)
.WithReference(postgresdb)
.WaitFor(cache)
.WaitFor(postgresdb)
.WithReference(migrations)
.WithReference(minio)
.WaitForCompletion(migrations)
@@ -60,11 +34,10 @@ var server = builder.AddProject<Projects.Clarity_Server>("server")
#region REACT
var webfrontend = builder.AddViteApp("webfrontend", "../frontend")
.WaitFor(keycloak)
.WithReference(server)
.WaitFor(server)
.WithEnvironment("VITE_KEYCLOAK_URL", keycloak.GetEndpoint("http"))
.WithEnvironment("VITE_KEYCLOAK_REALM", "clarity")
.WithEnvironment("VITE_KEYCLOAK_URL", "https://keycloak.clarity.test")
.WithEnvironment("VITE_KEYCLOAK_REALM", "clarity-fdev-app-clarity-01000000")
.WithEnvironment("VITE_KEYCLOAK_CLIENT_ID", "clarity-web-app");
server.PublishWithContainerFiles(webfrontend, "wwwroot");