Background
PlantUML is a plain text language for writing diagrams. We just type the diagram specifications and diagram visual can be generated from the same. Easy to version control, easy to compare what changed, etc...Visual Studio Code helps us to edit the diagram easily with preview and the environment is easy to setup. We can commit the diagrams to GitHub or any version control which can be rendered using PlantUML server. www.plantuml.com has a free service that we can use to render the diagrams from GitHub.com which even we an embed in web sites.
There is a separate tutorial on publishing rendered PlantUML diagrams using the www.plantuml.com provided rendering server.
Problem
The problem with using www.plantuml.com provided rendering is that it uses HTTP. No secure HTTP(s). An example URL is given below.
http://www.plantuml.com/plantuml/proxy?src=<URL to .puml>
There is an issue in the repo but not yet resolved.
Solution
One possible solution is to host the PlantUML server ourselves with our favorite hosting provider. If budget is a constraint, there are free hosting providers. Since its a Java application, we cannot host with GitHub pages or static file hosting providers. Another option is to host with cloud providers using their free tiers. Microsoft Azure has such an offering called App Service. They even allow containers to be hosted there.
This post is describing how we can host containerized PlantUML-Server in Azure App Service.
Steps
Below are steps to host our own PlantUML rendering server.- Create Azure Web Sites
- Select Linux containers
- Image source = "Docker Hub"
- Repository Access = "Public"
- Image and optional tag = "plantuml/plantuml-server:tomcat"
- Create App Service
- If there are issues in Refreshing the container image
- Go to "Configuration Blade" look for "DOCKER_REGISTRY_SERVER_URL" setting
- Change to https://hub.docker.com if it is https://index.docker.io
- Prepare the URL
- Normal URL - http://www.plantuml.com/plantuml/proxy?src=<URL to .puml>
- Azure App Service URL - https://<app service name>.azurewebsites.net/proxy?src=<URL to .puml>
The only place where some confusion may occur is the container settings. Below is the screenshot to make things clear
Troubleshooting
Below are some issues faced during the initial setup. The steps above already taking care of the solution.
Docker registry server URL
When we create Azure App Service, by default it points to https://index.docker.io. As of writing this post, that shows it has plantuml/plantuml-server when we search. But throws HTTP 404 when we click on the link. But the https://hub.docker.com works fine. This issue is already in Docker Forums.
URL difference
Below is the URL if we use the proxy provided by plantuml.com
http://www.plantuml.com/plantuml/proxy?src=<URL to .puml>
When we host the PlantUML server the URL has to change the format is below for Azure App Service URL
https://<app service name>.azurewebsites.net/proxy?src=<URL to .puml>
The difference is that we don't need the /plantuml path just after the domain.
2 comments:
Thanks for your contribution !
Note that our https issue should be fixed now.
https://www.plantuml.com/plantuml/proxy?src=https://raw.github.com/plantuml/plantuml-server/master/src/main/webapp/resource/test2diagrams.txt is working fine for example.
Thanks Unknown. I don't know how did you reach to my blog, but this is big news.
Post a Comment