@startuml
' convert it with additional command line argument -DRELATIVE_INCLUDE="./.." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
  !include %get_variable_value("RELATIVE_INCLUDE")/C4_Component.puml
!else
  !include https://gitea.utapp.cn/github-mirrors/C4-PlantUML/raw/branch/ut/C4_Component.puml
!endif

!define osaPuml https://raw.githubusercontent.com/Crashedmind/PlantUML-opensecurityarchitecture2-icons/master
!include osaPuml/Common.puml
!include osaPuml/User/all.puml
!include osaPuml/Server/all.puml

!include <office/Servers/database_server>
!include <office/Servers/file_server>
!include <office/Servers/application_server>
!include <office/Concepts/service_application>
!include <office/Concepts/firewall>

AddExternalPersonTag("anonymous_ext", $sprite="osa_user_black_hat", $legendText="anonymous user")
AddPersonTag("customer", $sprite="osa_user_large_group", $legendText="aggregated user")
AddPersonTag("admin", $sprite="osa_user_audit,color=red", $legendSprite="osa_user_audit,scale=0.25,color=red", $legendText="administration user")

AddContainerTag("webApp", $sprite="application_server", $legendText="web application")

AddContainerTag("mysql_db", $sprite="database_server", $techn="MySQL 5.5.x", $legendText="MySQL database container")
AddContainerTag("mongo_db", $sprite="database_server", $techn="MongoDB 2.2.x", $legendText="MongoDb database container")
AddContainerTag("files", $sprite="file_server", $legendText="file server container")

AddContainerTag("conApp", $sprite="img:https://plantuml.com/logo3.png{scale=0.3}", $legendSprite="img:https://plantuml.com/logo3.png{scale=0.1}", $legendText="console application")

UpdateElementStyle("external_system", $bgColor=$EXTERNAL_SYSTEM_BG_COLOR, $fontColor=$EXTERNAL_SYSTEM_FONT_COLOR, $borderColor=$EXTERNAL_SYSTEM_BORDER_COLOR, $sprite = "osa_server", , $legendText="external system")

AddRelTag("firewall", $textColor="$ARROW_FONT_COLOR", $lineColor="$ARROW_COLOR", $sprite="&envelope-closed", $techn="HTTPS", $legendText="firewall")
AddRelTag("plantuml", $textColor="$ARROW_FONT_COLOR", $lineColor="$ARROW_COLOR", $sprite="img:https://plantuml.com/logo3.png{scale=0.1}", $legendText="console triggered")

Person_Ext(anonymous_user, "Bob", $tags="anonymous_ext")
Person(aggregated_user, "Sam, Ivone", $tags="customer")
Person(administration_user, "Bernd", $tags="admin")

System_Boundary(c1, "techtribes.js"){
    Container(web_app, "Web Application", "Java, Spring MVC, Tomcat 7.x", "Allows users to view people, tribes, content, events, jobs, etc. from the local tech, digital and IT sector", $tags="webApp")
    ContainerDb(rel_db, "Relational Database", "", "Stores people, tribes, tribe membership, talks, events, jobs, badges, GitHub repos, etc.", $tags="mysql_db")
    Container(filesystem, "File System", "FAT32", "Stores search indexes", $tags="files")
    ContainerDb(nosql, "NoSQL Data Store", $descr = "Stores from RSS/Atom feeds (blog posts) and tweets", $tags="mongo_db")
    Container(updater, "Updater", "Java 7 Console App", "Updates profiles, tweets, GitHub repos and content on a scheduled basis", $tags="conApp")
}

System_Ext(twitter, "Twitter")
System_Ext(github, "GitHub")
System_Ext(blogs, "Blogs")

Rel(anonymous_user, web_app, "Uses", $descr="description", $tags="firewall")
Rel(aggregated_user, web_app, "Uses", "techn", "description", $tags="firewall")
Rel(administration_user, web_app, "Uses", "", "description", $tags="firewall")

Rel(web_app, rel_db, "Reads from and writes to", "SQL/JDBC, port 3306")
Rel(web_app, filesystem, "Reads from")
Rel(web_app, nosql, "Reads from", "MongoDB wire protocol, port 27017")

Rel_U(updater, rel_db, "Reads from and writes data to", "SQL/JDBC, port 3306")
Rel_U(updater, filesystem, "Writes to")
Rel_U(updater, nosql, "Reads from and writes to", "MongoDB wire protocol, port 27017")

Rel(updater, twitter, "Gets profile information and tweets from", "HTTPS", $tags="plantuml")
Rel(updater, github, "Gets information about public code repositories from", "HTTPS", $tags="plantuml")
Rel(updater, blogs, "Gets content using RSS and Atom feeds from", "HTTP", $tags="plantuml")

Lay_R(rel_db, filesystem)

SHOW_LEGEND()
@enduml
