obsidian-plantuml icon indicating copy to clipboard operation
obsidian-plantuml copied to clipboard

Auto-start UML server in a docker container (I'll be willing to make a PR on this feature)

Open stroiman opened this issue 7 months ago • 0 comments

First of all, if you think the suggestion is a good idea, I'd be willing to see if I could make a PR with the contribution.

Is your feature request related to a problem? Please describe.

Not to much a problem, but it would simplify my workflow slightly.

When using this plugin, I use docker to easily start a local server, like this:

docker run -d -p 8081:8080 plantuml/plantuml-server:jetty

And configure plugin server URL to http://localhost:8081. (I use 8081 as I have other stuff running on 8080)

This makes it extremely easy to have a local server and gives me the benefit of running a server but I get faster responses due to lower network latency, and not having to share the server with thousands of other users. And I don't have to worry about java versions, jetty/tomcat/other HTTP servers, etc. One command line, and I have a running server.

It could be helpful, if the plugin could just start the server, and stop it again, when no longer needed.

This should work on all desktop platforms, i.e. Windows, MacOS, and Linux. However, I doubt it would work on mobile devices.

Describe the solution you'd like

  • Add an option to "auto start" plantuml from from a docker container which would manage the server URL.
    • Keep the server URL as a fallback option, if docker isn't available.
      • That way, you can enable it for a vault, but it will only be used on platforms that support it, i.e. has docker is installed and running.
    • We can let docker automatically pick an available port, allowing the user to not having to specify that themselves.
  • Automatically start the docker container on a reasonable event (probably user configurable)
    • Plugin load, makes the server available quicker, but consumes resources on the user's computer
    • When first showing a UML diagram. Makes the first UML diagram show slower, but avoids.
  • Detect if a server is already running, e.g. because of an unclean exit.
  • Stop (and remove) the container (if started) on plugin unload event.

Describe alternatives you've considered

I'll just continue what I do now, start the container manually.

stroiman avatar Jun 28 '24 11:06 stroiman