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); var builder = DistributedApplication.CreateBuilder(args);
#region MINIO #region EXTERNAL CONNECTIONS OPC infra (postgres, minio)
var minio = builder.AddMinioContainer("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 #endregion
#region REDIS #region REDIS
var cache = builder.AddRedis("cache"); var cache = builder.AddRedis("cache");
#endregion #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 #region EFCORE MIGRATION WORKER
var migrations = builder.AddProject<Projects.Clarity_MigrationService>("clarity-migrationservice") var migrations = builder.AddProject<Projects.Clarity_MigrationService>("clarity-migrationservice")
.WithReference(postgresdb) .WithReference(postgresdb);
.WaitFor(postgresdb);
#endregion #endregion
#region REST API #region REST API
var server = builder.AddProject<Projects.Clarity_Server>("server") var server = builder.AddProject<Projects.Clarity_Server>("server")
.WaitFor(keycloak)
.WithReference(cache) .WithReference(cache)
.WithReference(postgresdb) .WithReference(postgresdb)
.WaitFor(cache) .WaitFor(cache)
.WaitFor(postgresdb)
.WithReference(migrations) .WithReference(migrations)
.WithReference(minio) .WithReference(minio)
.WaitForCompletion(migrations) .WaitForCompletion(migrations)
@@ -60,11 +34,10 @@ var server = builder.AddProject<Projects.Clarity_Server>("server")
#region REACT #region REACT
var webfrontend = builder.AddViteApp("webfrontend", "../frontend") var webfrontend = builder.AddViteApp("webfrontend", "../frontend")
.WaitFor(keycloak)
.WithReference(server) .WithReference(server)
.WaitFor(server) .WaitFor(server)
.WithEnvironment("VITE_KEYCLOAK_URL", keycloak.GetEndpoint("http")) .WithEnvironment("VITE_KEYCLOAK_URL", "https://keycloak.clarity.test")
.WithEnvironment("VITE_KEYCLOAK_REALM", "clarity") .WithEnvironment("VITE_KEYCLOAK_REALM", "clarity-fdev-app-clarity-01000000")
.WithEnvironment("VITE_KEYCLOAK_CLIENT_ID", "clarity-web-app"); .WithEnvironment("VITE_KEYCLOAK_CLIENT_ID", "clarity-web-app");
server.PublishWithContainerFiles(webfrontend, "wwwroot"); server.PublishWithContainerFiles(webfrontend, "wwwroot");
@@ -4,5 +4,9 @@
"Default": "Information", "Default": "Information",
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
},
"ConnectionStrings": {
"postgresdb": "Host=localhost;Port=5432;Database=clarity_fdev_app_clarity_01000000;Username=postgres;Password=postgres",
"minio": "Endpoint=http://localhost:9000/;AccessKey=minioadmin;SecretKey=minioadmin"
} }
} }
+10 -3
View File
@@ -5,7 +5,14 @@
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },
"ConnectionStrings": { "Keycloak": {
"postgresdb": "Host=localhost;Port=56235;Database=postgresdb;Username=postgres;Password=WdW+Q3wzq.Ssuzq6rT4A}_" "Realm": "clarity-fdev-app-clarity-01000000",
} "BaseUrl": "https://keycloak.clarity.test",
"InternalUrl": "http://localhost:8080"
},
"Vault": {
"Address": "http://localhost:8200",
"Token": "hvs.YLYBCUXgeJM3Gq4C10tWBWjw"
},
"Tenant__Id": "fdev-app-clarity-01000000"
} }