Migrate to Blazor WASM, MSSQL platform DB, and durable audio PVC.
build-and-deploy / deploy (push) Failing after 15m11s
build-and-deploy / deploy (push) Failing after 15m11s
Remove in-cluster Postgres; serve WASM via nginx; add audio import job for Gooya archives.
This commit is contained in:
@@ -56,23 +56,33 @@ public static class TafsirEndpoints
|
||||
return Results.Ok(detail);
|
||||
});
|
||||
|
||||
group.MapGet("/audio/{episodeId:guid}", async (Guid episodeId, AppDbContext db, IWebHostEnvironment env, CancellationToken ct) =>
|
||||
group.MapGet("/audio/{episodeId:guid}", async (Guid episodeId, AppDbContext db, IConfiguration config, IWebHostEnvironment env, CancellationToken ct) =>
|
||||
{
|
||||
var episode = await db.Episodes.AsNoTracking().FirstOrDefaultAsync(e => e.Id == episodeId, ct);
|
||||
if (episode is null) return Results.NotFound();
|
||||
|
||||
var relative = episode.AudioUrl.TrimStart('/');
|
||||
var path = Path.Combine(env.ContentRootPath, "wwwroot", relative);
|
||||
if (!File.Exists(path))
|
||||
var audioRoot = config["AudioRoot"] ?? "/data/audio";
|
||||
var relative = episode.AudioUrl.TrimStart('/').Replace('\\', '/');
|
||||
|
||||
// Prefer PVC mount; fallback to wwwroot for local sample files
|
||||
var candidates = new[]
|
||||
{
|
||||
// Fallback placeholder: return empty audio-friendly response path for demo
|
||||
var placeholder = Path.Combine(env.ContentRootPath, "wwwroot", "audio", "silence.mp3");
|
||||
if (File.Exists(placeholder))
|
||||
return Results.File(placeholder, "audio/mpeg", enableRangeProcessing: true);
|
||||
return Results.NotFound();
|
||||
Path.Combine(audioRoot, relative),
|
||||
Path.Combine(env.ContentRootPath, "wwwroot", relative),
|
||||
Path.Combine(env.ContentRootPath, "wwwroot", "audio", Path.GetFileName(relative))
|
||||
};
|
||||
|
||||
foreach (var path in candidates)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
return Results.File(path, "audio/mpeg", enableRangeProcessing: true);
|
||||
}
|
||||
|
||||
return Results.File(path, "audio/mpeg", enableRangeProcessing: true);
|
||||
var silence = Path.Combine(env.ContentRootPath, "wwwroot", "audio", "silence.mp3");
|
||||
if (File.Exists(silence))
|
||||
return Results.File(silence, "audio/mpeg", enableRangeProcessing: true);
|
||||
|
||||
return Results.NotFound();
|
||||
});
|
||||
|
||||
return group;
|
||||
|
||||
@@ -47,7 +47,8 @@ using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
try
|
||||
{
|
||||
await DbSeeder.SeedAsync(db);
|
||||
var audioRoot = app.Configuration["AudioRoot"] ?? "/data/audio";
|
||||
await DbSeeder.SeedAsync(db, audioRoot);
|
||||
break;
|
||||
}
|
||||
catch (Exception ex) when (attempt < 30)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"Default": "Host=localhost;Port=5434;Database=tafsirquran;Username=tafsir;Password=tafsir_dev"
|
||||
"Default": "Server=localhost,31433;Database=TafsirQuran;User Id=sa;Password=87zH26nbqT;TrustServerCertificate=True"
|
||||
},
|
||||
"AudioRoot": "/data/audio",
|
||||
"Jwt": {
|
||||
"Key": "TafsirQuran-Dev-Secret-Key-Change-In-Production-32+",
|
||||
"Issuer": "TafsirQuran",
|
||||
|
||||
Reference in New Issue
Block a user