fix: update MinIO container to use quay.io mirror and add EF migrations on startup
This commit is contained in:
parent
3b449f46e0
commit
535a59f092
2 changed files with 10 additions and 1 deletions
|
|
@ -46,7 +46,8 @@ public sealed class IntegrationTestFixture : IAsyncLifetime
|
||||||
private readonly PostgreSqlContainer _postgres = new PostgreSqlBuilder("postgres:16") // ให้ตรงกับ docker-compose ของ dev
|
private readonly PostgreSqlContainer _postgres = new PostgreSqlBuilder("postgres:16") // ให้ตรงกับ docker-compose ของ dev
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
private readonly MinioContainer _minio = new MinioBuilder("minio/minio:latest")
|
// quay.io mirror — Docker Hub ทำ minio/minio เป็น private แล้ว (เดียวกับ docker-compose)
|
||||||
|
private readonly MinioContainer _minio = new MinioBuilder("quay.io/minio/minio:latest")
|
||||||
.WithUsername(MinioUser)
|
.WithUsername(MinioUser)
|
||||||
.WithPassword(MinioPassword)
|
.WithPassword(MinioPassword)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,14 @@ if (devHttpsEnabled)
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
// สร้าง/อัปเดต schema ด้วย EF migrations ทุกครั้งที่สตาร์ท (idempotent — apply เฉพาะ migration ที่ยังค้าง)
|
||||||
|
// DB ไม่พร้อม = ให้ตายตรงนี้เลย ดีกว่าขึ้นมาแล้วเงียบๆ แล้ว 500 ทุก request
|
||||||
|
await using (var scope = app.Services.CreateAsyncScope())
|
||||||
|
{
|
||||||
|
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||||
|
await db.Database.MigrateAsync();
|
||||||
|
}
|
||||||
|
|
||||||
// FR-16 — ไฟล์ร่างอยู่ใต้ prefix `drafts/` ของ bucket versions: ตั้ง lifecycle ให้หมดอายุเอง (idempotent)
|
// FR-16 — ไฟล์ร่างอยู่ใต้ prefix `drafts/` ของ bucket versions: ตั้ง lifecycle ให้หมดอายุเอง (idempotent)
|
||||||
// best-effort — MinIO ยังไม่พร้อมตอนสตาร์ทก็แค่ log เตือน ไม่บล็อก (ไฟล์ร่างจะค้างนานขึ้นเท่านั้น)
|
// best-effort — MinIO ยังไม่พร้อมตอนสตาร์ทก็แค่ log เตือน ไม่บล็อก (ไฟล์ร่างจะค้างนานขึ้นเท่านั้น)
|
||||||
try
|
try
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue