diff --git a/README.md b/README.md new file mode 100644 index 0000000..eac3c9d --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +ServiceDock — Docker Swarm as a Service +======================================= + +Docker swarm is cool, much simpler to use than OpenShift, but unfortunately I did not find a really nice overview Web-UI to monitor the services, so I created [this one](https://mrw.sh/webservices/servicedock). + +Run +--- + +### Command-Line: + + docker run --rm -it -p 8888:4000 -v /var/run/docker.sock:/var/run/docker.sock:ro mwaeckerlin/servicedock:latest + +### YAML to Deploy in Swarm: + +```yaml +version: '3.7' +services: + + servicedock: + image: mwaeckerlin/servicedock + volumes: + - type: bind + source: /var/run/docker.sock + target: /var/run/docker.sock + read-only: true + ports: + - 8035:4000 + deploy: + placement: + constraints: [node.role == manager] + resources: + limits: + memory: 100M +``` diff --git a/bin/www b/bin/www index 8e463bd..fe5cc0a 100755 --- a/bin/www +++ b/bin/www @@ -9,7 +9,7 @@ var server = app.listen(app.get('port'), function() { debug('Express server listening on port ' + server.address().port) }) var io = require('socket.io').listen(server) -var docker = require('docker.js')(app, io) +var docker = require('docker.js')(app, io, process.env.UPDATE_INTERVAL||10000, process.env.STATS_INTERVAL||10000) io.sockets.on('connection', docker.connect) debug('Socket server listening on port ' + server.address().port); diff --git a/client/servicedock.js b/client/servicedock.js index 58e7d59..2bd3ab0 100644 --- a/client/servicedock.js +++ b/client/servicedock.js @@ -4,7 +4,7 @@ function error(msg) { // handle display errors } function init() { - socket = io.connect(); - docker = new Docker(socket, error, '#containers', '#nodes', '#stacks'); + socket = io.connect() + docker = new Docker(socket, error, '#containers', '#nodes', '#stacks') } -$(init); +$(init) diff --git a/package.json b/package.json index a0e3df8..3527de9 100644 --- a/package.json +++ b/package.json @@ -7,15 +7,18 @@ }, "dependencies": { "body-parser": "*", + "child_process": "^1.0.2", "cookie-parser": "*", "debug": "*", - "docker.js": ">=1.2.0", + "docker.js": "^1.2.2", "express": "*", + "jquery": "^3.1.1", "morgan": "*", - "pty.js": "*", + "pty.js": "^0.3.1", "pug": "*", "socket.io": "*", "static-favicon": "*", - "stylus": "*" + "stylus": "*", + "viz.js": "^1.4.1" } } diff --git a/style/style.styl b/style/style.styl index a8055cc..8e17481 100644 --- a/style/style.styl +++ b/style/style.styl @@ -4,6 +4,6 @@ body a color: #00B7FF -#main > svg +#stacks > svg width: 100% height: auto \ No newline at end of file