PlantUML, Docker and NGINX. Your own UML designer.
If you are familiar with Software Architecture, you will stumble with...
- Sequence Diagrams
- Class Diagrams
- C4 Diagrams
- BizzDesign
- Deployment Diagrams
So many diagrams it is making my head dizzy. And Visio sometimes to install the stencils and make everything look organized is a nightmare.
Well not to worry, PlantUML is here.
I can't tell you how many times I had to share a diagram and enhance it on the fly, PlantUML is great on doing that. Just share an URL, and voila!!! a rendered image with the diagram or better yet, syntax that you can edit.
Going forward every time I need to explain the architecture I will be adding, when possible, the syntax.
So, on this post I will only talk about installing docker to host the PlantUML image and configuring NGINX as a reverse proxy for the container. This is where the fun begins... (I know I know, another Star Wars reference)
I will be using a Linux Debian distro.
Installation of Docker
Open a terminal and execute command.
sudo apt update
This command will update all your packages to the latest version.

Next you will need to add the prerequisite packages.
sudo apt install apt-transport-https ca-certificates curl gnupg

Next steps install docker by executing.
sudo apt install docker

And check the status of docker by executing.
sudo systemctl status docker

Install NGINX
This is a personal choice, but for the reverse proxy I prefer not using docker, so I will install it directly into the distro and not a container.
sudo apt install nginx

If you are exposing NGINX to the public internet, I suggest updating the firewall rules to allow only https traffic, for now I will show you exposing it to port 80 with firewall disabling other ports.
sudo ufw allow 'Nginx HTTP'
PlantUML and NGINX configuration
Pull the image
docker pull plantuml/plantuml-server
Create the container
docker run -d -p 8080:8080 plantuml/plantuml-server:jetty
What is happening here is once we downloaded the PlantUML docker image, we need to mount it into a container.
The command docker run has several parameters.
-d is execute the container detached or in the background
-p is the port mapping, all requests coming from port 8080 will be mapped to port 8080, this is the default for PlantUML
And last, the image we need to mount.
If you did not update the firewall you can go to http://localhost:8080 and the designer will show

Last step is configuring NGINX to forward requests from port 443 or 80 to port 8080 where PlantUML is listening and create a virtual path.
On the Debian terminal open an editor for
sudo nano /etc/nginx/nginx.conf
I prefer nano as I am not that proficient in vi or other command tool, have bad memory...
Locate the location/ { in the editor and on the previous line type

This will instruct NGINX to
- Create a virtual path to /plantuml url
- Take the base of the cointainer url and map it to /plantuml
- Create a proxy and redirect all traffic intended for /plantuml and forward it to port 8080.
Thats it, you have your own UML designer.
On another post I will place some snippets, specially C4.
Until next time.