From 4bab9c34291f8bf9b0d344ec46b0b2dc1a19eb89 Mon Sep 17 00:00:00 2001 From: Guilherme Lawless Date: Fri, 23 Aug 2019 23:45:28 +0100 Subject: [PATCH] Docker changes for new TOML config (#2241) * Docker changes for new toml config * Fix docker entry --- docker/node/config/beta.json | 117 --------------------------- docker/node/config/beta_rpc.json | 13 --- docker/node/config/config-node.toml | 12 +++ docker/node/config/config-rpc.toml | 8 ++ docker/node/config/live.json | 120 ---------------------------- docker/node/config/live_rpc.json | 13 --- docker/node/config/test.json | 67 ---------------- docker/node/entry.sh | 20 ++--- 8 files changed, 27 insertions(+), 343 deletions(-) delete mode 100644 docker/node/config/beta.json delete mode 100644 docker/node/config/beta_rpc.json create mode 100644 docker/node/config/config-node.toml create mode 100644 docker/node/config/config-rpc.toml delete mode 100644 docker/node/config/live.json delete mode 100644 docker/node/config/live_rpc.json delete mode 100644 docker/node/config/test.json diff --git a/docker/node/config/beta.json b/docker/node/config/beta.json deleted file mode 100644 index 96de63cc5..000000000 --- a/docker/node/config/beta.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "version": "2", - "rpc_enable": "true", - "rpc": { - "version": "1", - "enable_sign_hash": "false", - "max_work_generate_difficulty": "ffffffffc0000000", - "child_process": { - "enable": "false", - "rpc_path": "\/usr\/bin\/nano_rpc" - } - }, - "node": { - "version": "17", - "peering_port": "54000", - "bootstrap_fraction_numerator": "1", - "receive_minimum": "1000000000000000000000000", - "logging": { - "version": "7", - "ledger": "false", - "ledger_duplicate": "false", - "vote": "false", - "network": "true", - "network_timeout": "false", - "network_message": "false", - "network_publish": "false", - "network_packet": "false", - "network_keepalive": "false", - "network_node_id_handshake": "false", - "node_lifetime_tracing": "false", - "insufficient_work": "true", - "log_ipc": "true", - "bulk_pull": "false", - "work_generation_time": "true", - "upnp_details": "false", - "timing": "false", - "log_to_cerr": "false", - "max_size": "134217728", - "rotation_size": "4194304", - "flush": "true", - "min_time_between_output": "5" - }, - "work_peers": "", - "preconfigured_peers": [ - "peering-beta.nano.org" - ], - "preconfigured_representatives": [ - "nano_3betaz86ypbygpqbookmzpnmd5jhh4efmd8arr9a3n4bdmj1zgnzad7xpmfp", - "nano_1beta1ayfkpj1tfbhi3e9ihkocjkqi6ms5e4xrbmbybqnkza1e5jrake8wai", - "nano_1beta3kp4j9tn7pko3apyyzbrx789jpc98ep3ufqazanbcxiyyoxmxhjtbfn", - "nano_1beta4nkzb3g6b1a1qhae89earmz3gk3kfrp3f8hyztm8qyjkeyz9kajfutq", - "nano_1beta5zm6rq4ghp6c9n99j8fz3am8e44dewae5ea7addsjtfo8umsafmr1r7" - ], - "online_weight_minimum": "60000000000000000000000000000000000000", - "online_weight_quorum": "50", - "password_fanout": "1024", - "io_threads": "4", - "network_threads": "4", - "work_threads": "4", - "signature_checker_threads": "3", - "enable_voting": "false", - "bootstrap_connections": "4", - "bootstrap_connections_max": "64", - "callback_address": "", - "callback_port": "0", - "callback_target": "", - "lmdb_max_dbs": "128", - "block_processor_batch_max_time": "5000", - "allow_local_peers": "true", - "vote_minimum": "1000000000000000000000000000000000", - "vote_generator_delay": "50", - "vote_generator_threshold": "3", - "unchecked_cutoff_time": "14400", - "tcp_io_timeout": "15", - "pow_sleep_interval": "0", - "external_address": "::", - "external_port": "0", - "tcp_incoming_connections_max": "1024", - "use_memory_pools": "true", - "websocket": { - "enable": "false", - "address": "::ffff:0.0.0.0", - "port": "57000" - }, - "ipc": { - "tcp": { - "enable": "true", - "port": "56000", - "io_timeout": "15" - }, - "local": { - "version": "1", - "enable": "false", - "allow_unsafe": "false", - "path": "\/tmp\/nano", - "io_timeout": "15" - } - }, - "diagnostics": { - "txn_tracking": { - "enable": "false", - "min_read_txn_time": "5000", - "min_write_txn_time": "500", - "ignore_writes_below_block_processor_max_time": "true" - } - }, - "confirmation_history_size": "2048", - "active_elections_size": "50000", - "bandwidth_limit": "5242880" - }, - "opencl_enable": "false", - "opencl": { - "platform": "0", - "device": "0", - "threads": "1048576" - } -} diff --git a/docker/node/config/beta_rpc.json b/docker/node/config/beta_rpc.json deleted file mode 100644 index 0791575e0..000000000 --- a/docker/node/config/beta_rpc.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "1", - "address": "::ffff:0.0.0.0", - "port": "55000", - "enable_control": "true", - "max_json_depth": "20", - "max_request_size": "33554432", - "process": { - "io_threads": "4", - "ipc_port": "56000", - "num_ipc_connections": "4" - } -} diff --git a/docker/node/config/config-node.toml b/docker/node/config/config-node.toml new file mode 100644 index 000000000..09ea6f090 --- /dev/null +++ b/docker/node/config/config-node.toml @@ -0,0 +1,12 @@ + +[node.websocket] + +# WebSocket server bind address +# type:string,ip +address = "::ffff:0.0.0.0" + +[rpc] + +# Enable or disable RPC +# type:bool +enable = true diff --git a/docker/node/config/config-rpc.toml b/docker/node/config/config-rpc.toml new file mode 100644 index 000000000..9b705fdc8 --- /dev/null +++ b/docker/node/config/config-rpc.toml @@ -0,0 +1,8 @@ + +# Bind address for the RPC server +# type:string,ip +address = "::ffff:0.0.0.0" + +# Enable or disable control-level requests +# type:bool +enable_control = false diff --git a/docker/node/config/live.json b/docker/node/config/live.json deleted file mode 100644 index 08b9285de..000000000 --- a/docker/node/config/live.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "version": "2", - "rpc_enable": "true", - "rpc": { - "version": "1", - "enable_sign_hash": "false", - "max_work_generate_difficulty": "ffffffffc0000000", - "child_process": { - "enable": "false", - "rpc_path": "\/usr\/bin\/nano_rpc" - } - }, - "node": { - "version": "17", - "peering_port": "7075", - "bootstrap_fraction_numerator": "1", - "receive_minimum": "1000000000000000000000000", - "logging": { - "version": "7", - "ledger": "false", - "ledger_duplicate": "false", - "vote": "false", - "network": "true", - "network_timeout": "false", - "network_message": "false", - "network_publish": "false", - "network_packet": "false", - "network_keepalive": "false", - "network_node_id_handshake": "false", - "node_lifetime_tracing": "false", - "insufficient_work": "true", - "log_ipc": "true", - "bulk_pull": "false", - "work_generation_time": "true", - "upnp_details": "false", - "timing": "false", - "log_to_cerr": "false", - "max_size": "134217728", - "rotation_size": "4194304", - "flush": "true", - "min_time_between_output": "5" - }, - "work_peers": "", - "preconfigured_peers": [ - "peering.nano.org" - ], - "preconfigured_representatives": [ - "nano_3arg3asgtigae3xckabaaewkx3bzsh7nwz7jkmjos79ihyaxwphhm6qgjps4", - "nano_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou", - "nano_1q3hqecaw15cjt7thbtxu3pbzr1eihtzzpzxguoc37bj1wc5ffoh7w74gi6p", - "nano_3dmtrrws3pocycmbqwawk6xs7446qxa36fcncush4s1pejk16ksbmakis78m", - "nano_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k", - "nano_1awsn43we17c1oshdru4azeqjz9wii41dy8npubm4rg11so7dx3jtqgoeahy", - "nano_1anrzcuwe64rwxzcco8dkhpyxpi8kd7zsjc1oeimpc3ppca4mrjtwnqposrs", - "nano_1hza3f7wiiqa7ig3jczyxj5yo86yegcmqk3criaz838j91sxcckpfhbhhra1" - ], - "online_weight_minimum": "60000000000000000000000000000000000000", - "online_weight_quorum": "50", - "password_fanout": "1024", - "io_threads": "4", - "network_threads": "4", - "work_threads": "4", - "signature_checker_threads": "3", - "enable_voting": "false", - "bootstrap_connections": "4", - "bootstrap_connections_max": "64", - "callback_address": "", - "callback_port": "0", - "callback_target": "", - "lmdb_max_dbs": "128", - "block_processor_batch_max_time": "5000", - "allow_local_peers": "false", - "vote_minimum": "1000000000000000000000000000000000", - "vote_generator_delay": "50", - "vote_generator_threshold": "3", - "unchecked_cutoff_time": "14400", - "tcp_io_timeout": "15", - "pow_sleep_interval": "0", - "external_address": "::", - "external_port": "0", - "tcp_incoming_connections_max": "1024", - "use_memory_pools": "true", - "websocket": { - "enable": "false", - "address": "::ffff:0.0.0.0", - "port": "7078" - }, - "ipc": { - "tcp": { - "enable": "false", - "port": "7077", - "io_timeout": "15" - }, - "local": { - "version": "1", - "enable": "false", - "allow_unsafe": "false", - "path": "\/tmp\/nano", - "io_timeout": "15" - } - }, - "diagnostics": { - "txn_tracking": { - "enable": "false", - "min_read_txn_time": "5000", - "min_write_txn_time": "500", - "ignore_writes_below_block_processor_max_time": "true" - } - }, - "confirmation_history_size": "2048", - "active_elections_size": "50000", - "bandwidth_limit": "5242880" - }, - "opencl_enable": "false", - "opencl": { - "platform": "0", - "device": "0", - "threads": "1048576" - } -} diff --git a/docker/node/config/live_rpc.json b/docker/node/config/live_rpc.json deleted file mode 100644 index f496c1e34..000000000 --- a/docker/node/config/live_rpc.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "1", - "address": "::ffff:0.0.0.0", - "port": "7076", - "enable_control": "true", - "max_json_depth": "20", - "max_request_size": "33554432", - "process": { - "io_threads": "4", - "ipc_port": "56000", - "num_ipc_connections": "4" - } -} diff --git a/docker/node/config/test.json b/docker/node/config/test.json deleted file mode 100644 index bdd6c1912..000000000 --- a/docker/node/config/test.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "version": "2", - "rpc_enable": "true", - "rpc": { - "address": "::ffff:0.0.0.0", - "port": "7076", - "enable_control": "true", - "frontier_request_limit": "16384", - "chain_request_limit": "16384" - }, - "node": { - "version": "8", - "peering_port": "7075", - "bootstrap_fraction_numerator": "1", - "receive_minimum": "1000000000000000000000000", - "logging": { - "version": "2", - "ledger": "false", - "ledger_duplicate": "false", - "vote": "false", - "network": "true", - "network_message": "false", - "network_publish": "false", - "network_packet": "false", - "network_keepalive": "false", - "node_lifetime_tracing": "false", - "insufficient_work": "true", - "log_rpc": "true", - "bulk_pull": "false", - "work_generation_time": "true", - "log_to_cerr": "false", - "max_size": "16777216", - "rotation_size": "4194304", - "flush": "false" - }, - "work_peers": "", - "preconfigured_peers": [ - "rai-test.raiblocks.net" - ], - "preconfigured_representatives": [ - "xrb_3arg3asgtigae3xckabaaewkx3bzsh7nwz7jkmjos79ihyaxwphhm6qgjps4", - "xrb_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou", - "xrb_1q3hqecaw15cjt7thbtxu3pbzr1eihtzzpzxguoc37bj1wc5ffoh7w74gi6p", - "xrb_3dmtrrws3pocycmbqwawk6xs7446qxa36fcncush4s1pejk16ksbmakis78m", - "xrb_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k", - "xrb_1awsn43we17c1oshdru4azeqjz9wii41dy8npubm4rg11so7dx3jtqgoeahy", - "xrb_1anrzcuwe64rwxzcco8dkhpyxpi8kd7zsjc1oeimpc3ppca4mrjtwnqposrs", - "xrb_1hza3f7wiiqa7ig3jczyxj5yo86yegcmqk3criaz838j91sxcckpfhbhhra1" - ], - "inactive_supply": "0", - "password_fanout": "1024", - "io_threads": "4", - "work_threads": "4", - "enable_voting": "true", - "bootstrap_connections": "16", - "callback_address": "", - "callback_port": "0", - "callback_target": "", - "lmdb_max_dbs": "128" - }, - "opencl_enable": "false", - "opencl": { - "platform": "0", - "device": "0", - "threads": "1048576" - } -} diff --git a/docker/node/entry.sh b/docker/node/entry.sh index 653a9fb4d..74a684af5 100644 --- a/docker/node/entry.sh +++ b/docker/node/entry.sh @@ -1,6 +1,5 @@ #!/bin/bash - set -Eeuo pipefail usage() { @@ -56,8 +55,9 @@ if [[ "${TEMP_OPTS[0]}" = 'nano_node' ]]; then db_size=${i//-v/} echo "Vacuum DB if over $db_size GB on startup" elif [[ "$i" = '-l' ]]; then - echo "\"log_to_cerr\":\"true\"" - log_to_cerr=1 + echo "log_to_cerr = true" + command+=("--config") + command+=("node.logging.log_to_cerr=true") else command+=("$i") fi @@ -97,16 +97,10 @@ else mkdir -p "${nanodir}" fi -if [ ! -f "${nanodir}/config.json" ]; then - echo "Config File not found, adding default." - cp "/usr/share/nano/config/${network}.json" "${nanodir}/config.json" - cp "/usr/share/nano/config/${network}_rpc.json" "${nanodir}/rpc_config.json" -fi - -if [[ $log_to_cerr -eq 1 ]]; then - sed -i 's/"log_to_cerr": "false",/"log_to_cerr": "true",/g' "${nanodir}/config.json" -else - sed -i 's/"log_to_cerr": "true",/"log_to_cerr": "false",/g' "${nanodir}/config.json" +if [ ! -f "${nanodir}/config-node.toml" ] && [ ! -f "${nanodir}/config.json" ]; then + echo "Config file not found, adding default." + cp "/usr/share/nano/config/config-node.toml" "${nanodir}/config-node.toml" + cp "/usr/share/nano/config/config-rpc.toml" "${nanodir}/config-rpc.toml" fi if [[ "${command[1]}" = "--daemon" ]]; then