Skip to content

Commit 480b7e5

Browse files
authored
Merge pull request #526 from bitshares/release
Release candidate
2 parents af2bce6 + b6d95fd commit 480b7e5

File tree

37 files changed

+1636
-299
lines changed

37 files changed

+1636
-299
lines changed

Dockerfile

+58-16
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,64 @@
1-
# This will build the witness_node in a docker image. Make sure you've already
2-
# checked out the submodules before building.
1+
FROM phusion/baseimage:0.9.19
2+
MAINTAINER The bitshares decentralized organisation
33

4-
FROM l3iggs/archlinux:latest
5-
MAINTAINER Nathan Hourt <[email protected]>
4+
ENV LANG=en_US.UTF-8
5+
RUN \
6+
apt-get update -y && \
7+
apt-get install -y \
8+
g++ \
9+
autoconf \
10+
cmake \
11+
git \
12+
libbz2-dev \
13+
libreadline-dev \
14+
libboost-all-dev \
15+
libcurl4-openssl-dev \
16+
libssl-dev \
17+
libncurses-dev \
18+
doxygen \
19+
libcurl4-openssl-dev \
20+
&& \
21+
apt-get update -y && \
22+
apt-get install -y fish && \
23+
apt-get clean && \
24+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
625

7-
RUN pacman -Syu --noconfirm gcc make autoconf automake cmake ninja boost libtool git
26+
ADD . /bitshares-core
27+
WORKDIR /bitshares-core
828

9-
ADD . /bitshares-2
10-
WORKDIR /bitshares-2
11-
RUN cmake -G Ninja -DCMAKE_BUILD_TYPE=Release .
12-
RUN ninja witness_node || ninja -j 1 witness_node
29+
# Compile
30+
RUN \
31+
git submodule update --init --recursive && \
32+
cmake \
33+
-DCMAKE_BUILD_TYPE=Release \
34+
. && \
35+
make witness_node && \
36+
make install && \
37+
#
38+
# Obtain version
39+
mkdir /etc/bitshares && \
40+
git rev-parse --short HEAD > /etc/bitshares/version && \
41+
cd / && \
42+
rm -rf /bitshares-core
1343

14-
RUN mkdir /data_dir
15-
ADD docker/default_config.ini /default_config.ini
16-
ADD docker/launch /launch
17-
RUN chmod a+x /launch
18-
VOLUME /data_dir
44+
# Home directory $HOME
45+
WORKDIR /
46+
RUN useradd -s /bin/bash -m -d /var/lib/bitshares bitshares
47+
ENV HOME /var/lib/bitshares
48+
RUN chown bitshares:bitshares -R /var/lib/bitshares
1949

20-
EXPOSE 8090 9090
50+
# Volume
51+
VOLUME ["/var/lib/bitshares", "/etc/bitshares"]
2152

22-
ENTRYPOINT ["/launch"]
53+
# rpc service:
54+
EXPOSE 8090
55+
# p2p service:
56+
EXPOSE 2001
57+
58+
# default exec/config files
59+
ADD docker/default_config.ini /etc/bitshares/config.ini
60+
ADD docker/bitsharesentry.sh /usr/local/bin/bitsharesentry.sh
61+
RUN chmod a+x /usr/local/bin/bitsharesentry.sh
62+
63+
# default execute entry
64+
CMD /usr/local/bin/bitsharesentry.sh

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Build instructions and additional documentation are available in the
3030
We recommend building on Ubuntu 16.04 LTS, and the build dependencies may be installed with:
3131

3232
sudo apt-get update
33-
sudo apt-get install autoconf cmake git libboost-all-dev libssl-dev g++
33+
sudo apt-get install autoconf cmake git libboost-all-dev libssl-dev g++ libcurl4-openssl-dev
3434

3535
To build after all dependencies are installed:
3636

@@ -43,8 +43,8 @@ To build after all dependencies are installed:
4343

