Skip to content

Commit

Permalink
Add config file support for ahnode
Browse files Browse the repository at this point in the history
  • Loading branch information
jredbeard authored and mvandeberg committed Jan 16, 2018
1 parent 7f3ed40 commit 7da1929
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 20 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ ADD doc/seednodes.txt /etc/steemd/seednodes.txt
# the following adds lots of logging info to stdout
ADD contrib/config-for-docker.ini /etc/steemd/config.ini
ADD contrib/fullnode.config.ini /etc/steemd/fullnode.config.ini
ADD contrib/config-for-broadcaster.ini /etc/steemd/config-for-broadcaster.ini
ADD contrib/config-for-ahnode.ini /etc/steemd/config-for-ahnode.ini

# add normal startup script that starts via sv
ADD contrib/steemd.run /usr/local/bin/steem-sv-run.sh
Expand Down
86 changes: 86 additions & 0 deletions contrib/config-for-ahnode.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Console appender definition json: {"appender", "stream"}
log-console-appender = {"appender":"stderr","stream":"std_error"}

# File appender definition json: {"appender", "file"}
log-file-appender = {"appender":"p2p","file":"logs/p2p/p2p.log"}

# Logger definition json: {"name", "level", "appender"}
log-logger = {"name":"default","level":"debug","appender":"stderr"}
log-logger = {"name":"p2p","level":"info","appender":"stderr"}

# Plugin(s) to enable, may be specified multiple times
plugin = webserver p2p json_rpc account_history

plugin = database_api account_history_api condenser_api

# Defines a range of accounts to track as a json pair ["from","to"] [from,to] Can be specified multiple times
# account-history-track-account-range =

# Defines a list of operations which will be explicitly logged.
# account-history-whitelist-ops = transfer_operation transfer_to_vesting_operation withdraw_vesting_operation interest_operation transfer_to_savings_operation transfer_from_savings_operation cancel_transfer_from_savings_operation escrow_transfer_operation escrow_approve_operation escrow_dispute_operation escrow_release_operation fill_convert_request_operation fill_order_operation claim_reward_balance_operation author_reward_operation curation_reward_operation fill_vesting_withdraw_operation fill_transfer_from_savings_operation delegate_vesting_shares_operation return_vesting_delegation_operation comment_benefactor_reward_operation

# Defines a list of operations which will be explicitly ignored.
# account-history-blacklist-ops =

# the location of the chain shared memory files (absolute path or relative to application data dir)
# shared-file-dir = "blockchain"

# Size of the shared memory file. Default: 54G
shared-file-size = 160G

# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.
# checkpoint =

# flush shared memory changes to disk every N blocks
# flush-state-interval = 0

# Database edits to apply on startup (may specify multiple times)
# edit-script =

# Set the maximum size of cached feed for an account
follow-max-feed-size = 500

# Block time (in epoch seconds) when to start calculating feeds
# follow-start-feeds = 0

# Track market history by grouping orders into buckets of equal size measured in seconds specified as a JSON array of numbers
market-history-bucket-size = [15,60,300,3600,86400]

# How far back in time to track history for each bucket size, measured in the number of buckets (default: 5760)
market-history-buckets-per-size = 5760

# The local IP address and port to listen for incoming connections.
# p2p-endpoint =

# Maxmimum number of incoming connections on P2P endpoint
# p2p-max-connections =

# The IP address and port of a remote peer to sync with. Deprecated in favor of p2p-seed-node.
# seed-node =

# The IP address and port of a remote peer to sync with.
# p2p-seed-node =

# User agent to advertise to peers
p2p-user-agent = Graphene Reference Implementation

# The local IP and port to listen for incoming http connections.
# webserver-http-endpoint =

# The local IP and port to listen for incoming websocket connections.
# webserver-ws-endpoint =

# Number of threads used to handle queries. Default: 256.
webserver-thread-pool-size = 1024

