From 866eafabd7398fd1485e7aa285345a7dcea480d0 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 30 Dec 2020 20:48:51 +0100 Subject: Moving everything under durable_rules-test. --- .gitignore | 1 - Makefile | 14 -- durable_rules-test/.gitignore | 1 + durable_rules-test/Makefile | 14 ++ durable_rules-test/gen/dns/acme-1.tf | 8 + durable_rules-test/gen/dns/acme-2.tf | 8 + durable_rules-test/gen/dns/acme-3.tf | 8 + durable_rules-test/gen/dns/inputs.tf | 3 + durable_rules-test/gen/platform/ansible/acme-1.yml | 6 + durable_rules-test/gen/platform/ansible/acme-2.yml | 6 + durable_rules-test/gen/platform/ansible/acme-3.yml | 6 + .../gen/platform/terraform/acme-1.tf | 15 ++ .../gen/platform/terraform/acme-2.tf | 15 ++ .../gen/platform/terraform/acme-3.tf | 15 ++ durable_rules-test/gen/platform/terraform/main.tf | 7 + .../gen/platform/terraform/outputs.tf | 7 + durable_rules-test/j2/platform-ansible.j2 | 6 + durable_rules-test/j2/terraform-machine-outputs.j2 | 7 + durable_rules-test/j2/terraform-machine.j2 | 15 ++ durable_rules-test/j2/terraform-record-set.j2 | 8 + .../out/phase-1/acme-application/ci.yaml | 4 + .../out/phase-1/acme-application/production.yaml | 4 + .../out/phase-1/acme-ops/acme-ops.yaml | 2 + .../out/phase-1/dba-cluster/acme-ci.yaml | 2 + .../out/phase-1/dba-cluster/acme-ops.yaml | 2 + .../out/phase-1/dba-cluster/acme-production.yaml | 2 + .../phase-1/dba-container/acme-ci_4tune-api.yaml | 7 + .../phase-1/dba-container/acme-ci_4tune-web.yaml | 7 + .../out/phase-1/dba-container/acme-ci_mdb.yaml | 7 + .../out/phase-1/dba-container/acme-ci_pdb.yaml | 7 + .../dba-container/acme-ci_statera-console.yaml | 9 + .../out/phase-1/dba-container/acme-ci_statera.yaml | 9 + .../out/phase-1/dba-container/acme-ops_n8n.yaml | 7 + .../out/phase-1/dba-container/acme-ops_pdb.yaml | 7 + .../dba-container/acme-production_4tune-api.yaml | 7 + .../dba-container/acme-production_4tune-web.yaml | 7 + .../phase-1/dba-container/acme-production_mdb.yaml | 7 + .../phase-1/dba-container/acme-production_pdb.yaml | 7 + .../acme-production_statera-console.yaml | 9 + .../dba-container/acme-production_statera.yaml | 9 + .../out/phase-1/dns-entry/acme-1.yaml | 4 + .../out/phase-1/dns-entry/acme-2.yaml | 4 + .../out/phase-1/dns-entry/acme-3.yaml | 4 + durable_rules-test/out/phase-1/machine/acme-1.yaml | 3 + durable_rules-test/out/phase-1/machine/acme-2.yaml | 3 + durable_rules-test/out/phase-1/machine/acme-3.yaml | 3 + .../out/phase-1/terraform-machine/acme-1.yaml | 2 + .../out/phase-1/terraform-machine/acme-2.yaml | 2 + .../out/phase-1/terraform-machine/acme-3.yaml | 2 + .../out/phase-1/terraform-record-set/acme-1.yaml | 6 + .../out/phase-1/terraform-record-set/acme-2.yaml | 6 + .../out/phase-1/terraform-record-set/acme-3.yaml | 6 + .../out/phase-2/dba-cluster/acme-ci.yaml | 2 + .../out/phase-2/dba-cluster/acme-ops.yaml | 2 + .../out/phase-2/dba-cluster/acme-production.yaml | 2 + .../phase-2/dba-container/acme-ci_4tune-api.yaml | 9 + .../phase-2/dba-container/acme-ci_4tune-web.yaml | 9 + .../out/phase-2/dba-container/acme-ci_mdb.yaml | 9 + .../out/phase-2/dba-container/acme-ci_pdb.yaml | 9 + .../dba-container/acme-ci_statera-console.yaml | 11 + .../out/phase-2/dba-container/acme-ci_statera.yaml | 11 + .../out/phase-2/dba-container/acme-ops_n8n.yaml | 9 + .../out/phase-2/dba-container/acme-ops_pdb.yaml | 9 + .../dba-container/acme-production_4tune-api.yaml | 9 + .../dba-container/acme-production_4tune-web.yaml | 9 + .../phase-2/dba-container/acme-production_mdb.yaml | 9 + .../phase-2/dba-container/acme-production_pdb.yaml | 9 + .../acme-production_statera-console.yaml | 11 + .../dba-container/acme-production_statera.yaml | 11 + .../out/phase-3/terraform-machine/acme-1.yaml | 2 + .../out/phase-3/terraform-machine/acme-2.yaml | 2 + .../out/phase-3/terraform-machine/acme-3.yaml | 2 + .../out/phase-3/terraform-record-set/acme-1.yaml | 6 + .../out/phase-3/terraform-record-set/acme-2.yaml | 6 + .../out/phase-3/terraform-record-set/acme-3.yaml | 6 + durable_rules-test/py/acme/rai/__main__.py | 273 +++++++++++++++++++++ durable_rules-test/py/acme/rai/acme.py | 39 +++ durable_rules-test/py/acme/rai/dba.py | 13 + durable_rules-test/py/acme/rai/machine.py | 22 ++ durable_rules-test/py/acme/rai/terraform.py | 41 ++++ durable_rules-test/py/acme/rai/utils.py | 59 +++++ durable_rules-test/requirements.txt | 3 + gen/dns/acme-1.tf | 8 - gen/dns/acme-2.tf | 8 - gen/dns/acme-3.tf | 8 - gen/dns/inputs.tf | 3 - gen/platform/ansible/acme-1.yml | 6 - gen/platform/ansible/acme-2.yml | 6 - gen/platform/ansible/acme-3.yml | 6 - gen/platform/terraform/acme-1.tf | 15 -- gen/platform/terraform/acme-2.tf | 15 -- gen/platform/terraform/acme-3.tf | 15 -- gen/platform/terraform/main.tf | 7 - gen/platform/terraform/outputs.tf | 7 - j2/platform-ansible.j2 | 6 - j2/terraform-machine-outputs.j2 | 7 - j2/terraform-machine.j2 | 15 -- j2/terraform-record-set.j2 | 8 - out/phase-1/acme-application/ci.yaml | 4 - out/phase-1/acme-application/production.yaml | 4 - out/phase-1/acme-ops/acme-ops.yaml | 2 - out/phase-1/dba-cluster/acme-ci.yaml | 2 - out/phase-1/dba-cluster/acme-ops.yaml | 2 - out/phase-1/dba-cluster/acme-production.yaml | 2 - out/phase-1/dba-container/acme-ci_4tune-api.yaml | 7 - out/phase-1/dba-container/acme-ci_4tune-web.yaml | 7 - out/phase-1/dba-container/acme-ci_mdb.yaml | 7 - out/phase-1/dba-container/acme-ci_pdb.yaml | 7 - .../dba-container/acme-ci_statera-console.yaml | 9 - out/phase-1/dba-container/acme-ci_statera.yaml | 9 - out/phase-1/dba-container/acme-ops_n8n.yaml | 7 - out/phase-1/dba-container/acme-ops_pdb.yaml | 7 - .../dba-container/acme-production_4tune-api.yaml | 7 - .../dba-container/acme-production_4tune-web.yaml | 7 - out/phase-1/dba-container/acme-production_mdb.yaml | 7 - out/phase-1/dba-container/acme-production_pdb.yaml | 7 - .../acme-production_statera-console.yaml | 9 - .../dba-container/acme-production_statera.yaml | 9 - out/phase-1/dns-entry/acme-1.yaml | 4 - out/phase-1/dns-entry/acme-2.yaml | 4 - out/phase-1/dns-entry/acme-3.yaml | 4 - out/phase-1/machine/acme-1.yaml | 3 - out/phase-1/machine/acme-2.yaml | 3 - out/phase-1/machine/acme-3.yaml | 3 - out/phase-1/terraform-machine/acme-1.yaml | 2 - out/phase-1/terraform-machine/acme-2.yaml | 2 - out/phase-1/terraform-machine/acme-3.yaml | 2 - out/phase-1/terraform-record-set/acme-1.yaml | 6 - out/phase-1/terraform-record-set/acme-2.yaml | 6 - out/phase-1/terraform-record-set/acme-3.yaml | 6 - out/phase-2/dba-cluster/acme-ci.yaml | 2 - out/phase-2/dba-cluster/acme-ops.yaml | 2 - out/phase-2/dba-cluster/acme-production.yaml | 2 - out/phase-2/dba-container/acme-ci_4tune-api.yaml | 9 - out/phase-2/dba-container/acme-ci_4tune-web.yaml | 9 - out/phase-2/dba-container/acme-ci_mdb.yaml | 9 - out/phase-2/dba-container/acme-ci_pdb.yaml | 9 - .../dba-container/acme-ci_statera-console.yaml | 11 - out/phase-2/dba-container/acme-ci_statera.yaml | 11 - out/phase-2/dba-container/acme-ops_n8n.yaml | 9 - out/phase-2/dba-container/acme-ops_pdb.yaml | 9 - .../dba-container/acme-production_4tune-api.yaml | 9 - .../dba-container/acme-production_4tune-web.yaml | 9 - out/phase-2/dba-container/acme-production_mdb.yaml | 9 - out/phase-2/dba-container/acme-production_pdb.yaml | 9 - .../acme-production_statera-console.yaml | 11 - .../dba-container/acme-production_statera.yaml | 11 - out/phase-3/terraform-machine/acme-1.yaml | 2 - out/phase-3/terraform-machine/acme-2.yaml | 2 - out/phase-3/terraform-machine/acme-3.yaml | 2 - out/phase-3/terraform-record-set/acme-1.yaml | 6 - out/phase-3/terraform-record-set/acme-2.yaml | 6 - out/phase-3/terraform-record-set/acme-3.yaml | 6 - py/acme/rai/__main__.py | 273 --------------------- py/acme/rai/acme.py | 39 --- py/acme/rai/dba.py | 13 - py/acme/rai/machine.py | 22 -- py/acme/rai/terraform.py | 41 ---- py/acme/rai/utils.py | 59 ----- requirements.txt | 3 - 160 files changed, 936 insertions(+), 936 deletions(-) delete mode 100644 .gitignore delete mode 100644 Makefile create mode 100644 durable_rules-test/.gitignore create mode 100644 durable_rules-test/Makefile create mode 100644 durable_rules-test/gen/dns/acme-1.tf create mode 100644 durable_rules-test/gen/dns/acme-2.tf create mode 100644 durable_rules-test/gen/dns/acme-3.tf create mode 100644 durable_rules-test/gen/dns/inputs.tf create mode 100644 durable_rules-test/gen/platform/ansible/acme-1.yml create mode 100644 durable_rules-test/gen/platform/ansible/acme-2.yml create mode 100644 durable_rules-test/gen/platform/ansible/acme-3.yml create mode 100644 durable_rules-test/gen/platform/terraform/acme-1.tf create mode 100644 durable_rules-test/gen/platform/terraform/acme-2.tf create mode 100644 durable_rules-test/gen/platform/terraform/acme-3.tf create mode 100644 durable_rules-test/gen/platform/terraform/main.tf create mode 100644 durable_rules-test/gen/platform/terraform/outputs.tf create mode 100644 durable_rules-test/j2/platform-ansible.j2 create mode 100644 durable_rules-test/j2/terraform-machine-outputs.j2 create mode 100644 durable_rules-test/j2/terraform-machine.j2 create mode 100644 durable_rules-test/j2/terraform-record-set.j2 create mode 100644 durable_rules-test/out/phase-1/acme-application/ci.yaml create mode 100644 durable_rules-test/out/phase-1/acme-application/production.yaml create mode 100644 durable_rules-test/out/phase-1/acme-ops/acme-ops.yaml create mode 100644 durable_rules-test/out/phase-1/dba-cluster/acme-ci.yaml create mode 100644 durable_rules-test/out/phase-1/dba-cluster/acme-ops.yaml create mode 100644 durable_rules-test/out/phase-1/dba-cluster/acme-production.yaml create mode 100644 durable_rules-test/out/phase-1/dba-container/acme-ci_4tune-api.yaml create mode 100644 durable_rules-test/out/phase-1/dba-container/acme-ci_4tune-web.yaml create mode 100644 durable_rules-test/out/phase-1/dba-container/acme-ci_mdb.yaml create mode 100644 durable_rules-test/out/phase-1/dba-container/acme-ci_pdb.yaml create mode 100644 durable_rules-test/out/phase-1/dba-container/acme-ci_statera-console.yaml create mode 100644 durable_rules-test/out/phase-1/dba-container/acme-ci_statera.yaml create mode 100644 durable_rules-test/out/phase-1/dba-container/acme-ops_n8n.yaml create mode 100644 durable_rules-test/out/phase-1/dba-container/acme-ops_pdb.yaml create mode 100644 durable_rules-test/out/phase-1/dba-container/acme-production_4tune-api.yaml create mode 100644 durable_rules-test/out/phase-1/dba-container/acme-production_4tune-web.yaml create mode 100644 durable_rules-test/out/phase-1/dba-container/acme-production_mdb.yaml create mode 100644 durable_rules-test/out/phase-1/dba-container/acme-production_pdb.yaml create mode 100644 durable_rules-test/out/phase-1/dba-container/acme-production_statera-console.yaml create mode 100644 durable_rules-test/out/phase-1/dba-container/acme-production_statera.yaml create mode 100644 durable_rules-test/out/phase-1/dns-entry/acme-1.yaml create mode 100644 durable_rules-test/out/phase-1/dns-entry/acme-2.yaml create mode 100644 durable_rules-test/out/phase-1/dns-entry/acme-3.yaml create mode 100644 durable_rules-test/out/phase-1/machine/acme-1.yaml create mode 100644 durable_rules-test/out/phase-1/machine/acme-2.yaml create mode 100644 durable_rules-test/out/phase-1/machine/acme-3.yaml create mode 100644 durable_rules-test/out/phase-1/terraform-machine/acme-1.yaml create mode 100644 durable_rules-test/out/phase-1/terraform-machine/acme-2.yaml create mode 100644 durable_rules-test/out/phase-1/terraform-machine/acme-3.yaml create mode 100644 durable_rules-test/out/phase-1/terraform-record-set/acme-1.yaml create mode 100644 durable_rules-test/out/phase-1/terraform-record-set/acme-2.yaml create mode 100644 durable_rules-test/out/phase-1/terraform-record-set/acme-3.yaml create mode 100644 durable_rules-test/out/phase-2/dba-cluster/acme-ci.yaml create mode 100644 durable_rules-test/out/phase-2/dba-cluster/acme-ops.yaml create mode 100644 durable_rules-test/out/phase-2/dba-cluster/acme-production.yaml create mode 100644 durable_rules-test/out/phase-2/dba-container/acme-ci_4tune-api.yaml create mode 100644 durable_rules-test/out/phase-2/dba-container/acme-ci_4tune-web.yaml create mode 100644 durable_rules-test/out/phase-2/dba-container/acme-ci_mdb.yaml create mode 100644 durable_rules-test/out/phase-2/dba-container/acme-ci_pdb.yaml create mode 100644 durable_rules-test/out/phase-2/dba-container/acme-ci_statera-console.yaml create mode 100644 durable_rules-test/out/phase-2/dba-container/acme-ci_statera.yaml create mode 100644 durable_rules-test/out/phase-2/dba-container/acme-ops_n8n.yaml create mode 100644 durable_rules-test/out/phase-2/dba-container/acme-ops_pdb.yaml create mode 100644 durable_rules-test/out/phase-2/dba-container/acme-production_4tune-api.yaml create mode 100644 durable_rules-test/out/phase-2/dba-container/acme-production_4tune-web.yaml create mode 100644 durable_rules-test/out/phase-2/dba-container/acme-production_mdb.yaml create mode 100644 durable_rules-test/out/phase-2/dba-container/acme-production_pdb.yaml create mode 100644 durable_rules-test/out/phase-2/dba-container/acme-production_statera-console.yaml create mode 100644 durable_rules-test/out/phase-2/dba-container/acme-production_statera.yaml create mode 100644 durable_rules-test/out/phase-3/terraform-machine/acme-1.yaml create mode 100644 durable_rules-test/out/phase-3/terraform-machine/acme-2.yaml create mode 100644 durable_rules-test/out/phase-3/terraform-machine/acme-3.yaml create mode 100644 durable_rules-test/out/phase-3/terraform-record-set/acme-1.yaml create mode 100644 durable_rules-test/out/phase-3/terraform-record-set/acme-2.yaml create mode 100644 durable_rules-test/out/phase-3/terraform-record-set/acme-3.yaml create mode 100644 durable_rules-test/py/acme/rai/__main__.py create mode 100644 durable_rules-test/py/acme/rai/acme.py create mode 100644 durable_rules-test/py/acme/rai/dba.py create mode 100644 durable_rules-test/py/acme/rai/machine.py create mode 100644 durable_rules-test/py/acme/rai/terraform.py create mode 100644 durable_rules-test/py/acme/rai/utils.py create mode 100644 durable_rules-test/requirements.txt delete mode 100644 gen/dns/acme-1.tf delete mode 100644 gen/dns/acme-2.tf delete mode 100644 gen/dns/acme-3.tf delete mode 100644 gen/dns/inputs.tf delete mode 100644 gen/platform/ansible/acme-1.yml delete mode 100644 gen/platform/ansible/acme-2.yml delete mode 100644 gen/platform/ansible/acme-3.yml delete mode 100644 gen/platform/terraform/acme-1.tf delete mode 100644 gen/platform/terraform/acme-2.tf delete mode 100644 gen/platform/terraform/acme-3.tf delete mode 100644 gen/platform/terraform/main.tf delete mode 100644 gen/platform/terraform/outputs.tf delete mode 100644 j2/platform-ansible.j2 delete mode 100644 j2/terraform-machine-outputs.j2 delete mode 100644 j2/terraform-machine.j2 delete mode 100644 j2/terraform-record-set.j2 delete mode 100644 out/phase-1/acme-application/ci.yaml delete mode 100644 out/phase-1/acme-application/production.yaml delete mode 100644 out/phase-1/acme-ops/acme-ops.yaml delete mode 100644 out/phase-1/dba-cluster/acme-ci.yaml delete mode 100644 out/phase-1/dba-cluster/acme-ops.yaml delete mode 100644 out/phase-1/dba-cluster/acme-production.yaml delete mode 100644 out/phase-1/dba-container/acme-ci_4tune-api.yaml delete mode 100644 out/phase-1/dba-container/acme-ci_4tune-web.yaml delete mode 100644 out/phase-1/dba-container/acme-ci_mdb.yaml delete mode 100644 out/phase-1/dba-container/acme-ci_pdb.yaml delete mode 100644 out/phase-1/dba-container/acme-ci_statera-console.yaml delete mode 100644 out/phase-1/dba-container/acme-ci_statera.yaml delete mode 100644 out/phase-1/dba-container/acme-ops_n8n.yaml delete mode 100644 out/phase-1/dba-container/acme-ops_pdb.yaml delete mode 100644 out/phase-1/dba-container/acme-production_4tune-api.yaml delete mode 100644 out/phase-1/dba-container/acme-production_4tune-web.yaml delete mode 100644 out/phase-1/dba-container/acme-production_mdb.yaml delete mode 100644 out/phase-1/dba-container/acme-production_pdb.yaml delete mode 100644 out/phase-1/dba-container/acme-production_statera-console.yaml delete mode 100644 out/phase-1/dba-container/acme-production_statera.yaml delete mode 100644 out/phase-1/dns-entry/acme-1.yaml delete mode 100644 out/phase-1/dns-entry/acme-2.yaml delete mode 100644 out/phase-1/dns-entry/acme-3.yaml delete mode 100644 out/phase-1/machine/acme-1.yaml delete mode 100644 out/phase-1/machine/acme-2.yaml delete mode 100644 out/phase-1/machine/acme-3.yaml delete mode 100644 out/phase-1/terraform-machine/acme-1.yaml delete mode 100644 out/phase-1/terraform-machine/acme-2.yaml delete mode 100644 out/phase-1/terraform-machine/acme-3.yaml delete mode 100644 out/phase-1/terraform-record-set/acme-1.yaml delete mode 100644 out/phase-1/terraform-record-set/acme-2.yaml delete mode 100644 out/phase-1/terraform-record-set/acme-3.yaml delete mode 100644 out/phase-2/dba-cluster/acme-ci.yaml delete mode 100644 out/phase-2/dba-cluster/acme-ops.yaml delete mode 100644 out/phase-2/dba-cluster/acme-production.yaml delete mode 100644 out/phase-2/dba-container/acme-ci_4tune-api.yaml delete mode 100644 out/phase-2/dba-container/acme-ci_4tune-web.yaml delete mode 100644 out/phase-2/dba-container/acme-ci_mdb.yaml delete mode 100644 out/phase-2/dba-container/acme-ci_pdb.yaml delete mode 100644 out/phase-2/dba-container/acme-ci_statera-console.yaml delete mode 100644 out/phase-2/dba-container/acme-ci_statera.yaml delete mode 100644 out/phase-2/dba-container/acme-ops_n8n.yaml delete mode 100644 out/phase-2/dba-container/acme-ops_pdb.yaml delete mode 100644 out/phase-2/dba-container/acme-production_4tune-api.yaml delete mode 100644 out/phase-2/dba-container/acme-production_4tune-web.yaml delete mode 100644 out/phase-2/dba-container/acme-production_mdb.yaml delete mode 100644 out/phase-2/dba-container/acme-production_pdb.yaml delete mode 100644 out/phase-2/dba-container/acme-production_statera-console.yaml delete mode 100644 out/phase-2/dba-container/acme-production_statera.yaml delete mode 100644 out/phase-3/terraform-machine/acme-1.yaml delete mode 100644 out/phase-3/terraform-machine/acme-2.yaml delete mode 100644 out/phase-3/terraform-machine/acme-3.yaml delete mode 100644 out/phase-3/terraform-record-set/acme-1.yaml delete mode 100644 out/phase-3/terraform-record-set/acme-2.yaml delete mode 100644 out/phase-3/terraform-record-set/acme-3.yaml delete mode 100644 py/acme/rai/__main__.py delete mode 100644 py/acme/rai/acme.py delete mode 100644 py/acme/rai/dba.py delete mode 100644 py/acme/rai/machine.py delete mode 100644 py/acme/rai/terraform.py delete mode 100644 py/acme/rai/utils.py delete mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore deleted file mode 100644 index bee8a64..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -__pycache__ diff --git a/Makefile b/Makefile deleted file mode 100644 index 41a2dab..0000000 --- a/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -PYTHONPATH=$(PWD)/py -export PYTHONPATH - -all: env/.cookie - -run: env/.cookie - env/bin/python -m acme.rai - -env: - virtualenv -p python3 env - -env/.cookie: env requirements.txt - env/bin/pip install -r requirements.txt - touch $@ diff --git a/durable_rules-test/.gitignore b/durable_rules-test/.gitignore new file mode 100644 index 0000000..bee8a64 --- /dev/null +++ b/durable_rules-test/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/durable_rules-test/Makefile b/durable_rules-test/Makefile new file mode 100644 index 0000000..41a2dab --- /dev/null +++ b/durable_rules-test/Makefile @@ -0,0 +1,14 @@ +PYTHONPATH=$(PWD)/py +export PYTHONPATH + +all: env/.cookie + +run: env/.cookie + env/bin/python -m acme.rai + +env: + virtualenv -p python3 env + +env/.cookie: env requirements.txt + env/bin/pip install -r requirements.txt + touch $@ diff --git a/durable_rules-test/gen/dns/acme-1.tf b/durable_rules-test/gen/dns/acme-1.tf new file mode 100644 index 0000000..c1022ba --- /dev/null +++ b/durable_rules-test/gen/dns/acme-1.tf @@ -0,0 +1,8 @@ +resource "google_dns_record_set" "acme-1_machine_acme_corp" { + name = "acme-1.machine.acme.corp" + managed_zone = "None" + type = "A" + ttl = 300 + + rrdatas = [var.addresses.acme-1] +} diff --git a/durable_rules-test/gen/dns/acme-2.tf b/durable_rules-test/gen/dns/acme-2.tf new file mode 100644 index 0000000..4847052 --- /dev/null +++ b/durable_rules-test/gen/dns/acme-2.tf @@ -0,0 +1,8 @@ +resource "google_dns_record_set" "acme-2_machine_acme_corp" { + name = "acme-2.machine.acme.corp" + managed_zone = "None" + type = "A" + ttl = 300 + + rrdatas = [var.addresses.acme-2] +} diff --git a/durable_rules-test/gen/dns/acme-3.tf b/durable_rules-test/gen/dns/acme-3.tf new file mode 100644 index 0000000..c192dd3 --- /dev/null +++ b/durable_rules-test/gen/dns/acme-3.tf @@ -0,0 +1,8 @@ +resource "google_dns_record_set" "acme-3_machine_acme_corp" { + name = "acme-3.machine.acme.corp" + managed_zone = "None" + type = "A" + ttl = 300 + + rrdatas = [var.addresses.acme-3] +} diff --git a/durable_rules-test/gen/dns/inputs.tf b/durable_rules-test/gen/dns/inputs.tf new file mode 100644 index 0000000..615ea69 --- /dev/null +++ b/durable_rules-test/gen/dns/inputs.tf @@ -0,0 +1,3 @@ +variable "addresses" { + type = map(string) +} diff --git a/durable_rules-test/gen/platform/ansible/acme-1.yml b/durable_rules-test/gen/platform/ansible/acme-1.yml new file mode 100644 index 0000000..f5849b2 --- /dev/null +++ b/durable_rules-test/gen/platform/ansible/acme-1.yml @@ -0,0 +1,6 @@ +# Ansible +- hosts: + - acme-1 + tasks: + - import_role: + name: acme-platform diff --git a/durable_rules-test/gen/platform/ansible/acme-2.yml b/durable_rules-test/gen/platform/ansible/acme-2.yml new file mode 100644 index 0000000..755c214 --- /dev/null +++ b/durable_rules-test/gen/platform/ansible/acme-2.yml @@ -0,0 +1,6 @@ +# Ansible +- hosts: + - acme-2 + tasks: + - import_role: + name: acme-platform diff --git a/durable_rules-test/gen/platform/ansible/acme-3.yml b/durable_rules-test/gen/platform/ansible/acme-3.yml new file mode 100644 index 0000000..880a21f --- /dev/null +++ b/durable_rules-test/gen/platform/ansible/acme-3.yml @@ -0,0 +1,6 @@ +# Ansible +- hosts: + - acme-3 + tasks: + - import_role: + name: acme-platform diff --git a/durable_rules-test/gen/platform/terraform/acme-1.tf b/durable_rules-test/gen/platform/terraform/acme-1.tf new file mode 100644 index 0000000..8100533 --- /dev/null +++ b/durable_rules-test/gen/platform/terraform/acme-1.tf @@ -0,0 +1,15 @@ +resource "scaleway_instance_server" "acme-1" { + name = "acme-1" + type = "DEV1-S" + image = "b3042271-d2b1-4f87-b407-aedd3bbd1663" + ip_id = scaleway_instance_ip.acme-1.id + enable_dynamic_ip = false + enable_ipv6 = true +} + +resource "scaleway_instance_ip" "acme-1" {} + +#resource "scaleway_instance_ip_reverse_dns" "acme-1" { +# ip_id = scaleway_instance_ip.acme-1.id +# reverse = "acme-1.${google_dns_managed_zone.machine.dns_name}" +#} diff --git a/durable_rules-test/gen/platform/terraform/acme-2.tf b/durable_rules-test/gen/platform/terraform/acme-2.tf new file mode 100644 index 0000000..07d5e8b --- /dev/null +++ b/durable_rules-test/gen/platform/terraform/acme-2.tf @@ -0,0 +1,15 @@ +resource "scaleway_instance_server" "acme-2" { + name = "acme-1" + type = "DEV1-S" + image = "b3042271-d2b1-4f87-b407-aedd3bbd1663" + ip_id = scaleway_instance_ip.acme-2.id + enable_dynamic_ip = false + enable_ipv6 = true +} + +resource "scaleway_instance_ip" "acme-2" {} + +#resource "scaleway_instance_ip_reverse_dns" "acme-2" { +# ip_id = scaleway_instance_ip.acme-2.id +# reverse = "acme-2.${google_dns_managed_zone.machine.dns_name}" +#} diff --git a/durable_rules-test/gen/platform/terraform/acme-3.tf b/durable_rules-test/gen/platform/terraform/acme-3.tf new file mode 100644 index 0000000..a2246bc --- /dev/null +++ b/durable_rules-test/gen/platform/terraform/acme-3.tf @@ -0,0 +1,15 @@ +resource "scaleway_instance_server" "acme-3" { + name = "acme-1" + type = "DEV1-S" + image = "b3042271-d2b1-4f87-b407-aedd3bbd1663" + ip_id = scaleway_instance_ip.acme-3.id + enable_dynamic_ip = false + enable_ipv6 = true +} + +resource "scaleway_instance_ip" "acme-3" {} + +#resource "scaleway_instance_ip_reverse_dns" "acme-3" { +# ip_id = scaleway_instance_ip.acme-3.id +# reverse = "acme-3.${google_dns_managed_zone.machine.dns_name}" +#} diff --git a/durable_rules-test/gen/platform/terraform/main.tf b/durable_rules-test/gen/platform/terraform/main.tf new file mode 100644 index 0000000..3f217ed --- /dev/null +++ b/durable_rules-test/gen/platform/terraform/main.tf @@ -0,0 +1,7 @@ +terraform { + required_providers { + scaleway = { + source = "scaleway/scaleway" + } + } +} diff --git a/durable_rules-test/gen/platform/terraform/outputs.tf b/durable_rules-test/gen/platform/terraform/outputs.tf new file mode 100644 index 0000000..87ccb0b --- /dev/null +++ b/durable_rules-test/gen/platform/terraform/outputs.tf @@ -0,0 +1,7 @@ +output "addresses" { + value = { + acme-2: scaleway_instance_ip.acme-2.address, + acme-3: scaleway_instance_ip.acme-3.address, + acme-1: scaleway_instance_ip.acme-1.address, + } +} diff --git a/durable_rules-test/j2/platform-ansible.j2 b/durable_rules-test/j2/platform-ansible.j2 new file mode 100644 index 0000000..72e3247 --- /dev/null +++ b/durable_rules-test/j2/platform-ansible.j2 @@ -0,0 +1,6 @@ +# Ansible +- hosts: + - {{ m.key }} + tasks: + - import_role: + name: acme-platform diff --git a/durable_rules-test/j2/terraform-machine-outputs.j2 b/durable_rules-test/j2/terraform-machine-outputs.j2 new file mode 100644 index 0000000..438fac6 --- /dev/null +++ b/durable_rules-test/j2/terraform-machine-outputs.j2 @@ -0,0 +1,7 @@ +output "addresses" { + value = { +{%- for m in machines %} + {{ m.key }}: scaleway_instance_ip.{{ m.key }}.address, +{%- endfor %} + } +} diff --git a/durable_rules-test/j2/terraform-machine.j2 b/durable_rules-test/j2/terraform-machine.j2 new file mode 100644 index 0000000..889a23d --- /dev/null +++ b/durable_rules-test/j2/terraform-machine.j2 @@ -0,0 +1,15 @@ +resource "scaleway_instance_server" "{{ m.key }}" { + name = "acme-1" + type = "DEV1-S" + image = "b3042271-d2b1-4f87-b407-aedd3bbd1663" + ip_id = scaleway_instance_ip.{{ m.key }}.id + enable_dynamic_ip = false + enable_ipv6 = true +} + +resource "scaleway_instance_ip" "{{ m.key }}" {} + +#resource "scaleway_instance_ip_reverse_dns" "{{ m.key }}" { +# ip_id = scaleway_instance_ip.{{ m.key }}.id +# reverse = "{{ m.key }}.${google_dns_managed_zone.machine.dns_name}" +#} diff --git a/durable_rules-test/j2/terraform-record-set.j2 b/durable_rules-test/j2/terraform-record-set.j2 new file mode 100644 index 0000000..03304bc --- /dev/null +++ b/durable_rules-test/j2/terraform-record-set.j2 @@ -0,0 +1,8 @@ +resource "google_dns_record_set" "{{ m.terraformId }}" { + name = "{{ m.fqdn }}" + managed_zone = "{{ m.terraformManagedZone }}" + type = "{{ m.rrType }}" + ttl = 300 + + rrdatas = [var.addresses.{{ m.key }}] +} diff --git a/durable_rules-test/out/phase-1/acme-application/ci.yaml b/durable_rules-test/out/phase-1/acme-application/ci.yaml new file mode 100644 index 0000000..2feec10 --- /dev/null +++ b/durable_rules-test/out/phase-1/acme-application/ci.yaml @@ -0,0 +1,4 @@ +env: ci +key: ci +tag: development +type: acme-application diff --git a/durable_rules-test/out/phase-1/acme-application/production.yaml b/durable_rules-test/out/phase-1/acme-application/production.yaml new file mode 100644 index 0000000..6054cec --- /dev/null +++ b/durable_rules-test/out/phase-1/acme-application/production.yaml @@ -0,0 +1,4 @@ +env: production +key: production +tag: master +type: acme-application diff --git a/durable_rules-test/out/phase-1/acme-ops/acme-ops.yaml b/durable_rules-test/out/phase-1/acme-ops/acme-ops.yaml new file mode 100644 index 0000000..15680bd --- /dev/null +++ b/durable_rules-test/out/phase-1/acme-ops/acme-ops.yaml @@ -0,0 +1,2 @@ +key: acme-ops +type: acme-ops diff --git a/durable_rules-test/out/phase-1/dba-cluster/acme-ci.yaml b/durable_rules-test/out/phase-1/dba-cluster/acme-ci.yaml new file mode 100644 index 0000000..fccc7ed --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-cluster/acme-ci.yaml @@ -0,0 +1,2 @@ +key: acme-ci +type: dba-cluster diff --git a/durable_rules-test/out/phase-1/dba-cluster/acme-ops.yaml b/durable_rules-test/out/phase-1/dba-cluster/acme-ops.yaml new file mode 100644 index 0000000..2735ff3 --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-cluster/acme-ops.yaml @@ -0,0 +1,2 @@ +key: acme-ops +type: dba-cluster diff --git a/durable_rules-test/out/phase-1/dba-cluster/acme-production.yaml b/durable_rules-test/out/phase-1/dba-cluster/acme-production.yaml new file mode 100644 index 0000000..3b7eb5a --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-cluster/acme-production.yaml @@ -0,0 +1,2 @@ +key: acme-production +type: dba-cluster diff --git a/durable_rules-test/out/phase-1/dba-container/acme-ci_4tune-api.yaml b/durable_rules-test/out/phase-1/dba-container/acme-ci_4tune-api.yaml new file mode 100644 index 0000000..94e265f --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-container/acme-ci_4tune-api.yaml @@ -0,0 +1,7 @@ +cluster: acme-ci +image: 4tune-api +key: acme-ci/4tune-api +machineRole: app +name: 4tune-api +tag: development +type: dba-container diff --git a/durable_rules-test/out/phase-1/dba-container/acme-ci_4tune-web.yaml b/durable_rules-test/out/phase-1/dba-container/acme-ci_4tune-web.yaml new file mode 100644 index 0000000..9127420 --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-container/acme-ci_4tune-web.yaml @@ -0,0 +1,7 @@ +cluster: acme-ci +image: 4tune-web +key: acme-ci/4tune-web +machineRole: app +name: 4tune-web +tag: development +type: dba-container diff --git a/durable_rules-test/out/phase-1/dba-container/acme-ci_mdb.yaml b/durable_rules-test/out/phase-1/dba-container/acme-ci_mdb.yaml new file mode 100644 index 0000000..b49853b --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-container/acme-ci_mdb.yaml @@ -0,0 +1,7 @@ +cluster: acme-ci +image: mongodb +key: acme-ci/mdb +machineRole: db +name: mdb +tag: '3.2' +type: dba-container diff --git a/durable_rules-test/out/phase-1/dba-container/acme-ci_pdb.yaml b/durable_rules-test/out/phase-1/dba-container/acme-ci_pdb.yaml new file mode 100644 index 0000000..d9ea55a --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-container/acme-ci_pdb.yaml @@ -0,0 +1,7 @@ +cluster: acme-ci +image: postgresql +key: acme-ci/pdb +machineRole: db +name: pdb +tag: '13' +type: dba-container diff --git a/durable_rules-test/out/phase-1/dba-container/acme-ci_statera-console.yaml b/durable_rules-test/out/phase-1/dba-container/acme-ci_statera-console.yaml new file mode 100644 index 0000000..0cb0cc4 --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-container/acme-ci_statera-console.yaml @@ -0,0 +1,9 @@ +cluster: acme-ci +image: statera-console +key: acme-ci/statera-console +machineRole: app +name: statera-console +ports: +- 80 +tag: development +type: dba-container diff --git a/durable_rules-test/out/phase-1/dba-container/acme-ci_statera.yaml b/durable_rules-test/out/phase-1/dba-container/acme-ci_statera.yaml new file mode 100644 index 0000000..6a3eb98 --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-container/acme-ci_statera.yaml @@ -0,0 +1,9 @@ +cluster: acme-ci +image: statera +key: acme-ci/statera +machineRole: app +name: statera +ports: +- 8090 +tag: development +type: dba-container diff --git a/durable_rules-test/out/phase-1/dba-container/acme-ops_n8n.yaml b/durable_rules-test/out/phase-1/dba-container/acme-ops_n8n.yaml new file mode 100644 index 0000000..d34efda --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-container/acme-ops_n8n.yaml @@ -0,0 +1,7 @@ +cluster: acme-ops +image: n8n +key: acme-ops/n8n +machineRole: app +name: n8n +tag: 0.84.1 +type: dba-container diff --git a/durable_rules-test/out/phase-1/dba-container/acme-ops_pdb.yaml b/durable_rules-test/out/phase-1/dba-container/acme-ops_pdb.yaml new file mode 100644 index 0000000..a3aa769 --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-container/acme-ops_pdb.yaml @@ -0,0 +1,7 @@ +cluster: acme-ops +image: postgresql +key: acme-ops/pdb +machineRole: app +name: pdb +tag: '11' +type: dba-container diff --git a/durable_rules-test/out/phase-1/dba-container/acme-production_4tune-api.yaml b/durable_rules-test/out/phase-1/dba-container/acme-production_4tune-api.yaml new file mode 100644 index 0000000..aa80827 --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-container/acme-production_4tune-api.yaml @@ -0,0 +1,7 @@ +cluster: acme-production +image: 4tune-api +key: acme-production/4tune-api +machineRole: app +name: 4tune-api +tag: master +type: dba-container diff --git a/durable_rules-test/out/phase-1/dba-container/acme-production_4tune-web.yaml b/durable_rules-test/out/phase-1/dba-container/acme-production_4tune-web.yaml new file mode 100644 index 0000000..6ba5f0d --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-container/acme-production_4tune-web.yaml @@ -0,0 +1,7 @@ +cluster: acme-production +image: 4tune-web +key: acme-production/4tune-web +machineRole: app +name: 4tune-web +tag: master +type: dba-container diff --git a/durable_rules-test/out/phase-1/dba-container/acme-production_mdb.yaml b/durable_rules-test/out/phase-1/dba-container/acme-production_mdb.yaml new file mode 100644 index 0000000..45206fe --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-container/acme-production_mdb.yaml @@ -0,0 +1,7 @@ +cluster: acme-production +image: mongodb +key: acme-production/mdb +machineRole: db +name: mdb +tag: '3.2' +type: dba-container diff --git a/durable_rules-test/out/phase-1/dba-container/acme-production_pdb.yaml b/durable_rules-test/out/phase-1/dba-container/acme-production_pdb.yaml new file mode 100644 index 0000000..112c678 --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-container/acme-production_pdb.yaml @@ -0,0 +1,7 @@ +cluster: acme-production +image: postgresql +key: acme-production/pdb +machineRole: db +name: pdb +tag: '13' +type: dba-container diff --git a/durable_rules-test/out/phase-1/dba-container/acme-production_statera-console.yaml b/durable_rules-test/out/phase-1/dba-container/acme-production_statera-console.yaml new file mode 100644 index 0000000..0f4fbf4 --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-container/acme-production_statera-console.yaml @@ -0,0 +1,9 @@ +cluster: acme-production +image: statera-console +key: acme-production/statera-console +machineRole: app +name: statera-console +ports: +- 80 +tag: master +type: dba-container diff --git a/durable_rules-test/out/phase-1/dba-container/acme-production_statera.yaml b/durable_rules-test/out/phase-1/dba-container/acme-production_statera.yaml new file mode 100644 index 0000000..a509810 --- /dev/null +++ b/durable_rules-test/out/phase-1/dba-container/acme-production_statera.yaml @@ -0,0 +1,9 @@ +cluster: acme-production +image: statera +key: acme-production/statera +machineRole: app +name: statera +ports: +- 8090 +tag: master +type: dba-container diff --git a/durable_rules-test/out/phase-1/dns-entry/acme-1.yaml b/durable_rules-test/out/phase-1/dns-entry/acme-1.yaml new file mode 100644 index 0000000..aafae11 --- /dev/null +++ b/durable_rules-test/out/phase-1/dns-entry/acme-1.yaml @@ -0,0 +1,4 @@ +fqdn: acme-1.machine.acme.corp +key: acme-1 +rrType: A +type: dns-entry diff --git a/durable_rules-test/out/phase-1/dns-entry/acme-2.yaml b/durable_rules-test/out/phase-1/dns-entry/acme-2.yaml new file mode 100644 index 0000000..38ad9e9 --- /dev/null +++ b/durable_rules-test/out/phase-1/dns-entry/acme-2.yaml @@ -0,0 +1,4 @@ +fqdn: acme-2.machine.acme.corp +key: acme-2 +rrType: A +type: dns-entry diff --git a/durable_rules-test/out/phase-1/dns-entry/acme-3.yaml b/durable_rules-test/out/phase-1/dns-entry/acme-3.yaml new file mode 100644 index 0000000..451ba7c --- /dev/null +++ b/durable_rules-test/out/phase-1/dns-entry/acme-3.yaml @@ -0,0 +1,4 @@ +fqdn: acme-3.machine.acme.corp +key: acme-3 +rrType: A +type: dns-entry diff --git a/durable_rules-test/out/phase-1/machine/acme-1.yaml b/durable_rules-test/out/phase-1/machine/acme-1.yaml new file mode 100644 index 0000000..9e4356e --- /dev/null +++ b/durable_rules-test/out/phase-1/machine/acme-1.yaml @@ -0,0 +1,3 @@ +key: acme-1 +name: acme-1 +type: machine diff --git a/durable_rules-test/out/phase-1/machine/acme-2.yaml b/durable_rules-test/out/phase-1/machine/acme-2.yaml new file mode 100644 index 0000000..24655d8 --- /dev/null +++ b/durable_rules-test/out/phase-1/machine/acme-2.yaml @@ -0,0 +1,3 @@ +key: acme-2 +name: acme-2 +type: machine diff --git a/durable_rules-test/out/phase-1/machine/acme-3.yaml b/durable_rules-test/out/phase-1/machine/acme-3.yaml new file mode 100644 index 0000000..d7d75ff --- /dev/null +++ b/durable_rules-test/out/phase-1/machine/acme-3.yaml @@ -0,0 +1,3 @@ +key: acme-3 +name: acme-3 +type: machine diff --git a/durable_rules-test/out/phase-1/terraform-machine/acme-1.yaml b/durable_rules-test/out/phase-1/terraform-machine/acme-1.yaml new file mode 100644 index 0000000..90653fe --- /dev/null +++ b/durable_rules-test/out/phase-1/terraform-machine/acme-1.yaml @@ -0,0 +1,2 @@ +key: acme-1 +type: terraform-machine diff --git a/durable_rules-test/out/phase-1/terraform-machine/acme-2.yaml b/durable_rules-test/out/phase-1/terraform-machine/acme-2.yaml new file mode 100644 index 0000000..79b0ce6 --- /dev/null +++ b/durable_rules-test/out/phase-1/terraform-machine/acme-2.yaml @@ -0,0 +1,2 @@ +key: acme-2 +type: terraform-machine diff --git a/durable_rules-test/out/phase-1/terraform-machine/acme-3.yaml b/durable_rules-test/out/phase-1/terraform-machine/acme-3.yaml new file mode 100644 index 0000000..8d77b80 --- /dev/null +++ b/durable_rules-test/out/phase-1/terraform-machine/acme-3.yaml @@ -0,0 +1,2 @@ +key: acme-3 +type: terraform-machine diff --git a/durable_rules-test/out/phase-1/terraform-record-set/acme-1.yaml b/durable_rules-test/out/phase-1/terraform-record-set/acme-1.yaml new file mode 100644 index 0000000..ccf16c7 --- /dev/null +++ b/durable_rules-test/out/phase-1/terraform-record-set/acme-1.yaml @@ -0,0 +1,6 @@ +fqdn: acme-1.machine.acme.corp +key: acme-1 +rrData: scaleway_instance_ip.acme-1.address +rrType: A +terraformId: acme-1_machine_acme_corp +type: terraform-record-set diff --git a/durable_rules-test/out/phase-1/terraform-record-set/acme-2.yaml b/durable_rules-test/out/phase-1/terraform-record-set/acme-2.yaml new file mode 100644 index 0000000..d95be1f --- /dev/null +++ b/durable_rules-test/out/phase-1/terraform-record-set/acme-2.yaml @@ -0,0 +1,6 @@ +fqdn: acme-2.machine.acme.corp +key: acme-2 +rrData: scaleway_instance_ip.acme-2.address +rrType: A +terraformId: acme-2_machine_acme_corp +type: terraform-record-set diff --git a/durable_rules-test/out/phase-1/terraform-record-set/acme-3.yaml b/durable_rules-test/out/phase-1/terraform-record-set/acme-3.yaml new file mode 100644 index 0000000..58c202e --- /dev/null +++ b/durable_rules-test/out/phase-1/terraform-record-set/acme-3.yaml @@ -0,0 +1,6 @@ +fqdn: acme-3.machine.acme.corp +key: acme-3 +rrData: scaleway_instance_ip.acme-3.address +rrType: A +terraformId: acme-3_machine_acme_corp +type: terraform-record-set diff --git a/durable_rules-test/out/phase-2/dba-cluster/acme-ci.yaml b/durable_rules-test/out/phase-2/dba-cluster/acme-ci.yaml new file mode 100644 index 0000000..fccc7ed --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-cluster/acme-ci.yaml @@ -0,0 +1,2 @@ +key: acme-ci +type: dba-cluster diff --git a/durable_rules-test/out/phase-2/dba-cluster/acme-ops.yaml b/durable_rules-test/out/phase-2/dba-cluster/acme-ops.yaml new file mode 100644 index 0000000..2735ff3 --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-cluster/acme-ops.yaml @@ -0,0 +1,2 @@ +key: acme-ops +type: dba-cluster diff --git a/durable_rules-test/out/phase-2/dba-cluster/acme-production.yaml b/durable_rules-test/out/phase-2/dba-cluster/acme-production.yaml new file mode 100644 index 0000000..3b7eb5a --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-cluster/acme-production.yaml @@ -0,0 +1,2 @@ +key: acme-production +type: dba-cluster diff --git a/durable_rules-test/out/phase-2/dba-container/acme-ci_4tune-api.yaml b/durable_rules-test/out/phase-2/dba-container/acme-ci_4tune-api.yaml new file mode 100644 index 0000000..58ec759 --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-container/acme-ci_4tune-api.yaml @@ -0,0 +1,9 @@ +cluster: acme-ci +image: 4tune-api +key: acme-ci/4tune-api +machineRole: app +name: 4tune-api +ports_classified: true +public_ports: false +tag: development +type: dba-container diff --git a/durable_rules-test/out/phase-2/dba-container/acme-ci_4tune-web.yaml b/durable_rules-test/out/phase-2/dba-container/acme-ci_4tune-web.yaml new file mode 100644 index 0000000..685dfb6 --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-container/acme-ci_4tune-web.yaml @@ -0,0 +1,9 @@ +cluster: acme-ci +image: 4tune-web +key: acme-ci/4tune-web +machineRole: app +name: 4tune-web +ports_classified: true +public_ports: false +tag: development +type: dba-container diff --git a/durable_rules-test/out/phase-2/dba-container/acme-ci_mdb.yaml b/durable_rules-test/out/phase-2/dba-container/acme-ci_mdb.yaml new file mode 100644 index 0000000..f1b661c --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-container/acme-ci_mdb.yaml @@ -0,0 +1,9 @@ +cluster: acme-ci +image: mongodb +key: acme-ci/mdb +machineRole: db +name: mdb +ports_classified: true +public_ports: false +tag: '3.2' +type: dba-container diff --git a/durable_rules-test/out/phase-2/dba-container/acme-ci_pdb.yaml b/durable_rules-test/out/phase-2/dba-container/acme-ci_pdb.yaml new file mode 100644 index 0000000..b138b1a --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-container/acme-ci_pdb.yaml @@ -0,0 +1,9 @@ +cluster: acme-ci +image: postgresql +key: acme-ci/pdb +machineRole: db +name: pdb +ports_classified: true +public_ports: false +tag: '13' +type: dba-container diff --git a/durable_rules-test/out/phase-2/dba-container/acme-ci_statera-console.yaml b/durable_rules-test/out/phase-2/dba-container/acme-ci_statera-console.yaml new file mode 100644 index 0000000..1b6a85f --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-container/acme-ci_statera-console.yaml @@ -0,0 +1,11 @@ +cluster: acme-ci +image: statera-console +key: acme-ci/statera-console +machineRole: app +name: statera-console +ports: +- 80 +ports_classified: true +public_ports: true +tag: development +type: dba-container diff --git a/durable_rules-test/out/phase-2/dba-container/acme-ci_statera.yaml b/durable_rules-test/out/phase-2/dba-container/acme-ci_statera.yaml new file mode 100644 index 0000000..10ecc77 --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-container/acme-ci_statera.yaml @@ -0,0 +1,11 @@ +cluster: acme-ci +image: statera +key: acme-ci/statera +machineRole: app +name: statera +ports: +- 8090 +ports_classified: true +public_ports: true +tag: development +type: dba-container diff --git a/durable_rules-test/out/phase-2/dba-container/acme-ops_n8n.yaml b/durable_rules-test/out/phase-2/dba-container/acme-ops_n8n.yaml new file mode 100644 index 0000000..3e7e558 --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-container/acme-ops_n8n.yaml @@ -0,0 +1,9 @@ +cluster: acme-ops +image: n8n +key: acme-ops/n8n +machineRole: app +name: n8n +ports_classified: true +public_ports: false +tag: 0.84.1 +type: dba-container diff --git a/durable_rules-test/out/phase-2/dba-container/acme-ops_pdb.yaml b/durable_rules-test/out/phase-2/dba-container/acme-ops_pdb.yaml new file mode 100644 index 0000000..17960c2 --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-container/acme-ops_pdb.yaml @@ -0,0 +1,9 @@ +cluster: acme-ops +image: postgresql +key: acme-ops/pdb +machineRole: app +name: pdb +ports_classified: true +public_ports: false +tag: '11' +type: dba-container diff --git a/durable_rules-test/out/phase-2/dba-container/acme-production_4tune-api.yaml b/durable_rules-test/out/phase-2/dba-container/acme-production_4tune-api.yaml new file mode 100644 index 0000000..aa61c4a --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-container/acme-production_4tune-api.yaml @@ -0,0 +1,9 @@ +cluster: acme-production +image: 4tune-api +key: acme-production/4tune-api +machineRole: app +name: 4tune-api +ports_classified: true +public_ports: false +tag: master +type: dba-container diff --git a/durable_rules-test/out/phase-2/dba-container/acme-production_4tune-web.yaml b/durable_rules-test/out/phase-2/dba-container/acme-production_4tune-web.yaml new file mode 100644 index 0000000..853ce1f --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-container/acme-production_4tune-web.yaml @@ -0,0 +1,9 @@ +cluster: acme-production +image: 4tune-web +key: acme-production/4tune-web +machineRole: app +name: 4tune-web +ports_classified: true +public_ports: false +tag: master +type: dba-container diff --git a/durable_rules-test/out/phase-2/dba-container/acme-production_mdb.yaml b/durable_rules-test/out/phase-2/dba-container/acme-production_mdb.yaml new file mode 100644 index 0000000..9df0405 --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-container/acme-production_mdb.yaml @@ -0,0 +1,9 @@ +cluster: acme-production +image: mongodb +key: acme-production/mdb +machineRole: db +name: mdb +ports_classified: true +public_ports: false +tag: '3.2' +type: dba-container diff --git a/durable_rules-test/out/phase-2/dba-container/acme-production_pdb.yaml b/durable_rules-test/out/phase-2/dba-container/acme-production_pdb.yaml new file mode 100644 index 0000000..4721b75 --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-container/acme-production_pdb.yaml @@ -0,0 +1,9 @@ +cluster: acme-production +image: postgresql +key: acme-production/pdb +machineRole: db +name: pdb +ports_classified: true +public_ports: false +tag: '13' +type: dba-container diff --git a/durable_rules-test/out/phase-2/dba-container/acme-production_statera-console.yaml b/durable_rules-test/out/phase-2/dba-container/acme-production_statera-console.yaml new file mode 100644 index 0000000..852d78c --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-container/acme-production_statera-console.yaml @@ -0,0 +1,11 @@ +cluster: acme-production +image: statera-console +key: acme-production/statera-console +machineRole: app +name: statera-console +ports: +- 80 +ports_classified: true +public_ports: true +tag: master +type: dba-container diff --git a/durable_rules-test/out/phase-2/dba-container/acme-production_statera.yaml b/durable_rules-test/out/phase-2/dba-container/acme-production_statera.yaml new file mode 100644 index 0000000..748a8c7 --- /dev/null +++ b/durable_rules-test/out/phase-2/dba-container/acme-production_statera.yaml @@ -0,0 +1,11 @@ +cluster: acme-production +image: statera +key: acme-production/statera +machineRole: app +name: statera +ports: +- 8090 +ports_classified: true +public_ports: true +tag: master +type: dba-container diff --git a/durable_rules-test/out/phase-3/terraform-machine/acme-1.yaml b/durable_rules-test/out/phase-3/terraform-machine/acme-1.yaml new file mode 100644 index 0000000..90653fe --- /dev/null +++ b/durable_rules-test/out/phase-3/terraform-machine/acme-1.yaml @@ -0,0 +1,2 @@ +key: acme-1 +type: terraform-machine diff --git a/durable_rules-test/out/phase-3/terraform-machine/acme-2.yaml b/durable_rules-test/out/phase-3/terraform-machine/acme-2.yaml new file mode 100644 index 0000000..79b0ce6 --- /dev/null +++ b/durable_rules-test/out/phase-3/terraform-machine/acme-2.yaml @@ -0,0 +1,2 @@ +key: acme-2 +type: terraform-machine diff --git a/durable_rules-test/out/phase-3/terraform-machine/acme-3.yaml b/durable_rules-test/out/phase-3/terraform-machine/acme-3.yaml new file mode 100644 index 0000000..8d77b80 --- /dev/null +++ b/durable_rules-test/out/phase-3/terraform-machine/acme-3.yaml @@ -0,0 +1,2 @@ +key: acme-3 +type: terraform-machine diff --git a/durable_rules-test/out/phase-3/terraform-record-set/acme-1.yaml b/durable_rules-test/out/phase-3/terraform-record-set/acme-1.yaml new file mode 100644 index 0000000..ccf16c7 --- /dev/null +++ b/durable_rules-test/out/phase-3/terraform-record-set/acme-1.yaml @@ -0,0 +1,6 @@ +fqdn: acme-1.machine.acme.corp +key: acme-1 +rrData: scaleway_instance_ip.acme-1.address +rrType: A +terraformId: acme-1_machine_acme_corp +type: terraform-record-set diff --git a/durable_rules-test/out/phase-3/terraform-record-set/acme-2.yaml b/durable_rules-test/out/phase-3/terraform-record-set/acme-2.yaml new file mode 100644 index 0000000..d95be1f --- /dev/null +++ b/durable_rules-test/out/phase-3/terraform-record-set/acme-2.yaml @@ -0,0 +1,6 @@ +fqdn: acme-2.machine.acme.corp +key: acme-2 +rrData: scaleway_instance_ip.acme-2.address +rrType: A +terraformId: acme-2_machine_acme_corp +type: terraform-record-set diff --git a/durable_rules-test/out/phase-3/terraform-record-set/acme-3.yaml b/durable_rules-test/out/phase-3/terraform-record-set/acme-3.yaml new file mode 100644 index 0000000..58c202e --- /dev/null +++ b/durable_rules-test/out/phase-3/terraform-record-set/acme-3.yaml @@ -0,0 +1,6 @@ +fqdn: acme-3.machine.acme.corp +key: acme-3 +rrData: scaleway_instance_ip.acme-3.address +rrType: A +terraformId: acme-3_machine_acme_corp +type: terraform-record-set diff --git a/durable_rules-test/py/acme/rai/__main__.py b/durable_rules-test/py/acme/rai/__main__.py new file mode 100644 index 0000000..b2664fa --- /dev/null +++ b/durable_rules-test/py/acme/rai/__main__.py @@ -0,0 +1,273 @@ +from durable.engine import MessageObservedException +from durable.lang import * +import shutil +import os +import os.path +import jinja2 + +from .utils import * + +from . import acme +from . import dba +from . import machine +from . import terraform + +with ruleset("phase-1"): + acme.Acme.declare_rules() + acme.AcmeOperations.declare_rules() + machine.Machine.declare_rules() + terraform.Terraform.declare_rules() + + @when_all(+s.exception) + def second(c): + print("Processing failed!") + print(c.s["exception"]) + c.s.exception = None + + @when_all(pri(1000), (m.type == 'machine')) + def defaultMachine(c): + pass + + @when_all(pri(1000), (m.type == 'dba-container')) + def dba_container(c): + pass + # print(f"dba-container: {c.m}") + + @when_all(pri(900), (m.type == 'dba-container') & (m.image == "statera") & -m.ports) + def addPortsToStatera(c): + c.retract_fact(c.m) + c.m.ports = [8090] + c.assert_fact(c.m) + + @when_all(pri(900), (m.type == 'dba-container') & (m.image == "statera-console") & -m.ports) + def addPortsToStateraConsole(c): + c.retract_fact(c.m) + c.m.ports = [80] + c.assert_fact(c.m) + + # The none() part doesn't work as is, but it is worked around with the try/except block. + @when_all( + (c.container << m.type == "dba-container"), + none((m.type == "dba-cluster") & (m.key == c.container.cluster)), + ) + def dbCluster(c): + cluster = c.container.cluster + try: + c.assert_fact(dba.cluster(cluster)) + # print(f"NEW CLUSTER: c.container={c.container}") + except MessageObservedException: + pass + +# @when_all(pri(40), +# (c.container << m.type == "dba-container"), +# (c.cluster << (m.type == "dba-cluster") & (m.key == c.container.cluster)), +# ) +# def dbCluster(c): +# print("dba-cluster: CATCH ALL") +# print(f"c.container: {c.container}") +# print(f"c.cluster: {c.cluster}") +# pass + +m1 = machine.Machine.make("acme-1") +m2 = machine.Machine.make("acme-2") +m3 = machine.Machine.make("acme-3") + +acmeCi = acme.Acme.make("ci", "development") +acmeProduction = acme.Acme.make("production", "master") +acmeOps = acme.AcmeOperations.make() + +x = assert_fact("phase-1", acmeCi); print(f"x: {x}") +x = assert_fact("phase-1", acmeProduction); print(f"x: {x}") +x = assert_fact("phase-1", acmeOps); print(f"x: {x}") +x = assert_fact("phase-1", m1); print(f"x: {x}") +x = assert_fact("phase-1", m2); print(f"x: {x}") +x = assert_fact("phase-1", m3); print(f"x: {x}") + +if False: + print("Facts:") + for f in get_facts("phase-1"): + print(f"fact: {f}") + + print("dba-clusters:") + for f in [f for f in get_facts("phase-1") if f["type"] == "dba-cluster"]: + cluster_name = f["key"] + + del f["key"] + print(f" cluster:") + print(f" key: {cluster_name}") + print(f" json: {f}") + + print(" dba-containers:") + for f in [f for f in get_facts("phase-1") if f.get("cluster") == cluster_name and f["type"] == "dba-container"]: + del f["cluster"] + del f["type"] + print(f" container: {f}") + +write_facts("phase-1") + +with ruleset("phase-2"): + + @when_all(+s.exception) + def second(c): + print("Processing failed!") + print(c.s["exception"]) + c.s.exception = None + +# @when_all(pri(100), m.type == "dba-cluster") +# def container(c): +# print(f"default: cluster: {c.m}") + + @when_all((m.type == "dba-container") & -m.ports_classified) + def mark_public_containers(c): +# print(f"marking container.. {c.m}") + item = c.m + c.retract_fact(item) + +# print(f"marking container.. {c.m.name}, ports={c.m.ports}") + item["public_ports"] = len(item.ports or []) > 0 + item["ports_classified"] = True +# print(f"marking container.. {item}") + c.assert_fact(item) + + @when_all(pri(50), + c.cluster << (m.type == "dba-cluster"), +# c.container << ((m.type == "dba-container") & (m.cluster == c.cluster.key) & m.ports.anyItem(item > 0)) + c.container << ((m.type == "dba-container") & +m.ports_classified & (m.public_ports > 0)) + ) + def container(c): + pass + # print(f"public container") + # print(f" cluster: {c.cluster}") + # print(f" container: {c.container}") + + @when_all(((m.type == "dba-container") & (+m.ports_classified) & (m.public_ports == 0))) + def container(c): + pass + # print(f"private container: {c.m}") + +print("PHASE 2") + +for f in [f for f in get_facts("phase-1") if f["type"] in ("dba-cluster", "dba-container")]: + x = assert_fact("phase-2", f); print(f"x: {x}") + +write_facts("phase-2") + +# Prepare +if os.path.isdir("gen"): + shutil.rmtree("gen") +os.mkdir("gen") +os.mkdir("gen/platform") +os.mkdir("gen/platform/terraform") +os.mkdir("gen/platform/ansible") +os.mkdir("gen/dns") + +print("PHASE 3: Generating stuff") + +file_loader = jinja2.FileSystemLoader("j2") +j2 = jinja2.Environment(loader=file_loader) + +# TODO: merge the dns files into the platform tf files as they are +# one-to-one now. +with ruleset("phase-3"): + @when_all(m.type == "meta") + def ignoreMeta(c): + print(f"ignoring {c.m}") + pass + + @when_all( + pri(-1), + (m.type == "terraform-machine"), + none(m.done == "platform/terraform/main.tf"), + ) + def mainTf(c): + path = f"gen/platform/terraform/main.tf" + print(f"WRITING {path}") + with open(path, "w") as f: + f.write(""" +terraform { + required_providers { + scaleway = { + source = "scaleway/scaleway" + } + } +} +""".strip()) + f.write("\n") + + machines = [] + for f in c.get_facts(): + if f.get("type") != "terraform-machine": + continue + machines.append(f) +# print(f"machine: {f}") + + template = j2.get_template("terraform-machine-outputs.j2") + path = f"gen/platform/terraform/outputs.tf" + print(f"WRITING {path}") + with open(path, "w") as f: + s = template.render(**{"machines": machines}) + f.write(s.strip()) + f.write("\n") + + try: + c.assert_fact({"type": "meta", "done": path}) + except MessageObservedException: + pass + + @when_all((m.type == "terraform-machine")) + def ansibleMachine(c): + template = j2.get_template("platform-ansible.j2") + path = f"gen/platform/ansible/{c.m.key}.yml" + print(f"WRITING {path}") + with open(path, "w") as f: + s = template.render(**{"m": c.m}) + f.write(s.strip()) + f.write("\n") + + @when_all((m.type == "terraform-machine")) + def terraformMachine(c): + template = j2.get_template("terraform-machine.j2") + path = f"gen/platform/terraform/{c.m.key}.tf" + print(f"WRITING {path}") + with open(path, "w") as f: + s = template.render(**{"m": c.m}) + f.write(s.strip()) + f.write("\n") + + @when_all((m.type == "terraform-record-set")) + def terraformRecordSet(c): + template = j2.get_template("terraform-record-set.j2") + path = f"gen/dns/{c.m.key}.tf" + print(f"WRITING {path}") + with open(path, "w") as f: + s = template.render(**{"m": c.m}) + f.write(s.strip()) + f.write("\n") + + @when_all( + pri(-1), + c.x << (m.type == "terraform-record-set"), + none(m.done == "gen/dns/inputs.tf"), +# c.x << (m.done == "gen/dns/inputs.tf"), + ) + def mainTf(c): + path = f"gen/dns/inputs.tf" + print(f"WRITING {path}") + with open(path, "w") as f: + f.write(""" +variable "addresses" { + type = map(string) +} +""".strip()) + f.write("\n") + try: + c.assert_fact({"type": "meta", "done": path}) + except MessageObservedException: + pass + +facts = [f for f in get_facts("phase-1") if f["type"] in ("terraform-record-set", "terraform-machine")] +#for f in facts: +# x = assert_fact("phase-3", f); print(f"x: {x}") +x = assert_facts("phase-3", facts); print(f"x: {x}") + +write_facts("phase-3") diff --git a/durable_rules-test/py/acme/rai/acme.py b/durable_rules-test/py/acme/rai/acme.py new file mode 100644 index 0000000..e75d492 --- /dev/null +++ b/durable_rules-test/py/acme/rai/acme.py @@ -0,0 +1,39 @@ +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")) diff --git a/durable_rules-test/py/acme/rai/dba.py b/durable_rules-test/py/acme/rai/dba.py new file mode 100644 index 0000000..04d10bf --- /dev/null +++ b/durable_rules-test/py/acme/rai/dba.py @@ -0,0 +1,13 @@ +from durable.lang import * + +def cluster(key: str): + return {"type": "dba-cluster", "key": key} + +def container(cluster: str, machineRole: str, name: str, image: str, tag: str): + return {"type": "dba-container", + "key": f"{cluster}/{name}", + "cluster": cluster, + "machineRole": machineRole, + "name": name, + "image": image, + "tag": tag} diff --git a/durable_rules-test/py/acme/rai/machine.py b/durable_rules-test/py/acme/rai/machine.py new file mode 100644 index 0000000..5b5da22 --- /dev/null +++ b/durable_rules-test/py/acme/rai/machine.py @@ -0,0 +1,22 @@ +from durable.lang import * + +class Dns: + @staticmethod + def a(key: str, fqdn: str): + return {"type": "dns-entry", + "key": key, + "fqdn": fqdn, + "rrType": "A" + } + +class Machine: + @staticmethod + def make(name: str): + return {"type": "machine", "key": name, "name": name} + + @staticmethod + def declare_rules(): + @when_all((m.type == "machine")) + def acmeApp(c): + c.assert_fact(Dns.a(c.m.key, f"{c.m.name}.machine.acme.corp")) + diff --git a/durable_rules-test/py/acme/rai/terraform.py b/durable_rules-test/py/acme/rai/terraform.py new file mode 100644 index 0000000..6feedd1 --- /dev/null +++ b/durable_rules-test/py/acme/rai/terraform.py @@ -0,0 +1,41 @@ +from durable.lang import * + +class Terraform: + @staticmethod + def recordSetForMachine(machineKey: str, terraformId: str, fqdn: str): + return {"type": "terraform-record-set", + "key": machineKey, + "terraformId": terraformId, + "fqdn": fqdn, + "rrType": "A", + "rrData": f"scaleway_instance_ip.{machineKey}.address", + } + + @staticmethod + def machine(key: str): + return {"type": "terraform-machine", + "key": key, + } + + @staticmethod + def declare_rules(): + @when_all( + c.dns << (m.type == "dns-entry"), + c.machine << ((m.type == "terraform-machine") & (m.key == c.dns.key)), + ) + def onDnsEntry(c): + terraformId = c.dns.fqdn.replace(".", "_") + c.assert_fact(Terraform.recordSetForMachine(c.machine.key, terraformId, c.dns.fqdn)) + + @when_all((m.type == "terraform-record-set")) + def defaultTerraformRecordSet(c): + pass + + @when_all((m.type == "machine")) + def onDnsEntry(c): + print(f"matched machine: {c.m}") + c.assert_fact(Terraform.machine(c.m.key)) + + @when_all((m.type == "terraform-machine")) + def defaultTerraformMachine(c): + print(f"matched terraform-machine: {c.m}") diff --git a/durable_rules-test/py/acme/rai/utils.py b/durable_rules-test/py/acme/rai/utils.py new file mode 100644 index 0000000..bc47d8f --- /dev/null +++ b/durable_rules-test/py/acme/rai/utils.py @@ -0,0 +1,59 @@ +import os +import os.path +import yaml +from durable.lang import * + +def write_facts(ruleset: set): + facts = get_facts(ruleset) + + types = set((f.get("type") for f in facts)) + + print(f"types: {types}") + + out_dir = "out" + if not os.path.exists(out_dir): + os.mkdir(out_dir) + + basedir = os.path.join(out_dir, ruleset) + if os.path.exists(basedir): + for f in os.listdir(basedir): + p = os.path.join(basedir, f) + if os.path.isdir(p): + for f2 in os.listdir(p): + os.remove(os.path.join(p, f2)) + os.rmdir(p) + else: + os.remove(p) + os.rmdir(basedir) + os.mkdir(basedir) + + for t in types: + typedir = os.path.join(basedir, t) + os.mkdir(typedir) + + fs = [] + for fact in facts: + if fact["type"] != t: + continue + + if fact["type"] == "meta": + continue + + if fact.get("key") is None: + raise Exception(f"Bad fact: no 'key' {fact}") + + try: + del fact["sid"] + except KeyError: + pass + + fs.append(fact) + + i = 0 + for fact in sorted(fs, key=lambda f: f["key"]): + key = fact["key"] + path = os.path.join(typedir, f"{key.replace('/', '_')}.yaml") + with open(path, "w") as f: + s = yaml.dump(fact) + f.write(s) + i = i + 1 diff --git a/durable_rules-test/requirements.txt b/durable_rules-test/requirements.txt new file mode 100644 index 0000000..1103fe2 --- /dev/null +++ b/durable_rules-test/requirements.txt @@ -0,0 +1,3 @@ +durable_rules==2.0.28 +pyyaml==5.3.1 +jinja2==2.11.2 diff --git a/gen/dns/acme-1.tf b/gen/dns/acme-1.tf deleted file mode 100644 index c1022ba..0000000 --- a/gen/dns/acme-1.tf +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_dns_record_set" "acme-1_machine_acme_corp" { - name = "acme-1.machine.acme.corp" - managed_zone = "None" - type = "A" - ttl = 300 - - rrdatas = [var.addresses.acme-1] -} diff --git a/gen/dns/acme-2.tf b/gen/dns/acme-2.tf deleted file mode 100644 index 4847052..0000000 --- a/gen/dns/acme-2.tf +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_dns_record_set" "acme-2_machine_acme_corp" { - name = "acme-2.machine.acme.corp" - managed_zone = "None" - type = "A" - ttl = 300 - - rrdatas = [var.addresses.acme-2] -} diff --git a/gen/dns/acme-3.tf b/gen/dns/acme-3.tf deleted file mode 100644 index c192dd3..0000000 --- a/gen/dns/acme-3.tf +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_dns_record_set" "acme-3_machine_acme_corp" { - name = "acme-3.machine.acme.corp" - managed_zone = "None" - type = "A" - ttl = 300 - - rrdatas = [var.addresses.acme-3] -} diff --git a/gen/dns/inputs.tf b/gen/dns/inputs.tf deleted file mode 100644 index 615ea69..0000000 --- a/gen/dns/inputs.tf +++ /dev/null @@ -1,3 +0,0 @@ -variable "addresses" { - type = map(string) -} diff --git a/gen/platform/ansible/acme-1.yml b/gen/platform/ansible/acme-1.yml deleted file mode 100644 index f5849b2..0000000 --- a/gen/platform/ansible/acme-1.yml +++ /dev/null @@ -1,6 +0,0 @@ -# Ansible -- hosts: - - acme-1 - tasks: - - import_role: - name: acme-platform diff --git a/gen/platform/ansible/acme-2.yml b/gen/platform/ansible/acme-2.yml deleted file mode 100644 index 755c214..0000000 --- a/gen/platform/ansible/acme-2.yml +++ /dev/null @@ -1,6 +0,0 @@ -# Ansible -- hosts: - - acme-2 - tasks: - - import_role: - name: acme-platform diff --git a/gen/platform/ansible/acme-3.yml b/gen/platform/ansible/acme-3.yml deleted file mode 100644 index 880a21f..0000000 --- a/gen/platform/ansible/acme-3.yml +++ /dev/null @@ -1,6 +0,0 @@ -# Ansible -- hosts: - - acme-3 - tasks: - - import_role: - name: acme-platform diff --git a/gen/platform/terraform/acme-1.tf b/gen/platform/terraform/acme-1.tf deleted file mode 100644 index 8100533..0000000 --- a/gen/platform/terraform/acme-1.tf +++ /dev/null @@ -1,15 +0,0 @@ -resource "scaleway_instance_server" "acme-1" { - name = "acme-1" - type = "DEV1-S" - image = "b3042271-d2b1-4f87-b407-aedd3bbd1663" - ip_id = scaleway_instance_ip.acme-1.id - enable_dynamic_ip = false - enable_ipv6 = true -} - -resource "scaleway_instance_ip" "acme-1" {} - -#resource "scaleway_instance_ip_reverse_dns" "acme-1" { -# ip_id = scaleway_instance_ip.acme-1.id -# reverse = "acme-1.${google_dns_managed_zone.machine.dns_name}" -#} diff --git a/gen/platform/terraform/acme-2.tf b/gen/platform/terraform/acme-2.tf deleted file mode 100644 index 07d5e8b..0000000 --- a/gen/platform/terraform/acme-2.tf +++ /dev/null @@ -1,15 +0,0 @@ -resource "scaleway_instance_server" "acme-2" { - name = "acme-1" - type = "DEV1-S" - image = "b3042271-d2b1-4f87-b407-aedd3bbd1663" - ip_id = scaleway_instance_ip.acme-2.id - enable_dynamic_ip = false - enable_ipv6 = true -} - -resource "scaleway_instance_ip" "acme-2" {} - -#resource "scaleway_instance_ip_reverse_dns" "acme-2" { -# ip_id = scaleway_instance_ip.acme-2.id -# reverse = "acme-2.${google_dns_managed_zone.machine.dns_name}" -#} diff --git a/gen/platform/terraform/acme-3.tf b/gen/platform/terraform/acme-3.tf deleted file mode 100644 index a2246bc..0000000 --- a/gen/platform/terraform/acme-3.tf +++ /dev/null @@ -1,15 +0,0 @@ -resource "scaleway_instance_server" "acme-3" { - name = "acme-1" - type = "DEV1-S" - image = "b3042271-d2b1-4f87-b407-aedd3bbd1663" - ip_id = scaleway_instance_ip.acme-3.id - enable_dynamic_ip = false - enable_ipv6 = true -} - -resource "scaleway_instance_ip" "acme-3" {} - -#resource "scaleway_instance_ip_reverse_dns" "acme-3" { -# ip_id = scaleway_instance_ip.acme-3.id -# reverse = "acme-3.${google_dns_managed_zone.machine.dns_name}" -#} diff --git a/gen/platform/terraform/main.tf b/gen/platform/terraform/main.tf deleted file mode 100644 index 3f217ed..0000000 --- a/gen/platform/terraform/main.tf +++ /dev/null @@ -1,7 +0,0 @@ -terraform { - required_providers { - scaleway = { - source = "scaleway/scaleway" - } - } -} diff --git a/gen/platform/terraform/outputs.tf b/gen/platform/terraform/outputs.tf deleted file mode 100644 index 87ccb0b..0000000 --- a/gen/platform/terraform/outputs.tf +++ /dev/null @@ -1,7 +0,0 @@ -output "addresses" { - value = { - acme-2: scaleway_instance_ip.acme-2.address, - acme-3: scaleway_instance_ip.acme-3.address, - acme-1: scaleway_instance_ip.acme-1.address, - } -} diff --git a/j2/platform-ansible.j2 b/j2/platform-ansible.j2 deleted file mode 100644 index 72e3247..0000000 --- a/j2/platform-ansible.j2 +++ /dev/null @@ -1,6 +0,0 @@ -# Ansible -- hosts: - - {{ m.key }} - tasks: - - import_role: - name: acme-platform diff --git a/j2/terraform-machine-outputs.j2 b/j2/terraform-machine-outputs.j2 deleted file mode 100644 index 438fac6..0000000 --- a/j2/terraform-machine-outputs.j2 +++ /dev/null @@ -1,7 +0,0 @@ -output "addresses" { - value = { -{%- for m in machines %} - {{ m.key }}: scaleway_instance_ip.{{ m.key }}.address, -{%- endfor %} - } -} diff --git a/j2/terraform-machine.j2 b/j2/terraform-machine.j2 deleted file mode 100644 index 889a23d..0000000 --- a/j2/terraform-machine.j2 +++ /dev/null @@ -1,15 +0,0 @@ -resource "scaleway_instance_server" "{{ m.key }}" { - name = "acme-1" - type = "DEV1-S" - image = "b3042271-d2b1-4f87-b407-aedd3bbd1663" - ip_id = scaleway_instance_ip.{{ m.key }}.id - enable_dynamic_ip = false - enable_ipv6 = true -} - -resource "scaleway_instance_ip" "{{ m.key }}" {} - -#resource "scaleway_instance_ip_reverse_dns" "{{ m.key }}" { -# ip_id = scaleway_instance_ip.{{ m.key }}.id -# reverse = "{{ m.key }}.${google_dns_managed_zone.machine.dns_name}" -#} diff --git a/j2/terraform-record-set.j2 b/j2/terraform-record-set.j2 deleted file mode 100644 index 03304bc..0000000 --- a/j2/terraform-record-set.j2 +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_dns_record_set" "{{ m.terraformId }}" { - name = "{{ m.fqdn }}" - managed_zone = "{{ m.terraformManagedZone }}" - type = "{{ m.rrType }}" - ttl = 300 - - rrdatas = [var.addresses.{{ m.key }}] -} diff --git a/out/phase-1/acme-application/ci.yaml b/out/phase-1/acme-application/ci.yaml deleted file mode 100644 index 2feec10..0000000 --- a/out/phase-1/acme-application/ci.yaml +++ /dev/null @@ -1,4 +0,0 @@ -env: ci -key: ci -tag: development -type: acme-application diff --git a/out/phase-1/acme-application/production.yaml b/out/phase-1/acme-application/production.yaml deleted file mode 100644 index 6054cec..0000000 --- a/out/phase-1/acme-application/production.yaml +++ /dev/null @@ -1,4 +0,0 @@ -env: production -key: production -tag: master -type: acme-application diff --git a/out/phase-1/acme-ops/acme-ops.yaml b/out/phase-1/acme-ops/acme-ops.yaml deleted file mode 100644 index 15680bd..0000000 --- a/out/phase-1/acme-ops/acme-ops.yaml +++ /dev/null @@ -1,2 +0,0 @@ -key: acme-ops -type: acme-ops diff --git a/out/phase-1/dba-cluster/acme-ci.yaml b/out/phase-1/dba-cluster/acme-ci.yaml deleted file mode 100644 index fccc7ed..0000000 --- a/out/phase-1/dba-cluster/acme-ci.yaml +++ /dev/null @@ -1,2 +0,0 @@ -key: acme-ci -type: dba-cluster diff --git a/out/phase-1/dba-cluster/acme-ops.yaml b/out/phase-1/dba-cluster/acme-ops.yaml deleted file mode 100644 index 2735ff3..0000000 --- a/out/phase-1/dba-cluster/acme-ops.yaml +++ /dev/null @@ -1,2 +0,0 @@ -key: acme-ops -type: dba-cluster diff --git a/out/phase-1/dba-cluster/acme-production.yaml b/out/phase-1/dba-cluster/acme-production.yaml deleted file mode 100644 index 3b7eb5a..0000000 --- a/out/phase-1/dba-cluster/acme-production.yaml +++ /dev/null @@ -1,2 +0,0 @@ -key: acme-production -type: dba-cluster diff --git a/out/phase-1/dba-container/acme-ci_4tune-api.yaml b/out/phase-1/dba-container/acme-ci_4tune-api.yaml deleted file mode 100644 index 94e265f..0000000 --- a/out/phase-1/dba-container/acme-ci_4tune-api.yaml +++ /dev/null @@ -1,7 +0,0 @@ -cluster: acme-ci -image: 4tune-api -key: acme-ci/4tune-api -machineRole: app -name: 4tune-api -tag: development -type: dba-container diff --git a/out/phase-1/dba-container/acme-ci_4tune-web.yaml b/out/phase-1/dba-container/acme-ci_4tune-web.yaml deleted file mode 100644 index 9127420..0000000 --- a/out/phase-1/dba-container/acme-ci_4tune-web.yaml +++ /dev/null @@ -1,7 +0,0 @@ -cluster: acme-ci -image: 4tune-web -key: acme-ci/4tune-web -machineRole: app -name: 4tune-web -tag: development -type: dba-container diff --git a/out/phase-1/dba-container/acme-ci_mdb.yaml b/out/phase-1/dba-container/acme-ci_mdb.yaml deleted file mode 100644 index b49853b..0000000 --- a/out/phase-1/dba-container/acme-ci_mdb.yaml +++ /dev/null @@ -1,7 +0,0 @@ -cluster: acme-ci -image: mongodb -key: acme-ci/mdb -machineRole: db -name: mdb -tag: '3.2' -type: dba-container diff --git a/out/phase-1/dba-container/acme-ci_pdb.yaml b/out/phase-1/dba-container/acme-ci_pdb.yaml deleted file mode 100644 index d9ea55a..0000000 --- a/out/phase-1/dba-container/acme-ci_pdb.yaml +++ /dev/null @@ -1,7 +0,0 @@ -cluster: acme-ci -image: postgresql -key: acme-ci/pdb -machineRole: db -name: pdb -tag: '13' -type: dba-container diff --git a/out/phase-1/dba-container/acme-ci_statera-console.yaml b/out/phase-1/dba-container/acme-ci_statera-console.yaml deleted file mode 100644 index 0cb0cc4..0000000 --- a/out/phase-1/dba-container/acme-ci_statera-console.yaml +++ /dev/null @@ -1,9 +0,0 @@ -cluster: acme-ci -image: statera-console -key: acme-ci/statera-console -machineRole: app -name: statera-console -ports: -- 80 -tag: development -type: dba-container diff --git a/out/phase-1/dba-container/acme-ci_statera.yaml b/out/phase-1/dba-container/acme-ci_statera.yaml deleted file mode 100644 index 6a3eb98..0000000 --- a/out/phase-1/dba-container/acme-ci_statera.yaml +++ /dev/null @@ -1,9 +0,0 @@ -cluster: acme-ci -image: statera -key: acme-ci/statera -machineRole: app -name: statera -ports: -- 8090 -tag: development -type: dba-container diff --git a/out/phase-1/dba-container/acme-ops_n8n.yaml b/out/phase-1/dba-container/acme-ops_n8n.yaml deleted file mode 100644 index d34efda..0000000 --- a/out/phase-1/dba-container/acme-ops_n8n.yaml +++ /dev/null @@ -1,7 +0,0 @@ -cluster: acme-ops -image: n8n -key: acme-ops/n8n -machineRole: app -name: n8n -tag: 0.84.1 -type: dba-container diff --git a/out/phase-1/dba-container/acme-ops_pdb.yaml b/out/phase-1/dba-container/acme-ops_pdb.yaml deleted file mode 100644 index a3aa769..0000000 --- a/out/phase-1/dba-container/acme-ops_pdb.yaml +++ /dev/null @@ -1,7 +0,0 @@ -cluster: acme-ops -image: postgresql -key: acme-ops/pdb -machineRole: app -name: pdb -tag: '11' -type: dba-container diff --git a/out/phase-1/dba-container/acme-production_4tune-api.yaml b/out/phase-1/dba-container/acme-production_4tune-api.yaml deleted file mode 100644 index aa80827..0000000 --- a/out/phase-1/dba-container/acme-production_4tune-api.yaml +++ /dev/null @@ -1,7 +0,0 @@ -cluster: acme-production -image: 4tune-api -key: acme-production/4tune-api -machineRole: app -name: 4tune-api -tag: master -type: dba-container diff --git a/out/phase-1/dba-container/acme-production_4tune-web.yaml b/out/phase-1/dba-container/acme-production_4tune-web.yaml deleted file mode 100644 index 6ba5f0d..0000000 --- a/out/phase-1/dba-container/acme-production_4tune-web.yaml +++ /dev/null @@ -1,7 +0,0 @@ -cluster: acme-production -image: 4tune-web -key: acme-production/4tune-web -machineRole: app -name: 4tune-web -tag: master -type: dba-container diff --git a/out/phase-1/dba-container/acme-production_mdb.yaml b/out/phase-1/dba-container/acme-production_mdb.yaml deleted file mode 100644 index 45206fe..0000000 --- a/out/phase-1/dba-container/acme-production_mdb.yaml +++ /dev/null @@ -1,7 +0,0 @@ -cluster: acme-production -image: mongodb -key: acme-production/mdb -machineRole: db -name: mdb -tag: '3.2' -type: dba-container diff --git a/out/phase-1/dba-container/acme-production_pdb.yaml b/out/phase-1/dba-container/acme-production_pdb.yaml deleted file mode 100644 index 112c678..0000000 --- a/out/phase-1/dba-container/acme-production_pdb.yaml +++ /dev/null @@ -1,7 +0,0 @@ -cluster: acme-production -image: postgresql -key: acme-production/pdb -machineRole: db -name: pdb -tag: '13' -type: dba-container diff --git a/out/phase-1/dba-container/acme-production_statera-console.yaml b/out/phase-1/dba-container/acme-production_statera-console.yaml deleted file mode 100644 index 0f4fbf4..0000000 --- a/out/phase-1/dba-container/acme-production_statera-console.yaml +++ /dev/null @@ -1,9 +0,0 @@ -cluster: acme-production -image: statera-console -key: acme-production/statera-console -machineRole: app -name: statera-console -ports: -- 80 -tag: master -type: dba-container diff --git a/out/phase-1/dba-container/acme-production_statera.yaml b/out/phase-1/dba-container/acme-production_statera.yaml deleted file mode 100644 index a509810..0000000 --- a/out/phase-1/dba-container/acme-production_statera.yaml +++ /dev/null @@ -1,9 +0,0 @@ -cluster: acme-production -image: statera -key: acme-production/statera -machineRole: app -name: statera -ports: -- 8090 -tag: master -type: dba-container diff --git a/out/phase-1/dns-entry/acme-1.yaml b/out/phase-1/dns-entry/acme-1.yaml deleted file mode 100644 index aafae11..0000000 --- a/out/phase-1/dns-entry/acme-1.yaml +++ /dev/null @@ -1,4 +0,0 @@ -fqdn: acme-1.machine.acme.corp -key: acme-1 -rrType: A -type: dns-entry diff --git a/out/phase-1/dns-entry/acme-2.yaml b/out/phase-1/dns-entry/acme-2.yaml deleted file mode 100644 index 38ad9e9..0000000 --- a/out/phase-1/dns-entry/acme-2.yaml +++ /dev/null @@ -1,4 +0,0 @@ -fqdn: acme-2.machine.acme.corp -key: acme-2 -rrType: A -type: dns-entry diff --git a/out/phase-1/dns-entry/acme-3.yaml b/out/phase-1/dns-entry/acme-3.yaml deleted file mode 100644 index 451ba7c..0000000 --- a/out/phase-1/dns-entry/acme-3.yaml +++ /dev/null @@ -1,4 +0,0 @@ -fqdn: acme-3.machine.acme.corp -key: acme-3 -rrType: A -type: dns-entry diff --git a/out/phase-1/machine/acme-1.yaml b/out/phase-1/machine/acme-1.yaml deleted file mode 100644 index 9e4356e..0000000 --- a/out/phase-1/machine/acme-1.yaml +++ /dev/null @@ -1,3 +0,0 @@ -key: acme-1 -name: acme-1 -type: machine diff --git a/out/phase-1/machine/acme-2.yaml b/out/phase-1/machine/acme-2.yaml deleted file mode 100644 index 24655d8..0000000 --- a/out/phase-1/machine/acme-2.yaml +++ /dev/null @@ -1,3 +0,0 @@ -key: acme-2 -name: acme-2 -type: machine diff --git a/out/phase-1/machine/acme-3.yaml b/out/phase-1/machine/acme-3.yaml deleted file mode 100644 index d7d75ff..0000000 --- a/out/phase-1/machine/acme-3.yaml +++ /dev/null @@ -1,3 +0,0 @@ -key: acme-3 -name: acme-3 -type: machine diff --git a/out/phase-1/terraform-machine/acme-1.yaml b/out/phase-1/terraform-machine/acme-1.yaml deleted file mode 100644 index 90653fe..0000000 --- a/out/phase-1/terraform-machine/acme-1.yaml +++ /dev/null @@ -1,2 +0,0 @@ -key: acme-1 -type: terraform-machine diff --git a/out/phase-1/terraform-machine/acme-2.yaml b/out/phase-1/terraform-machine/acme-2.yaml deleted file mode 100644 index 79b0ce6..0000000 --- a/out/phase-1/terraform-machine/acme-2.yaml +++ /dev/null @@ -1,2 +0,0 @@ -key: acme-2 -type: terraform-machine diff --git a/out/phase-1/terraform-machine/acme-3.yaml b/out/phase-1/terraform-machine/acme-3.yaml deleted file mode 100644 index 8d77b80..0000000 --- a/out/phase-1/terraform-machine/acme-3.yaml +++ /dev/null @@ -1,2 +0,0 @@ -key: acme-3 -type: terraform-machine diff --git a/out/phase-1/terraform-record-set/acme-1.yaml b/out/phase-1/terraform-record-set/acme-1.yaml deleted file mode 100644 index ccf16c7..0000000 --- a/out/phase-1/terraform-record-set/acme-1.yaml +++ /dev/null @@ -1,6 +0,0 @@ -fqdn: acme-1.machine.acme.corp -key: acme-1 -rrData: scaleway_instance_ip.acme-1.address -rrType: A -terraformId: acme-1_machine_acme_corp -type: terraform-record-set diff --git a/out/phase-1/terraform-record-set/acme-2.yaml b/out/phase-1/terraform-record-set/acme-2.yaml deleted file mode 100644 index d95be1f..0000000 --- a/out/phase-1/terraform-record-set/acme-2.yaml +++ /dev/null @@ -1,6 +0,0 @@ -fqdn: acme-2.machine.acme.corp -key: acme-2 -rrData: scaleway_instance_ip.acme-2.address -rrType: A -terraformId: acme-2_machine_acme_corp -type: terraform-record-set diff --git a/out/phase-1/terraform-record-set/acme-3.yaml b/out/phase-1/terraform-record-set/acme-3.yaml deleted file mode 100644 index 58c202e..0000000 --- a/out/phase-1/terraform-record-set/acme-3.yaml +++ /dev/null @@ -1,6 +0,0 @@ -fqdn: acme-3.machine.acme.corp -key: acme-3 -rrData: scaleway_instance_ip.acme-3.address -rrType: A -terraformId: acme-3_machine_acme_corp -type: terraform-record-set diff --git a/out/phase-2/dba-cluster/acme-ci.yaml b/out/phase-2/dba-cluster/acme-ci.yaml deleted file mode 100644 index fccc7ed..0000000 --- a/out/phase-2/dba-cluster/acme-ci.yaml +++ /dev/null @@ -1,2 +0,0 @@ -key: acme-ci -type: dba-cluster diff --git a/out/phase-2/dba-cluster/acme-ops.yaml b/out/phase-2/dba-cluster/acme-ops.yaml deleted file mode 100644 index 2735ff3..0000000 --- a/out/phase-2/dba-cluster/acme-ops.yaml +++ /dev/null @@ -1,2 +0,0 @@ -key: acme-ops -type: dba-cluster diff --git a/out/phase-2/dba-cluster/acme-production.yaml b/out/phase-2/dba-cluster/acme-production.yaml deleted file mode 100644 index 3b7eb5a..0000000 --- a/out/phase-2/dba-cluster/acme-production.yaml +++ /dev/null @@ -1,2 +0,0 @@ -key: acme-production -type: dba-cluster diff --git a/out/phase-2/dba-container/acme-ci_4tune-api.yaml b/out/phase-2/dba-container/acme-ci_4tune-api.yaml deleted file mode 100644 index 58ec759..0000000 --- a/out/phase-2/dba-container/acme-ci_4tune-api.yaml +++ /dev/null @@ -1,9 +0,0 @@ -cluster: acme-ci -image: 4tune-api -key: acme-ci/4tune-api -machineRole: app -name: 4tune-api -ports_classified: true -public_ports: false -tag: development -type: dba-container diff --git a/out/phase-2/dba-container/acme-ci_4tune-web.yaml b/out/phase-2/dba-container/acme-ci_4tune-web.yaml deleted file mode 100644 index 685dfb6..0000000 --- a/out/phase-2/dba-container/acme-ci_4tune-web.yaml +++ /dev/null @@ -1,9 +0,0 @@ -cluster: acme-ci -image: 4tune-web -key: acme-ci/4tune-web -machineRole: app -name: 4tune-web -ports_classified: true -public_ports: false -tag: development -type: dba-container diff --git a/out/phase-2/dba-container/acme-ci_mdb.yaml b/out/phase-2/dba-container/acme-ci_mdb.yaml deleted file mode 100644 index f1b661c..0000000 --- a/out/phase-2/dba-container/acme-ci_mdb.yaml +++ /dev/null @@ -1,9 +0,0 @@ -cluster: acme-ci -image: mongodb -key: acme-ci/mdb -machineRole: db -name: mdb -ports_classified: true -public_ports: false -tag: '3.2' -type: dba-container diff --git a/out/phase-2/dba-container/acme-ci_pdb.yaml b/out/phase-2/dba-container/acme-ci_pdb.yaml deleted file mode 100644 index b138b1a..0000000 --- a/out/phase-2/dba-container/acme-ci_pdb.yaml +++ /dev/null @@ -1,9 +0,0 @@ -cluster: acme-ci -image: postgresql -key: acme-ci/pdb -machineRole: db -name: pdb -ports_classified: true -public_ports: false -tag: '13' -type: dba-container diff --git a/out/phase-2/dba-container/acme-ci_statera-console.yaml b/out/phase-2/dba-container/acme-ci_statera-console.yaml deleted file mode 100644 index 1b6a85f..0000000 --- a/out/phase-2/dba-container/acme-ci_statera-console.yaml +++ /dev/null @@ -1,11 +0,0 @@ -cluster: acme-ci -image: statera-console -key: acme-ci/statera-console -machineRole: app -name: statera-console -ports: -- 80 -ports_classified: true -public_ports: true -tag: development -type: dba-container diff --git a/out/phase-2/dba-container/acme-ci_statera.yaml b/out/phase-2/dba-container/acme-ci_statera.yaml deleted file mode 100644 index 10ecc77..0000000 --- a/out/phase-2/dba-container/acme-ci_statera.yaml +++ /dev/null @@ -1,11 +0,0 @@ -cluster: acme-ci -image: statera -key: acme-ci/statera -machineRole: app -name: statera -ports: -- 8090 -ports_classified: true -public_ports: true -tag: development -type: dba-container diff --git a/out/phase-2/dba-container/acme-ops_n8n.yaml b/out/phase-2/dba-container/acme-ops_n8n.yaml deleted file mode 100644 index 3e7e558..0000000 --- a/out/phase-2/dba-container/acme-ops_n8n.yaml +++ /dev/null @@ -1,9 +0,0 @@ -cluster: acme-ops -image: n8n -key: acme-ops/n8n -machineRole: app -name: n8n -ports_classified: true -public_ports: false -tag: 0.84.1 -type: dba-container diff --git a/out/phase-2/dba-container/acme-ops_pdb.yaml b/out/phase-2/dba-container/acme-ops_pdb.yaml deleted file mode 100644 index 17960c2..0000000 --- a/out/phase-2/dba-container/acme-ops_pdb.yaml +++ /dev/null @@ -1,9 +0,0 @@ -cluster: acme-ops -image: postgresql -key: acme-ops/pdb -machineRole: app -name: pdb -ports_classified: true -public_ports: false -tag: '11' -type: dba-container diff --git a/out/phase-2/dba-container/acme-production_4tune-api.yaml b/out/phase-2/dba-container/acme-production_4tune-api.yaml deleted file mode 100644 index aa61c4a..0000000 --- a/out/phase-2/dba-container/acme-production_4tune-api.yaml +++ /dev/null @@ -1,9 +0,0 @@ -cluster: acme-production -image: 4tune-api -key: acme-production/4tune-api -machineRole: app -name: 4tune-api -ports_classified: true -public_ports: false -tag: master -type: dba-container diff --git a/out/phase-2/dba-container/acme-production_4tune-web.yaml b/out/phase-2/dba-container/acme-production_4tune-web.yaml deleted file mode 100644 index 853ce1f..0000000 --- a/out/phase-2/dba-container/acme-production_4tune-web.yaml +++ /dev/null @@ -1,9 +0,0 @@ -cluster: acme-production -image: 4tune-web -key: acme-production/4tune-web -machineRole: app -name: 4tune-web -ports_classified: true -public_ports: false -tag: master -type: dba-container diff --git a/out/phase-2/dba-container/acme-production_mdb.yaml b/out/phase-2/dba-container/acme-production_mdb.yaml deleted file mode 100644 index 9df0405..0000000 --- a/out/phase-2/dba-container/acme-production_mdb.yaml +++ /dev/null @@ -1,9 +0,0 @@ -cluster: acme-production -image: mongodb -key: acme-production/mdb -machineRole: db -name: mdb -ports_classified: true -public_ports: false -tag: '3.2' -type: dba-container diff --git a/out/phase-2/dba-container/acme-production_pdb.yaml b/out/phase-2/dba-container/acme-production_pdb.yaml deleted file mode 100644 index 4721b75..0000000 --- a/out/phase-2/dba-container/acme-production_pdb.yaml +++ /dev/null @@ -1,9 +0,0 @@ -cluster: acme-production -image: postgresql -key: acme-production/pdb -machineRole: db -name: pdb -ports_classified: true -public_ports: false -tag: '13' -type: dba-container diff --git a/out/phase-2/dba-container/acme-production_statera-console.yaml b/out/phase-2/dba-container/acme-production_statera-console.yaml deleted file mode 100644 index 852d78c..0000000 --- a/out/phase-2/dba-container/acme-production_statera-console.yaml +++ /dev/null @@ -1,11 +0,0 @@ -cluster: acme-production -image: statera-console -key: acme-production/statera-console -machineRole: app -name: statera-console -ports: -- 80 -ports_classified: true -public_ports: true -tag: master -type: dba-container diff --git a/out/phase-2/dba-container/acme-production_statera.yaml b/out/phase-2/dba-container/acme-production_statera.yaml deleted file mode 100644 index 748a8c7..0000000 --- a/out/phase-2/dba-container/acme-production_statera.yaml +++ /dev/null @@ -1,11 +0,0 @@ -cluster: acme-production -image: statera -key: acme-production/statera -machineRole: app -name: statera -ports: -- 8090 -ports_classified: true -public_ports: true -tag: master -type: dba-container diff --git a/out/phase-3/terraform-machine/acme-1.yaml b/out/phase-3/terraform-machine/acme-1.yaml deleted file mode 100644 index 90653fe..0000000 --- a/out/phase-3/terraform-machine/acme-1.yaml +++ /dev/null @@ -1,2 +0,0 @@ -key: acme-1 -type: terraform-machine diff --git a/out/phase-3/terraform-machine/acme-2.yaml b/out/phase-3/terraform-machine/acme-2.yaml deleted file mode 100644 index 79b0ce6..0000000 --- a/out/phase-3/terraform-machine/acme-2.yaml +++ /dev/null @@ -1,2 +0,0 @@ -key: acme-2 -type: terraform-machine diff --git a/out/phase-3/terraform-machine/acme-3.yaml b/out/phase-3/terraform-machine/acme-3.yaml deleted file mode 100644 index 8d77b80..0000000 --- a/out/phase-3/terraform-machine/acme-3.yaml +++ /dev/null @@ -1,2 +0,0 @@ -key: acme-3 -type: terraform-machine diff --git a/out/phase-3/terraform-record-set/acme-1.yaml b/out/phase-3/terraform-record-set/acme-1.yaml deleted file mode 100644 index ccf16c7..0000000 --- a/out/phase-3/terraform-record-set/acme-1.yaml +++ /dev/null @@ -1,6 +0,0 @@ -fqdn: acme-1.machine.acme.corp -key: acme-1 -rrData: scaleway_instance_ip.acme-1.address -rrType: A -terraformId: acme-1_machine_acme_corp -type: terraform-record-set diff --git a/out/phase-3/terraform-record-set/acme-2.yaml b/out/phase-3/terraform-record-set/acme-2.yaml deleted file mode 100644 index d95be1f..0000000 --- a/out/phase-3/terraform-record-set/acme-2.yaml +++ /dev/null @@ -1,6 +0,0 @@ -fqdn: acme-2.machine.acme.corp -key: acme-2 -rrData: scaleway_instance_ip.acme-2.address -rrType: A -terraformId: acme-2_machine_acme_corp -type: terraform-record-set diff --git a/out/phase-3/terraform-record-set/acme-3.yaml b/out/phase-3/terraform-record-set/acme-3.yaml deleted file mode 100644 index 58c202e..0000000 --- a/out/phase-3/terraform-record-set/acme-3.yaml +++ /dev/null @@ -1,6 +0,0 @@ -fqdn: acme-3.machine.acme.corp -key: acme-3 -rrData: scaleway_instance_ip.acme-3.address -rrType: A -terraformId: acme-3_machine_acme_corp -type: terraform-record-set diff --git a/py/acme/rai/__main__.py b/py/acme/rai/__main__.py deleted file mode 100644 index b2664fa..0000000 --- a/py/acme/rai/__main__.py +++ /dev/null @@ -1,273 +0,0 @@ -from durable.engine import MessageObservedException -from durable.lang import * -import shutil -import os -import os.path -import jinja2 - -from .utils import * - -from . import acme -from . import dba -from . import machine -from . import terraform - -with ruleset("phase-1"): - acme.Acme.declare_rules() - acme.AcmeOperations.declare_rules() - machine.Machine.declare_rules() - terraform.Terraform.declare_rules() - - @when_all(+s.exception) - def second(c): - print("Processing failed!") - print(c.s["exception"]) - c.s.exception = None - - @when_all(pri(1000), (m.type == 'machine')) - def defaultMachine(c): - pass - - @when_all(pri(1000), (m.type == 'dba-container')) - def dba_container(c): - pass - # print(f"dba-container: {c.m}") - - @when_all(pri(900), (m.type == 'dba-container') & (m.image == "statera") & -m.ports) - def addPortsToStatera(c): - c.retract_fact(c.m) - c.m.ports = [8090] - c.assert_fact(c.m) - - @when_all(pri(900), (m.type == 'dba-container') & (m.image == "statera-console") & -m.ports) - def addPortsToStateraConsole(c): - c.retract_fact(c.m) - c.m.ports = [80] - c.assert_fact(c.m) - - # The none() part doesn't work as is, but it is worked around with the try/except block. - @when_all( - (c.container << m.type == "dba-container"), - none((m.type == "dba-cluster") & (m.key == c.container.cluster)), - ) - def dbCluster(c): - cluster = c.container.cluster - try: - c.assert_fact(dba.cluster(cluster)) - # print(f"NEW CLUSTER: c.container={c.container}") - except MessageObservedException: - pass - -# @when_all(pri(40), -# (c.container << m.type == "dba-container"), -# (c.cluster << (m.type == "dba-cluster") & (m.key == c.container.cluster)), -# ) -# def dbCluster(c): -# print("dba-cluster: CATCH ALL") -# print(f"c.container: {c.container}") -# print(f"c.cluster: {c.cluster}") -# pass - -m1 = machine.Machine.make("acme-1") -m2 = machine.Machine.make("acme-2") -m3 = machine.Machine.make("acme-3") - -acmeCi = acme.Acme.make("ci", "development") -acmeProduction = acme.Acme.make("production", "master") -acmeOps = acme.AcmeOperations.make() - -x = assert_fact("phase-1", acmeCi); print(f"x: {x}") -x = assert_fact("phase-1", acmeProduction); print(f"x: {x}") -x = assert_fact("phase-1", acmeOps); print(f"x: {x}") -x = assert_fact("phase-1", m1); print(f"x: {x}") -x = assert_fact("phase-1", m2); print(f"x: {x}") -x = assert_fact("phase-1", m3); print(f"x: {x}") - -if False: - print("Facts:") - for f in get_facts("phase-1"): - print(f"fact: {f}") - - print("dba-clusters:") - for f in [f for f in get_facts("phase-1") if f["type"] == "dba-cluster"]: - cluster_name = f["key"] - - del f["key"] - print(f" cluster:") - print(f" key: {cluster_name}") - print(f" json: {f}") - - print(" dba-containers:") - for f in [f for f in get_facts("phase-1") if f.get("cluster") == cluster_name and f["type"] == "dba-container"]: - del f["cluster"] - del f["type"] - print(f" container: {f}") - -write_facts("phase-1") - -with ruleset("phase-2"): - - @when_all(+s.exception) - def second(c): - print("Processing failed!") - print(c.s["exception"]) - c.s.exception = None - -# @when_all(pri(100), m.type == "dba-cluster") -# def container(c): -# print(f"default: cluster: {c.m}") - - @when_all((m.type == "dba-container") & -m.ports_classified) - def mark_public_containers(c): -# print(f"marking container.. {c.m}") - item = c.m - c.retract_fact(item) - -# print(f"marking container.. {c.m.name}, ports={c.m.ports}") - item["public_ports"] = len(item.ports or []) > 0 - item["ports_classified"] = True -# print(f"marking container.. {item}") - c.assert_fact(item) - - @when_all(pri(50), - c.cluster << (m.type == "dba-cluster"), -# c.container << ((m.type == "dba-container") & (m.cluster == c.cluster.key) & m.ports.anyItem(item > 0)) - c.container << ((m.type == "dba-container") & +m.ports_classified & (m.public_ports > 0)) - ) - def container(c): - pass - # print(f"public container") - # print(f" cluster: {c.cluster}") - # print(f" container: {c.container}") - - @when_all(((m.type == "dba-container") & (+m.ports_classified) & (m.public_ports == 0))) - def container(c): - pass - # print(f"private container: {c.m}") - -print("PHASE 2") - -for f in [f for f in get_facts("phase-1") if f["type"] in ("dba-cluster", "dba-container")]: - x = assert_fact("phase-2", f); print(f"x: {x}") - -write_facts("phase-2") - -# Prepare -if os.path.isdir("gen"): - shutil.rmtree("gen") -os.mkdir("gen") -os.mkdir("gen/platform") -os.mkdir("gen/platform/terraform") -os.mkdir("gen/platform/ansible") -os.mkdir("gen/dns") - -print("PHASE 3: Generating stuff") - -file_loader = jinja2.FileSystemLoader("j2") -j2 = jinja2.Environment(loader=file_loader) - -# TODO: merge the dns files into the platform tf files as they are -# one-to-one now. -with ruleset("phase-3"): - @when_all(m.type == "meta") - def ignoreMeta(c): - print(f"ignoring {c.m}") - pass - - @when_all( - pri(-1), - (m.type == "terraform-machine"), - none(m.done == "platform/terraform/main.tf"), - ) - def mainTf(c): - path = f"gen/platform/terraform/main.tf" - print(f"WRITING {path}") - with open(path, "w") as f: - f.write(""" -terraform { - required_providers { - scaleway = { - source = "scaleway/scaleway" - } - } -} -""".strip()) - f.write("\n") - - machines = [] - for f in c.get_facts(): - if f.get("type") != "terraform-machine": - continue - machines.append(f) -# print(f"machine: {f}") - - template = j2.get_template("terraform-machine-outputs.j2") - path = f"gen/platform/terraform/outputs.tf" - print(f"WRITING {path}") - with open(path, "w") as f: - s = template.render(**{"machines": machines}) - f.write(s.strip()) - f.write("\n") - - try: - c.assert_fact({"type": "meta", "done": path}) - except MessageObservedException: - pass - - @when_all((m.type == "terraform-machine")) - def ansibleMachine(c): - template = j2.get_template("platform-ansible.j2") - path = f"gen/platform/ansible/{c.m.key}.yml" - print(f"WRITING {path}") - with open(path, "w") as f: - s = template.render(**{"m": c.m}) - f.write(s.strip()) - f.write("\n") - - @when_all((m.type == "terraform-machine")) - def terraformMachine(c): - template = j2.get_template("terraform-machine.j2") - path = f"gen/platform/terraform/{c.m.key}.tf" - print(f"WRITING {path}") - with open(path, "w") as f: - s = template.render(**{"m": c.m}) - f.write(s.strip()) - f.write("\n") - - @when_all((m.type == "terraform-record-set")) - def terraformRecordSet(c): - template = j2.get_template("terraform-record-set.j2") - path = f"gen/dns/{c.m.key}.tf" - print(f"WRITING {path}") - with open(path, "w") as f: - s = template.render(**{"m": c.m}) - f.write(s.strip()) - f.write("\n") - - @when_all( - pri(-1), - c.x << (m.type == "terraform-record-set"), - none(m.done == "gen/dns/inputs.tf"), -# c.x << (m.done == "gen/dns/inputs.tf"), - ) - def mainTf(c): - path = f"gen/dns/inputs.tf" - print(f"WRITING {path}") - with open(path, "w") as f: - f.write(""" -variable "addresses" { - type = map(string) -} -""".strip()) - f.write("\n") - try: - c.assert_fact({"type": "meta", "done": path}) - except MessageObservedException: - pass - -facts = [f for f in get_facts("phase-1") if f["type"] in ("terraform-record-set", "terraform-machine")] -#for f in facts: -# x = assert_fact("phase-3", f); print(f"x: {x}") -x = assert_facts("phase-3", facts); print(f"x: {x}") - -write_facts("phase-3") diff --git a/py/acme/rai/acme.py b/py/acme/rai/acme.py deleted file mode 100644 index e75d492..0000000 --- a/py/acme/rai/acme.py +++ /dev/null @@ -1,39 +0,0 @@ -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")) diff --git a/py/acme/rai/dba.py b/py/acme/rai/dba.py deleted file mode 100644 index 04d10bf..0000000 --- a/py/acme/rai/dba.py +++ /dev/null @@ -1,13 +0,0 @@ -from durable.lang import * - -def cluster(key: str): - return {"type": "dba-cluster", "key": key} - -def container(cluster: str, machineRole: str, name: str, image: str, tag: str): - return {"type": "dba-container", - "key": f"{cluster}/{name}", - "cluster": cluster, - "machineRole": machineRole, - "name": name, - "image": image, - "tag": tag} diff --git a/py/acme/rai/machine.py b/py/acme/rai/machine.py deleted file mode 100644 index 5b5da22..0000000 --- a/py/acme/rai/machine.py +++ /dev/null @@ -1,22 +0,0 @@ -from durable.lang import * - -class Dns: - @staticmethod - def a(key: str, fqdn: str): - return {"type": "dns-entry", - "key": key, - "fqdn": fqdn, - "rrType": "A" - } - -class Machine: - @staticmethod - def make(name: str): - return {"type": "machine", "key": name, "name": name} - - @staticmethod - def declare_rules(): - @when_all((m.type == "machine")) - def acmeApp(c): - c.assert_fact(Dns.a(c.m.key, f"{c.m.name}.machine.acme.corp")) - diff --git a/py/acme/rai/terraform.py b/py/acme/rai/terraform.py deleted file mode 100644 index 6feedd1..0000000 --- a/py/acme/rai/terraform.py +++ /dev/null @@ -1,41 +0,0 @@ -from durable.lang import * - -class Terraform: - @staticmethod - def recordSetForMachine(machineKey: str, terraformId: str, fqdn: str): - return {"type": "terraform-record-set", - "key": machineKey, - "terraformId": terraformId, - "fqdn": fqdn, - "rrType": "A", - "rrData": f"scaleway_instance_ip.{machineKey}.address", - } - - @staticmethod - def machine(key: str): - return {"type": "terraform-machine", - "key": key, - } - - @staticmethod - def declare_rules(): - @when_all( - c.dns << (m.type == "dns-entry"), - c.machine << ((m.type == "terraform-machine") & (m.key == c.dns.key)), - ) - def onDnsEntry(c): - terraformId = c.dns.fqdn.replace(".", "_") - c.assert_fact(Terraform.recordSetForMachine(c.machine.key, terraformId, c.dns.fqdn)) - - @when_all((m.type == "terraform-record-set")) - def defaultTerraformRecordSet(c): - pass - - @when_all((m.type == "machine")) - def onDnsEntry(c): - print(f"matched machine: {c.m}") - c.assert_fact(Terraform.machine(c.m.key)) - - @when_all((m.type == "terraform-machine")) - def defaultTerraformMachine(c): - print(f"matched terraform-machine: {c.m}") diff --git a/py/acme/rai/utils.py b/py/acme/rai/utils.py deleted file mode 100644 index bc47d8f..0000000 --- a/py/acme/rai/utils.py +++ /dev/null @@ -1,59 +0,0 @@ -import os -import os.path -import yaml -from durable.lang import * - -def write_facts(ruleset: set): - facts = get_facts(ruleset) - - types = set((f.get("type") for f in facts)) - - print(f"types: {types}") - - out_dir = "out" - if not os.path.exists(out_dir): - os.mkdir(out_dir) - - basedir = os.path.join(out_dir, ruleset) - if os.path.exists(basedir): - for f in os.listdir(basedir): - p = os.path.join(basedir, f) - if os.path.isdir(p): - for f2 in os.listdir(p): - os.remove(os.path.join(p, f2)) - os.rmdir(p) - else: - os.remove(p) - os.rmdir(basedir) - os.mkdir(basedir) - - for t in types: - typedir = os.path.join(basedir, t) - os.mkdir(typedir) - - fs = [] - for fact in facts: - if fact["type"] != t: - continue - - if fact["type"] == "meta": - continue - - if fact.get("key") is None: - raise Exception(f"Bad fact: no 'key' {fact}") - - try: - del fact["sid"] - except KeyError: - pass - - fs.append(fact) - - i = 0 - for fact in sorted(fs, key=lambda f: f["key"]): - key = fact["key"] - path = os.path.join(typedir, f"{key.replace('/', '_')}.yaml") - with open(path, "w") as f: - s = yaml.dump(fact) - f.write(s) - i = i + 1 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 1103fe2..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -durable_rules==2.0.28 -pyyaml==5.3.1 -jinja2==2.11.2 -- cgit v1.2.3