from durable.lang import * from . import dba class Acme: @staticmethod def make(env: str, tag: str): return {"type": "acme-application", "key": env, "env": env, "tag": tag} @staticmethod def declare_rules(): @when_all((m.type == "acme-application")) def acmeApp(c): cluster = f"acme-{c.m.env}" tag = f"{c.m.tag}" # c.assert_fact(dba.cluster(cluster)) for f in [ dba.container(cluster, "app", "statera", "statera", tag), dba.container(cluster, "app", "statera-console", "statera-console", tag), dba.container(cluster, "app", "4tune-web", "4tune-web", tag), dba.container(cluster, "app", "4tune-api", "4tune-api", tag), dba.container(cluster, "db", "pdb", "postgresql", "13"), dba.container(cluster, "db", "mdb", "mongodb", "3.2"), ]: c.assert_fact(f) class AcmeOperations: @staticmethod def make(): return {"type": "acme-ops", "key": "acme-ops"} @staticmethod def declare_rules(): @when_all((m.type == "acme-ops")) def acmeOps(c): cluster = "acme-ops" c.assert_fact(dba.cluster(cluster)) c.assert_fact(dba.container(cluster, "app", "pdb", "postgresql", "11")) c.assert_fact(dba.container(cluster, "app", "n8n", "n8n", "0.84.1"))