Giter Club home page Giter Club logo

plantuml-service's Introduction

PlantUML HTTP service Build Status

This is a high-performance HTTP interface to PlantUML.

Table of Contents

Install

There's two way to install plantuml-service:

Jar

Get plantuml-service.jar from GitHub releases.

Docker

There is a docker image in Docker Hub.

docker pull bitjourney/plantuml-service:1.4.0

Usage

POST /svg where body is the source of PlantUML

Returns an SVG image of the request body, processed by PlantUML.

Because the size of GET requests might be limited by middlewares, the POST API is recommended in production.

GET /svg/:source

Returns an SVG image of :source processed by PlantUML.

:source is source code of PlantUML, encoded in percent encoding.

Example:

Given a PlantUML source code:

@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
@enduml

To show it in SVG:

![]($ENDPOINT/%40startuml%0AAlice%20-%3E%20Bob%3A%20Authentication%20Request%0ABob%20--%3E%20Alice%3A%20Authentication%20Response%0A%0AAlice%20-%3E%20Bob%3A%20Another%20authentication%20Request%0AAlice%20%3C--%20Bob%3A%20another%20authentication%20Response%0A%40enduml%0A)

Then, you'll get:

sample

This path takes multiple config parameters to set configuration, for example:

/svg/...?config=scale max 1024 width&config=skin BlueModern

NOTE: you should use server-side RPC to render SVG because browsers have URL limitations.

GET /version

Shows the version of PlantUML and plantuml-service in JSON:

{"PlantUML":"2017.11","plantuml-service":"1.0.9"}

This is also intended to check the service helth.

Development

Run on local:

./gradlew stage

Deployment

Run with systemd

Here is an example systemd.service(5) config file:

[Unit]
Descrption=PlantUML service
Documentation=https://github.com/bitjourney/plantuml-service
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=$APP_PATH/app/bin/plantuml-service
WorkingDirectory=$APP_PATH/app

User=$APP_USER
Group=$APP_USER

[Install]
WantedBy=multi-user.target

Release Engineering

  1. Create the credential file by echo "oauth=$GITHUB_ACCESS_TOKEN" > ~/.github
  2. Update the version of build.gradle
  3. Run ./gradlew release
    • It uploads artifacts to GitHub
    • And then build the docker image and push the image to Docker Hub

See Also

Authors

  • FUJI Goro (gfx)

License

Copyright (c) 2016 Bit Journey, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

plantuml-service's People

Contributors

dependabot[bot] avatar gfx avatar kuroponzu avatar michiomochi avatar shimbaco avatar slamdev avatar ywindish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plantuml-service's Issues

Problem of SVG image's textLength

When I use Chinese characters, the SVG image's textLength is smaller then expected.

actual

2018-01-17 8 01 23

source code:

<text xmlns="http://www.w3.org/2000/svg" fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="14" x="104" y="28.1543">中文</text>

expected

2018-01-17 8 03 02

source code:

<text xmlns="http://www.w3.org/2000/svg" fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="24" x="104" y="28.1543">中文</text>

update to plantuml latest

Hi,
Thank you for your software. I use it prolifically with vscode jebbs plantuml plugin via its plantuml.render setting.

When I preview the following document

@startuml
version
@enduml

I notice the version is 1.2018.3

Is there a way to redirect the plantuml-service to call a local version of the plantuml jar so as to pick up an updated version of the base plantuml.jar?

Cheers.

Where is the server running on localhost?

I started the server with:

D:\>java -jar plantuml-service.jar
[main] INFO com.bitjourney.plantuml.Main - The environment variable GRAPHVIZ_DOT has been set to D:\User\Documents\graphviz-2.38\release\bin\dot.exe
[main] INFO com.bitjourney.plantuml.Main - Dot executable is D:\graphviz-2.38\release\bin\dot.exe
[main] INFO com.bitjourney.plantuml.Main - Dot version: dot - graphviz version 2.38.0 (20140413.2041)
[main] INFO com.bitjourney.plantuml.Main - Installation seems OK. File generation OK
[Thread-7] INFO org.eclipse.jetty.util.log - Logging initialized @2492ms to org.eclipse.jetty.util.log.Slf4jLog
[Thread-7] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - == Spark has ignited ...
[Thread-7] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - >> Listening on 0.0.0.0:1608
[Thread-7] INFO org.eclipse.jetty.server.Server - jetty-9.4.z-SNAPSHOT
[Thread-7] INFO org.eclipse.jetty.server.session - DefaultSessionIdManager workerName=node0
[Thread-7] INFO org.eclipse.jetty.server.session - No SessionScavenger set, using defaults
[Thread-7] INFO org.eclipse.jetty.server.session - Scavenging every 600000ms
[Thread-7] INFO org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@4dd21dcf{HTTP/1.1,[http/1.1]}{0.0.0.0:1608}
[Thread-7] INFO org.eclipse.jetty.server.Server - Started @3145ms

When running https://github.com/plantuml/plantuml-server I could access it on http://localhost:8080/plantuml

SALT is broken when it includes "+"

given the following source:

@startuml
salt
{
{T
 + World
 ++ America
 +++ Canada
 +++ USA
 ++++ New York
 ++++ Boston
 +++ Mexico
 ++ Europe
 +++ Italy
 +++ Germany
 ++++ Berlin
 ++ Africa
}
}
@enduml

expected (using www.plantuml.com):

as of plantml-service 1.2.3 (using plantuml-service.herokuapp.com):

Python 3 POST usage example

Python 3 POST usage example:

from urllib.parse import urlencode
from urllib.request import Request, urlopen

url = 'http://localhost:1608/png'
post_fields = self.text.encode()

request = Request(url, post_fields)
answer = urlopen(request).read().decode()
print(answer)

Can not pull from docker hub

I can not pull from docker hub, any one have the same problem?

Error response from daemon: manifest for bitjourney/plantuml-service:latest not found

PlantUML version update

Hi @gfx , PlantUML now supports mindmaps and it would be great if possible we could get the service and brew version bumped to incorporate this latest version. (i.e. As per #35).

Many thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.