diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2021-01-06 12:37:26 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2021-01-06 12:37:26 +0100 |
commit | 9504c7efb9b57aeacf5e2717a43c3cf178a65aee (patch) | |
tree | c1d5e78dcb0054e11f39e449b90e4f98aa5e0031 /module/acme/src/main/resources/io/trygvis | |
parent | b40cab15f4d01a4e8455e5808ca82e40ff291a92 (diff) | |
download | rules-sandbox-9504c7efb9b57aeacf5e2717a43c3cf178a65aee.tar.gz rules-sandbox-9504c7efb9b57aeacf5e2717a43c3cf178a65aee.tar.bz2 rules-sandbox-9504c7efb9b57aeacf5e2717a43c3cf178a65aee.tar.xz rules-sandbox-9504c7efb9b57aeacf5e2717a43c3cf178a65aee.zip |
Splitting ACME out from the generic parts.
Diffstat (limited to 'module/acme/src/main/resources/io/trygvis')
-rw-r--r-- | module/acme/src/main/resources/io/trygvis/acme/acme.drl | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/module/acme/src/main/resources/io/trygvis/acme/acme.drl b/module/acme/src/main/resources/io/trygvis/acme/acme.drl new file mode 100644 index 0000000..d978579 --- /dev/null +++ b/module/acme/src/main/resources/io/trygvis/acme/acme.drl @@ -0,0 +1,58 @@ +package io.trygvis.acme; + +import io.trygvis.rules.machine.Machine; +import io.trygvis.rules.dba.Cluster; +import io.trygvis.rules.dba.Container; + +dialect "mvel" + +declare AcmeServer + name : String + machine : Machine +end + +rule "Ops" +when + $ops: AcmeOps() +then + var cluster = new Cluster("acme-ops"); + insert(cluster); + insert(new Container(cluster, "app", "pdb", "postgresql", "11")); + insert(new Container(cluster, "app", "n8n", "n8n", "0.84.1")); +end + +rule "MyApp" +when + $app: AcmeMyApp() +then + var cluster = new Cluster("acme-" + $app.environment); + insert(cluster); + + var tag = $app.dockerTag; + insert(new Container(cluster, "app", "statera", "statera", tag)); + insert(new Container(cluster, "app", "statera-console", "statera-console", tag)); + insert(new Container(cluster, "app", "4tune-web", "4tune-web", tag)); + insert(new Container(cluster, "app", "4tune-api", "4tune-api", tag)); + insert(new Container(cluster, "db", "pdb", "postgresql", "13")); + insert(new Container(cluster, "db", "mdb", "mongodb", "3.2")); +end + +rule "Create Acme servers" +when + $m : Machine(name.startsWith("acme-")) + not(AcmeServer(name == $m.name)) +then + var s = new AcmeServer(); + s.name = $m.name; + s.machine = $m; + insert(s); +end + +rule "Set public domain for ACME servers" +when + $m : Machine(fqdn == null) + $s : AcmeServer(machine == $m) +then + $s.machine.fqdn = "%s.machine.acme.com".formatted($s.machine.name); + update($s.machine) +end |