private void GenerateMyDBDefinition(ServerVersion myDbServerVersion) { DatabaseDefinition mydbdd = new DatabaseDefinition(federation) { Name = Constants.MyDbName, System = federation.System, LayoutType = DatabaseLayoutType.Monolithic, DatabaseInstanceNamePattern = Constants.MyDbInstanceNamePattern, DatabaseNamePattern = Constants.MyDbNamePattern, SliceCount = 1, PartitionCount = 1, }; mydbdd.Save(); var mydbddi = new DatabaseDefinitionInstaller(mydbdd); mydbddi.GenerateDefaultChildren(myDbServerVersion, Constants.MyDbName); mydbdd.LoadDatabaseVersions(true); federation.MyDBDatabaseVersion = mydbdd.DatabaseVersions[Constants.MyDbName]; }
private void GenerateCodeDBDefinition(ServerVersion nodeServerVersion) { DatabaseDefinition codedbdd = new DatabaseDefinition(federation) { Name = Constants.CodeDbName, System = federation.System, LayoutType = DatabaseLayoutType.Mirrored, DatabaseInstanceNamePattern = Constants.CodeDbInstanceNamePattern, DatabaseNamePattern = Constants.CodeDbNamePattern, SliceCount = 1, PartitionCount = 1, }; codedbdd.Save(); var codedbddi = new DatabaseDefinitionInstaller(codedbdd); codedbddi.GenerateDefaultChildren(nodeServerVersion, Constants.CodeDbName); codedbdd.LoadDatabaseVersions(true); federation.CodeDatabaseVersion = codedbdd.DatabaseVersions[Constants.CodeDbName]; }
public Cluster Install(bool system, string clusterName, string username, string email, string password) { cluster = new Cluster(Context) { Name = clusterName, System = system, }; cluster.Save(); // Create machine roles and machines // -- controller role var mrcont = new MachineRole(cluster) { Name = Constants.ControllerMachineRoleName, System = system, MachineRoleType = MachineRoleType.StandAlone, }; mrcont.Save(); var sv = new ServerVersion(mrcont) { Name = Constants.ServerVersionName, System = system, }; sv.Save(); var mcont = new Machine(mrcont) { Name = Constants.ControllerMachineName, }; mcont.Save(); var sicont = new ServerInstance(mcont) { Name = Constants.ServerInstanceName, ServerVersion = sv, }; sicont.Save(); // -- node role var mrnode = new MachineRole(cluster) { Name = Constants.NodeMachineRoleName, MachineRoleType = MachineRoleType.MirroredSet, }; mrnode.Save(); var nodesv = new ServerVersion(mrnode) { Name = Constants.ServerVersionName, }; nodesv.Save(); // -- Create a node /* * Machine mnode = new Machine(Context, mrnode); * mnode.Name = Constants.NodeMachineName; * mnode.Save(); * * si = new ServerInstance(Context, mnode); * si.Name = Constants.ServerInstanceName; * si.ServerVersionReference.Value = sv; * si.Save();*/ // Create the shared domain for cluster level databases and users var domain = new Domain(cluster) { Name = Constants.SharedDomainName, Email = email, System = system, }; domain.Save(); // Create administrator group and user GenerateAdminGroup(system); GenerateAdmin(system, username, email, password); // Create the shared feredation var federation = new Federation(domain) { Name = Constants.SharedFederationName, Email = email, System = system, ControllerMachine = mcont, SchemaSourceServerInstance = sicont, }; federation.Save(); // Temp database definition var tempdd = new DatabaseDefinition(federation) { Name = Constants.TempDbName, System = system, LayoutType = DatabaseLayoutType.Monolithic, DatabaseInstanceNamePattern = Constants.TempDbInstanceNamePattern, DatabaseNamePattern = Constants.TempDbNamePattern, SliceCount = 1, PartitionCount = 1, }; tempdd.Save(); var tempddi = new DatabaseDefinitionInstaller(tempdd); tempddi.GenerateDefaultChildren(nodesv, Constants.TempDbName); // Create cluster level jobs and queues // -- admin queue definition QueueDefinition qd = new QueueDefinition(cluster) { Name = Constants.MaintenanceQueueDefinitionName, System = system, }; qd.Save(); QueueInstance qi = new QueueInstance(mcont) { Name = Constants.MaintenanceQueueName, RunningState = Registry.RunningState.Running, }; qi.QueueDefinitionReference.Value = qd; qi.Save(); // -- long queue definition qd = new QueueDefinition(cluster) { Name = Constants.LongQueueDefinitionName }; qd.Save(); qi = new QueueInstance(mcont) { Name = Constants.LongQueueName, RunningState = Registry.RunningState.Running, }; qi.QueueDefinitionReference.Value = qd; qi.Save(); // -- quick queue definition qd = new QueueDefinition(cluster) { Name = Constants.QuickQueueDefinitionName, }; qd.Save(); qi = new QueueInstance(mcont) { Name = Constants.QuickQueueName, RunningState = Registry.RunningState.Running, }; qi.QueueDefinitionReference.Value = qd; qi.Save(); // -- database mirror job var jd = new JobDefinition(federation) { Name = typeof(Jhu.Graywulf.Jobs.MirrorDatabase.MirrorDatabaseJob).Name, System = system, WorkflowTypeName = typeof(Jhu.Graywulf.Jobs.MirrorDatabase.MirrorDatabaseJob).AssemblyQualifiedName, }; jd.DiscoverWorkflowParameters(); jd.Save(); // -- test job jd = new JobDefinition(federation) { Name = typeof(Jhu.Graywulf.Jobs.Test.TestJob).Name, System = system, WorkflowTypeName = typeof(Jhu.Graywulf.Jobs.Test.TestJob).AssemblyQualifiedName, }; jd.DiscoverWorkflowParameters(); jd.Save(); return(cluster); }