4444
**NOTE:** BitShares requires an [OpenSSL](https://www.openssl.org/) version in the 1.0.x series. OpenSSL 1.1.0 and newer are NOT supported. If your system OpenSSL version is newer, then you will need to manually provide an older version of OpenSSL and specify it to CMake using `-DOPENSSL_INCLUDE_DIR`, `-DOPENSSL_SSL_LIBRARY`, and `-DOPENSSL_CRYPTO_LIBRARY`.
4545

46-
**NOTE:** BitShares requires a [Boost](http://www.boost.org/) version in the range [1.57, 1.60]. Versions earlier than
47-
1.57 or newer than 1.60 are NOT supported. If your system Boost version is newer, then you will need to manually build
46+
**NOTE:** BitShares requires a [Boost](http://www.boost.org/) version in the range [1.57, 1.63]. Versions earlier than
47+
1.57 or newer than 1.63 are NOT supported. If your system Boost version is newer, then you will need to manually build
4848
an older version of Boost and specify it to CMake using `DBOOST_ROOT`.
4949

5050
After building, the witness node can be launched with:

docker/bitsharesentry.sh

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/bash
2+
BITSHARESD="/usr/local/bin/witness_node"
3+
4+
# For blockchain download
5+
VERSION=`cat /etc/bitshares/version`
6+
7+
## Supported Environmental Variables
8+
#
9+
# * $BITSHARESD_SEED_NODES
10+
# * $BITSHARESD_RPC_ENDPOINT
11+
# * $BITSHARESD_PLUGINS
12+
# * $BITSHARESD_REPLAY
13+
# * $BITSHARESD_RESYNC
14+
# * $BITSHARESD_P2P_ENDPOINT
15+
# * $BITSHARESD_WITNESS_ID
16+
# * $BITSHARESD_PRIVATE_KEY
17+
# * $BITSHARESD_TRACK_ACCOUNTS
18+
# * $BITSHARESD_PARTIAL_OPERATIONS
19+
# * $BITSHARESD_MAX_OPS_PER_ACCOUNT
20+
# * $BITSHARESD_ES_NODE_URL
21+
# * $BITSHARESD_TRUSTED_NODE
22+
#
23+
24+
ARGS=""
25+
# Translate environmental variables
26+
if [[ ! -z "$BITSHARESD_SEED_NODES" ]]; then
27+
for NODE in $BITSHARESD_SEED_NODES ; do
28+
ARGS+=" --seed-node=$NODE"
29+
done
30+
fi
31+
if [[ ! -z "$BITSHARESD_RPC_ENDPOINT" ]]; then
32+
ARGS+=" --rpc-endpoint=${BITSHARESD_RPC_ENDPOINT}"
33+
fi
34+
35+
if [[ ! -z "$BITSHARESD_PLUGINS" ]]; then
36+
ARGS+=" --plugins=\"${BITSHARESD_PLUGINS}\""
37+
fi
38+
39+
if [[ ! -z "$BITSHARESD_REPLAY" ]]; then
40+
ARGS+=" --replay-blockchain"
41+
fi
42+
43+
if [[ ! -z "$BITSHARESD_RESYNC" ]]; then
44+
ARGS+=" --resync-blockchain"
45+
fi
46+
47+
if [[ ! -z "$BITSHARESD_P2P_ENDPOINT" ]]; then
48+
ARGS+=" --p2p-endpoint=${BITSHARESD_P2P_ENDPOINT}"
49+
fi
50+
51+
if [[ ! -z "$BITSHARESD_WITNESS_ID" ]]; then
52+
ARGS+=" --witness-id=$BITSHARESD_WITNESS_ID"
53+
fi
54+
55+
if [[ ! -z "$BITSHARESD_PRIVATE_KEY" ]]; then
56+
ARGS+=" --private-key=$BITSHARESD_PRIVATE_KEY"
57+
fi
58+
59+
if [[ ! -z "$BITSHARESD_TRACK_ACCOUNTS" ]]; then
60+
for ACCOUNT in $BITSHARESD_TRACK_ACCOUNTS ; do
61+
ARGS+=" --track-account=$ACCOUNT"
62+
done
63+
fi
64+
65+
if [[ ! -z "$BITSHARESD_PARTIAL_OPERATIONS" ]]; then
66+
ARGS+=" --partial-operations=${BITSHARESD_PARTIAL_OPERATIONS}"
67+
fi
68+
69+
if [[ ! -z "$BITSHARESD_MAX_OPS_PER_ACCOUNT" ]]; then
70+
ARGS+=" --max-ops-per-account=${BITSHARESD_MAX_OPS_PER_ACCOUNT}"
71+
fi
72+
73+
if [[ ! -z "$BITSHARESD_ES_NODE_URL" ]]; then
74+
ARGS+=" --elasticsearch-node-url=${BITSHARESD_ES_NODE_URL}"
75+
fi
76+
77+
if [[ ! -z "$BITSHARESD_TRUSTED_NODE" ]]; then
78+
ARGS+=" --trusted-node=${BITSHARESD_TRUSTED_NODE}"
79+
fi
80+
81+
## Link the bitshares config file into home
82+
## This link has been created in Dockerfile, already
83+
ln -f -s /etc/bitshares/config.ini /var/lib/bitshares
84+
85+
$BITSHARESD --data-dir ${HOME} ${ARGS} ${BITSHARESD_ARGS}

docker/default_config.ini

+8-20
Original file line numberDiff line numberDiff line change
@@ -47,28 +47,16 @@ required-participation = false
4747
# track-account =
4848

4949
# Track market history by grouping orders into buckets of equal size measured in seconds specified as a JSON array of numbers
50-
bucket-size = [15,60,300,3600,86400]
50+
# bucket-size = [15,60,300,3600,86400]
51+
bucket-size = [60,300,900,1800,3600,14400,86400]
52+
# for 1 min, 5 mins, 30 mins, 1h, 4 hs and 1 day. i think this should be the default.
53+
# https://github.com/bitshares/bitshares-core/issues/465
5154

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

55-
# declare an appender named "stderr" that writes messages to the console
56-
[log.console_appender.stderr]
57-
stream=std_error
58-
59-
# declare an appender named "p2p" that writes messages to p2p.log
60-
[log.file_appender.p2p]
61-
filename=logs/p2p/p2p.log
62-
# filename can be absolute or relative to this config file
63-
64-
# route any messages logged to the default logger to the "stderr" logger we
65-
# declared above, if they are info level are higher
66-
[logger.default]
67-
level=info
68-
appenders=stderr
69-
70-
# route messages sent to the "p2p" logger to the p2p appender declared above
71-
[logger.p2p]
72-
level=info
73-
appenders=p2p
58+
# Max amount of operations to store in the database, per account (drastically reduces RAM requirements)
59+
max-ops-per-account = 1000
7460

61+
# Remove old operation history # objects from RAM
62+
partial-operations = true

docker/launch

-11
This file was deleted.

libraries/app/application.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858

5959
#include <boost/range/adaptor/reversed.hpp>
6060

61+
#include <graphene/utilities/git_revision.hpp>
62+
6163
namespace graphene { namespace app {
6264
using net::item_hash_t;
6365
using net::item_id;
@@ -943,6 +945,7 @@ void application::set_program_options(boost::program_options::options_descriptio
943945
("resync-blockchain", "Delete all blocks and re-sync with network from scratch")
944946
("force-validate", "Force validation of all transactions")
945947
("genesis-timestamp", bpo::value<uint32_t>(), "Replace timestamp from genesis.json with current time plus this many seconds (experts only!)")
948+
("version,v", "Display version information")
946949
;
947950
command_line_options.add(_cli_options);
948951
configuration_file_options.add(_cfg_options);
@@ -953,6 +956,14 @@ void application::initialize(const fc::path& data_dir, const boost::program_opti
953956
my->_data_dir = data_dir;
954957
my->_options = &options;
955958

959+
if( options.count("version") )
960+
{
961+
std::cout << "Version: " << graphene::utilities::git_revision_description << "\n";
962+
std::cout << "SHA: " << graphene::utilities::git_revision_sha << "\n";
963+
std::cout << "Timestamp: " << fc::get_approximate_relative_time_string(fc::time_point_sec(graphene::utilities::git_revision_unix_timestamp)) << "\n";
964+
std::exit(EXIT_SUCCESS);
965+
}
966+
956967
if( options.count("create-genesis-json") )
957968
{
958969
fc::path genesis_out = options.at("create-genesis-json").as<boost::filesystem::path>();
@@ -989,8 +1000,18 @@ void application::initialize(const fc::path& data_dir, const boost::program_opti
9891000
wanted.push_back("account_history");
9901001
wanted.push_back("market_history");
9911002
}
1003+
int es_ah_conflict_counter = 0;
9921004
for (auto& it : wanted)
9931005
{
1006+
if(it == "account_history")
1007+
++es_ah_conflict_counter;
1008+
if(it == "elasticsearch")
1009+
++es_ah_conflict_counter;
1010+
1011+
if(es_ah_conflict_counter > 1) {
1012+
elog("Can't start program with elasticsearch and account_history plugin at the same time");
1013+
std::exit(EXIT_FAILURE);
1014+
}
9941015
if (!it.empty()) enable_plugin(it);
9951016
}
9961017
}

0 commit comments

Comments
 (0)