Implemented statistics. Refactored storage abstractions. Added config options for docker and local storage. Added server service and server updating.
This commit is contained in:
@@ -9,15 +9,21 @@ public class DockerInstallEnvService : IInstallEnvironmentService
|
||||
private readonly DockerClient DockerClient;
|
||||
private readonly ILoggerFactory LoggerFactory;
|
||||
private readonly DockerEventService DockerEventService;
|
||||
private readonly ContainerConfigMapper ConfigMapper;
|
||||
|
||||
private const string NameTemplate = "ml-install-{0}";
|
||||
|
||||
public DockerInstallEnvService(DockerClient dockerClient, ILoggerFactory loggerFactory,
|
||||
DockerEventService dockerEventService)
|
||||
public DockerInstallEnvService(
|
||||
DockerClient dockerClient,
|
||||
ILoggerFactory loggerFactory,
|
||||
DockerEventService dockerEventService,
|
||||
ContainerConfigMapper configMapper
|
||||
)
|
||||
{
|
||||
DockerClient = dockerClient;
|
||||
LoggerFactory = loggerFactory;
|
||||
DockerEventService = dockerEventService;
|
||||
ConfigMapper = configMapper;
|
||||
}
|
||||
|
||||
public async Task<IInstallEnvironment?> FindAsync(string id)
|
||||
@@ -28,8 +34,7 @@ public class DockerInstallEnvService : IInstallEnvironmentService
|
||||
string.Format(NameTemplate, id)
|
||||
);
|
||||
|
||||
var logger =
|
||||
LoggerFactory.CreateLogger($"MoonlightServers.Daemon.ServerSystem.Implementations.Docker({id})");
|
||||
var logger = LoggerFactory.CreateLogger($"MoonlightServers.Daemon.ServerSystem.Implementations.Docker({id})");
|
||||
|
||||
return new DockerInstallEnv(dockerInspect.ID, DockerClient, logger, DockerEventService);
|
||||
}
|
||||
@@ -63,8 +68,8 @@ public class DockerInstallEnvService : IInstallEnvironmentService
|
||||
// Ignored
|
||||
}
|
||||
|
||||
var runtimeStoragePath = await runtimeStorage.GetHostPathAsync();
|
||||
var installStoragePath = await installStorage.GetHostPathAsync();
|
||||
var runtimeStoragePath = await runtimeStorage.GetBindPathAsync();
|
||||
var installStoragePath = await installStorage.GetBindPathAsync();
|
||||
|
||||
var parameters = ConfigMapper.GetInstallConfig(
|
||||
id,
|
||||
@@ -74,7 +79,7 @@ public class DockerInstallEnvService : IInstallEnvironmentService
|
||||
runtimeStoragePath,
|
||||
installStoragePath
|
||||
);
|
||||
|
||||
|
||||
var container = await DockerClient.Containers.CreateContainerAsync(parameters);
|
||||
|
||||
var logger = LoggerFactory.CreateLogger($"MoonlightServers.Daemon.ServerSystem.Implementations.Docker({id})");
|
||||
|
||||
Reference in New Issue
Block a user