Skip to content

jtgasper3/swarm-visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swarm Visualizer

The Swarm Visualizer extends on the dockersamples/docker-swarm-visualizer concept demo'd at the 2015 DockerCon EU keynote.

It's goals are:

  • minimize internal data being exposed to the browser
  • allow for more control of the data being viewed
  • implement authentication via OpenID Connect

Usage

Docker CLI

docker service create visualizer \
    -e CLUSTER_NAME="Dev Cluster" \
    -p 8080:8080 \
    -v /var/run/docker.sock:/var/run/docker.sock \
    --constraint node.role==manager
    jtgasper3/swarm-visualizer

Docker Compose

service:
  viz:
    image: jtgasper3/swarm-visualizer:latest
    deploy:
      placement:
        constraints:
          - node.role==manager
    environment:
      CLUSTER_NAME: Dev Cluster
    ports:
      - 8080:8080
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

Configuration

General Environment Variables:

  • CLUSTER_NAME: title to display on the main page
  • CONTEXT_ROOT: the context root of the web app; useful when working with reverse-proxies (default: /)
  • LISTENER_PORT: port to listen on (default: 8080)

OIDC Environment Variables:

  • ENABLE_AUTHN: true enable OIDC authentication support (default: false)
  • OIDC_CLIENT_ID: standard OAuth client id
  • OIDC_CLIENT_SECRET_FILE: path to file containing a standard OAuth client secret
  • OIDC_REDIRECT_URL: this app's callback url; should end in /callback and will be registered in the identity provider. For example, https://myswarm.example.internal/visualizer/callback
  • OIDC_SCOPES: comma separated list of scopes. For example, openid,profile,email
  • OIDC_WELL_KNOWN_URL: Location to lookup the identity provider's public signing key, token and authorization endpoints. For example, https://auth.example.com/.well-known/openid-configuration
  • OIDC_USERNAME_CLAIM:

Other Environment Variables:

  • DOCKER_API_VERSION: adjust the Docker api version if the server needs it. (default: 1.47)

Development/Testing

Turn on Swarm Mode

If not already enabled:

docker swarm init

Spin up some services

docker service create --name nginx --replicas=3 nginx:latest
docker service create --name redis redis:latest
docker service create --name redis2 redis:latest
docker service create --name redis3 redis:latest
docker service create --name redis4 --mode global redis:latest

Build and test

docker compose -f deployment/docker-compose.yml up --build

The compose file mounts the static assets so they can be modified on the fly.

Cleaning up

Stop dummy services:

 docker service rm nginx redis redis2 redis3 redis4 redis5

Remove Swarm mode:

docker swarm leave --force

About

A modern version of the "dockersamples/docker-swarm-visualizer" app/image

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •