Пример #1
0
 public Driver(TeamCityApi teamCityApi, WebApplicationApi webApplicationApi, WebFarm webFarm)
 {
     m_TeamCityApi         = teamCityApi;
     m_WebApplicationApi   = webApplicationApi;
     m_WebFarm             = webFarm;
     m_ApplicationVersions = new List <Version>();
 }
Пример #2
0
        static void CreateWebFarm()
        {
            //WebFarmManager is the class that manages several web farms.
            WebFarmManager webFarmManager = new WebFarmManager();

            //Create a new WebFarm
            WebFarm myWebFarm = webFarmManager.WebFarms.CreateNewWebFarm("MyWebFarm");

            //Provide user name and password for the webfarm. Note that these credentials are
            //used for sync up and load balancing the farm. All the servers in the farms should
            //recognize the credentials.
            myWebFarm.AdminUserName = "******";
            myWebFarm.AdminPassword = "******";

            //Optionally you can also specify how many number of servers must be online
            //at any given point of time and also how many servers could be stopped at any
            //given point of time.

            //myWebFarm.MinimumServers = 1;
            //myWebFarm.MaximumStoppedServers = 2;

            //This will enable the agent service automatically on the servers
            myWebFarm.AutoEnableAgent = true;

            //Now add a new server to the web farm
            Server srv1 = myWebFarm.Servers.CreateNewServer("MyServer1");

            //Make MyServer1 as Primary server. During the provisioning of application or platform
            //Primary server is used as the primary server from which the application or platforms
            //are provisioned.
            myWebFarm.PrimaryServer = srv1;

            //Add more servers. MyServer2 and MyServer3 acts as secondary servers
            //These two servers gets provisioned before loadbalancing.
            Server srv2 = myWebFarm.Servers.CreateNewServer("MyServer2");
            Server srv3 = myWebFarm.Servers.CreateNewServer("MyServer3");

            //The changes will take effect only after committing the changes.
            //This is a MUST call.
            webFarmManager.CommitChanges();
        }