Adding a lot of heartbeating and OOBE work

This commit is contained in:
Rick Falkvinge
2017-01-16 22:09:09 +01:00
parent 789b06359d
commit adeeece59a
12 changed files with 138 additions and 347 deletions
+1 -1
View File
@@ -62,7 +62,7 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="etcsystemd\swarmops-frontend.service" />
<None Include="libsystemd\swarmops-frontend.service" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
+13
View File
@@ -21,6 +21,17 @@ namespace Swarmops.Frontend.Socket
{
static void Main(string[] args)
{
// Are we running yet?
if (!SystemSettings.DatabaseInitialized)
{
// will restart the service every 30s until db initialized on OOBE
// also, the read of DatabaseInitialized can and will fail if
// we're not initalized enough to even have a database
throw new InvalidOperationException();
}
// Check if we're Sandbox
if (PilotInstallationIds.IsPilot(PilotInstallationIds.DevelopmentSandbox))
@@ -163,6 +174,8 @@ namespace Swarmops.Frontend.Socket
private static void OnEveryTenSeconds()
{
SystemSettings.HeartbeatFrontend = DateTime.UtcNow.ToUnix();
_socketServer.WebSocketServices.Broadcast ("{\"messageType\":\"Heartbeat\"}");
if (_isSandbox)
@@ -6,7 +6,8 @@ After=network.target
User=root
ExecStart=/usr/bin/mono /usr/share/swarmops/frontend/bin/Swarmops.Frontend.Socket.exe
WorkingDirectory=/usr/share/swarmops/frontend
Restart=on-abort
Restart=on-failure
RestartSec=30
[Install]
WantedBy=multi-user.target