Skip to content

SharpeRAD/CakeBoss

Repository files navigation

CakeBoss

CakeBoss is the DevOpps tool for the C# masocistc that knows Chef and Puppet are better but blindly chooses something different for the sole reason that they don't like being told they can't write their scripts in C#!

Build status

cakebuild.net

Join the chat at https://gitter.im/cake-build/cake

Agent Events

CakeBoss.Agent is a windows service that subscribes to the following events, executing the corresponding Cake-Build task when the event is triggered. The agent can even poll AWS instance meta-data every 5 seconds to trigger the Termination event.

  • Start Service
  • Stop Service
  • Startup Server
  • Shutdown Server
  • Terminate Server

Agent Event Usage

Task("Start")
    .Description("Service Start.")
    .Does(() =>
{
	Information("---Configure the agent---");
    ConfigureAgent(new AgentSettings()
	{
		Port = 8888,

        EnableTerminationCheck = true,
		EnableAPI = true
	}.AddUser("Admin", "Password1"));
});

Task("Stop")
    .Description("Service Stop.")
    .Does(() =>
{

});

Task("Startup")
    .Description("Server Startup.")
    .Does(() =>
{

});

Task("Shutdown")
    .Description("Server Shutdown.")
    .Does(() =>
{

});

Task("Terminate")
    .Description("AWS Instance Termination.")
    .Does(() =>
{

});

Agent API

A Nancy based api enables remote calls from the "Cake.CakeBoss" nuget package, allowing a central machine to execute tasks on individual nodes. Should go without saying but please do NOT enabled the api on a public machine!

Client Referencing

NuGet Version NuGet Downloads

Cake.CakeBoss is available as a nuget package from the package manager console:

Install-Package Cake.CakeBoss

or directly in your build script via a cake addin:

#addin "Cake.CakeBoss"

API Usage (Machine1)

#addin "Cake.CakeBoss"

Task("Deploy")
    .Description("The deployment process on Machine1")
    .Does(() =>
{
    Information("---Call the agent API on another machine---");
    RunRemoteTarget(new RemoteSettings()
	{
        Username = "Admin",
        Password = "Password1",

        Host = "Machine2"
        Port = 8888,

        Target = "Deploy"
	});
});

API Usage (Machine2)

Task("Start")
    .Description("Configures the API on Machine2")
    .Does(() =>
{
    Information("---Configure the agent---");
	ConfigureAgent(new AgentSettings()
	{
		Port = 8888,

        EnableTerminationCheck = false,
		EnableAPI = true
	}.AddUser("Admin", "Password1"));
});

Task("Deploy")
    .Description("Remote target on machine2")
    .Does(() =>
{
    Information("---This would execute on machine2 from the script on machine1---");
});

Scheduled Tasks

CakeBoss uses FluentScheduler to enable scheduled tasks, please consulte their documetnation for the fluent interface.

Scheduled Task Usage

Task("Start")
    .Description("Service Start.")
    .Does(() =>
{
    //Every two hours
	ScheduleTask("Timed-Critical-Task")
        .ToRunNow().AndEvery(2).Hours();

    //15 minute delay
    ScheduleTask("Timed-Critical-Task")
        .ToRunOnceIn(15).Minutes();
        
    //Every morning
    ScheduleTask("Timed-Critical-Task")
        .ToRunEvery(1).Days().At(8, 30);



    Information("---Configure the agent---");
	ConfigureAgent(new AgentSettings()
	{
        EnableScheduledTasks = true
	});
});

Task("Timed-Critical-Task")
    .Description("A task that needs to run at a particular time")
    .Does(() =>
{

});

Example

A complete Cake example can be found here

About

Cake-Build as a devOpps service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published