From b059c088b0f73ddf635c60aa918ab03f07e0965e Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Mon, 16 Sep 2019 17:18:31 +0200 Subject: [PATCH 1/4] Resolve #173 - add logging.ini to docker --- docker/bitsharesentry.sh | 1 + docker/default_logging.ini | 47 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 docker/default_logging.ini diff --git a/docker/bitsharesentry.sh b/docker/bitsharesentry.sh index f4ce734db3..9a1cccac82 100644 --- a/docker/bitsharesentry.sh +++ b/docker/bitsharesentry.sh @@ -82,6 +82,7 @@ fi ## Link the bitshares config file into home ## This link has been created in Dockerfile, already ln -f -s /etc/bitshares/config.ini /var/lib/bitshares +ln -f -s /etc/bitshares/logging.ini /var/lib/bitshares # Plugins need to be provided in a space-separated list, which # makes it necessary to write it like this diff --git a/docker/default_logging.ini b/docker/default_logging.ini new file mode 100644 index 0000000000..ba16d72409 --- /dev/null +++ b/docker/default_logging.ini @@ -0,0 +1,47 @@ +# declare an appender named "stderr" that writes messages to the console +[log.console_appender.stderr] +stream=std_error + +# declare an appender named "default" that writes messages to default.log +[log.file_appender.default] +# filename can be absolute or relative to this config file +filename=logs/default/default.log +# Rotate log every ? minutes, if leave out default to 60 +rotation_interval=60 +# how long will logs be kept (in days), if leave out default to 1 +rotation_limit=7 + +# declare an appender named "p2p" that writes messages to p2p.log +[log.file_appender.p2p] +# filename can be absolute or relative to this config file +filename=logs/p2p/p2p.log +# Rotate log every ? minutes, if leave out default to 60 +rotation_interval=60 +# how long will logs be kept (in days), if leave out default to 1 +rotation_limit=7 + +# declare an appender named "rpc" that writes messages to rpc.log +[log.file_appender.rpc] +# filename can be absolute or relative to this config file +filename=logs/rpc/rpc.log +# Rotate log every ? minutes, if leave out default to 60 +rotation_interval=60 +# how long will logs be kept (in days), if leave out default to 1 +rotation_limit=7 + +# route any messages logged to the default logger to the "stderr" appender and +# "default" appender we declared above, if they are info level or higher +[logger.default] +level=info +appenders=stderr,default + +# route messages sent to the "p2p" logger to the "p2p" appender declared above +[logger.p2p] +level=warn +appenders=p2p + +# route messages sent to the "rpc" logger to the "rpc" appender declared above +[logger.rpc] +level=error +appenders=rpc + From 6e29db566a360d22e17332c36cedd8a2be82c3d8 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Mon, 16 Sep 2019 17:18:52 +0200 Subject: [PATCH 2/4] Update default config.ini --- docker/default_config.ini | 252 +++++++++++++++++++++++++++++++++++++- 1 file changed, 247 insertions(+), 5 deletions(-) diff --git a/docker/default_config.ini b/docker/default_config.ini index 4d79d099c0..6d6c947b59 100644 --- a/docker/default_config.ini +++ b/docker/default_config.ini @@ -31,10 +31,108 @@ rpc-endpoint = 0.0.0.0:8090 # JSON file specifying API permissions # api-access = +# Number of IO threads, default to 0 for auto-configuration +# io-threads = + +# Whether allow API clients to subscribe to universal object creation and removal events +# enable-subscribe-to-all = + +# Whether to enable tracking of votes of standby witnesses and committee members. Set it to true to provide accurate data to API clients, set to false for slightly better performance. +# enable-standby-votes-tracking = + +# For history_api::get_account_history_operations to set max limit value +# api-limit-get-account-history-operations = 100 + +# For history_api::get_account_history to set max limit value +# api-limit-get-account-history = 100 + +# For orders_api::get_grouped_limit_orders to set max limit value +# api-limit-get-grouped-limit-orders = 101 + +# For history_api::get_relative_account_history to set max limit value +# api-limit-get-relative-account-history = 100 + +# For history_api::get_account_history_by_operations to set max limit value +# api-limit-get-account-history-by-operations = 100 + +# For asset_api::get_asset_holders to set max limit value +# api-limit-get-asset-holders = 100 + +# For database_api_impl::get_key_references to set max limit value +# api-limit-get-key-references = 100 + +# For database_api_impl::get_htlc_by_from and get_htlc_by_to to set max limit value +# api-limit-get-htlc-by = 100 + +# For database_api_impl::get_full_accounts to set max limit value +# api-limit-get-full-accounts = 10 + +# For database_api_impl::get_full_accounts to set max limit value +# api-limit-get-full-accounts-lists = 100 + +# For database_api_impl::get_call_orders and get_call_orders_by_account to set max limit value +# api-limit-get-call-orders = 300 + +# For database_api_impl::get_settle_orders and get_settle_orders_by_account to set max limit value +# api-limit-get-settle-orders = 300 + +# For database_api_impl::list_assets and get_assets_by_issuer to set max limit value +# api-limit-get-assets = 101 + +# For database_api_impl::get_limit_orders to set max limit value +# api-limit-get-limit-orders = 300 + +# For database_api_impl::get_order_book to set max limit value +# api-limit-get-order-book = 50 + +# For database_api_impl::lookup_accounts to set max limit value +# api-limit-lookup-accounts = 1000 + +# For database_api_impl::lookup_witness_accounts to set max limit value +# api-limit-lookup-witness-accounts = 1000 + +# For database_api_impl::lookup_committee_member_accounts to set max limit value +# api-limit-lookup-committee-member-accounts = 1000 + +# For database_api_impl::lookup_vote_ids to set max limit value +# api-limit-lookup-vote-ids = 1000 + +# For database_api_impl::get_account_limit_orders to set max limit value +# api-limit-get-account-limit-orders = 101 + +# For database_api_impl::get_collateral_bids to set max limit value +# api-limit-get-collateral-bids = 100 + +# For database_api_impl::get_top_markets to set max limit value +# api-limit-get-top-markets = 100 + +# For database_api_impl::get_trade_history to set max limit value +# api-limit-get-trade-history = 100 + +# For database_api_impl::get_trade_history_by_sequence to set max limit value +# api-limit-get-trade-history-by-sequence = 100 + +# For database_api_impl::get_withdraw_permissions_by_giver to set max limit value +# api-limit-get-withdraw-permissions-by-giver = 101 + +# For database_api_impl::get_withdraw_permissions_by_recipient to set max limit value +# api-limit-get-withdraw-permissions-by-recipient = 101 + +# Space-separated list of plugins to activate +plugins = witness account_history market_history grouped_orders api_helper_indexes + +# Do not exit if api_helper_indexes plugin is not enabled. +# ignore-api-helper-indexes-warning = true + + +# ============================================================================== +# witness plugin options +# ============================================================================== + # Enable block production, even if the chain is stale. enable-stale-production = false -# Percent of witnesses (0-99) that must be participating in order to produce blocks +# Percent of witnesses (0-100) that must be participating in order to produce blocks # required-participation = 33 # ID of witness controlled by this node (e.g. "1.6.5", quotes are required, may specify multiple times) @@ -43,9 +141,71 @@ enable-stale-production = false # Tuple of [PublicKey, WIF private key] (may specify multiple times) # private-key = ["BTS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"] +# Path to a file containing tuples of [PublicKey, WIF private key]. The file has to contain exactly one tuple (i.e. private - public key pair) per line. This option may be specified multiple times, thus multiple files can be provided. +# private-key-file = + + +# ============================================================================== +# debug_witness plugin options +# ============================================================================== + +# Tuple of [PublicKey, WIF private key] (may specify multiple times) +# debug-private-key = ["BTS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"] + + +# ============================================================================== +# account_history plugin options +# ============================================================================== + # Account ID to track history for (may specify multiple times) # track-account = +# Keep only those operations in memory that are related to account history tracking +partial-operations = true + +# Maximum number of operations per account will be kept in memory +max-ops-per-account = 1000 + + +# ============================================================================== +# elasticsearch plugin options +# ============================================================================== + +# Elastic Search database node url(http://localhost:9200/) +# elasticsearch-node-url = + +# Number of bulk documents to index on replay(10000) +# elasticsearch-bulk-replay = + +# Number of bulk documents to index on a syncronied chain(100) +# elasticsearch-bulk-sync = + +# Use visitor to index additional data(slows down the replay(false)) +# elasticsearch-visitor = + +# Pass basic auth to elasticsearch database('') +# elasticsearch-basic-auth = + +# Add a prefix to the index(bitshares-) +# elasticsearch-index-prefix = + +# Save operation as object(false) +# elasticsearch-operation-object = + +# Start doing ES job after block(0) +# elasticsearch-start-es-after-block = + +# Save operation as string. Needed to serve history api calls(true) +# elasticsearch-operation-string = + +# Mode of operation: only_save(0), only_query(1), all(2) - Default: 0 +# elasticsearch-mode = + + +# ============================================================================== +# market_history plugin options +# ============================================================================== + # Track market history by grouping orders into buckets of equal size measured in seconds specified as a JSON array of numbers # bucket-size = [15,60,300,3600,86400] bucket-size = [60,300,900,1800,3600,14400,86400] @@ -55,8 +215,90 @@ bucket-size = [60,300,900,1800,3600,14400,86400] # How far back in time to track history for each bucket size, measured in the number of buckets (default: 1000) history-per-size = 1000 -# Max amount of operations to store in the database, per account (drastically reduces RAM requirements) -max-ops-per-account = 1000 +# Will only store this amount of matched orders for each market in order history for querying, or those meet the other option, which has more data (default: 1000) +max-order-his-records-per-market = 1000 -# Remove old operation history # objects from RAM -partial-operations = true +# Will only store matched orders in last X seconds for each market in order history for querying, or those meet the other option, which has more data (default: 259200 (3 days)) +max-order-his-seconds-per-market = 259200 + + +# ============================================================================== +# delayed_node plugin options +# ============================================================================== + +# RPC endpoint of a trusted validating node (required for delayed_node) +# trusted-node = + + +# ============================================================================== +# snapshot plugin options +# ============================================================================== + +# Block number after which to do a snapshot +# snapshot-at-block = + +# Block time (ISO format) after which to do a snapshot +# snapshot-at-time = + +# Pathname of JSON file where to store the snapshot +# snapshot-to = + + +# ============================================================================== +# es_objects plugin options +# ============================================================================== + +# Elasticsearch node url(http://localhost:9200/) +# es-objects-elasticsearch-url = + +# Basic auth username:password('') +# es-objects-auth = + +# Number of bulk documents to index on replay(10000) +# es-objects-bulk-replay = + +# Number of bulk documents to index on a synchronized chain(100) +# es-objects-bulk-sync = + +# Store proposal objects(true) +# es-objects-proposals = + +# Store account objects(true) +# es-objects-accounts = + +# Store asset objects(true) +# es-objects-assets = + +# Store balances objects(true) +# es-objects-balances = + +# Store limit order objects(true) +# es-objects-limit-orders = + +# Store feed data(true) +# es-objects-asset-bitasset = + +# Add a prefix to the index(objects-) +# es-objects-index-prefix = + +# Keep only current state of the objects(true) +# es-objects-keep-only-current = + +# Start doing ES job after block(0) +# es-objects-start-es-after-block = + + +# ============================================================================== +# grouped_orders plugin options +# ============================================================================== + +# Group orders by percentage increase on price. Specify a JSON array of numbers here, each number is a group, number 1 means 0.01%. +# tracked-groups = [10,100] + + +# ============================================================================== +# logging options +# ============================================================================== +# +# Logging configuration is loaded from logging.ini by default. +# If logging.ini exists, logging configuration added in this file will be ignored. From 521bcbc9e0cdb9425a5f28cd973cd70dddc29db9 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Tue, 24 Sep 2019 18:52:26 +0200 Subject: [PATCH 3/4] Improve quoting --- docker/bitsharesentry.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/bitsharesentry.sh b/docker/bitsharesentry.sh index 9a1cccac82..58a2cd5150 100644 --- a/docker/bitsharesentry.sh +++ b/docker/bitsharesentry.sh @@ -87,7 +87,7 @@ ln -f -s /etc/bitshares/logging.ini /var/lib/bitshares # Plugins need to be provided in a space-separated list, which # makes it necessary to write it like this if [[ ! -z "$BITSHARESD_PLUGINS" ]]; then - exec $BITSHARESD --data-dir ${HOME} ${ARGS} ${BITSHARESD_ARGS} --plugins "${BITSHARESD_PLUGINS}" + exec "$BITSHARESD" --data-dir "${HOME}" ${ARGS} ${BITSHARESD_ARGS} --plugins "${BITSHARESD_PLUGINS}" else - exec $BITSHARESD --data-dir ${HOME} ${ARGS} ${BITSHARESD_ARGS} + exec "$BITSHARESD" --data-dir "${HOME}" ${ARGS} ${BITSHARESD_ARGS} fi From 51c27ff0536d982e4cc1164ec5299c5c1f2a1e89 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Sat, 28 Sep 2019 18:49:34 +0200 Subject: [PATCH 4/4] Copy logging.ini to /etc --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 9c703458ba..2b376c3b10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -74,6 +74,7 @@ EXPOSE 1776 # default exec/config files ADD docker/default_config.ini /etc/bitshares/config.ini +ADD docker/default_logging.ini /etc/bitshares/logging.ini ADD docker/bitsharesentry.sh /usr/local/bin/bitsharesentry.sh RUN chmod a+x /usr/local/bin/bitsharesentry.sh