# 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
# required-participation =

# name of witness controlled by this node (e.g. initwitness )
# witness =

# WIF PRIVATE KEY to be used by one or more witnesses or miners
# private-key =
4 changes: 2 additions & 2 deletions contrib/fullnode.config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ log-logger = {"name":"default","level":"debug","appender":"stderr"}
log-logger = {"name":"p2p","level":"info","appender":"stderr"}

# Plugin(s) to enable, may be specified multiple times
plugin = webserver p2p json_rpc witness account_history account_by_key tags follow market_history
plugin = webserver p2p json_rpc witness account_by_key tags follow market_history

plugin = database_api account_by_key_api network_broadcast_api tags_api follow_api market_history_api account_history_api witness_api condenser_api
plugin = database_api account_by_key_api network_broadcast_api tags_api follow_api market_history_api witness_api condenser_api

# Defines a range of accounts to track as a json pair ["from","to"] [from,to] Can be specified multiple times
# account-history-track-account-range =
Expand Down
10 changes: 0 additions & 10 deletions contrib/paas-sv-run.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
#!/bin/bash

# if all of the reader nodes die, kill runsv causing the container to exit
if [[ "$USE_MULTICORE_READONLY" ]]; then
STEEMD_READONLY_PIDS=`pgrep -f read-only`
if [[ ! $? -eq 0 ]]; then
echo NOTIFYALERT! steemd reader nodes have quit unexpectedly, starting a new instance..
RUN_SV_PID=`pgrep -f /etc/service/steemd`
kill -9 $RUN_SV_PID
fi
fi

# if the writer node dies, kill runsv causing the container to exit
STEEMD_PID=`pgrep -f p2p-endpoint`
if [[ ! $? -eq 0 ]]; then
Expand Down
23 changes: 16 additions & 7 deletions contrib/startpaassteemd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

VERSION=`cat /etc/steemdversion`

if [[ ! "$IS_BROADCAST_NODE" ]]; then
STEEMD="/usr/local/steemd-full/bin/steemd"
else
if [[ "$IS_BROADCAST_NODE" ]]; then
STEEMD="/usr/local/steemd-default/bin/steemd"
else if [[ "$IS_AH_NODE" ]]; then
STEEMD="/usr/local/steemd-default/bin/steemd"
else
STEEMD="/usr/local/steemd-full/bin/steemd"
fi

chown -R steemd:steemd $HOME
Expand Down Expand Up @@ -54,7 +56,9 @@ fi

# overwrite local config with image one
if [[ "$IS_BROADCAST_NODE" ]]; then
cp /etc/steemd/config.ini $HOME/config.ini
cp /etc/steemd/config-for-broadcaster.ini $HOME/config.ini
else if [[ "$IS_AH_NODE" ]]; then
cp /etc/steemd/config-for-ahnode.ini $HOME/config.ini
else
cp /etc/steemd/fullnode.config.ini $HOME/config.ini
fi
Expand All @@ -73,14 +77,18 @@ if [[ "$USE_RAMDISK" ]]; then
mount -t ramfs -o size=${RAMDISK_SIZE_IN_MB:-51200}m ramfs /mnt/ramdisk
ARGS+=" --shared-file-dir=/mnt/ramdisk/blockchain"
if [[ "$IS_BROADCAST_NODE" ]]; then
s3cmd get s3://$S3_BUCKET/broadcast-$VERSION-latest.tar.bz2 - | lbzip2 -dc | tar x --wildcards 'blockchain/block*' -C /mnt/ramdisk 'blockchain/shared*'
s3cmd get s3://$S3_BUCKET/broadcast-$VERSION-latest.tar.bz2 - | pbzip2 -m2000dc | tar x --wildcards 'blockchain/block*' -C /mnt/ramdisk 'blockchain/shared*'
else if [[ "$IS_AH_NODE" ]]; then
s3cmd get s3://$S3_BUCKET/ahnode-$VERSION-latest.tar.bz2 - | pbzip2 -m2000dc | tar x --wildcards 'blockchain/block*' -C /mnt/ramdisk 'blockchain/shared*'
else
s3cmd get s3://$S3_BUCKET/blockchain-$VERSION-latest.tar.bz2 - | lbzip2 -dc | tar x --wildcards 'blockchain/block*' -C /mnt/ramdisk 'blockchain/shared*'
fi
chown -R steemd:steemd /mnt/ramdisk/blockchain
else
if [[ "$IS_BROADCAST_NODE" ]]; then
s3cmd get s3://$S3_BUCKET/broadcast-$VERSION-latest.tar.bz2 - | lbzip2 -dc | tar x
s3cmd get s3://$S3_BUCKET/broadcast-$VERSION-latest.tar.bz2 - | pbzip2 -m2000dc | tar x
else if [[ "$IS_AH_NODE" ]]; then
s3cmd get s3://$S3_BUCKET/ahnode-$VERSION-latest.tar.bz2 - | pbzip2 -m2000dc | tar x
else
s3cmd get s3://$S3_BUCKET/blockchain-$VERSION-latest.tar.bz2 - | lbzip2 -dc | tar x
fi
Expand Down Expand Up @@ -111,6 +119,7 @@ fi

