Skip to content

Deploy Agent Configuration

Daniel Lee edited this page Feb 3, 2016 · 2 revisions

##Introduction Start by following the instructions to install a Windows Deploy Agent in the Getting Started section

The source code for the the Windows Deploy Agent is located in its own repository.

This page describes how to configure an Agent and all the configuration parameters.

###Basic Concepts Package Sources are the locations or filepaths to the files that should be installed on the agents.

Units are the different components that should be installed on the agent e.g. a website or a windows service or just a file that should be copied onto the agent.

#Two ways to configure the Windows Agent On each Deploy Agent a config file is used to define the package sources and deploy units as well as some other settings. There are however two ways to setup the configuration for Asimov agents.

1. One config file for all the agents and their units

The first is to have one config file that holds all the settings for all the agents. This is useful in a scenario where you only have a few agents with the same units. Each agent will have a copy of the config file and report to the Asimov Deploy UI/Node Front.

The config files for the agents are placed in the ConfigFiles subfolder (exactly where depends on where you installed the agent files). A is initially named config.empty.json. The simplest way to use it is to rename the file to config.json and then define your Package Source and Units.

2. One config file per environment

There is also support for having a config file per environment (dev, test, prod, app servers, web fronts etc.). The config.json file can be used just to match the environment config files to an agent or as a base config file with Package Sources and/or Units for every agent.

The general principle is that all config files are copied to every agent and the base config file matches the agent to the right environment config file.

Environment config files are placed in the same directory, the ConfigFiles subfolder. The filename structure has to be in this form:

config.environment.json

e.g. config.test.json

The environment value is then matched like this in the config.json file:

"Agents": {
		/* TEST */
		"test*":			{ "Environment" : "test" },
		"staging":			{ "Environment" : "test" },
		"integration01":	{ "Environment" : "test" }
}

This example matches all agents with names starting with test (test01, test02 etc.) and an agent with the name staging and an agent with the name integration01. They will use the config values defined in the config file config.test.config.

##Examples Here is example of a Deploy Agent configuration file (one config file for all agents).

{
   "NodeFrontUrl": "http://deploy.intranet.mycompany.com",
   "HeartbeatIntervalSeconds": 60,
   "ConfigVersion": 2,

   "PackageSources":  {
      "ProductionBuilds":  { "Type": "FileSystem", "Uri": "file://some-file-share/drops" }     
   },

   "Units": [
      {
         "Name":        "UserRegistration.ApplicantRegistration",
         "Type":        "WebSite",

         "PackageInfo": { "Source": "ProductionBuilds", "InternalPath":  "_PublishedWebsites/ApplicantRegistration"  },

         "SiteName":    "ProcessService.UserRegistration",
         "SiteUrl":     "http://localhost/ApplicantRegistration"
      },    

      {
         "Name":        "UserRegistration.PostProcessing.Handler",
         "Type":        "WindowsService",
         
         "PackageInfo": { "Source": "ProductionBuilds", "InternalPath":  "_PublishedApplications/UserRegistration.PostProcessing.Handler"  },
         
         "ServiceName": "UserRegistration.PostProcessing.Handler"
      }
   ]
}

Here is an example of the base config file which matches agents to environment files:

{	"WebPort":						21233,
	"DataFolder":					"D:\\Applications\\AsimovDeploy\\Data",
	"HeartbeatIntervalSeconds":		10,
	"NodeFrontUrl":					"http://nodefront:3333",
	"ConfigVersion":				{version},

	"PackageSources":  {
		"Test.Drops":			{ "Type": "FileSystem", "Uri": "file://file-server/drops/CI_Drops" }	,
		"Prod.Drops":	{ "Type": "FileSystem", "Uri": "file://file-server/drops/ProductionBuildDrops" },
	},

	"Agents": {
		/* TEST */
		"test*":			{ "Environment" : "test" },
		"staging":			{ "Environment" : "test" },
		"integration01":	{ "Environment" : "test" },

		/* ADMIN & SUPPORT */
		"cust-support1": { "Environment" : "customer_support" },
		"monitoring-01": { "Environment" : "monitoring" },
	}
}

Agent Configuration Parameters List

NodeFrontUrl (obligatory)

