Browse Source
Merge pull request #147 from Samourai-Wallet/feat_dojo_config_ip
increase control over ports exposed by dojo
use-env-var-docker
kenshin samourai
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with
29 additions and
15 deletions
-
accounts/index.js
-
docker/my-dojo/.env
-
docker/my-dojo/node/keys.index.js
-
keys/index-example.js
-
lib/http-server/http-server.js
-
package-lock.json
-
package.json
-
pushtx/index-orchestrator.js
-
pushtx/index.js
-
tracker/index.js
-
tracker/tracker.js
|
|
@ -52,8 +52,9 @@ |
|
|
|
hdaHelper.activateExternalDerivation() |
|
|
|
|
|
|
|
// Initialize the http server
|
|
|
|
const host = keys.apiBind |
|
|
|
const port = keys.ports.account |
|
|
|
const httpServer = new HttpServer(port) |
|
|
|
const httpServer = new HttpServer(port, host) |
|
|
|
|
|
|
|
// Initialize the rest api endpoints
|
|
|
|
const authRestApi = new AuthRestApi(httpServer) |
|
|
|
|
|
@ -13,7 +13,7 @@ COMPOSE_CONVERT_WINDOWS_PATHS=1 |
|
|
|
DOJO_VERSION_TAG=1.6.0 |
|
|
|
DOJO_DB_VERSION_TAG=1.1.1 |
|
|
|
DOJO_BITCOIND_VERSION_TAG=1.5.0 |
|
|
|
DOJO_NODEJS_VERSION_TAG=1.5.0 |
|
|
|
DOJO_NODEJS_VERSION_TAG=1.6.0 |
|
|
|
DOJO_NGINX_VERSION_TAG=1.4.0 |
|
|
|
DOJO_TOR_VERSION_TAG=1.3.0 |
|
|
|
DOJO_EXPLORER_VERSION_TAG=1.2.0 |
|
|
|
|
|
@ -64,6 +64,10 @@ module.exports = { |
|
|
|
connectionLimitPushTxApi: 5, |
|
|
|
connectionLimitPushTxOrchestrator: 5 |
|
|
|
}, |
|
|
|
/* |
|
|
|
* IP address used to expose the API ports |
|
|
|
*/ |
|
|
|
apiBind: '0.0.0.0', |
|
|
|
/* |
|
|
|
* TCP Ports |
|
|
|
*/ |
|
|
|
|
|
@ -15,7 +15,7 @@ module.exports = { |
|
|
|
/* |
|
|
|
* Dojo version |
|
|
|
*/ |
|
|
|
dojoVersion: '1.5.0', |
|
|
|
dojoVersion: '1.6.0', |
|
|
|
/* |
|
|
|
* Bitcoind |
|
|
|
*/ |
|
|
@ -61,6 +61,10 @@ module.exports = { |
|
|
|
connectionLimitPushTxApi: 5, |
|
|
|
connectionLimitPushTxOrchestrator: 5 |
|
|
|
}, |
|
|
|
/* |
|
|
|
* IP address used to expose the API ports |
|
|
|
*/ |
|
|
|
apiBind: '127.0.0.1', |
|
|
|
/* |
|
|
|
* TCP Ports |
|
|
|
*/ |
|
|
@ -216,7 +220,7 @@ module.exports = { |
|
|
|
* Testnet parameters |
|
|
|
*/ |
|
|
|
testnet: { |
|
|
|
dojoVersion: '1.5.0', |
|
|
|
dojoVersion: '1.6.0', |
|
|
|
bitcoind: { |
|
|
|
rpc: { |
|
|
|
user: 'user', |
|
|
@ -240,6 +244,7 @@ module.exports = { |
|
|
|
connectionLimitPushTxApi: 1, |
|
|
|
connectionLimitPushTxOrchestrator: 5 |
|
|
|
}, |
|
|
|
apiBind: '127.0.0.1', |
|
|
|
ports: { |
|
|
|
account: 18080, |
|
|
|
pushtx: 18081, |
|
|
|
|
|
@ -18,9 +18,11 @@ class HttpServer { |
|
|
|
/** |
|
|
|
* Constructor |
|
|
|
* @param {int} port - port used by the http server |
|
|
|
* @param {string} host - host exposing the http server |
|
|
|
*/ |
|
|
|
constructor(port) { |
|
|
|
// Initialize server port
|
|
|
|
constructor(port, host) { |
|
|
|
// Initialize server host and port
|
|
|
|
this.host = host ? host : '127.0.0.1' |
|
|
|
this.port = port |
|
|
|
|
|
|
|
// Listening server instance
|
|
|
@ -54,8 +56,8 @@ class HttpServer { |
|
|
|
}) |
|
|
|
|
|
|
|
// Start a http server
|
|
|
|
this.server = this.app.listen(this.port, () => { |
|
|
|
Logger.info('HTTP server listening on port ' + this.port) |
|
|
|
this.server = this.app.listen(this.port, this.host, () => { |
|
|
|
Logger.info(`HTTP server listening on ${this.host}:${this.port}`) |
|
|
|
}) |
|
|
|
|
|
|
|
this.server.timeout = 600 * 1000 |
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
{ |
|
|
|
"name": "samourai-dojo", |
|
|
|
"version": "1.5.0", |
|
|
|
"version": "1.6.0", |
|
|
|
"lockfileVersion": 1, |
|
|
|
"requires": true, |
|
|
|
"dependencies": { |
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
{ |
|
|
|
"name": "samourai-dojo", |
|
|
|
"version": "1.5.0", |
|
|
|
"version": "1.6.0", |
|
|
|
"description": "Backend server for Samourai Wallet", |
|
|
|
"main": "accounts/index.js", |
|
|
|
"scripts": { |
|
|
|
|
|
@ -39,7 +39,7 @@ |
|
|
|
|
|
|
|
// Initialize notification sockets of singleton pushTxProcessor
|
|
|
|
pushTxProcessor.initNotifications({ |
|
|
|
uriSocket: `tcp://*:${keys.ports.orchestrator}` |
|
|
|
uriSocket: `tcp://127.0.0.1:${keys.ports.orchestrator}` |
|
|
|
}) |
|
|
|
|
|
|
|
// Initialize and start the orchestrator
|
|
|
|
|
|
@ -40,12 +40,13 @@ |
|
|
|
|
|
|
|
// Initialize notification sockets of singleton pushTxProcessor
|
|
|
|
pushTxProcessor.initNotifications({ |
|
|
|
uriSocket: `tcp://*:${keys.ports.notifpushtx}` |
|
|
|
uriSocket: `tcp://127.0.0.1:${keys.ports.notifpushtx}` |
|
|
|
}) |
|
|
|
|
|
|
|
// Initialize the http server
|
|
|
|
const host = keys.apiBind |
|
|
|
const port = keys.ports.pushtx |
|
|
|
const httpServer = new HttpServer(port) |
|
|
|
const httpServer = new HttpServer(port, host) |
|
|
|
|
|
|
|
// Initialize the PushTx rest api
|
|
|
|
const pushtxRestApi = new PushTxRestApi(httpServer) |
|
|
|
|
|
@ -39,8 +39,9 @@ |
|
|
|
const tracker = new Tracker() |
|
|
|
|
|
|
|
// Initialize the http server
|
|
|
|
const host = keys.apiBind |
|
|
|
const port = keys.ports.trackerApi |
|
|
|
const httpServer = new HttpServer(port) |
|
|
|
const httpServer = new HttpServer(port, host) |
|
|
|
|
|
|
|
// Initialize the rest api endpoints
|
|
|
|
const trackerRestApi = new TrackerRestApi(httpServer, tracker) |
|
|
|
|
|
@ -22,7 +22,7 @@ class Tracker { |
|
|
|
constructor() { |
|
|
|
// Notification socket for client events
|
|
|
|
this.notifSock = zmq.socket('pub') |
|
|
|
this.notifSock.bindSync(`tcp://*:${keys.ports.tracker}`) |
|
|
|
this.notifSock.bindSync(`tcp://127.0.0.1:${keys.ports.tracker}`) |
|
|
|
|
|
|
|
// Initialize the blockchain processor
|
|
|
|
// and the mempool buffer
|
|
|
|