chown -R steemd:steemd $HOME/*

# let's get going
cp /etc/nginx/healthcheck.conf.template /etc/nginx/healthcheck.conf
echo server 127.0.0.1:8091\; >> /etc/nginx/healthcheck.conf
echo } >> /etc/nginx/healthcheck.conf
Expand All @@ -136,4 +145,4 @@ else
cp /usr/local/bin/sync-sv-run.sh /etc/service/steemd/run
fi
chmod +x /etc/service/steemd/run
runsv /etc/service/steemd
runsv /etc/service/steemd
4 changes: 4 additions & 0 deletions contrib/steemd.run
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ ARGS+=" --follow-start-feeds=$STEEMD_FEED_START_TIME"
# overwrite local config with image one
if [[ "$USE_FULL_WEB_NODE" ]]; then
cp /etc/steemd/fullnode.config.ini $HOME/config.ini
else if [[ "$IS_BROADCAST_NODE" ]]; then
cp /etc/steemd/config-for-broadcaster.ini $HOME/config.ini
else if [[ "$IS_AH_NODE" ]]; then
cp /etc/steemd/config-for-ahnode.ini $HOME/config.ini
else
cp /etc/steemd/config.ini $HOME/config.ini
fi
Expand Down
4 changes: 3 additions & 1 deletion contrib/sync-sv-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ if [[ ! -z "$BLOCKCHAIN_TIME" ]]; then
fi
if [[ "$IS_BROADCAST_NODE" ]]; then
FILE_NAME=broadcast-$VERSION-`date '+%Y%m%d-%H%M%S'`.tar.bz2
else if [[ "$IS_AH_NODE" ]]; then
FILE_NAME=ahnode-$VERSION-`date '+%Y%m%d-%H%M%S'`.tar.bz2
else
FILE_NAME=blockchain-$VERSION-`date '+%Y%m%d-%H%M%S'`.tar.bz2
fi
Expand All @@ -70,7 +72,7 @@ if [[ ! -z "$BLOCKCHAIN_TIME" ]]; then
fi
# upload a current block_log
cd $HOME
if [[ ! "$IS_BROADCAST_NODE" ]]; then
if [[ ! "$IS_BROADCAST_NODE" ]] && [[ ! "$IS_AH_NODE" ]]; then
aws s3 cp blockchain/block_log s3://$S3_BUCKET/block_log-intransit
aws s3 cp s3://$S3_BUCKET/block_log-intransit s3://$S3_BUCKET/block_log-latest
fi
Expand Down

0 comments on commit 7da1929

Please sign in to comment.