This url points to the Deploy UI website (NodeFront).

HeartbeatIntervalSeconds (obligatory)

The number of seconds between heartbeats. A heartbeat is a signal sent from the Deployment Agent to the Deployment UI so that you can see that the Deploy Agent is up and working. 60 seconds is the recommended value unless there are reasons for using a shorter or longer interval.

WebPort (obligatory)

The port on which the Deploy Agent is available on.

PackageSources (obligatory)

This is a list of the sources where files can be fetched from. These files can then be used by the Units to deploy out to the agents. Each source is given a name and can have two properties:

  • Type: One of the following values: FileSystem, AsimovWeb

For a FileSystem package source, there are two possible fields.

  • Uri: points out a folder where the zip files are located
  • Pattern: The filename regex pattern for the a (zip) file. Asimov parses out the version, branch and commit from the filename. The default regex is v(?\d+.\d+.\d+.\d+)-[(?[\w-])]-[(?\w)]

An example of a filename that matches the above regex is:

Tradera-v15.1.0.1615-[my-branch-name]-[439d389].CI.zip

PackageSources example:

	"PackageSources":  {
		"Test.Drops":			{ "Type": "FileSystem", "Uri": "file://file-server/drops/CI_Drops" }
	}

Units (obligatory)

See Deployment Units for more details.

ConfigVersion

Every agent has a config version that shoud be incremented for every new version. The config version for each agent is shown on the Agents tab in the UI. Usually you will want to have the same version for every agent. (At Tradera, we

Environment (optional)

The environment that this Deploy Agent runs as. For example, "test" would mean that this is a Deploy Agent for a test server. See the example config.json above.

DataFolder (optional)

The default is "Data" and refers to the name of the folder where all the data for the Deploy Agent is stored - Unit logs, temp data etc.

LoadBalancerAgentUrl (optional)

If using Asimov Deploy together with a load balancer then setting the url to the Load Balancer will enable the support. The Deploy Agent will notify the Node Front (Asimov UI) with the status of the Load Balancer - whether it is enabled/disabled and the number of connections. It will make a call to the the url and expects a resource called server-status to exist that will return an object with a status and number of connections. A querystring parameter called name should be set to the load balancer id.

E.g. http://prod.loadbalancer.test.com:3450/server-status?name=1

AgentGroup

Not to be confused with the Environment concept, an Agent Group is a purely visual concept for the Deploy UI. It groups Environments together on different pages. The Agent Group can be chosen in the top right hand corner on the UI home page. This is useful when the list of Units gets very long. The default value is "Asimov".

ApiKey

Should not be set. This a guid that connects the agents with the Deploy UI/Node Front. The agent creates a new guid itself.

WebNotificationUrl

Events can be sent to an url as an HTTP Post. All events have the agentName and eventName fields.

Current events:

DeployCompletedEvent

eventName: "deployCompleted"

  • unitName
  • version
  • branch
  • status
  • userId
  • userName

LoadBalancerStateChanged

eventName: "loadBalancerStateChanged"

  • enabled
  • connectionCount
  • serverId

UnitStatusChangedEvent

eventName: "unitStatusChanged"

  • unitName
  • status

VerifyProgressEvent

eventName: "verify-progress"

  • completed
  • started
  • unitName
  • test;
  • image;
  • report;

Agents

If you are using multiple config files then you need to match Environment to an agent or group of agents.

This is an example of a simple Agents list. The agent name is matched to an environment.

"Agents": {
	/* TEST */
	"test01":			{ "Environment" : "test" },
	"test02": 			{ "Environment" : "test" },
	"staging":			{ "Environment" : "test" },

	"se1-appsrv-01":	{ "Environment" : "prod_app_servers" },
	"myPc":			    { "Environment" : "dev" }
}

Some more advanced settings are available. For the agent name, there is support for ranges and wildcards.

"webfront-1[1-9]":  { "Environment" : "prod_site", "LoadBalancerParameters": { "lbParam": "prod" } },

"se1-testweb-*": 	{ "Environment" : "prod_site_test", "LoadBalancerParameters": { "lbParam": "test" } },

A list of LoadBalancerParameters can be set per environment. This list is sent as a querystring and as post data to the custom LoadBalancer code.