Skip to content
Cake-Build as a devOpps service
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
nuspec
script
src
.gitattributes
.gitignore
LICENSE
README.md
ReleaseNotes.md
appveyor.yml
build.bat
build.cake
build.ps1

README.md

CakeBoss

CakeBoss is the DevOpps tool for the C# masochist that knows Chef and Puppet are better but chooses something different because 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

Table of contents

  1. Agent Events
  2. Agent API
  3. Client Referencing
  4. API Usage Machine1
  5. API Usage Machine2
  6. Scheduled Tasks
  7. Addins
  8. Example
  9. License
  10. Share the love

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
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("Deploy", new RemoteSettings()
	{
        Username = "Admin",
        Password = "Password1",

        Host = "Machine2"
        Port = 8888
    });
});

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 consult their documentation for the fluent interface.

Task("Start")
    .Description("Service Start.")
    .Does(() =>
{
    Information("---Add scheduled tasks---");

	//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(() =>
{
	Information("---This would execute at the scheduled times---");
});

Addins

Since CakeBoss is effectively just a different host for the Cake engine so you get access to all of its addins in your tasks:

Example

A complete Cake example can be found here

License

Copyright (c) 2015 - 2016 Phillip Sharpe

CakeBoss is provided as-is under the MIT license. For more information see LICENSE.

Share the love

If this project helps you in anyway then please ⭐️ the repository.

You can’t perform that action at this time.