shows docker swarm stack

master
Marc Wäckerlin 6 years ago
parent 7096587f3a
commit 4d4f2e9a92
  1. 19
      Dockerfile
  2. 14
      app.js
  3. 20
      bin/www
  4. 2
      client/servicedock.js
  5. 24
      package.json
  6. 3
      start.sh
  7. 4
      style/style.styl
  8. 2
      views/index.pug
  9. 3
      views/layout.pug

@ -0,0 +1,19 @@
FROM mwaeckerlin/base
MAINTAINER mwaeckerlin
ENV PORT 4000
ENV CONTAINERNAME "servicedock"
RUN adduser -D npm
ADD --chown=npm . /app
WORKDIR /app
RUN apk add npm python docker make g++ \
&& npm install npm@latest -g \
&& rm -rf node_modules \
&& npm install \
&& npm audit fix --force \
&& apk del python make g++
#USER npm
EXPOSE $PORT
VOLUME /var/run/docker.sock

@ -4,19 +4,9 @@ var favicon = require('static-favicon')
var logger = require('morgan')
var cookieParser = require('cookie-parser')
var bodyParser = require('body-parser')
var io = require('socket.io').listen(app)
var docker = require('docker.js')(app, io)
io.sockets.on('connection', docker.connect(socket))
var routes = require('./routes/index')
var users = require('./routes/users')
var app = express()
var io = require('socket.io').listen(app)
var docker = require('docker.js')(app, io)
io.sockets.on('connection', docker.connect(socket))
// view engine setup
app.set('views', path.join(__dirname, 'views'))
app.set('view engine', 'pug')
@ -26,11 +16,12 @@ app.use(logger('dev'))
app.use(bodyParser.json())
app.use(bodyParser.urlencoded())
app.use(cookieParser())
app.use(require('stylus').middleware(path.join(__dirname, 'public')))
app.use(require('stylus').middleware(path.join(__dirname, 'style')))
app.use(express.static(path.join(__dirname, 'style')))
app.use(express.static(path.join(__dirname, 'client')))
app.use(express.static(path.join(__dirname, 'node_modules', 'jquery', 'dist')))
app.use(express.static(path.join(__dirname, 'node_modules', 'viz.js')))
app.use(express.static(path.join(__dirname, 'node_modules', 'socket.io-client', 'dist')))
app.use(express.static(path.join(__dirname, 'node_modules', 'docker.js')))
app.use('/', routes)
@ -66,5 +57,4 @@ app.use(function(err, req, res, next) {
})
})
module.exports = app

@ -1,9 +1,17 @@
#!/usr/bin/nodejs
var debug = require('debug')('ServiceDock');
var app = require('../app');
#!/usr/bin/node
app.set('port', process.env.PORT || 4000);
var debug = require('debug')('ServiceDock')
var app = require('../app')
app.set('port', process.env.PORT || 4000)
var server = app.listen(app.get('port'), function() {
debug('Express server listening on port ' + server.address().port);
});
debug('Express server listening on port ' + server.address().port)
})
var io = require('socket.io').listen(server)
var docker = require('docker.js')(app, io)
io.sockets.on('connection', docker.connect)
debug('Socket server listening on port ' + server.address().port);

@ -5,6 +5,6 @@ function error(msg) {
}
function init() {
socket = io.connect();
docker = new Docker(socket, '#main', error);
docker = new Docker(socket, error, '#containers', '#nodes', '#stacks');
}
$(init);

@ -1,19 +1,21 @@
{
"name": "ServiceDock",
"version": "2.0.0",
"version": "2.1.0",
"private": true,
"scripts": {
"start": "nodejs ./bin/www"
"start": "./bin/www"
},
"dependencies": {
"body-parser": "~1.0.0",
"cookie-parser": "~1.0.1",
"debug": "~0.7.4",
"docker.js": "^1.0.1",
"express": "~4.0.0",
"morgan": "~1.0.0",
"pug": "^2.0.3",
"static-favicon": "~1.0.0",
"stylus": "0.42.3"
"body-parser": "*",
"cookie-parser": "*",
"debug": "*",
"docker.js": ">=1.2.0",
"express": "*",
"morgan": "*",
"pty.js": "*",
"pug": "*",
"socket.io": "*",
"static-favicon": "*",
"stylus": "*"
}
}

@ -0,0 +1,3 @@
#!/bin/sh
npm start

@ -3,3 +3,7 @@ body
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif
a
color: #00B7FF
#main > svg
width: 100%
height: auto

@ -2,4 +2,4 @@ extends layout
block content
h1 ServiceDock
div#main
div#stacks

@ -2,10 +2,11 @@ doctype html
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
link(rel='stylesheet', href='/style.css')
script(type="text/javascript", src="/jquery.min.js")
script(type="text/javascript", src="/viz.js")
script(type="text/javascript", src="/docker.js")
script(type="text/javascript", src="/socket.io.js")
script(type="text/javascript", src="/servicedock.js")
body
block content
Loading…
Cancel
Save