From 70d0ad3c9f37e44a9504a0d7f66e412a3f3bba6f Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 7 Jan 2021 12:20:02 +0100 Subject: More Wireguard. Fixing broken myapps too. --- .../src/main/java/io/trygvis/acme/AcmeMyApp.java | 6 ---- .../src/main/java/io/trygvis/acme/AcmeOps.java | 4 --- .../main/java/io/trygvis/acme/apps/AcmeMyApp.java | 6 ++++ .../main/java/io/trygvis/acme/apps/AcmeOps.java | 4 +++ .../acme/src/main/resources/META-INF/kmodule.xml | 8 ++++-- .../src/main/resources/io/trygvis/acme/acme.drl | 26 ----------------- .../main/resources/io/trygvis/acme/apps/apps.drl | 33 ++++++++++++++++++++++ 7 files changed, 49 insertions(+), 38 deletions(-) delete mode 100644 module/acme/src/main/java/io/trygvis/acme/AcmeMyApp.java delete mode 100644 module/acme/src/main/java/io/trygvis/acme/AcmeOps.java create mode 100644 module/acme/src/main/java/io/trygvis/acme/apps/AcmeMyApp.java create mode 100644 module/acme/src/main/java/io/trygvis/acme/apps/AcmeOps.java create mode 100644 module/acme/src/main/resources/io/trygvis/acme/apps/apps.drl (limited to 'module/acme') diff --git a/module/acme/src/main/java/io/trygvis/acme/AcmeMyApp.java b/module/acme/src/main/java/io/trygvis/acme/AcmeMyApp.java deleted file mode 100644 index dfe374b..0000000 --- a/module/acme/src/main/java/io/trygvis/acme/AcmeMyApp.java +++ /dev/null @@ -1,6 +0,0 @@ -package io.trygvis.acme; - -public class AcmeMyApp { - public String environment; - public String dockerTag; -} diff --git a/module/acme/src/main/java/io/trygvis/acme/AcmeOps.java b/module/acme/src/main/java/io/trygvis/acme/AcmeOps.java deleted file mode 100644 index 844c7f0..0000000 --- a/module/acme/src/main/java/io/trygvis/acme/AcmeOps.java +++ /dev/null @@ -1,4 +0,0 @@ -package io.trygvis.acme; - -public class AcmeOps { -} diff --git a/module/acme/src/main/java/io/trygvis/acme/apps/AcmeMyApp.java b/module/acme/src/main/java/io/trygvis/acme/apps/AcmeMyApp.java new file mode 100644 index 0000000..9371af2 --- /dev/null +++ b/module/acme/src/main/java/io/trygvis/acme/apps/AcmeMyApp.java @@ -0,0 +1,6 @@ +package io.trygvis.acme.apps; + +public class AcmeMyApp { + public String environment; + public String dockerTag; +} diff --git a/module/acme/src/main/java/io/trygvis/acme/apps/AcmeOps.java b/module/acme/src/main/java/io/trygvis/acme/apps/AcmeOps.java new file mode 100644 index 0000000..be9d82b --- /dev/null +++ b/module/acme/src/main/java/io/trygvis/acme/apps/AcmeOps.java @@ -0,0 +1,4 @@ +package io.trygvis.acme.apps; + +public class AcmeOps { +} diff --git a/module/acme/src/main/resources/META-INF/kmodule.xml b/module/acme/src/main/resources/META-INF/kmodule.xml index e86da96..6bcd1db 100644 --- a/module/acme/src/main/resources/META-INF/kmodule.xml +++ b/module/acme/src/main/resources/META-INF/kmodule.xml @@ -3,11 +3,15 @@ xmlns="http://www.drools.org/xsd/kmodule" xsi:schemaLocation="http://www.drools.org/xsd/kmodule https://www.drools.org/xsd/kmodule_7_1.xsd"> - + - + + + + + diff --git a/module/acme/src/main/resources/io/trygvis/acme/acme.drl b/module/acme/src/main/resources/io/trygvis/acme/acme.drl index d978579..66623c3 100644 --- a/module/acme/src/main/resources/io/trygvis/acme/acme.drl +++ b/module/acme/src/main/resources/io/trygvis/acme/acme.drl @@ -11,32 +11,6 @@ declare AcmeServer 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-")) diff --git a/module/acme/src/main/resources/io/trygvis/acme/apps/apps.drl b/module/acme/src/main/resources/io/trygvis/acme/apps/apps.drl new file mode 100644 index 0000000..95f09c8 --- /dev/null +++ b/module/acme/src/main/resources/io/trygvis/acme/apps/apps.drl @@ -0,0 +1,33 @@ +package io.trygvis.acme.apps; + +import io.trygvis.rules.machine.Machine; +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, "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-myapp-" + $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 -- cgit v1.2.3