- install from https://github.com/mozilla-iot/gateway
- install debian dependencies
- build
- copy
static
andbuild
to/opt/mozilla-iot
- run
npm install --production
and then movenode_modules
to/opt/mozilla-iot
- make
/opt/mozilla-iot/config/default.js
- make
/etc/systemd/system/mozilla-iot.service
(run as a dynamic user and keep state in /var/lib/mozilla-iot)
Last active
August 18, 2019 15:19
-
-
Save gdamjan/ea4afa94afc71cdeb9d8b2c683f3177f to your computer and use it in GitHub Desktop.
Mozilla WebThings iot gateway - run as service on debian 10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config/default.js | |
'use strict'; | |
const proc = require('process'); | |
const os = require('os'); | |
const path = require('path'); | |
module.exports = { | |
// Expose CLI | |
cli: false, | |
profileDir: proc.env.STATE_DIRECTORY.split(':')[0], | |
ports: { | |
http: 8080, | |
}, | |
// Whether the gateway is behind port forwarding and should use simplified | |
// port-free urls | |
behindForwarding: true, | |
database: { | |
removeBeforeOpen: false, | |
}, | |
ipc: { | |
protocol: 'ipc', | |
}, | |
settings: { | |
defaults: { | |
domain: { | |
localAccess: true, | |
mozillaTunnelService: false, | |
localControl: { | |
mdnsServiceType: 'http', | |
mdnsServiceName: 'Mozilla WebThings Gateway', | |
mdnsServiceDomain: os.hostname().split('.')[0], | |
mdnsTxt: { | |
desc: 'Web of Things Gateway', | |
protocol: 'http, https, Web Sockets', | |
power: '6 watts', | |
}, | |
}, | |
}, | |
}, | |
}, | |
authentication: { | |
defaultUser: null, | |
}, | |
ssltunnel: { | |
enabled: false | |
}, | |
bcryptRounds: 2, | |
addonManager: { | |
api: 2, | |
listUrls: [ | |
'https://api.mozilla-iot.org:8443/addons', | |
], | |
testAddons: false, | |
}, | |
updateUrl: 'https://api.mozilla-iot.org:8443/releases', | |
wifi: { | |
ap: { | |
ipaddr: '192.168.2.1', | |
ssid_base: 'WebThings Gateway', | |
}, | |
}, | |
oauthPostToken: false, | |
oauthTestClients: false, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Mozilla WebThings iot gateway | |
After=network.target | |
[Service] | |
DynamicUser=true | |
Type=simple | |
StateDirectory=mozilla-iot | |
Environment=HOME=/var/lib/mozilla-iot | |
WorkingDirectory=/opt/mozilla-iot | |
ExecStart=/usr/bin/node build/gateway.js | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment