summaryrefslogtreecommitdiff
path: root/example/modules/acme/src/main/resources/io/trygvis/acme/apps/apps.drl
diff options
context:
space:
mode:
Diffstat (limited to 'example/modules/acme/src/main/resources/io/trygvis/acme/apps/apps.drl')
-rw-r--r--example/modules/acme/src/main/resources/io/trygvis/acme/apps/apps.drl44
1 files changed, 44 insertions, 0 deletions
diff --git a/example/modules/acme/src/main/resources/io/trygvis/acme/apps/apps.drl b/example/modules/acme/src/main/resources/io/trygvis/acme/apps/apps.drl
new file mode 100644
index 0000000..670079f
--- /dev/null
+++ b/example/modules/acme/src/main/resources/io/trygvis/acme/apps/apps.drl
@@ -0,0 +1,44 @@
+package io.trygvis.acme.apps
+
+import io.trygvis.rules.machine.Machine;
+import io.trygvis.rules.dba.Cluster;
+import io.trygvis.rules.dba.Container
+import io.trygvis.rules.dns.DnsZone;
+import io.trygvis.rules.machine.Machine
+import io.trygvis.rules.machine.MachineSpecification
+import io.trygvis.rules.dba.Cluster
+import io.trygvis.rules.dba.Container
+
+dialect "mvel"
+
+rule "Ops"
+when
+ $ops: AcmeOps()
+then
+ var cluster = new Cluster("acme-ops");
+ insert(cluster);
+ insert(new Container(cluster, "pdb", "ops", "postgresql", "11", null));
+ insert(new Container(cluster, "n8n", "ops", "n8n", "0.84.1", null));
+end
+
+rule "MyApp"
+when
+ $app: AcmeMyApp()
+then
+ var zone = new DnsZone($app.environment + ".acme.com");
+ insert(zone)
+
+ var cluster = new Cluster("acme-myapp-" + $app.environment);
+ insert(cluster);
+
+ var app = $app.environment + "-app";
+ var db = $app.environment + "-db";
+
+ var tag = $app.dockerTag;
+ insert(new Container(cluster, "statera", app, "statera", tag, new MachineSpecification(200, 1000)));
+ insert(new Container(cluster, "statera-console", app, "statera-console", tag, new MachineSpecification(100, 50)));
+ insert(new Container(cluster, "4tune-web", app, "4tune-web", tag, new MachineSpecification(100, 50)));
+ insert(new Container(cluster, "4tune-api", app, "4tune-api", tag, new MachineSpecification(200, 200)));
+ insert(new Container(cluster, "pdb", db, "postgresql", "13", new MachineSpecification(500, 500)));
+ insert(new Container(cluster, "mdb", db, "mongodb", "3.2", new MachineSpecification(500, 200)));
+end