digraph {
    nodesep=0.5;
    splines="ortho";
    node [shape="box"];
    edge [color="blue"];
    
    ifm [label="intergalactic.fm (video)"];

    subgraph cluster_lag {
       label="things in the lag";
        edge [color="grey"];
 
    subgraph cluster_devices_around_table {
       label="non computer devices on table";
        edge [color="grey"];
      mic
      turntables
      big_mixer [label="big mixer"] 
      dj_mixer [label="dj mixer"] 
      turntables -> dj_mixer
      mic -> mixer
      mixer [label="Mixer (Behringer)"];
      studio_monitors [label="Studio Monitors"]
      dvr [label="4 channel digital video recorder 4chdvr.lag, connect with rtsp"]
      mixer -> antani_soundcard;
      antani_soundcard -> mixer;
      mixer -> studio_monitors;
      lag_webcam_dj [label="LAG webcam dj"];
      lag_webcam_dj -> dvr [color="red"];
      lag_webcam_ptz [label="LAG webcam ptz"];
      lag_webcam_ptz -> dvr [color="red"];
      big_mixer -> mixer 
      dj_mixer -> mixer 

    } 
    subgraph cluster_antani {
        label="Antani (antani.lag)";
        edge [color="grey"];
        antani_soundcard [label="Antani Soundcard, build into behringer mixer hw:CODEC (USB)"];
        antani_jack [label="Jack Audio"];
        antani_ardour [label="Ardour"];
        antani_obs [label="OBS"];
        nextcloud_desktop [label="nextcloud desktop client \n should be replaced by a smarter script based on rclone"]
        liquidsoap_papillon_ls1ls2 [label="liquidsoap that takes audio from jack and sends to ls1 and ls2"]
        antani_soundcard -> antani_jack -> antani_ardour -> antani_obs;
        antani_ardour -> liquidsoap_papillon_ls1ls2 [color="pink"];
        dvr -> antani_obs;

    subgraph cluster_irc_shouts {
        label="IRC .shouts";
        hackint_irc_papillon [label="sopel on \n Hackint #papillon"];
        indymedia_irc_lag [label="sopel on \n Indymedia #lag"];
        ifm_chat [label="sopel on \n ifm chat"];
        shoutdb [label="shoutdb \n sqlite database"]
        shoutfile [label="shoutfile \n file written by shoutloop, and read by obs"]
        hackint_irc_papillon -> shoutdb 
        ifm_chat -> shoutdb 
        indymedia_irc_lag ->  shoutdb [color="black"];
        shoutdb -> shoutfile -> antani_obs [color="black"];


    }


     }

    subgraph cluster_streaming_server {
      label="Streaming server (dock.lag, on domlag)";
      edge [color="grey"];

      archive_directory [label="directory with old recordings \n /mnt/radio/[jingles|papillon_archive|etc]"]

      liquidsoap_papillon_ls1 [label="primary liquidsoap \n relays live \n  or plays archive"]
      nginx_rtmp [label="nginx-rtmp \n input on: rtmp://[streamingserver]/stream/leftover"]
      ifm [label="intergalactic fm \n https://intergalactic.fm/leftover"]
      archive_directory -> liquidsoap_papillon_ls1
      antani_obs -> nginx_rtmp [color="red" label="rtmp"]
      rtmp_recordings [label="recordings \n in /mnt/radio/recordings/rtmprec/streams"]
      nginx_rtmp -> rtmp_recordings [color="red"]
      hls_hi [label="hls hi \n https://[streamingserver]/live/leftover_hi.m3u8"] 
      hls_low [label="hls low \n https://[streamingserver]/live/leftover_low.m3u8"] 
      hls_audio [label="hls audio \n https://[streamingserver]/live/leftover_audio.m3u8"] 

      hls_variant [label="hls playlist that combines the variants \n (to make it possible to adjust quality from player) \n http://dock.lag/live/leftover.m3u8 \n https://hlsorigin.laglab.org/live/leftover.m3u8"]
      hls_low -> hls_variant [color="blue"]
      hls_hi -> hls_variant [color="red"]
      liquidsoap_papillon_ls1ls2 -> liquidsoap_papillon_ls1 [label="when audio from LAG,\n ogg over http",color="pink"];
      liquidsoap_papillon_ls1ls2 -> liquidsoap_papillon_ls2 [label="when audio from LAG,\n ogg over http",color="pink"];
      nginx_rtmp -> hls_low [color="blue"];

      nginx_rtmp -> ffmpeg -> ifm [label="transmuxed",color="red"];
      nginx_rtmp -> ffmpeg [color="red"]
      ffmpeg -> low [label="transcoded",color="blue"];
      low -> nginx_rtmp -> hls_hi [color="blue"]; 
      ffmpeg -> audioonly -> nginx_rtmp -> hls_audioonly -> hls_variant [color="orange"]; 


    }
}

    subgraph cluster_backup_streaming_server {
      label="Backup streaming server";
      edge [color="grey"];

      liquidsoap_papillon_ls2 [label="secondary liquidsoap (REDUNDANT, NOT RUNNING ATM.)"]
    }


    subgraph cluster_puscii_nl {
      label="puscii server";
      edge [color="grey"];

    subgraph cluster_laglab_org {
      label="laglab vm on puscii.nl";
      edge [color="grey"];
    
      leftover_website [label="leftover.puscii.nl \n jekyll generated website \n update it with getleftover.sh"];
      hls_variant -> nginx_cache
      nginx_cache [label="https://hls.laglab.org:8443 nginx \n reverse caching proxy for video"]
      nginx_cache -> leftover_website;

      lag_wiki [label="lag ikiwiki on \n laglab.org"]
    } 

      puscii_icecast [label="icecast with failover config on \n deathstar.puscii.nl \n http://deathstar.puscii.nl:8000/papillon.[mp3|ogg|opus]"];
      nextcloud [label="leftover_publication \n on cloud.puscii.nl \n https://cloud.puscii.nl/index.php/s/jAKnsg4KppyRgkC"]
      puscii_icecast -> leftover_website;
    
     subgraph cluster_gitlab {
      label="git.puscii.nl";
      edge [color="grey"];
      lag_wiki_git [label="lag wiki git \n https://git.puscii.nl/lag/wiki"];
      leftover_website_git [label="leftover website \n https://git.puscii.nl/admradio/pap-website-jekyll"];
      lag_wiki_git -> lag_wiki;
      leftover_website_git -> leftover_website;
     }

      nextcloud -> leftover_website
      nextcloud_desktop -> nextcloud [label="uploads recordings"];

      puscii_icecast
      liquidsoap_papillon_ls1 -> puscii_icecast [color="pink"];
      liquidsoap_papillon_ls2 -> puscii_icecast [color="pink"];


    }




}

