Started with adding container creation and a server state machine
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
namespace MoonlightServers.Daemon.Models;
|
||||
|
||||
public class Allocation
|
||||
{
|
||||
public string IpAddress { get; set; }
|
||||
public int Port { get; set; }
|
||||
}
|
||||
@@ -1,22 +1,30 @@
|
||||
namespace MoonlightServers.Daemon.Models;
|
||||
namespace MoonlightServers.Daemon.Models.Cache;
|
||||
|
||||
public class ServerData
|
||||
public class ServerConfiguration
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string StartupCommand { get; set; }
|
||||
public string OnlineDetection { get; set; }
|
||||
public string StopCommand { get; set; }
|
||||
public string DockerImage { get; set; }
|
||||
public bool PullDockerImage { get; set; }
|
||||
public string ParseConiguration { get; set; }
|
||||
|
||||
// Limits
|
||||
public int Cpu { get; set; }
|
||||
public int Memory { get; set; }
|
||||
public int Disk { get; set; }
|
||||
|
||||
public bool UseVirtualDisk { get; set; }
|
||||
public int Bandwidth { get; set; }
|
||||
public bool UseVirtualDisk { get; set; }
|
||||
|
||||
// Start, Stop & Status
|
||||
public string StartupCommand { get; set; }
|
||||
public string StopCommand { get; set; }
|
||||
public string OnlineDetection { get; set; }
|
||||
|
||||
// Container
|
||||
public string DockerImage { get; set; }
|
||||
public AllocationConfiguration[] Allocations { get; set; }
|
||||
|
||||
public List<Allocation> Allocations { get; set; }
|
||||
public Dictionary<string, string> Variables { get; set; }
|
||||
|
||||
public struct AllocationConfiguration
|
||||
{
|
||||
public string IpAddress { get; set; }
|
||||
public int Port { get; set; }
|
||||
}
|
||||
}
|
||||
12
MoonlightServers.Daemon/Models/Server.cs
Normal file
12
MoonlightServers.Daemon/Models/Server.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using MoonlightServers.Daemon.Helpers;
|
||||
using MoonlightServers.Daemon.Models.Cache;
|
||||
|
||||
namespace MoonlightServers.Daemon.Models;
|
||||
|
||||
public class Server
|
||||
{
|
||||
public ServerState State => StateMachine.CurrentState;
|
||||
public StateMachine<ServerState> StateMachine { get; set; }
|
||||
public ServerConfiguration Configuration { get; set; }
|
||||
public string? ContainerId { get; set; }
|
||||
}
|
||||
10
MoonlightServers.Daemon/Models/ServerState.cs
Normal file
10
MoonlightServers.Daemon/Models/ServerState.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace MoonlightServers.Daemon.Models;
|
||||
|
||||
public enum ServerState
|
||||
{
|
||||
Offline = 0,
|
||||
Starting = 1,
|
||||
Online = 2,
|
||||
Stopping = 3,
|
||||
Installing = 4
|
||||
}
|
||||
11
MoonlightServers.Daemon/Models/ServerTask.cs
Normal file
11
MoonlightServers.Daemon/Models/ServerTask.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace MoonlightServers.Daemon.Models;
|
||||
|
||||
public enum ServerTask
|
||||
{
|
||||
None = 0,
|
||||
CreatingStorage = 1,
|
||||
PullingDockerImage = 2,
|
||||
RemovingContainer = 3,
|
||||
CreatingContainer = 4,
|
||||
StartingContainer = 5
|
||||
}
|
||||
Reference in New Issue
Block a user