Deliver portable native Architecture B deployment and final verification
This commit is contained in:
1 parent
f451b55de1
commit
36740d2492
92 files changed
+10939
-926
No files matched your search
@@ -0,0 +1,33 @@
|
||||
using System.Text.Json;
|
||||
namespace HealthApp.Provisioning;
|
||||
|
||||
public static class Program
|
||||
{
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
var stage = "arguments";
|
||||
try
|
||||
{
|
||||
if (args.Length == 0) throw new ArgumentException();
|
||||
var options = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||
for (var i = 1; i < args.Length; i += 2) { if (i + 1 >= args.Length || !args[i].StartsWith("--") || !options.TryAdd(args[i][2..], args[i + 1])) throw new ArgumentException(); }
|
||||
string Required(string key) => options.GetValueOrDefault(key) ?? throw new ArgumentException();
|
||||
stage = args[0]; var plan = Required("plan");
|
||||
switch (stage)
|
||||
{
|
||||
case "prepare": Installation.Prepare(plan, Required("host"), int.Parse(options.GetValueOrDefault("port", "5443")), Required("root"), options.GetValueOrDefault("certificate"), options.GetValueOrDefault("certificate-password-file"), options.GetValueOrDefault("ca")); break;
|
||||
case "database": await Installation.DatabaseAsync(plan, Required("migrations"), options.GetValueOrDefault("admin-file")); break;
|
||||
case "configure": Installation.Configure(plan, Required("root")); break;
|
||||
case "verify-database": await Installation.VerifyDatabaseAsync(plan); break;
|
||||
case "verify": await Installation.VerifyAsync(plan); break;
|
||||
default: throw new ArgumentException();
|
||||
}
|
||||
Console.WriteLine("Completed " + stage + "."); return 0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Never print SQL, password/token values, health payloads or exception text.
|
||||
Console.Error.WriteLine("Provisioning failed at " + stage + " (" + e.GetType().Name + "). Existing data and diagnostics retained."); return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user