Skip to content

Commit

Permalink
Merge pull request #380 from steemit/develop
Browse files Browse the repository at this point in the history
0.14.1
  • Loading branch information
Michael Vandeberg authored Sep 13, 2016
2 parents d52af4c + 76592f0 commit c029001
Show file tree
Hide file tree
Showing 22 changed files with 792 additions and 117 deletions.
131 changes: 131 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
FROM phusion/baseimage:0.9.19

#ARG STEEMD_BLOCKCHAIN=https://example.com/steemd-blockchain.tbz2

RUN \
apt-get update && \
apt-get install -y \
autoconf \
automake \
autotools-dev \
bsdmainutils \
build-essential \
cmake \
doxygen \
git \
libboost-all-dev \
libreadline-dev \
libssl-dev \
libtool \
ncurses-dev \
pbzip2 \
python3 \
python3-dev \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ADD . /usr/local/src/steem

RUN \
cd /usr/local/src/steem && \
git submodule update --init --recursive && \
rsync -a \
/usr/local/src/steem/ \
/usr/local/src/steemtest/

RUN \
cd /usr/local/src/steemtest && \
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_STEEM_TESTNET=On \
-DLOW_MEMORY_NODE=ON \
. \
&& \
make -j$(nproc) chain_test && \
./tests/chain_test && \
rm -rf /usr/local/src/steemtest

RUN \
cd /usr/local/src/steem && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DLOW_MEMORY_NODE=ON \
. \
&& \
make -j$(nproc) && \
make install && \
rm -rf /usr/local/src/steem

