mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-10-28 07:41:27 +00:00
feat(preview): real preview environments — clone, deploy, TTL, promote (#67)
Preview environments were bookkeeping only: a fabricated deployment row marked "running" and a fake *.preview.containr.local URL. Now a preview is a real service clone — full config copy (source, env, volumes, access), git_branch pinned to the requested branch, its own preview hostname under the clone's node default domain, and a real deployment through the queue. - cloneServiceRow extracted from handleCloneService for reuse - preview_environments.preview_service_id links to the clone - minute sweeper: expires past-TTL previews (removes clone runtime + row) and syncs preview status from the clone's live service status - delete/cleanup paths tear the clone down, not just the row - promote redeploys the SOURCE service at the preview branch and retires the clone — a real deployment, not a pending stub Verified live: create → clone → deploy → running container; TTL expiry → clone + container gone; promote → real deploy on the source, preview stopped. Unit test covers the DNS-safe clone naming. Generated with [Devin](https://devin.ai) Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
d5909172ae
commit
dd7b735b38
8 files changed
+397
-122
No files matched your search
@@ -111,6 +111,7 @@ func SetupRoutes(router *gin.Engine, db *database.DB, redis *database.Redis, cfg
|
||||
|
||||
// Sleep sweeper — scales idle services to zero and prunes wake containers.
|
||||
StartSleepSweeper(context.Background(), db, dockerClient, deploymentEngine, cfg.Port)
|
||||
StartPreviewSweeper(context.Background(), db, deploymentEngine)
|
||||
|
||||
// Audit retention — prunes rows past AUDIT_RETENTION_DAYS (default 90).
|
||||
StartAuditRetention(context.Background(), db)
|
||||
|
||||
Reference in new issue
Block a user