TOR first, fixed when OFF, small tweaks

This commit is contained in:
kexkey
2019-11-08 16:50:54 -05:00
committed by kexkey
parent 58b80e1d3b
commit 96f6301282
8 changed files with 43 additions and 36 deletions

View File

@@ -1,4 +1,8 @@
[ [
{
"name": "TOR Hidden Service/Gateway",
"value": "tor"
},
{ {
"name": "Lightning node", "name": "Lightning node",
"value": "lightning" "value": "lightning"
@@ -6,9 +10,5 @@
{ {
"name": "Opentimestamps client", "name": "Opentimestamps client",
"value": "otsclient" "value": "otsclient"
},
{
"name": "Tor Hidden Service/Gateway",
"value": "tor"
} }
] ]

View File

@@ -474,9 +474,11 @@ module.exports = class App {
} }
}, },
otsclient: { otsclient: {
networks: ['cyphernodenet'],
docker: "cyphernode/otsclient:" + this.config.docker_versions['cyphernode/otsclient'] docker: "cyphernode/otsclient:" + this.config.docker_versions['cyphernode/otsclient']
}, },
lightning: { lightning: {
networks: ['cyphernodenet'],
docker: "cyphernode/clightning:"+this.config.docker_versions['cyphernode/clightning'], docker: "cyphernode/clightning:"+this.config.docker_versions['cyphernode/clightning'],
extra: { extra: {
nodename: this.config.data.lightning_nodename, nodename: this.config.data.lightning_nodename,
@@ -494,7 +496,7 @@ module.exports = class App {
name: feature.name, name: feature.name,
label: feature.value, label: feature.value,
host: feature.value, host: feature.value,
networks: ['cyphernodenet'], networks: optional_features_data[feature.value].networks,
docker: optional_features_data[feature.value].docker docker: optional_features_data[feature.value].docker
}; };

View File

@@ -98,13 +98,13 @@ module.exports = {
message: prefix()+'Where do you want to store your tor data?'+utils.getHelp('tor_datapath'), message: prefix()+'Where do you want to store your tor data?'+utils.getHelp('tor_datapath'),
}, },
{ {
when: (props)=>{ return installerDocker(props) && props.features.indexOf('tor') !== -1 && props.otsclient_datapath === '_custom' }, when: (props)=>{ return installerDocker(props) && props.features.indexOf('tor') !== -1 && props.tor_datapath === '_custom' },
type: 'input', type: 'input',
name: 'tor_datapath_custom', name: 'tor_datapath_custom',
default: utils.getDefault( 'tor_datapath_custom' ), default: utils.getDefault( 'tor_datapath_custom' ),
filter: utils.trimFilter, filter: utils.trimFilter,
validate: utils.pathValidator, validate: utils.pathValidator,
message: prefix()+'Custom path for tor data?'+utils.getHelp('tor_datapath_custom'), message: prefix()+'Custom path for TOR data?'+utils.getHelp('tor_datapath_custom'),
}, },
{ {
when: installerDocker, when: installerDocker,

View File

@@ -85,6 +85,24 @@
] ]
} }
}, },
{
"if": {
"properties": {
"features": {
"contains": {
"enum": [
"tor"
]
}
}
}
},
"then": {
"required": [
"tor_datapath"
]
}
},
{ {
"if": { "if": {
"properties": { "properties": {
@@ -125,24 +143,6 @@
"otsclient_datapath" "otsclient_datapath"
] ]
} }
},
{
"if": {
"properties": {
"features": {
"contains": {
"enum": [
"tor"
]
}
}
}
},
"then": {
"required": [
"tor_datapath"
]
}
} }
], ],
"properties": { "properties": {
@@ -180,16 +180,16 @@
"$id": "#/properties/features/items", "$id": "#/properties/features/items",
"type": "string", "type": "string",
"enum": [ "enum": [
"tor",
"lightning", "lightning",
"otsclient", "otsclient"
"tor"
], ],
"title": "The feature", "title": "The feature",
"default": "", "default": "",
"examples": [ "examples": [
"tor",
"lightning", "lightning",
"otsclient", "otsclient"
"tor"
] ]
} }
}, },

View File

@@ -122,8 +122,10 @@ services:
notifier: notifier:
image: cyphernode/notifier:<%= notifier_version %> image: cyphernode/notifier:<%= notifier_version %>
command: $USER ./startnotifier.sh command: $USER ./startnotifier.sh
<% if ( features.indexOf('tor') !== -1 ) { %>
volumes: volumes:
- "<%= tor_datapath %>/curlcfg:/notifier/curlcfg" - "<%= tor_datapath %>/curlcfg:/notifier/curlcfg"
<% } %>
networks: networks:
- cyphernodenet - cyphernodenet
- cyphernodeappsnet - cyphernodeappsnet
@@ -246,8 +248,6 @@ services:
tor: tor:
image: cyphernode/tor:<%= tor_version %> image: cyphernode/tor:<%= tor_version %>
command: $USER sh -c 'export HOME=/tor && tor -f /tor/torrc' command: $USER sh -c 'export HOME=/tor && tor -f /tor/torrc'
depends_on:
- traefik
volumes: volumes:
- "<%= tor_datapath %>:/tor" - "<%= tor_datapath %>:/tor"
restart: always restart: always

View File

@@ -3,9 +3,9 @@
"setup_version": "setup_version", "setup_version": "setup_version",
"docker_versions": {}, "docker_versions": {},
"features": [ "features": [
"tor",
"lightning", "lightning",
"otsclient", "otsclient"
"tor"
], ],
"net": "testnet", "net": "testnet",
"use_xpub": true, "use_xpub": true,

View File

@@ -56,7 +56,8 @@ curl_it() {
local response local response
local rnd=$(dd if=/dev/urandom bs=5 count=1 | xxd -pc 5) local rnd=$(dd if=/dev/urandom bs=5 count=1 | xxd -pc 5)
if [ "${torbypass}" = "true" ]; then if [ "${torbypass}" = "true" ] || [ ! -f "curlcfg" ]; then
# If we want to bypass tor or the config file doesn't exist
torbypass="" torbypass=""
else else
torbypass="-K curlcfg" torbypass="-K curlcfg"

View File

@@ -79,8 +79,12 @@ main() {
installation_info) installation_info)
# GET http://192.168.111.152:8080/info # GET http://192.168.111.152:8080/info
if [ -f "$DB_PATH/info.json" ]; then if [ -f "$DB_PATH/info.json" ]; then
# Replace tor_hostname_placeholder with actual tor hostname from tor file if [ -f "tor/hidden_service/hostname" ]; then
response=$(sed "s/tor_hostname_placeholder/`tr -d '\n\r' < tor/hidden_service/hostname`/g" "$DB_PATH/info.json") # Replace tor_hostname_placeholder with actual tor hostname from tor file
response=$(sed "s/tor_hostname_placeholder/`tr -d '\n\r' < tor/hidden_service/hostname`/g" "$DB_PATH/info.json")
else
response=$(cat "$DB_PATH/info.json")
fi
else else
response='{ "error": "missing installation data" }' response='{ "error": "missing installation data" }'
fi fi