@startuml
package "Docker Netzwerk" {
[nginx SSL Proxy] as proxy
[Webapp DB] as webappdb
[Webapp] as webapp
[Webapp CLI] as client
[Webapp Tests] as tests
[Swagger UI] as swagger
[Document Generator DB] as docsdb
[Document Generator] as docs
[Mail Catcher] as mailhog
[Keycloak] as keycloak
}
Browser --> proxy
Terminal --> client
Terminal --> tests
proxy -down-> webapp
proxy -down-> docs
proxy -down-> swagger
proxy -down-> keycloak
webapp --> webappdb
webapp --> mailhog
webapp -left-> docs
webapp -left-> keycloak
client --> webapp
client --> keycloak
tests --> webapp
tests --> keycloak
swagger -left-> webapp
docs --> docsdb
docs -left-> keycloak
@enduml
Last active
August 20, 2019 07:02
-
-
Save Rokko11/72cf7bb9aed1de1f93728d5150cf59a0 to your computer and use it in GitHub Desktop.
Beispiel-Code für die Transformation eines docker-compose.yml in ein Markdown-File. Dieses wird mit dem pandoc-plantuml-Filter in ein Diagramm überführt.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
proxy: | |
image: nginx:1.15-alpine | |
labels: | |
description: "nginx SSL Proxy" | |
depends_on: | |
- webapp | |
- docs | |
- swagger | |
- keycloak | |
webappdb: | |
image: postgres:9.6-alpine | |
labels: | |
description: "Webapp DB" | |
webapp: | |
image: enowa/webapp:1.0.0 | |
labels: | |
description: "Webapp" | |
depends_on: | |
- webappdb | |
- mailhog | |
- docs | |
- keycloak | |
client: | |
image: enowa/client:1.0.0 | |
labels: | |
description: "Webapp CLI" | |
depends_on: | |
- webapp | |
- keycloak | |
tests: | |
image: enowa/webapp-tests:1.0.0 | |
labels: | |
description: "Webapp Tests" | |
depends_on: | |
- webapp | |
- keycloak | |
swagger: | |
image: swaggerapi/swagger-ui | |
labels: | |
description: "Swagger UI" | |
depends_on: | |
- webapp | |
docsdb: | |
image: postgres:9.6-alpine | |
labels: | |
description: "Document Generator DB" | |
docs: | |
image: enowa/docs:2.0.3 | |
labels: | |
description: "Document Generator" | |
depends_on: | |
- docsdb | |
- keycloak | |
mailhog: | |
labels: | |
description: "Mail Catcher" | |
image: mailhog/mailhog | |
keycloak: | |
image: jboss/keycloak | |
labels: | |
description: "Keycloak" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -v $(pwd):/tmp \ | |
ruby:2.3.1 \ | |
ruby \ | |
/tmp/transformation.rb \ | |
> output.md | |
# Vielen Dank an cloudogu für die Bereitstellung dieses Services | |
docker run -v $(pwd):/data \ | |
-e PLANTUML_URL=https://ecosystem.cloudogu.com \ | |
cloudogu/pandoc \ | |
*.md \ | |
--filter pandoc-plantuml-filter \ | |
-o result.pdf | |
rm -f *eps* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
thing = YAML.load_file('/tmp/docker-compose.yml') | |
puts '## Verteilungssicht' | |
puts '' | |
puts '```uml' | |
puts '@startuml' | |
puts 'package "Docker Netzwerk" {' | |
thing['services'].each do |key, service| | |
puts " [#{service['labels']['description']}] as #{key}" | |
end | |
puts '}' | |
puts 'Browser --> proxy' | |
puts 'Terminal --> client' | |
puts 'Terminal --> tests' | |
stages = Hash.new | |
stages['proxy'] = 1 | |
thing['services']['proxy']['depends_on'].each do |d| | |
stages[d] = 2 | |
end | |
thing['services'].each do |key, service| | |
unless service['depends_on'].nil? | |
service['depends_on'].each do |depend| | |
if key == 'proxy' | |
puts "#{key} -down-> #{depend}" | |
elsif stages[key] == 2 and stages[depend] == 2 | |
puts "#{key} -left-> #{depend}" | |
else | |
puts "#{key} --> #{depend}" | |
end | |
end | |
end | |
end | |
puts '@enduml' | |
puts '```' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment