infrastructure/templates/infrastructure.d2.j2

84 lines
1.3 KiB
Django/Jinja

vars: {
d2-config: {
layout-engine: elk
theme-id: 101
}
}
external: {
scaleway: {
s3
}
restic: {
icon: https://cdn.jsdelivr.net/gh/selfhst/icons/webp/restic.webp
}
}
{% for host in hosts %}
{{ host.key }}: {
}
{{ host.key }}.backup -> external.restic {
style: {
stroke: "#0f0"
stroke-dash: 3
}
}
{% endfor %}{# host #}
{% for svc in svcs %}
{{ svc.key }}: {
label: {{ svc.label }}
label.near: top-left
icon: {{ svc.icon }}
icon.near: top-right
}
{% for backup in svc.backup or [] %}
{{ svc.key }} -> {{ svc.host_key }}.backup: {{ backup.name }} {
style: {
stroke: "#0f0"
stroke-dash: 3
}
}
{% endfor %}{# backup #}
{% if svc.monitoring %}
{{ monitoring_key }} -> {{ svc.key }}: {
style.stroke: "#1E9025"
}
{% endif %}
{% if svc.database %}
{{ svc.key }} -> {{ db_key }}: {
style.stroke: "#336791"
}
{{ db_key }}.{{ svc.name }}
{% endif %}
{% if svc.auth %}
{{ svc.key }} -> {{ auth_key }}: {
style.stroke: "#FD4B2D"
}
{{ auth_key }}.{{ svc.name }}
{% endif %}
{% if svc.s3 %}
{{ svc.key }} -> external.scaleway.s3: {
style: {
stroke: "#110B1E"
stroke-dash: 3
}
}
external.scaleway.s3.{{ svc.name }}
{% endif %}
{% endfor %}{# svc #}
{% for svc in grid_svcs %}
{{ svc }}: {
grid-columns: 3
grid-gap: 0
}
{% endfor %}