/// <summary> /// Call from the RoleEntryPoint.OnStart() method. /// </summary> /// <returns>true; throws exception is there is an error</returns> public bool OnStart() { if (_purgesites) { IisEnvironment.PurgeAllSites(); } _octopusDeploy.ConfigureTentacle(); _octopusDeploy.DeployAllCurrentReleasesToThisMachine(); return(true); }
/// <summary> /// Call from the RoleEntryPoint.Run() method. /// Note: This method is an infinite loop; call from a Thread/Task if you want to run other code alongside. /// </summary> public void Run() { // Don't want to configure IIS if we are emulating; just sleep forever if (RoleEnvironment.IsEmulated) { Thread.Sleep(-1); } while (true) { try { IisEnvironment.ActivateAppInitialisationModuleForAllSites(); } catch (Exception e) { Log.Warning(e, "Failure to configure IIS"); } Thread.Sleep(TimeSpan.FromMinutes(10)); } // ReSharper disable FunctionNeverReturns }
// ReSharper restore FunctionNeverReturns /// <summary> /// Call from RoleEntryPoint.OnStop(). /// </summary> public void OnStop() { _octopusDeploy.DeleteMachine(); IisEnvironment.WaitForAllHttpRequestsToEnd(); }