Skip to content

Commit

Permalink
Merge pull request #617 from bitshares/release
Browse files Browse the repository at this point in the history
Merge release to master
  • Loading branch information
oxarbitrage authored Feb 1, 2018
2 parents 015026f + c570a73 commit 1d0b859
Show file tree
Hide file tree
Showing 38 changed files with 1,560 additions and 312 deletions.
125 changes: 125 additions & 0 deletions README-docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Docker Container

This repository comes with built-in Dockerfile to support docker
containers. This README serves as documentation.

## Dockerfile Specifications

The `Dockerfile` performs the following steps:

1. Obtain base image (phusion/baseimage:0.9.19)
2. Install required dependencies using `apt-get`
3. Add bitshares-core source code into container
4. Update git submodules
5. Perform `cmake` with build type `Release`
6. Run `make` and `make_install` (this will install binaries into `/usr/local/bin`
7. Purge source code off the container
8. Add a local bitshares user and set `$HOME` to `/var/lib/bitshares`
9. Make `/var/lib/bitshares` and `/etc/bitshares` a docker *volume*
10. Expose ports `8090` and `2001`
11. Add default config from `docker/default_config.ini` and entry point script
12. Run entry point script by default

The entry point simplifies the use of parameters for the `witness_node`
(which is run by default when spinning up the container).

### Supported Environmental Variables

* `$BITSHARESD_SEED_NODES`
* `$BITSHARESD_RPC_ENDPOINT`
* `$BITSHARESD_PLUGINS`
* `$BITSHARESD_REPLAY`
* `$BITSHARESD_RESYNC`
* `$BITSHARESD_P2P_ENDPOINT`
* `$BITSHARESD_WITNESS_ID`
* `$BITSHARESD_PRIVATE_KEY`
* `$BITSHARESD_TRACK_ACCOUNTS`
* `$BITSHARESD_PARTIAL_OPERATIONS`
* `$BITSHARESD_MAX_OPS_PER_ACCOUNT`
* `$BITSHARESD_ES_NODE_URL`
* `$BITSHARESD_TRUSTED_NODE`

### Default config

The default configuration is:

p2p-endpoint = 0.0.0.0:9090
rpc-endpoint = 0.0.0.0:8090
bucket-size = [60,300,900,1800,3600,14400,86400]
history-per-size = 1000
max-ops-per-account = 1000
partial-operations = true

# Docker Compose

With docker compose, multiple nodes can be managed with a single
`docker-compose.yaml` file:

version: '3'
services:
main:
# Image to run
image: bitshares/bitshares-core:latest
#
volumes:
- ./docker/conf/:/etc/bitshares/
# Optional parameters
environment:
- BITSHARESD_ARGS=--help


version: '3'
services:
fullnode:
# Image to run
image: bitshares/bitshares-core:latest
environment:
# Optional parameters
environment:
- BITSHARESD_ARGS=--help
ports:
- "0.0.0.0:8090:8090"
volumes:
- "bitshares-fullnode:/var/lib/bitshares"


# Docker Hub

This container is properly registered with docker hub under the name:

* [bitshares/bitshares-core](https://hub.docker.com/r/bitshares/bitshares-core/)

Going forward, every release tag as well as all pushes to `develop` and
`testnet` will be built into ready-to-run containers, there.

# Docker Compose

One can use docker compose to setup a trusted full node together with a
delayed node like this:

```
version: '3'
services:
fullnode:
image: bitshares/bitshares-core:latest
ports:
- "0.0.0.0:8090:8090"
volumes:
- "bitshares-fullnode:/var/lib/bitshares"
delayed_node:
image: bitshares/bitshares-core:latest
environment:
- 'BITSHARESD_PLUGINS=delayed_node witness'
- 'BITSHARESD_TRUSTED_NODE=ws://fullnode:8090'
ports:
- "0.0.0.0:8091:8090"
volumes:
- "bitshares-delayed_node:/var/lib/bitshares"
links:
- fullnode
volumes:
bitshares-fullnode:
```
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ the blockchain. After syncing, you can exit the node using Ctrl+C and setup the

rpc-endpoint = 127.0.0.1:8090

**NOTE:** Currently(2017-09-04) a full node need 40GB of RAM to operate and required memory is growing fast. To start a node with reduced RAM check the following: [Memory reduction for nodes](https://github.com/bitshares/bitshares-core/wiki/Memory-reduction-for-nodes).
**NOTE:** By default the witness node will start in reduced memory ram mode by using some of the commands detailed in [Memory reduction for nodes](https://github.com/bitshares/bitshares-core/wiki/Memory-reduction-for-nodes).
In order to run a full node with all the account history you need to remove `partial-operations` and `max-ops-per-account` from your config file. Please note that currently(2017-12-23) a full node need 54GB of RAM to operate and required memory is growing fast.

After starting the witness node again, in a separate terminal you can run:

Expand Down
12 changes: 7 additions & 5 deletions docker/bitsharesentry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ if [[ ! -z "$BITSHARESD_RPC_ENDPOINT" ]]; then
ARGS+=" --rpc-endpoint=${BITSHARESD_RPC_ENDPOINT}"
fi

if [[ ! -z "$BITSHARESD_PLUGINS" ]]; then
ARGS+=" --plugins=\"${BITSHARESD_PLUGINS}\""
fi

if [[ ! -z "$BITSHARESD_REPLAY" ]]; then
ARGS+=" --replay-blockchain"
fi
Expand Down Expand Up @@ -82,4 +78,10 @@ fi
## This link has been created in Dockerfile, already
ln -f -s /etc/bitshares/config.ini /var/lib/bitshares

$BITSHARESD --data-dir ${HOME} ${ARGS} ${BITSHARESD_ARGS}
# Plugins need to be provided in a space-separated list, which
# makes it necessary to write it like this
if [[ ! -z "$BITSHARESD_PLUGINS" ]]; then
$BITSHARESD --data-dir ${HOME} ${ARGS} ${BITSHARESD_ARGS} --plugins "${BITSHARESD_PLUGINS}"
else
$BITSHARESD --data-dir ${HOME} ${ARGS} ${BITSHARESD_ARGS}
fi
1 change: 1 addition & 0 deletions libraries/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ file(GLOB EGENESIS_HEADERS "../egenesis/include/graphene/app/*.hpp")
add_library( graphene_app
api.cpp
application.cpp
util.cpp
database_api.cpp
impacted.cpp
plugin.cpp
Expand Down
15 changes: 15 additions & 0 deletions libraries/app/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,21 @@ namespace graphene { namespace app {
return hist->tracked_buckets();
}

history_operation_detail history_api::get_account_history_by_operations(account_id_type account, vector<uint16_t> operation_types, uint32_t start, unsigned limit)
{
FC_ASSERT(limit <= 100);
history_operation_detail result;
vector<operation_history_object> objs = get_relative_account_history(account, start, limit, limit + start - 1);
std::for_each(objs.begin(), objs.end(), [&](const operation_history_object &o) {
if (operation_types.empty() || find(operation_types.begin(), operation_types.end(), o.op.which()) != operation_types.end()) {
result.operation_history_objs.push_back(o);
}
});

result.total_count = objs.size();
return result;
}

vector<bucket_object> history_api::get_market_history( asset_id_type a, asset_id_type b,
uint32_t bucket_seconds, fc::time_point_sec start, fc::time_point_sec end )const
{ try {
Expand Down
11 changes: 0 additions & 11 deletions libraries/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@

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

#include <graphene/utilities/git_revision.hpp>

namespace graphene { namespace app {
using net::item_hash_t;
using net::item_id;
Expand Down Expand Up @@ -945,7 +943,6 @@ void application::set_program_options(boost::program_options::options_descriptio
("resync-blockchain", "Delete all blocks and re-sync with network from scratch")
("force-validate", "Force validation of all transactions")
("genesis-timestamp", bpo::value<uint32_t>(), "Replace timestamp from genesis.json with current time plus this many seconds (experts only!)")
("version,v", "Display version information")
;
command_line_options.add(_cli_options);
configuration_file_options.add(_cfg_options);
Expand All @@ -956,14 +953,6 @@ void application::initialize(const fc::path& data_dir, const boost::program_opti
my->_data_dir = data_dir;
my->_options = &options;

if( options.count("version") )
{
std::cout << "Version: " << graphene::utilities::git_revision_description << "\n";
std::cout << "SHA: " << graphene::utilities::git_revision_sha << "\n";
std::cout << "Timestamp: " << fc::get_approximate_relative_time_string(fc::time_point_sec(graphene::utilities::git_revision_unix_timestamp)) << "\n";
std::exit(EXIT_SUCCESS);
}

if( options.count("create-genesis-json") )
{
fc::path genesis_out = options.at("create-genesis-json").as<boost::filesystem::path>();
Expand Down
Loading

0 comments on commit 1d0b859

Please sign in to comment.