public void Start() { if (isStarted) { throw new Exception("Server has already been started!"); } isStarted = true; // Load existing or default server configuration ServerConfiguration.Load(); MessageRegistry.Scan(Assembly.GetExecutingAssembly()); MessageRegistry.Scan(typeof(ILibraryAssembly).Assembly); MessageRegistry.Scan(typeof(IFrameworkAssembly).Assembly); // TODO: Cache Project Package Index? //ProjectPackages.Initialize(); Sessions.Start(); Queue.Start(); var taskVariables = LoadVariables(); var taskHttp = Task.Run(() => StartHttpServer()); var taskAgents = Task.Run(() => Agents.Load()); var taskProjects = Task.Run(() => Projects.Load()); var taskProjectData = Task.Run(() => ProjectData.Initialize()); Task.WaitAll( taskVariables, taskAgents, taskProjects, taskProjectData, taskHttp); }
public void Start() { if (isStarted) throw new Exception("Server has already been started!"); isStarted = true; Log.Debug("Starting Server..."); // Load existing or default server configuration ServerConfiguration.Load(); UserMgr.Directory = Configuration.Directory; if (!UserMgr.Initialize()) DefaultSecurityGroups.Initialize(UserMgr); Http.Initialize(); MessageRegistry.Scan(Assembly.GetExecutingAssembly()); MessageRegistry.Scan(typeof(ILibraryAssembly).Assembly); MessageRegistry.Scan(typeof(IFrameworkAssembly).Assembly); // TODO: Cache Project Package Index? //ProjectPackages.Initialize(); Sessions.Start(); Queue.Start(); var taskVariables = Task.Run(() => Variables.Load(Configuration.VariablesDirectory)); var taskHttp = Task.Run(() => Http.Start()); var taskAgents = Task.Run(() => Agents.Load()); var taskProjects = Task.Run(() => Projects.Load()); Task.WaitAll( taskVariables, taskAgents, taskProjects, taskHttp); ProjectPackageCache.Initialize() .GetAwaiter().GetResult(); HealthChecks.Start(); Log.Info("Server started."); }
public void Start() { if (isStarted) { throw new Exception("Agent has already been started!"); } isStarted = true; Log.Debug("Starting Agent..."); // Load existing or default agent configuration Definition = ParseAgentDefinition() ?? new AgentDefinition { Http = { Host = "localhost", Port = 8082, Path = "/photon/agent", }, }; if (!IPAddress.TryParse(Definition.Tcp.Host, out var _address)) { throw new Exception($"Invalid TCP Host '{Definition.Tcp.Host}'!"); } MessageRegistry.Scan(Assembly.GetExecutingAssembly()); MessageRegistry.Scan(typeof(ILibraryAssembly).Assembly); MessageRegistry.Scan(typeof(IFrameworkAssembly).Assembly); messageListener.Listen(_address, Definition.Tcp.Port); Sessions.Start(); var taskVariables = Task.Run(() => Variables.Load(Configuration.VariablesDirectory)); var taskRepositories = Task.Run(() => RepositorySources.Initialize()); var taskHttp = Task.Run(() => StartHttpServer()); Task.WaitAll( taskVariables, taskRepositories, taskHttp); Log.Info("Agent started."); }
public void Start() { if (isStarted) { throw new Exception("Agent has already been started!"); } isStarted = true; Log.Debug("Starting Agent..."); // Load existing or default agent configuration AgentConfiguration.Load(); UserMgr.Directory = Configuration.Directory; SecurityTest.Initialize(UserMgr); ApplicationMgr.Initialize(); if (!IPAddress.TryParse(AgentConfiguration.Value.Tcp.Host, out var _address)) { throw new Exception($"Invalid TCP Host '{AgentConfiguration.Value.Tcp.Host}'!"); } Http.Initialize(); MessageRegistry.Scan(Assembly.GetExecutingAssembly()); MessageRegistry.Scan(typeof(ILibraryAssembly).Assembly); MessageRegistry.Scan(typeof(IFrameworkAssembly).Assembly); messageListener.Listen(_address, AgentConfiguration.Value.Tcp.Port); Sessions.Start(); var taskVariables = Task.Run(() => Variables.Load(Configuration.VariablesDirectory)); var taskRepositories = Task.Run(() => RepositorySources.Initialize()); var taskHttp = Task.Run(() => Http.Start()); Task.WaitAll( taskVariables, taskRepositories, taskHttp); Log.Info("Agent started."); }