这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
40efe42
Default MQTT to current http:// location
dersimn Apr 27, 2018
4ae5c4c
Add Dockerfile
dersimn Apr 27, 2018
bc65b93
Remove $SYS/# subscription for now
dersimn Jul 4, 2018
bc984c9
Use nginx config from mqtt-smarthome-webui
dersimn Jul 5, 2018
cb6a79f
Readme for Docker
dersimn Jul 5, 2018
487f562
Update nginx config from mqtt-smarthome-webui
dersimn Oct 3, 2018
b887786
Update README
dersimn Oct 3, 2018
31173aa
Add build for armhf
dersimn Oct 3, 2018
fcc7e04
Update to mqttws library 1.1.0
dersimn Dec 11, 2018
4f43229
Rename main.js, remove import statements
dersimn Oct 16, 2019
d26650d
Remove Bower
dersimn Oct 16, 2019
1bf1bfe
Make index.html valid HTML5
dersimn Oct 16, 2019
34c4cbd
Use store-js global variable
dersimn Oct 16, 2019
9026022
Remove download of Paho
dersimn Oct 16, 2019
01ed019
Remove unused packages, update packages
dersimn Oct 16, 2019
52e0aed
.gitignore
dersimn Oct 16, 2019
39d944d
Gruntfile
dersimn Oct 16, 2019
2b21e9c
Website looks bad with proper doctype
dersimn Oct 16, 2019
8119b21
Directory change
dersimn Oct 16, 2019
e05e624
store.legacy.js is not compiled
dersimn Oct 16, 2019
c7283b9
README
dersimn Oct 16, 2019
4897797
Use Docker multi-stage build
dersimn Oct 16, 2019
38babac
Note on About page
dersimn Oct 16, 2019
2dc388c
README
dersimn Oct 16, 2019
e2e159f
bump version
dersimn Oct 16, 2019
6c3a1fb
README
dersimn Oct 16, 2019
fd1a8ee
Fix .selectmenu zIndex issue
nicjansma Jun 29, 2021
93f21ec
Merge pull request #1 from nicjansma/master
dersimn Jun 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
.idea
node_modules
bower_components
tmp
releases
credentials.json
npm-debug.log
dist
/node_modules
/dist
/build
/package-lock.json
44 changes: 44 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM ubuntu:18.04 as builder

