from diagrams import Cluster, Diagram

from diagrams.azure.database import SQLDatabases
from diagrams.onprem.inmemory import Redis
from diagrams.onprem.network import Internet
from diagrams.onprem.groupware import Nextcloud
from diagrams.onprem.monitoring import Grafana, Prometheus
from diagrams.onprem.storage import Ceph, CephOsd
from diagrams.onprem.network import Haproxy

from diagrams.digitalocean.network import LoadBalancer

import diagrams.generic.storage as storage_1

from diagrams.azure.identity import Groups
from diagrams.custom import Custom

with Diagram(filename="./assets/dia_nc_dev_simple", show=False, direction="TB"):
    out = Internet("Intranet")

    with Cluster("SSL proxy"):
        openstack_lb = Custom("", "../assets/vagrant.png")
        lb = Haproxy()

    with Cluster("Web server"):
        openstack_web = Custom("", "../assets/vagrant.png")
        nc_frontend = Nextcloud()      

    with Cluster("Caching"):
        openstack_cach = Custom("", "../assets/vagrant.png")
        redis = Redis()

    with Cluster("Control / Monitor"):
        openstack_ctrl = Custom("", "../assets/vagrant.png")
        ctrl = [Prometheus(), Grafana()]

    with Cluster("Database"):
        openstack_db = Custom("", "../assets/vagrant.png")
        db = SQLDatabases()

    openstack_cach << nc_frontend
    openstack_web >> openstack_db    
    openstack_ctrl << openstack_lb >> openstack_web
    out >> lb
    openstack_web >> openstack_ctrl << openstack_db    