diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2021-01-07 12:20:02 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2021-01-07 12:20:02 +0100 |
commit | 70d0ad3c9f37e44a9504a0d7f66e412a3f3bba6f (patch) | |
tree | 623815a975541ebba1fba8208bd2b3e984ceb9d4 /module/acme | |
parent | ede2372547db659e7b0e9cfd3b531ff542018229 (diff) | |
download | rules-sandbox-70d0ad3c9f37e44a9504a0d7f66e412a3f3bba6f.tar.gz rules-sandbox-70d0ad3c9f37e44a9504a0d7f66e412a3f3bba6f.tar.bz2 rules-sandbox-70d0ad3c9f37e44a9504a0d7f66e412a3f3bba6f.tar.xz rules-sandbox-70d0ad3c9f37e44a9504a0d7f66e412a3f3bba6f.zip |
More Wireguard.
Fixing broken myapps too.
Diffstat (limited to 'module/acme')
-rw-r--r-- | module/acme/src/main/java/io/trygvis/acme/AcmeOps.java | 4 | ||||
-rw-r--r-- | module/acme/src/main/java/io/trygvis/acme/apps/AcmeMyApp.java (renamed from module/acme/src/main/java/io/trygvis/acme/AcmeMyApp.java) | 2 | ||||
-rw-r--r-- | module/acme/src/main/java/io/trygvis/acme/apps/AcmeOps.java | 4 | ||||
-rw-r--r-- | module/acme/src/main/resources/META-INF/kmodule.xml | 8 | ||||
-rw-r--r-- | module/acme/src/main/resources/io/trygvis/acme/acme.drl | 26 | ||||
-rw-r--r-- | module/acme/src/main/resources/io/trygvis/acme/apps/apps.drl | 33 |
6 files changed, 44 insertions, 33 deletions
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/AcmeMyApp.java b/module/acme/src/main/java/io/trygvis/acme/apps/AcmeMyApp.java index dfe374b..9371af2 100644 --- a/module/acme/src/main/java/io/trygvis/acme/AcmeMyApp.java +++ b/module/acme/src/main/java/io/trygvis/acme/apps/AcmeMyApp.java @@ -1,4 +1,4 @@ -package io.trygvis.acme; +package io.trygvis.acme.apps; public class AcmeMyApp { public String environment; 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"> - <kbase packages="io.trygvis.acme" includes="dba,engine,machine,terraform" name="acme-apps"> + <kbase name="acme-apps" packages="io.trygvis.acme.apps" includes="dba,engine,machine,terraform, acme-shared"> <ksession name="acme-apps" default="true"/> </kbase> - <kbase packages="io.trygvis.acme" includes="engine,wireguard" name="acme-wireguard"> + <kbase name="acme-wireguard" packages="io.trygvis.acme.wireguard" includes="engine,wireguard, acme-shared"> <ksession name="acme-wireguard" default="true"/> </kbase> + + <kbase packages="io.trygvis.acme" name="acme-shared"> + <ksession name="acme-shared" default="true"/> + </kbase> </kmodule> 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 |