Swagger UI — a browser interface that renders any OpenAPI/Swagger spec into interactive, try-it-out API documentation. Point it at a spec URL and get explorable docs. Deployed as a host-networked, stateless Nomad service.
Needs nomad-pack on PATH. The script only adds the nomploy registry and runs this pack.
Source ↗ Project ↗ ★ 29k ⚑ Report an issue
Save as values.hcl, edit, then run:
# The name of the Nomad job.
job_name = "swagger-ui"
# The Nomad namespace to deploy into.
namespace = "default"
# The datacenters to deploy to.
datacenters = ["*"]
# The Swagger UI container image. Pin a tag in production.
image = "swaggerapi/swagger-ui:latest"
# Host port for the Swagger UI web server (PORT).
port = 8112
# URL of the OpenAPI/Swagger spec to render (URL). Point this at your API's spec.
spec_url = "https://petstore.swagger.io/v2/swagger.json"
# How many instances to run. Swagger UI is stateless, so you can run several.
count = 1
# Placement constraints. On a nomploy cluster: attribute = "$${meta.nomploy_control_plane}", operator = "=", value = "true".
constraints = []
# Resources for the Swagger UI task.
resources = {
cpu = 200
memory = 128
}
| Name | Type | Default | Description |
|---|---|---|---|
| job_name | string | "swagger-ui" | The name of the Nomad job. |
| namespace | string | "default" | The Nomad namespace to deploy into. |
| datacenters | list | ["*"] | The datacenters to deploy to. |
| image | string | "swaggerapi/swagger-ui:latest" | The Swagger UI container image. Pin a tag in production. |
| port | number | 8112 | Host port for the Swagger UI web server (PORT). |
| spec_url | string | "https://petstore.swagger.io/v2/swagger.json" | URL of the OpenAPI/Swagger spec to render (URL). Point this at your API's spec. |
| count | number | 1 | How many instances to run. Swagger UI is stateless, so you can run several. |
| constraints | list | [] | Placement constraints. On a nomploy cluster: attribute = "$${meta.nomploy_control_plane}", operator = "=", value = "true". |
| resources | object | {
cpu = 200
memory = 128
} | Resources for the Swagger UI task. |
No variables match.
Swagger UI — renders any OpenAPI/Swagger specification into clean, interactive, "try it out" API documentation in the browser. Point it at a spec URL and share explorable docs for your API.
Single host-networked Nomad service. Stateless — no volumes, so you can raise count.
nomad-pack registry add nomploy https://github.com/Nomploy/nomad-packs
nomad-pack run swagger-ui --registry=nomploy
| Variable | Default | Description |
|---|---|---|
port |
8112 |
Web server port (PORT). |
spec_url |
Petstore demo | URL of the OpenAPI/Swagger spec to render (URL). Point at your API. |
count |
1 |
Instances to run (stateless — safe to scale). |
image |
swaggerapi/swagger-ui:latest |
Container image. Pin a tag in production. |
resources |
{ cpu = 200, memory = 128 } |
Task resources. |
Set spec_url to your API's spec (e.g. https://api.example.com/openapi.json). If the spec lives on
another origin, that server must return permissive CORS headers so the browser can fetch it. To serve
a spec file baked into the image instead, mount it and set the SWAGGER_JSON env var.