private static void BaselineUpdate(EndecaApplication app, bool applyNewIndex) { Logger.Info("Baseline update in progress ..."); Logger.Info("Merging web studio and dev studio configs ..."); EacGateway.Instance.StartScript(app.AppId, "PreForgeConfigMerge"); RunForge(app, app.Forges[BaselineForge]); RunDgidx(app.Dgidx); var cluster = new DgraphCluster(app); // Baseline update scenario // 1. Clean local temp folder // 2. Clean local updates folder // 3. Distrubute index // 4. Apply index // 5. Archive updates folder CleanFoldersAndDistributeIndex(cluster); TestIndex(cluster); if (applyNewIndex) { ApplyIndex(app); } Logger.Info("Updating post-forge web studio dimensions ..."); EacGateway.Instance.StartScript(app.AppId, "PostForgeConfigUpdate"); Logger.Info("Baseline update complete!"); }
private static void PartialUpdate(EndecaApplication app) { // Partial updates scenario // 1. Distribute update // 2. Apply update // 2.1. Apply update // 2.2. Copy update file to cumulative updates folder // 2.3. Clean updates foder Logger.Info("Partial update in progress ..."); var forge = app.Forges[PartialForge]; Debug.Assert(forge != null); forge.ArchiveLog(false); Logger.Info("Forging..."); forge.Run(); if (forge.IsFailed) { throw new ControlScriptException(forge.FailureMessage); } var cluster = new DgraphCluster(app); Logger.Info("Distributing update to remote hosts..."); cluster.DistributeUpdate(forge); Logger.Info("Applying updates ..."); cluster.ApplyUpdate(); Logger.Info("Update complete!"); }
private static void ApplyIndex(EndecaApplication app) { var cluster = new DgraphCluster(app); Logger.Info("Applying index ..."); cluster.ApplyIndex(PauseBetweenUpdates); RollLogServerLog(app); }
private static void CleanFoldersAndDistributeIndex(DgraphCluster cluster) { Logger.Info("Cleaning local distribution folder on remote hosts ..."); cluster.CleanLocalIndexDistributionDir(); Logger.Info("Cleaning local update folder on remote hosts ..."); cluster.CleanLocalUpdatesDir(); Logger.Info("Distributing index to remote hosts..."); cluster.DistributeIndex(); }
private static void TestIndex(DgraphCluster cluster) { Logger.Info("Testing index ..."); var indexOk = cluster.ApplyIndex(new[] { IndexTestHostId }); if (!indexOk) { throw new ControlScriptException( String.Format("Index test failed on {0}. At least one Dgraph instance failed to start.", IndexTestHostId)); } }
private static void RollbackIndex(EndecaApplication app) { Logger.Info("Rolling back index ..."); if (app.Dgidx.RollbackIndex()) { var cluster = new DgraphCluster(app); CleanFoldersAndDistributeIndex(cluster); TestIndex(cluster); ApplyIndex(app); } else { Logger.Warn("Rolling back index failed!"); } }