RUN apt-get update && apt-get install -y \
nginx-extras \
lua5.1 \
liblua5.1-dev \
git \
diffutils \
autoconf \
libssl1.0-dev \
make \
gettext-base \
curl \
wget \
&& rm -rf /var/lib/apt/lists/*

RUN git clone https://github.com/dersimn/luacrypto /opt/luacrypto \
&& cd /opt/luacrypto \
&& autoreconf -i \
&& ./configure \
&& make

RUN curl -sSL -o /mo https://git.io/get-mo && chmod a+x /mo


FROM ubuntu:18.04

RUN apt-get update && apt-get install -y \
nginx-extras \
lua5.1 \
libssl1.0 \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /opt/luacrypto/src/.libs/crypto.so /usr/local/lib/lua/5.1/crypto.so
COPY --from=builder /mo /usr/local/bin/mo

COPY dist /www
COPY nginx.template /nginx.template
COPY run.bash /run.bash

EXPOSE 80
EXPOSE 443

CMD ["bash", "/run.bash"]
44 changes: 44 additions & 0 deletions Dockerfile.armhf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM arm32v7/ubuntu:18.04 as builder

RUN apt-get update && apt-get install -y \
nginx-extras \
lua5.1 \
liblua5.1-dev \
git \
diffutils \
autoconf \
libssl1.0-dev \
make \
gettext-base \
curl \
wget \
&& rm -rf /var/lib/apt/lists/*

RUN git clone https://github.com/dersimn/luacrypto /opt/luacrypto \
&& cd /opt/luacrypto \
&& autoreconf -i \
&& ./configure \
&& make

RUN curl -sSL -o /mo https://git.io/get-mo && chmod a+x /mo


FROM arm32v7/ubuntu:18.04

RUN apt-get update && apt-get install -y \
nginx-extras \
lua5.1 \
libssl1.0 \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /opt/luacrypto/src/.libs/crypto.so /usr/local/lib/lua/5.1/crypto.so
COPY --from=builder /mo /usr/local/bin/mo

COPY dist /www
COPY nginx.template /nginx.template
COPY run.bash /run.bash

EXPOSE 80
EXPOSE 443

CMD ["bash", "/run.bash"]
133 changes: 68 additions & 65 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,91 +1,94 @@
const pkg = require('./package.json');

module.exports = function (grunt) {
grunt.config.data.bower = require('./bower.json');
grunt.initConfig({
"steal-build": {
bundle: {
pkg: pkg,

browserify: {
pkgjs: {
src: ['./package.json'],
dest: 'build/package.js',
options: {
system: {
config: "bower.json!bower"
browserifyOptions: {
standalone: 'pkg'
}
}
},
},

less: {
dist: {
options: {
paths: ["assets/css"]
},
files: {"build/index.css": "index.less"}
}
},

concat: {
js: {
src: [
'build/package.js',
'node_modules/jquery/dist/jquery.js',
'node_modules/components-jqueryui/jquery-ui.js',
'node_modules/free-jqgrid/dist/jquery.jqgrid.src.js',
'node_modules/free-jqgrid/dist/plugins/ui.multiselect.js',
'node_modules/store-js/dist/store.legacy.min.js',
'node_modules/paho-mqtt/paho-mqtt.js'
],
dest: 'dist/bundle.js'
},
css: {
src: [
'node_modules/components-jqueryui/themes/base/jquery-ui.css',
'node_modules/components-jqueryui/themes/redmond/jquery-ui.css',
'node_modules/free-jqgrid/dist/css/ui.jqgrid.css',
'node_modules/free-jqgrid/dist/plugins/css/ui.multiselect.css',
'build/index.css'
],
dest: 'dist/bundle.css'
}
},

copy: {
release: {
dist: {
files: [
{
expand: true,
flatten: true,
src: [
'node_modules/components-jqueryui/themes/redmond/images/*'
],
dest: 'dist/images/'
},
{
src: [
'bower_components/steal/steal.production.js',
'bower_components/jquery-ui/themes/redmond/images/**',
'dist/bundles/**',
'LICENSE',
'README.md'
'index.html',
'index.js',

],
dest: 'tmp/'
dest: 'dist/'
}
]
}
},

clean: {
release: ["tmp"]
},
'string-replace': {
release: {
files: {
'tmp/': 'index.html'
},
options: {
replacements: [{
pattern: 'bower_components\/steal\/steal\.js',
replacement: 'bower_components/steal/steal.production.js'
}]
}
}
},
zip: {
'release': {
router: function (filepath) {
return filepath.replace(/^tmp/, 'mqtt-admin');
},
src: ['tmp/**'],
dest: 'releases/mqtt-admin_' + grunt.config.data.bower.version + '.zip'
}
},
bump: {
options: {
files: ['bower.json'],
updateConfigs: ['bower'],
commit: false,
commitMessage: 'Release v%VERSION%',
commitFiles: ['package.json'],
createTag: false,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: false,
pushTo: 'upstream',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
globalReplace: false,
regExp: false,
prereleaseName: 'beta'
}
build: [
'build/',
'dist/',
'node_modules/',
'package-lock.json'
]
}

});

grunt.loadNpmTasks("steal-tools");
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-string-replace');
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-zip');

grunt.registerTask("build", ["steal-build", "clean", "copy", "string-replace"]);
grunt.registerTask("release prerelease", ["bump:prerelease", "build", "zip"]);
grunt.registerTask("release patch", ["bump:patch", "build", "zip"]);
grunt.registerTask("release minor", ["bump:minor", "build", "zip"]);
grunt.registerTask("release major", ["bump:major", "build", "zip"]);
grunt.registerTask("release premajor", ["bump:premajor", "build", "zip"]);


grunt.registerTask('default', ['browserify', 'less', 'concat', 'copy']);
};
95 changes: 35 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,53 @@
# mqtt-admin
This is a fork from https://github.com/hobbyquaker/mqtt-admin used to generate Docker Images. See original documentation for reference about the script itself.

MQTT Web Frontend: Publish, Subscribe and see Topic Status in a comfortable UI.
## Supported tags

## getting started
* [`1.2.0`, `latest`](https://github.com/dersimn/mqtt-admin/tree/v1.2.0)
* [`1.1.0`](https://github.com/dersimn/mqtt-admin/tree/v1.1.0)
* [`1.0.0`, `hobbyquaker-untouched`](https://github.com/hobbyquaker/mqtt-admin/releases/tag/v1.0.0)

Download [mqtt-admin.zip](https://github.com/hobbyquaker/mqtt-admin/releases/latest), unzip, put it on a webserver and
open index.html with a modern browser. You can also give it a try by just visiting https://hobbyquaker.github.io/mqtt-admin
Images for Raspberry Pi are available with the suffix `-armhf`. E.g.: `1.0.0` -> `1.0.0-armhf`.

### Usage
## Config

mqtt-admin offers 3 tabs, Publish, Subscribe and Status, these are described in more detail below. Topic input fields offer
autocompletion, mqtt-admin subscribes # to get all availabe topics to be able to offer this. Broker settings, the UI state,
subscriptions and the publish history are persisted in your browser local storage.
This image can proxy-pass the Websocket connection from your MQTT broker, by setting the env variable `MQTT_HOST`.
You have to enable Websockets on your broker. The Docker Image [toke/mosquitto](https://hub.docker.com/r/toke/mosquitto) for e.g. has it already enabled by default on [port 9001](https://github.com/toke/docker-mosquitto/blob/8aa0a74b444fb2377fcd4a43ac85a257aef51176/config/conf.d/websockets.conf#L1), where the official Docker Image [eclipse-mosquitto](https://hub.docker.com/_/eclipse-mosquitto) need to be configured first.

#### Publish
docker run -d --restart=always \
-e "MQTT_HOST=10.1.1.50:9001" \
-p 80:80 \
dersimn/mqtt-admin

Just enter a topic and a payload and click the publish button. The payload input field can be resized vertically and has
a built in JSON linter - a checkmark below the input field will indicate valid JSON.
If you provide an SSL key/cert pair in `/ssl`, the Docker Image will also enable HTTPS:

Every publish is saved in the history table, you can refill the input fields by clicking in history, a double click
immediatly publishes again (not retained).
* `/ssl/nginx.key`
* `/ssl/nginx.crt`

#### Subscribe
Additionally you can enable client-authentification via SSL certificates, by providing:

It's possible to open a unlimited number of subscriptions tabs that can contain a unlimited number of single subscriptions.
You can color your subscriptions, but you have to select a color before you enter a topic and press enter.
Subscription tabs can be renamed by double-clicking on the name.
Every subscription tab has Play/Pause/Stop buttons, pause will cache incoming messages and delay insertion into the DOM
until you activate play again. The trash button just clears the table.
* `/ssl/client.crt`

#### Status
In case you have revoked clients, also prodive a `/ssl/client.crl` file.

The status table shows the last-received payload of the listed topics, it's meant to keep an eye on e.g. _current_ sensor
data without being interested in previous data.
A nice tutorial on how to generate your own certificates, is located [here](https://jamielinux.com/docs/openssl-certificate-authority/introduction.html).

#### Warnings
docker run -d --restart=always \
-v $(pwd)/ssl:/ssl:ro \
-e "MQTT_HOST=10.1.1.50:9001" \
-p 80:80 \
-p 443:443 \
dersimn/mqtt-admin

* This tool is meant to be used with keyboard and mouse, I do not plan any efforts on optimizing it for touch devices.
* Connecting to test.mosquitto.org will stress your browser (Many retained topics, big payloads, ...).
If you want to change the default ports, specify it like this: `-p 8001:80 -p 8443:443 -e "HTTPS_REDIRECT_PORT=8443"`.

#### mqtt-smarthome
HTTPS and client-auth are optional for clients connecting via a local IP, according to [these](https://github.com/dersimn/mqtt-smarthome-webui/blob/6e419811d3bd433e5fc594e1beccaa0499fe08cf/nginx.template#L69) IP ranges. If you make port 80/443 public to the Internet you should definitely enable client-auth.

mqtt-admin contains some syntactic sugar for [mqtt-smarthome](https://github.com/mqtt-smarthome/) users (special columns
in status tab, auto-completion of // to /status/ and /set/)
## Development

Basic build:

## contributing

Pull Requests welcome!

Dependencies are managed with [Bower](http://bower.io/), [StealJS](http://stealjs.com/) takes care of module loading,
the [Grunt](http://gruntjs.com/) task named "build" creates a production build in tmp dir.


## license

The MIT License (MIT)

Copyright (c) Sebastian Raff <hq@ccu.io> (https://github.com/hobbyquaker)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
npm install
grunt
docker build -t dersimn/mqtt-admin .
docker build -t dersimn/mqtt-admin:armhf -f Dockerfile.armhf .
grunt clean
18 changes: 0 additions & 18 deletions bower.json

This file was deleted.

Loading