RUN \
apt-get remove -y \
automake \
autotools-dev \
bsdmainutils \
build-essential \
cmake \
doxygen \
dpkg-dev \
git \
libboost-all-dev \
libc6-dev \
libexpat1-dev \
libgcc-5-dev \
libhwloc-dev \
libibverbs-dev \
libicu-dev \
libltdl-dev \
libncurses5-dev \
libnuma-dev \
libopenmpi-dev \
libpython-dev \
libpython2.7-dev \
libreadline-dev \
libreadline6-dev \
libssl-dev \
libstdc++-5-dev \
libtinfo-dev \
libtool \
linux-libc-dev \
m4 \
make \
manpages \
manpages-dev \
mpi-default-dev \
python-dev \
python2.7-dev \
python3-dev \
&& \
apt-get autoremove -y && \
rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/var/cache/* \
/usr/include \
/usr/local/include

RUN useradd -s /bin/bash -m -d /var/lib/steemd steemd

RUN mkdir /var/cache/steemd && \
chown steemd:steemd -R /var/cache/steemd

# add blockchain cache to image
#ADD $STEEMD_BLOCKCHAIN /var/cache/steemd/blocks.tbz2

ENV HOME /var/lib/steemd
RUN chown steemd:steemd -R /var/lib/steemd

VOLUME ["/var/lib/steemd"]

# rpc service:
EXPOSE 8090
# p2p service:
EXPOSE 2001

RUN mkdir -p /etc/service/steemd
ADD contrib/steemd.run /etc/service/steemd/run
RUN chmod +x /etc/service/steemd/run

# the following adds lots of logging info to stdout
ADD contrib/config-for-docker.ini /etc/steemd/config.ini
8 changes: 8 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
machine:
services:
- docker

test:
override:
- docker info
- docker build --rm=false -t steemit/steem .
111 changes: 111 additions & 0 deletions contrib/config-for-docker.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Endpoint for P2P node to listen on
# p2p-endpoint =

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

# P2P nodes to connect to on startup (may specify multiple times)
# seed-node =

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

# Endpoint for websocket RPC to listen on
# rpc-endpoint =

# Endpoint for TLS websocket RPC to listen on
# rpc-tls-endpoint =

# The TLS certificate file for this server
# server-pem =

# Password for this certificate
# server-pem-password =

# Block signing key to use for init witnesses, overrides genesis file
# dbg-init-key =

# API user specification, may be specified multiple times
# api-user =

# Set an API to be publicly available, may be specified multiple times
public-api = database_api login_api

# Plugin(s) to enable, may be specified multiple times
enable-plugin = witness account_history

# JSON list of [nblocks,nseconds] pairs, see doc/bcd-trigger.md
bcd-trigger = [[0,10],[85,300]]

# Defines a range of accounts to track as a json pair ["from","to"] [from,to]
# track-account-range =

# Ignore posting operations, only track transfers and account updates
# filter-posting-ops =

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

# RPC endpoint of a trusted validating node (required)
# trusted-node =

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

# 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]

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

# Defines a range of accounts to private messages to/from as a json pair ["from","to"] [from,to)
# pm-account-range =

# 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 = false

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

# name of miner and its private key (e.g. ["account","WIF PRIVATE KEY"] )
# miner =

# Number of threads to use for proof of work mining
# mining-threads =

# WIF PRIVATE KEY to be used by one or more witnesses or miners
# private-key =

# Account creation fee to be voted on upon successful POW - Minimum fee is 100.000 STEEM (written as 100000)
# miner-account-creation-fee =

# Maximum block size (in bytes) to be voted on upon successful POW - Max block size must be between 128 KB and 750 MB
# miner-maximum-block-size =

# SBD interest rate to be vote on upon successful POW - Default interest rate is 10% (written as 1000)
# miner-sbd-interest-rate =

# declare an appender named "stderr" that writes messages to the console
[log.console_appender.stderr]
stream=std_error

# declare an appender named "p2p" that writes messages to p2p.log
[log.file_appender.p2p]
filename=logs/p2p/p2p.log
# filename can be absolute or relative to this config file

# route any messages logged to the default logger to the "stderr" logger we
# declared above, if they are info level are higher
[logger.default]
level=info
appenders=stderr

# route messages sent to the "p2p" logger to stderr too
[logger.p2p]
level=info
appenders=stderr


77 changes: 77 additions & 0 deletions contrib/steemd.run
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash

export HOME="/var/lib/steemd"

chown -R steemd:steemd $HOME

SEED_NODES="
52.38.66.234:2001
52.37.169.52:2001
52.26.78.244:2001
192.99.4.226:2001
46.252.27.1:1337
81.89.101.133:2001
52.4.250.181:39705
steemd.pharesim.me:2001
seed.steemed.net:2001
steem.clawmap.com:2001
seed.steemwitness.com:2001
steem-seed1.abit-more.com:2001
"

ARGS=""

if [[ -z "$STEEMD_SEED_NODES" ]]; then
for NODE in $SEED_NODES ; do
ARGS+=" --seed-node=$NODE"
done
fi

if [[ ! -z "$STEEMD_SEED_NODES" ]]; then
for NODE in $STEEMD_SEED_NODES ; do
ARGS+=" --seed-node=$NODE"
done
fi

if [[ ! -z "$STEEMD_WITNESS_NAME" ]]; then
ARGS+=" --witness=\"$STEEMD_WITNESS_NAME\""
fi

if [[ ! -z "$STEEMD_MINER_NAME" ]]; then
ARGS+=" --miner=[\"$STEEMD_MINER_NAME\",\"$STEEMD_PRIVATE_KEY\"]"
ARGS+=" --mining-threads=$(nproc)"
fi

if [[ ! -z "$STEEMD_PRIVATE_KEY" ]]; then
ARGS+=" --private-key=$STEEMD_PRIVATE_KEY"
fi

# overwrite local config with image one
cp /etc/steemd/config.ini $HOME/config.ini

chown steemd:steemd $HOME/config.ini

if [[ ! -d $HOME/blockchain ]]; then
# init with blockchain cached in image
ARGS+=" --replay-blockchain"
mkdir -p $HOME/blockchain/database
cd $HOME/blockchain/database
tar xvjpf /var/cache/steemd/blocks.tbz2
chown -R steemd:steemd $HOME/blockchain
fi

# without --data-dir it uses cwd as datadir(!)
# who knows what else it dumps into current dir
cd $HOME

# slow down restart loop if flapping
sleep 1

exec chpst -usteemd \
steemd \
--rpc-endpoint=0.0.0.0:8090 \
--p2p-endpoint=0.0.0.0:2001 \
--data-dir=$HOME \
$ARGS \
$STEEMD_EXTRA_OPTS \
2>&1
3 changes: 2 additions & 1 deletion libraries/app/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ namespace steemit { namespace app {
continue;
std::shared_ptr< network_broadcast_api > capture_this = shared_from_this();
confirmation_callback callback = cb_it->second;
fc::async( [capture_this,block_num,txid,callback](){ callback( fc::variant(transaction_confirmation{ txid, block_num, -1, true}) ); } );
transaction_id_type txid_byval = txid; // can't pass in by reference as it's going to be deleted
fc::async( [capture_this,block_num,txid_byval,callback](){ callback( fc::variant(transaction_confirmation{ txid_byval, block_num, -1, true}) ); } );
_callbacks.erase( cb_it );
}
_callbacks_expirations.erase( exp_it );
Expand Down
7 changes: 7 additions & 0 deletions libraries/app/database_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,13 @@ state database_api::get_state( string path )const
case operation::tag<liquidity_reward_operation>::value:
case operation::tag<author_reward_operation>::value:
case operation::tag<curation_reward_operation>::value:
case operation::tag<transfer_to_savings_operation>::value:
case operation::tag<transfer_from_savings_operation>::value:
case operation::tag<cancel_transfer_from_savings_operation>::value:
case operation::tag<escrow_transfer_operation>::value:
case operation::tag<escrow_approve_operation>::value:
case operation::tag<escrow_dispute_operation>::value:
case operation::tag<escrow_release_operation>::value:
eacnt.transfer_history[item.first] = item.second;
break;
case operation::tag<comment_operation>::value:
Expand Down
Loading

0 comments on commit c029001

Please sign in to comment.