summaryrefslogtreecommitdiff
path: root/example/db
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2021-02-03 16:35:48 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2021-02-03 16:35:48 +0100
commitbafe762ac01d16904c18404283027e426e19bc73 (patch)
treec22688ad186f5ce635f525704c5035f91b983b68 /example/db
parent91abd0b04320a9c9d932df195aca38c1cacfcc5a (diff)
downloadrules-sandbox-bafe762ac01d16904c18404283027e426e19bc73.tar.gz
rules-sandbox-bafe762ac01d16904c18404283027e426e19bc73.tar.bz2
rules-sandbox-bafe762ac01d16904c18404283027e426e19bc73.tar.xz
rules-sandbox-bafe762ac01d16904c18404283027e426e19bc73.zip
Code reorganization.
Moving main code to src, keeping modules in modules/
Diffstat (limited to 'example/db')
-rw-r--r--example/db/apps.yaml354
-rw-r--r--example/db/wireguard.yaml161
2 files changed, 515 insertions, 0 deletions
diff --git a/example/db/apps.yaml b/example/db/apps.yaml
new file mode 100644
index 0000000..b27231a
--- /dev/null
+++ b/example/db/apps.yaml
@@ -0,0 +1,354 @@
+---
+- type: "io.trygvis.rules.machine.Machine"
+ data:
+ &acme-1 name: "acme-1"
+ fqdn: "acme-1.machine.acme.com"
+- type: "io.trygvis.rules.machine.Machine"
+ data:
+ &acme-2 name: "acme-2"
+ fqdn: "acme-2.machine.acme.com"
+- type: "io.trygvis.rules.machine.Machine"
+ data:
+ &acme-3 name: "acme-3"
+ fqdn: "acme-3.machine.acme.com"
+- type: "io.trygvis.rules.machine.Machine"
+ data:
+ &ws-1 name: "ws-1"
+ fqdn: null
+- type: "io.trygvis.rules.machine.Machine"
+ data:
+ &ws-2 name: "ws-2"
+ fqdn: null
+- type: "io.trygvis.rules.dns.DnsZone"
+ data:
+ name: "ci.acme.com"
+- type: "io.trygvis.rules.dns.DnsZone"
+ data:
+ name: "production.acme.com"
+- type: "io.trygvis.rules.dba.Cluster"
+ data:
+ &acme-myapp-ci name: "acme-myapp-ci"
+- type: "io.trygvis.rules.dba.Cluster"
+ data:
+ &acme-myapp-production name: "acme-myapp-production"
+- type: "io.trygvis.rules.dba.Cluster"
+ data:
+ &acme-ops name: "acme-ops"
+- type: "io.trygvis.rules.dba.Container"
+ data:
+ id: "acme-myapp-ci-4tune-api"
+ cluster: *acme-myapp-ci
+ name: "4tune-api"
+ machineRole: "ci-app"
+ image: "4tune-api"
+ tag: "development"
+ machine: *acme-1
+ machineSpecification:
+ cpu: 200
+ memory: 200
+- type: "io.trygvis.rules.dba.Container"
+ data:
+ id: "acme-myapp-production-4tune-api"
+ cluster: *acme-myapp-production
+ name: "4tune-api"
+ machineRole: "production-app"
+ image: "4tune-api"
+ tag: "master"
+ machine: *acme-3
+ machineSpecification:
+ cpu: 200
+ memory: 200
+- type: "io.trygvis.rules.dba.Container"
+ data:
+ id: "acme-myapp-ci-4tune-web"
+ cluster: *acme-myapp-ci
+ name: "4tune-web"
+ machineRole: "ci-app"
+ image: "4tune-web"
+ tag: "development"
+ machine: *acme-1
+ machineSpecification:
+ cpu: 100
+ memory: 50
+- type: "io.trygvis.rules.dba.Container"
+ data:
+ id: "acme-myapp-production-4tune-web"
+ cluster: *acme-myapp-production
+ name: "4tune-web"
+ machineRole: "production-app"
+ image: "4tune-web"
+ tag: "master"
+ machine: *acme-3
+ machineSpecification:
+ cpu: 100
+ memory: 50
+- type: "io.trygvis.rules.dba.Container"
+ data:
+ id: "acme-myapp-ci-mdb"
+ cluster: *acme-myapp-ci
+ name: "mdb"
+ machineRole: "ci-db"
+ image: "mongodb"
+ tag: "3.2"
+ machine: *acme-2
+ machineSpecification:
+ cpu: 500
+ memory: 200
+- type: "io.trygvis.rules.dba.Container"
+ data:
+ id: "acme-myapp-production-mdb"
+ cluster: *acme-myapp-production
+ name: "mdb"
+ machineRole: "production-db"
+ image: "mongodb"
+ tag: "3.2"
+ machine: *acme-3
+ machineSpecification:
+ cpu: 500
+ memory: 200
+- type: "io.trygvis.rules.dba.Container"
+ data:
+ id: "acme-ops-n8n"
+ cluster: *acme-ops
+ name: "n8n"
+ machineRole: "ops"
+ image: "n8n"
+ tag: "0.84.1"
+ machine: *acme-2
+ machineSpecification: null
+- type: "io.trygvis.rules.dba.Container"
+ data:
+ id: "acme-myapp-ci-pdb"
+ cluster: *acme-myapp-ci
+ name: "pdb"
+ machineRole: "ci-db"
+ image: "postgresql"
+ tag: "13"
+ machine: *acme-2
+ machineSpecification:
+ cpu: 500
+ memory: 500
+- type: "io.trygvis.rules.dba.Container"
+ data:
+ id: "acme-myapp-production-pdb"
+ cluster: *acme-myapp-production
+ name: "pdb"
+ machineRole: "production-db"
+ image: "postgresql"
+ tag: "13"
+ machine: *acme-3
+ machineSpecification:
+ cpu: 500
+ memory: 500
+- type: "io.trygvis.rules.dba.Container"
+ data:
+ id: "acme-ops-pdb"
+ cluster: *acme-ops
+ name: "pdb"
+ machineRole: "ops"
+ image: "postgresql"
+ tag: "11"
+ machine: *acme-2
+ machineSpecification: null
+- type: "io.trygvis.rules.dba.Container"
+ data:
+ id: "acme-myapp-ci-statera"
+ cluster: *acme-myapp-ci
+ name: "statera"
+ machineRole: "ci-app"
+ image: "statera"
+ tag: "development"
+ machine: *acme-1
+ machineSpecification:
+ cpu: 200
+ memory: 1000
+- type: "io.trygvis.rules.dba.Container"
+ data:
+ id: "acme-myapp-production-statera"
+ cluster: *acme-myapp-production
+ name: "statera"
+ machineRole: "production-app"
+ image: "statera"
+ tag: "master"
+ machine: *acme-3
+ machineSpecification:
+ cpu: 200
+ memory: 1000
+- type: "io.trygvis.rules.dba.Container"
+ data:
+ id: "acme-myapp-ci-statera-console"
+ cluster: *acme-myapp-ci
+ name: "statera-console"
+ machineRole: "ci-app"
+ image: "statera-console"
+ tag: "development"
+ machine: *acme-1
+ machineSpecification:
+ cpu: 100
+ memory: 50
+- type: "io.trygvis.rules.dba.Container"
+ data:
+ id: "acme-myapp-production-statera-console"
+ cluster: *acme-myapp-production
+ name: "statera-console"
+ machineRole: "production-app"
+ image: "statera-console"
+ tag: "master"
+ machine: *acme-3
+ machineSpecification:
+ cpu: 100
+ memory: 50
+- type: "io.trygvis.rules.dba.DbaMachineRole"
+ data:
+ &1 machine: "acme-1"
+ roles:
+ - "ci-app"
+- type: "io.trygvis.rules.dba.DbaMachineRole"
+ data:
+ &2 machine: "acme-2"
+ roles:
+ - "ops"
+ - "ci-db"
+- type: "io.trygvis.rules.dba.DbaMachineRole"
+ data:
+ &3 machine: "acme-3"
+ roles:
+ - "production-app"
+ - "production-db"
+- type: "io.trygvis.rules.wireguard.WgNet"
+ data:
+ &vpn0 name: "vpn0"
+ domain: "vpn.acme.com"
+ port: 53476
+ linkCidr: "192.168.10.0/29"
+ networkCidr: "10.55.0.0/16"
+ networkBits: 24
+- type: "io.trygvis.rules.terraform.TerraformResource$ArrayTerraformValue"
+ data:
+ - "scaleway_instance_ip.acme-1.id"
+- type: "io.trygvis.rules.terraform.TerraformResource$ArrayTerraformValue"
+ data:
+ - "scaleway_instance_ip.acme-3.id"
+- type: "io.trygvis.rules.terraform.TerraformResource$ArrayTerraformValue"
+ data:
+ - "scaleway_instance_ip.acme-2.id"
+- type: "io.trygvis.rules.terraform.TerraformResource"
+ data:
+ output: "terraform/acme-1-instance.tf"
+ kind: "scaleway_server_instance"
+ instance: "acme-1"
+ values:
+ name: "acme-1"
+ type: "DEV1-S"
+ image: "b3042271-d2b1-4f87-b407-aedd3bbd1663"
+ ip_id: "scaleway_instance_ip.acme-1.ip"
+ enable_dynamic_ip: false
+ enable_ipv6: true
+ name: "scaleway_server_instance.acme-1"
+- type: "io.trygvis.rules.terraform.TerraformResource"
+ data:
+ output: "terraform/acme-1-ip.tf"
+ kind: "scaleway_instance_ip"
+ instance: "acme-1"
+ values: {}
+ name: "scaleway_instance_ip.acme-1"
+- type: "io.trygvis.rules.terraform.TerraformResource"
+ data:
+ output: "terraform/acme-1-ip.tf"
+ kind: "scaleway_instance_reverse_dns"
+ instance: "acme-1"
+ values:
+ reverse: "acme-1.machine.acme.com."
+ ip_id: "scaleway_instance_ip.acme-1.id"
+ name: "scaleway_instance_reverse_dns.acme-1"
+- type: "io.trygvis.rules.terraform.TerraformResource"
+ data:
+ output: "terraform/acme-2-instance.tf"
+ kind: "scaleway_server_instance"
+ instance: "acme-2"
+ values:
+ name: "acme-1"
+ type: "DEV1-S"
+ image: "b3042271-d2b1-4f87-b407-aedd3bbd1663"
+ ip_id: "scaleway_instance_ip.acme-2.ip"
+ enable_dynamic_ip: false
+ enable_ipv6: true
+ name: "scaleway_server_instance.acme-2"
+- type: "io.trygvis.rules.terraform.TerraformResource"
+ data:
+ output: "terraform/acme-2-ip.tf"
+ kind: "scaleway_instance_ip"
+ instance: "acme-2"
+ values: {}
+ name: "scaleway_instance_ip.acme-2"
+- type: "io.trygvis.rules.terraform.TerraformResource"
+ data:
+ output: "terraform/acme-2-ip.tf"
+ kind: "scaleway_instance_reverse_dns"
+ instance: "acme-2"
+ values:
+ reverse: "acme-2.machine.acme.com."
+ ip_id: "scaleway_instance_ip.acme-2.id"
+ name: "scaleway_instance_reverse_dns.acme-2"
+- type: "io.trygvis.rules.terraform.TerraformResource"
+ data:
+ output: "terraform/acme-3-instance.tf"
+ kind: "scaleway_server_instance"
+ instance: "acme-3"
+ values:
+ name: "acme-1"
+ type: "DEV1-S"
+ image: "b3042271-d2b1-4f87-b407-aedd3bbd1663"
+ ip_id: "scaleway_instance_ip.acme-3.ip"
+ enable_dynamic_ip: false
+ enable_ipv6: true
+ name: "scaleway_server_instance.acme-3"
+- type: "io.trygvis.rules.terraform.TerraformResource"
+ data:
+ output: "terraform/acme-3-ip.tf"
+ kind: "scaleway_instance_ip"
+ instance: "acme-3"
+ values: {}
+ name: "scaleway_instance_ip.acme-3"
+- type: "io.trygvis.rules.terraform.TerraformResource"
+ data:
+ output: "terraform/acme-3-ip.tf"
+ kind: "scaleway_instance_reverse_dns"
+ instance: "acme-3"
+ values:
+ reverse: "acme-3.machine.acme.com."
+ ip_id: "scaleway_instance_ip.acme-3.id"
+ name: "scaleway_instance_reverse_dns.acme-3"
+- type: "io.trygvis.rules.terraform.TerraformMain"
+ data:
+ module: "terraform"
+ providers:
+ scaleway:
+ source: "scaleway"
+ version: "2.0.0-rc1"
+- type: "io.trygvis.rules.engine.KeyValue"
+ data:
+ key: "rm-gen"
+ value: null
+- type: "io.trygvis.acme.AcmeServer"
+ data:
+ &acme-1 name: "acme-1"
+ machine: *acme-1
+- type: "io.trygvis.acme.AcmeServer"
+ data:
+ &acme-2 name: "acme-2"
+ machine: *acme-2
+- type: "io.trygvis.acme.AcmeServer"
+ data:
+ &acme-3 name: "acme-3"
+ machine: *acme-3
+- type: "io.trygvis.acme.apps.AcmeOps"
+ data: {}
+- type: "io.trygvis.acme.apps.AcmeMyApp"
+ data:
+ environment: "ci"
+ dockerTag: "development"
+- type: "io.trygvis.acme.apps.AcmeMyApp"
+ data:
+ environment: "production"
+ dockerTag: "master"
diff --git a/example/db/wireguard.yaml b/example/db/wireguard.yaml
new file mode 100644
index 0000000..a374351
--- /dev/null
+++ b/example/db/wireguard.yaml
@@ -0,0 +1,161 @@
+---
+- type: "io.trygvis.rules.machine.Machine"
+ data:
+ &acme-1 name: "acme-1"
+ fqdn: "acme-1.machine.acme.com"
+- type: "io.trygvis.rules.machine.Machine"
+ data:
+ &acme-2 name: "acme-2"
+ fqdn: "acme-2.machine.acme.com"
+- type: "io.trygvis.rules.machine.Machine"
+ data:
+ &acme-3 name: "acme-3"
+ fqdn: "acme-3.machine.acme.com"
+- type: "io.trygvis.rules.machine.Machine"
+ data:
+ &ws-1 name: "ws-1"
+ fqdn: null
+- type: "io.trygvis.rules.machine.Machine"
+ data:
+ &ws-2 name: "ws-2"
+ fqdn: null
+- type: "io.trygvis.rules.dns.DnsEntry"
+ data:
+ fqdn: "acme-1.vpn.acme.com"
+ type: "A"
+- type: "io.trygvis.rules.dns.DnsEntry"
+ data:
+ fqdn: "acme-2.vpn.acme.com"
+ type: "A"
+- type: "io.trygvis.rules.dns.DnsEntry"
+ data:
+ fqdn: "acme-3.vpn.acme.com"
+ type: "A"
+- type: "io.trygvis.rules.dns.DnsEntry"
+ data:
+ fqdn: "ws-1.vpn.acme.com"
+ type: "A"
+- type: "io.trygvis.rules.dns.DnsEntry"
+ data:
+ fqdn: "ws-2.vpn.acme.com"
+ type: "A"
+- type: "io.trygvis.rules.wireguard.WgNet"
+ data:
+ &vpn0 name: "vpn0"
+ domain: "vpn.acme.com"
+ port: 53476
+ linkCidr: "192.168.10.0/29"
+ networkCidr: "10.55.0.0/16"
+ networkBits: 24
+- type: "io.trygvis.rules.wireguard.WgIpPool"
+ data:
+ &1 net: *vpn0
+ role: "link"
+ cidr:
+ value: "192.168.10.0/29"
+- type: "io.trygvis.rules.wireguard.WgIpPool"
+ data:
+ &2 net: *vpn0
+ role: "networks"
+ cidr:
+ value: "10.55.0.0/16"
+- type: "io.trygvis.rules.wireguard.WgHost"
+ data:
+ &3 machine: *ws-1
+ net: *vpn0
+ publicName: null
+ publicPort: 53476
+ ip: "192.168.10.6"
+ networkCidr: "10.55.252.0/24"
+- type: "io.trygvis.rules.wireguard.WgHost"
+ data:
+ &4 machine: *ws-2
+ net: *vpn0
+ publicName: null
+ publicPort: 53476
+ ip: "192.168.10.7"
+ networkCidr: "10.55.251.0/24"
+- type: "io.trygvis.rules.wireguard.WgHost"
+ data:
+ &5 machine: *acme-1
+ net: *vpn0
+ publicName: "acme-1.machine.acme.com"
+ publicPort: 53476
+ ip: "192.168.10.3"
+ networkCidr: "10.55.255.0/24"
+- type: "io.trygvis.rules.wireguard.WgHost"
+ data:
+ &6 machine: *acme-2
+ net: *vpn0
+ publicName: "acme-2.machine.acme.com"
+ publicPort: 53476
+ ip: "192.168.10.4"
+ networkCidr: "10.55.254.0/24"
+- type: "io.trygvis.rules.wireguard.WgHost"
+ data:
+ &7 machine: *acme-3
+ net: *vpn0
+ publicName: "acme-3.machine.acme.com"
+ publicPort: 53476
+ ip: "192.168.10.5"
+ networkCidr: "10.55.253.0/24"
+- type: "io.trygvis.rules.wireguard.WgConnection"
+ data:
+ &acme-1_x_acme-2 name: "acme-1_x_acme-2"
+ host: *5
+ to: *6
+- type: "io.trygvis.rules.wireguard.WgConnection"
+ data:
+ &acme-1_x_acme-3 name: "acme-1_x_acme-3"
+ host: *5
+ to: *7
+- type: "io.trygvis.rules.wireguard.WgConnection"
+ data:
+ &acme-2_x_acme-1 name: "acme-2_x_acme-1"
+ host: *6
+ to: *5
+- type: "io.trygvis.rules.wireguard.WgConnection"
+ data:
+ &acme-2_x_acme-3 name: "acme-2_x_acme-3"
+ host: *6
+ to: *7
+- type: "io.trygvis.rules.wireguard.WgConnection"
+ data:
+ &acme-3_x_acme-1 name: "acme-3_x_acme-1"
+ host: *7
+ to: *5
+- type: "io.trygvis.rules.wireguard.WgConnection"
+ data:
+ &acme-3_x_acme-2 name: "acme-3_x_acme-2"
+ host: *7
+ to: *6
+- type: "io.trygvis.rules.wireguard.WgConnection"
+ data:
+ &ws-1_x_acme-1 name: "ws-1_x_acme-1"
+ host: *3
+ to: *5
+- type: "io.trygvis.rules.wireguard.WgConnection"
+ data:
+ &ws-1_x_acme-2 name: "ws-1_x_acme-2"
+ host: *3
+ to: *6
+- type: "io.trygvis.rules.wireguard.WgConnection"
+ data:
+ &ws-1_x_acme-3 name: "ws-1_x_acme-3"
+ host: *3
+ to: *7
+- type: "io.trygvis.rules.wireguard.WgConnection"
+ data:
+ &ws-2_x_acme-1 name: "ws-2_x_acme-1"
+ host: *4
+ to: *5
+- type: "io.trygvis.rules.wireguard.WgConnection"
+ data:
+ &ws-2_x_acme-2 name: "ws-2_x_acme-2"
+ host: *4
+ to: *6
+- type: "io.trygvis.rules.wireguard.WgConnection"
+ data:
+ &ws-2_x_acme-3 name: "ws-2_x_acme-3"
+ host: *4
+ to: *7