Commit b597ef72 authored by Bartek Wrona's avatar Bartek Wrona
Browse files

branch 'bw_hf25_develop2master' rebased onto master

parents a09c66e2 8413b6d0
......@@ -62,7 +62,6 @@ libraries/jsonball/gensrc/
libraries/jsonball/template_context/
libraries/manifest/gensrc/
libraries/manifest/template_context/
libraries/mira/test/mira_test
libraries/utilities/git_revision.cpp
libraries/vendor/rocksdb/RocksDBConfig.cmake
libraries/vendor/rocksdb/RocksDBConfigVersion.cmake
......
......@@ -15,8 +15,8 @@ testnet_node_build:
stage: build
image: "$CI_REGISTRY_IMAGE/builder$BUILDER_IMAGE_TAG"
script:
# LOW_MEMORY=OFF CLEAR_VOTES=OFF TESTNET=ON ENABLE_MIRA=OFF
- ./ciscripts/build.sh OFF OFF ON OFF
# TESTNET=ON HIVE_LINT=ON
- ./ciscripts/build.sh ON ON
- mkdir -p "$CI_JOB_NAME"/tests/unit
- mv build/install-root "$CI_JOB_NAME"
- mv contrib/hived.run "$CI_JOB_NAME"
......@@ -35,8 +35,8 @@ consensus_build:
stage: build
image: "$CI_REGISTRY_IMAGE/builder$BUILDER_IMAGE_TAG"
script:
# LOW_MEMORY=ON CLEAR_VOTES=ON TESTNET=OFF ENABLE_MIRA=OFF
- ./ciscripts/build.sh ON ON OFF OFF
# TESTNET=OFF HIVE_LINT=ON
- ./ciscripts/build.sh OFF ON
- mkdir "$CI_JOB_NAME"
- mv build/install-root "$CI_JOB_NAME"
- mv contrib/hived.run "$CI_JOB_NAME"
......@@ -86,6 +86,15 @@ plugin_test:
tags:
- public-runner-docker
.beem_setup : &beem_setup |
git clone --depth=1 --single-branch --branch master https://gitlab.syncad.com/hive/beem.git
cd beem
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade -r requirements-test.txt
python3 setup.py install
cd ..
mkdir -p build/tests/hive-node-data
beem_tests:
stage: test
needs:
......@@ -95,13 +104,7 @@ beem_tests:
variables:
PYTHONPATH: $CI_PROJECT_DIR/tests/functional
script:
# boilerplate for installing latested beem
- git clone --depth=1 --single-branch --branch dk-hybrid-operations https://gitlab.syncad.com/hive/beem.git
- cd beem
- python3 setup.py install
- cd ..
# stuff specific to this test
- mkdir -p build/tests/hive-node-data
- *beem_setup
- cd tests/functional/python_tests/dhf_tests
- "python3 run_proposal_tests.py initminer hive.fund 5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n --run-hived $CI_PROJECT_DIR/testnet_node_build/install-root/bin/hived --working-dir=$CI_PROJECT_DIR/build/tests/hive-node-data"
- rm -rf $CI_PROJECT_DIR/build/tests/hive-node-data
......@@ -130,13 +133,7 @@ list_proposals_tests:
variables:
PYTHONPATH: $CI_PROJECT_DIR/tests/functional
script:
# boilerplate for installing latested beem
- git clone --depth=1 --single-branch --branch dk-hybrid-operations https://gitlab.syncad.com/hive/beem.git
- cd beem
- python3 setup.py install
- cd ..
# stuff specific to this test
- mkdir -p build/tests/hive-node-data
- *beem_setup
- cd tests/functional/python_tests/dhf_tests
- "python3 list_proposals_tests.py initminer initminer 5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n --run-hived $CI_PROJECT_DIR/testnet_node_build/install-root/bin/hived --working-dir=$CI_PROJECT_DIR/build/tests/hive-node-data --junit-output=list_proposals_tests.xml"
artifacts:
......@@ -149,6 +146,28 @@ list_proposals_tests:
tags:
- public-runner-docker
cli_wallet_tests:
stage: test
needs:
- job: testnet_node_build
artifacts: true
image: "$CI_REGISTRY_IMAGE/test$TEST_IMAGE_TAG"
variables:
PYTHONPATH: $CI_PROJECT_DIR/tests/functional
script:
- *beem_setup
- cd tests/functional/python_tests/cli_wallet
- "python3 run.py --hive-path $CI_PROJECT_DIR/testnet_node_build/install-root/bin/hived --hive-working-dir=$CI_PROJECT_DIR/build/tests/hive-node-data --path-to-cli $CI_PROJECT_DIR/testnet_node_build/install-root/bin --creator initminer --wif 5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n --junit-output=cli_wallet_tests.xml"
artifacts:
paths:
- tests/functional/python_tests/cli_wallet/tests/logs/cli_wallet.log
reports:
junit: tests/functional/python_tests/cli_wallet/cli_wallet_tests.xml
when: always
expire_in: 6 months
tags:
- public-runner-docker
hived_options_tests:
stage: test
needs:
......@@ -159,10 +178,97 @@ hived_options_tests:
PYTHONPATH: $CI_PROJECT_DIR/tests/functional
script:
- cd tests/functional/python_tests/hived
- apt-get update -y && apt-get install -y python3 python3-pip python3-dev
- pip3 install -U psutil
- "python3 hived_options_tests.py --run-hived $CI_PROJECT_DIR/testnet_node_build/install-root/bin/hived"
tags:
- public-runner-docker
.test_tools_based:
variables:
PYTHONPATH: "$CI_PROJECT_DIR/tests/test_tools/package"
HIVED_PATH: "$CI_PROJECT_DIR/testnet_node_build/install-root/bin/hived"
CLI_WALLET_PATH: "$CI_PROJECT_DIR/testnet_node_build/install-root/bin/cli_wallet"
GET_DEV_KEY_PATH: "$CI_PROJECT_DIR/testnet_node_build/install-root/bin/get_dev_key"
before_script:
- apt-get update -y && apt-get install -y python3 python3-pip python3-dev
- pip3 install requests
create_account_tests:
stage: test
extends: .test_tools_based
needs:
- job: testnet_node_build
artifacts: true
image: "$CI_REGISTRY_IMAGE/test$TEST_IMAGE_TAG"
script:
- pip3 install pytest
- cd tests/functional/python_tests/create_account_tests
- pytest
tags:
- public-runner-docker
last_irreversible_block_tests:
stage: test
extends: .test_tools_based
needs:
- job: testnet_node_build
artifacts: true
image: "$CI_REGISTRY_IMAGE/test$TEST_IMAGE_TAG"
script:
- pip3 install pytest pytest-timeout
- cd tests/functional/python_tests/last_irreversible_block_tests
- pytest
tags:
- public-runner-docker
test_tools_tests:
stage: test
extends: .test_tools_based
needs:
- job: testnet_node_build
artifacts: true
image: "$CI_REGISTRY_IMAGE/test$TEST_IMAGE_TAG"
script:
- pip3 install pytest
- cd tests/test_tools/tests
- pytest
tags:
- public-runner-docker
hived_replay_tests:
stage: test
needs:
- job: consensus_build
artifacts: true
image: "$CI_REGISTRY_IMAGE/builder$BUILDER_IMAGE_TAG"
variables:
PYTHONPATH: $CI_PROJECT_DIR/tests/functional
script:
- export ROOT_DIRECTORY=$PWD
- mkdir $ROOT_DIRECTORY/replay_logs
- cd tests/functional/python_tests/hived
- apt-get update -y && apt-get install -y python3 python3-pip python3-dev
- pip3 install -U wget psutil junit_xml gcovr secp256k1prp requests
- $CI_PROJECT_DIR/consensus_build/install-root/bin/truncate_block_log /blockchain/block_log /tmp/block_log 3000000
# quick replays for 10k blocks, with node restarts
- "python3 snapshot_1.py --run-hived $CI_PROJECT_DIR/consensus_build/install-root/bin/hived --block-log /tmp/block_log --blocks 10000 --artifact-directory $ROOT_DIRECTORY/replay_logs"
- "python3 snapshot_2.py --run-hived $CI_PROJECT_DIR/consensus_build/install-root/bin/hived --block-log /tmp/block_log --blocks 10000 --artifact-directory $ROOT_DIRECTORY/replay_logs"
# group of tests, that uses one node with 5 milion blocks replayed
- "python3 start_replay_tests.py --run-hived $CI_PROJECT_DIR/consensus_build/install-root/bin/hived --blocks 3000000 --block-log /tmp/block_log --test-directory $PWD/replay_based_tests --artifact-directory $ROOT_DIRECTORY/replay_logs"
artifacts:
paths:
- replay_logs
when: always
expire_in: 6 months
tags:
- public-runner-docker
- hived-for-tests
package_consensus_node:
stage: package
needs:
......@@ -182,3 +288,4 @@ package_consensus_node:
- "echo ===> the consensus node image for this build is: $CI_REGISTRY_IMAGE/consensus_node:$CI_COMMIT_SHORT_SHA"
tags:
- public-runner-docker
[submodule "libraries/fc/vendor/diff-match-patch-cpp-stl"]
path = libraries/fc/vendor/diff-match-patch-cpp-stl
url = https://github.com/leutloff/diff-match-patch-cpp-stl.git
[submodule "libraries/fc/vendor/secp256k1-zkp"]
path = libraries/fc/vendor/secp256k1-zkp
url = https://github.com/cryptonomex/secp256k1-zkp.git
......@@ -11,3 +8,6 @@
path = tests/tests_api
url = https://gitlab.syncad.com/hive/tests_api.git
branch = mi_tests_import
[submodule "tests/test_tools"]
path = tests/test_tools
url = https://gitlab.syncad.com/hive/test-tools.git
......@@ -3,23 +3,18 @@ project( Hive )
cmake_minimum_required( VERSION 3.2 )
set( BLOCKCHAIN_NAME "Hive" )
set( CMAKE_CXX_STANDARD 14 )
set( CMAKE_CXX_EXTENSIONS OFF )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_C_STANDARD 99 )
set( CMAKE_C_STANDARD_REQUIRED ON )
set( GUI_CLIENT_EXECUTABLE_NAME Hive )
set( CUSTOM_URL_SCHEME "gcs" )
set( INSTALLER_APP_ID "68ad7005-8eee-49c9-95ce-9eed97e5b347" )
# http://stackoverflow.com/a/18369825
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
message(FATAL_ERROR "GCC version must be at least 4.8!")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3)
message(FATAL_ERROR "Clang version must be at least 3.3!")
endif()
endif()
list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" )
set(CMAKE_EXPORT_COMPILE_COMMANDS "ON")
......@@ -74,27 +69,25 @@ OPTION( ENABLE_MIRA "Build source with MIRA (ON OR OFF)" OFF )
MESSAGE( STATUS "ENABLE_MIRA: ${ENABLE_MIRA}" )
if( ENABLE_MIRA )
MESSAGE( STATUS " " )
MESSAGE( STATUS " CONFIGURING FOR MIRA " )
MESSAGE( FATAL_ERROR " NOTE: MIRA HAS BEEN REMOVED " )
MESSAGE( STATUS " " )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_MIRA" )
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_MIRA" )
endif()
OPTION( LOW_MEMORY_NODE "Build source for low memory node (ON OR OFF)" OFF )
OPTION( LOW_MEMORY_NODE "Build source for low memory node (ON OR OFF)" ON )
MESSAGE( STATUS "LOW_MEMORY_NODE: ${LOW_MEMORY_NODE}" )
MESSAGE( STATUS " " )
if( LOW_MEMORY_NODE )
MESSAGE( STATUS " " )
MESSAGE( STATUS " CONFIGURING FOR LOW MEMORY NODE " )
MESSAGE( STATUS " " )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIS_LOW_MEM" )
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DIS_LOW_MEM" )
MESSAGE( WARNING " NOTE: LOW MEMORY NODE OPTION HAS BEEN DEPRECATED " )
else()
MESSAGE( FATAL_ERROR " NOTE: LOW MEMORY NODE OPTION HAS BEEN DEPRECATED " )
endif()
MESSAGE( STATUS " " )
OPTION (COLLECT_ACCOUNT_METADATA "Allows to enable/disable storing account metadata" ON)
MESSAGE( STATUS "COLLECT_ACCOUNT_METADATA: ${COLLECT_ACCOUNT_METADATA}" )
if( COLLECT_ACCOUNT_METADATA )
OPTION( STORE_ACCOUNT_METADATA "Keep the json_metadata for accounts (ON OR OFF)" ON )
MESSAGE( STATUS "STORE_ACCOUNT_METADATA: ${STORE_ACCOUNT_METADATA}" )
if( STORE_ACCOUNT_METADATA )
MESSAGE( STATUS " " )
MESSAGE( STATUS " CONFIGURING FOR ACCOUNT METADATA SUPPORT " )
MESSAGE( STATUS " CONFIGURING TO INDEX ACCOUNT METADATA " )
MESSAGE( STATUS " " )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOLLECT_ACCOUNT_METADATA" )
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DCOLLECT_ACCOUNT_METADATA" )
......@@ -103,17 +96,9 @@ endif()
OPTION( SUPPORT_COMMENT_CONTENT "Build source with enabled comment content support (ON OR OFF)" OFF )
MESSAGE( STATUS "SUPPORT_COMMENT_CONTENT: ${SUPPORT_COMMENT_CONTENT}" )
IF (SUPPORT_COMMENT_CONTENT)
if( LOW_MEMORY_NODE )
MESSAGE( WARNING "Ignoring SUPPORT_COMMENT_CONTENT setting due to enabled LOW_MEMORY_NODE")
ELSE()
MESSAGE( STATUS " " )
MESSAGE( STATUS " CONFIGURING FOR COMMENT_CONTENT_SUPPORT " )
MESSAGE( STATUS " " )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTORE_COMMENT_CONTENT" )
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSTORE_COMMENT_CONTENT" )
endif()
ELSE()
MESSAGE( STATUS " CONFIGURING to skip COMMENT_CONTENT objects " )
MESSAGE( STATUS " " )
MESSAGE( FATAL_ERROR " COMMENT_CONTENT_SUPPORT HAS BEEN REMOVED! " )
MESSAGE( STATUS " " )
ENDIF()
OPTION( CHAINBASE_CHECK_LOCKING "Check locks in chainbase (ON or OFF)" ON )
......@@ -126,8 +111,8 @@ endif()
OPTION( CLEAR_VOTES "Build source to clear old votes from memory" ON )
if( CLEAR_VOTES )
MESSAGE( STATUS " CONFIGURING TO CLEAR OLD VOTES FROM MEMORY" )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCLEAR_VOTES" )
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DCLEAR_VOTES" )
else()
MESSAGE( FATAL_ERROR " NOTE: CLEAR OLD VOTES OPTION HAS BEEN DEPRECATED" )
endif()
OPTION( SKIP_BY_TX_ID "Skip ordering operation history by transaction id (ON or OFF)" OFF )
......@@ -144,31 +129,50 @@ if( HIVE_STATIC_BUILD AND ( ( MSVC AND NOT MINGW ) OR APPLE ) )
endif()
MESSAGE( STATUS "HIVE_STATIC_BUILD: ${HIVE_STATIC_BUILD}" )
SET( HIVE_LINT_LEVEL "OFF" CACHE STRING "Lint level during Hive build (FULL, HIGH, LOW, OFF)" )
SET( HIVE_LINT "OFF" CACHE STRING "Enable linting with clang-tidy during compilation" )
find_program(
CLANG_TIDY_EXE
NAMES "clang-tidy"
DOC "Path to clain-tidy executable"
)
SET( CLANG_TIDY_IGNORED
"-fuchsia-default-arguments\
,-hicpp-*\
,-cert-err60-cpp\
,-llvm-namespace-comment\
,-cert-err09-cpp\
,-cert-err61-cpp\
,-fuchsia-overloaded-operator\
,-misc-throw-by-value-catch-by-reference\
,-misc-unused-parameters\
,-clang-analyzer-core.uninitialized.Assign\
,-llvm-include-order\
,-clang-diagnostic-unused-lambda-capture\
,-misc-macro-parentheses\
,-boost-use-to-string\
,-misc-lambda-function-name\
,-cert-err58-cpp\
,-cert-err34-c\
,-cppcoreguidelines-*\
,-modernize-*\
,-clang-diagnostic-#pragma-messages\
,-google-*\
,-readability-*"
)
if( NOT CLANG_TIDY_EXE )
message( STATUS "clang-tidy not found" )
elseif( VERSION LESS 3.6 )
messgae( STATUS "clang-tidy found but only supported with CMake version >= 3.6" )
else()
message( STATUS "clany-tidy found: ${CLANG_TIDY_EXE}" )
if( "${HIVE_LINT_LEVEL}" STREQUAL "FULL" )
message( STATUS "Linting level set to: FULL" )
set( DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-checks='*'" )
elseif( "${HIVE_LINT_LEVEL}" STREQUAL "HIGH" )
message( STATUS "Linting level set to: HIGH" )
set( DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-checks='boost-use-to-string,clang-analyzer-*,cppcoreguidelines-*,llvm-*,misc-*,performance-*,readability-*'" )
elseif( "${HIVE_LINT_LEVEL}" STREQUAL "LOW" )
message( STATUS "Linting level set to: LOW" )
set( DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-checks='clang-analyzer-*'" )
if( HIVE_LINT )
message( STATUS "Linting enabled" )
set( DO_CLANG_TIDY ${CLANG_TIDY_EXE};-checks=*,${CLANG_TIDY_IGNORED};--warnings-as-errors=* )
else()
unset( CLANG_TIDY_EXE )
message( STATUS "Linting level set to: OFF" )
message( STATUS "Linting disabled" )
endif()
endif( NOT CLANG_TIDY_EXE )
......@@ -178,9 +182,14 @@ IF( WIN32 )
set(BOOST_ALL_DYN_LINK OFF) # force dynamic linking for all libraries
ENDIF(WIN32)
cmake_policy(SET CMP0057 NEW)
FIND_PACKAGE(Boost 1.58 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
if( NOT( Boost_VERSION LESS 106900 ) )
if( NOT Boost_VERSION_MACRO ) # FindBoost in CMake version >=3.15 reports Boost_VERSION in x.y.z format
set( Boost_VERSION_MACRO Boost_VERSION )
endif()
if( NOT( Boost_VERSION_MACRO LESS 106900 ) )
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
endif()
......@@ -221,7 +230,7 @@ if( WIN32 )
SET(TCL_LIBRARY ${TCL_LIBS})
elseif( MINGW )
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fpermissive -msse4.2 -Wa,-mbig-obj")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -msse4.2 -Wa,-mbig-obj")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3")
# Optimization flag apparently needed to get rid of "File too big" assembler errors when compiling in Debug mode
# See: https://stackoverflow.com/questions/14125007/gcc-string-table-overflow-error-during-compilation/14601779#29479701
......@@ -242,11 +251,11 @@ else( WIN32 ) # Apple AND Linux
if( APPLE )
# Apple Specific Options Here
message( STATUS "Configuring Hive on OS X" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -stdlib=libc++ -Wall -Wno-conversion -Wno-deprecated-declarations" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -stdlib=libc++ -Wall -Wno-conversion -Wno-deprecated-declarations" )
else( APPLE )
# Linux Specific Options Here
message( STATUS "Configuring Hive on Linux" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall" )
set( rt_library rt )
set( pthread_library pthread)
if ( NOT DEFINED crypto_library )
......@@ -286,7 +295,6 @@ endif()
# fc/src/compress/miniz.c breaks strict aliasing. The Linux kernel builds with no strict aliasing
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing -Werror -DBOOST_THREAD_DONT_PROVIDE_PROMISE_LAZY" )
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing -DBOOST_THREAD_DONT_PROVIDE_PROMISE_LAZY" )
# -Werror
# external_plugins needs to be compiled first because libraries/app depends on HIVE_EXTERNAL_PLUGINS being fully populated
add_subdirectory( external_plugins )
......@@ -309,7 +317,7 @@ set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install)
SET(CPACK_PACKAGE_DIRECTORY "${CMAKE_INSTALL_PREFIX}")
set(CPACK_PACKAGE_NAME "hive")
set(CPACK_PACKAGE_VENDOR "Steemit, Inc.")
set(CPACK_PACKAGE_VENDOR "Hive Community")
set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
......@@ -356,14 +364,11 @@ else()
MESSAGE( STATUS "\n\n CONFIGURED FOR NO SUPPORT OF SMT \n\n" )
endif()
if( ENABLE_MIRA )
MESSAGE( STATUS "\n\n CONFIGURED FOR MIRA \n\n" )
else()
MESSAGE( STATUS "\n\n CONFIGURED FOR BMIC MMAP \n\n" )
endif()
if( LOW_MEMORY_NODE )
MESSAGE( STATUS "\n\n CONFIGURED FOR LOW MEMORY NODE \n\n" )
if( STORE_ACCOUNT_METADATA )
MESSAGE( STATUS "\n\n BUT STILL STORING ACCOUNT METADATA \n\n" )
endif()
else()
MESSAGE( STATUS "\n\n CONFIGURED FOR FULL NODE \n\n" )
endif()
......
#Usage: DOCKER_BUILDKIT=1 docker build --no-cache --target=testnet_node_builder .
ARG LOW_MEMORY_NODE=ON
ARG CLEAR_VOTES=ON
ARG BUILD_HIVE_TESTNET=OFF
ARG ENABLE_MIRA=OFF
ARG HIVE_LINT=OFF
FROM registry.gitlab.syncad.com/hive/hive/hive-baseenv:latest AS builder
ENV src_dir="/usr/local/src/hive"
......@@ -21,7 +19,7 @@ FROM builder AS consensus_node_builder
RUN \
cd ${src_dir} && \
${src_dir}/ciscripts/build.sh "ON" "ON" "OFF" "OFF"
${src_dir}/ciscripts/build.sh "OFF" "ON"
###################################################################################################
## CONSENSUS NODE CONFIGURATION ##
......@@ -48,60 +46,22 @@ EXPOSE 8090
EXPOSE 2001
CMD "${install_base_dir}/consensus/hived.run"
###################################################################################################
## FAT NODE BUILD ##
###################################################################################################
FROM builder AS fat_node_builder
RUN \
cd ${src_dir} && \
${src_dir}/ciscripts/build.sh "OFF" "OFF" "OFF" "ON"
###################################################################################################
## FAT NODE CONFIGURATION ##
###################################################################################################
FROM builder AS fat_node
ARG TRACKED_ACCOUNT_NAME
ENV TRACKED_ACCOUNT_NAME=${TRACKED_ACCOUNT_NAME}
ARG USE_PUBLIC_BLOCKLOG
ENV USE_PUBLIC_BLOCKLOG=${USE_PUBLIC_BLOCKLOG}
WORKDIR "${install_base_dir}/fat-node"
# Get all needed files from previous stage, and throw away unneeded rest(like objects)
COPY --from=fat_node_builder ${src_dir}/build/install-root/ ${src_dir}/contrib/hived.run ./
COPY --from=fat_node_builder ${src_dir}/contrib/config-for-docker.ini datadir/config.ini
RUN \
ls -la && \
chmod +x hived.run
# rpc service :
EXPOSE 8090
# p2p service :
EXPOSE 2001
CMD "${install_base_dir}/fat-node/hived.run"
###################################################################################################
## GENERAL NODE BUILD ##
###################################################################################################
FROM builder AS general_node_builder
ARG LOW_MEMORY_NODE
ARG CLEAR_VOTES
ARG BUILD_HIVE_TESTNET
ARG ENABLE_MIRA
ARG HIVE_LINT
ENV LOW_MEMORY_NODE=${LOW_MEMORY_NODE}
ENV CLEAR_VOTES=${CLEAR_VOTES}
ENV BUILD_HIVE_TESTNET=${BUILD_HIVE_TESTNET}
ENV ENABLE_MIRA=${ENABLE_MIRA}
ENV HIVE_LINT=${HIVE_LINT}
RUN \
cd ${src_dir} && \
${src_dir}/ciscripts/build.sh ${LOW_MEMORY_NODE} ${CLEAR_VOTES} ${BUILD_HIVE_TESTNET} ${ENABLE_MIRA}
${src_dir}/ciscripts/build.sh ${BUILD_HIVE_TESTNET} ${HIVE_LINT}
###################################################################################################
## GENERAL NODE CONFIGURATION ##
......@@ -134,19 +94,17 @@ CMD "${install_base_dir}/hive-node/hived.run"
FROM builder AS testnet_node_builder
ARG LOW_MEMORY_NODE=OFF
ARG CLEAR_VOTES=OFF
ARG ENABLE_MIRA=OFF
ARG HIVE_LINT=ON
ENV LOW_MEMORY_NODE=${LOW_MEMORY_NODE}
ENV CLEAR_VOTES=${CLEAR_VOTES}
ENV BUILD_HIVE_TESTNET="ON"
ENV ENABLE_MIRA=${ENABLE_MIRA}
ENV HIVE_LINT=${HIVE_LINT}
RUN \
cd ${src_dir} && \
${src_dir}/ciscripts/build.sh ${LOW_MEMORY_NODE} ${CLEAR_VOTES} ${BUILD_HIVE_TESTNET} ${ENABLE_MIRA} && \
apt-get update && \
apt-get install -y clang && \
apt-get install -y clang-tidy && \
${src_dir}/ciscripts/build.sh ${BUILD_HIVE_TESTNET} ${HIVE_LINT} && \
apt-get install -y screen && \
pip3 install -U secp256k1prp && \
git clone https://gitlab.syncad.com/hive/beem.git && \
......
......@@ -39,6 +39,8 @@ RUN \
libbz2-dev \
liblz4-dev \
libzstd-dev \
clang \
clang-tidy \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
......
......@@ -54,27 +54,15 @@ We **strongly** recommend using one of our pre-built Docker images or using Dock
But if you would still like to build from source, we also have [build instructions](doc/building.md) for Linux (Ubuntu LTS) and macOS.
## Dockerized P2P Node
## Dockerized Consensus Node
To run a p2p node (ca. 2GB of memory is required at the moment):
To run a Hive node (ca. 16GB of memory is required at the moment):
docker run \
-d -p 2001:2001 -p 8090:8090 --name hived-default \
openhive-network/hive
-d -p 2001:2001 -p 8090:8090 --name hived \
hiveio/hive
docker logs -f hived-default # follow along
## Dockerized Full Node
To run a node with *all* the data (e.g. for supporting a content website)
ca. 14GB of memory, and growing, is required:
docker run \
--env USE_WAY_TOO_MUCH_RAM=1 --env USE_FULL_WEB_NODE=1 \
-d -p 2001:2001 -p 8090:8090 --name hived-full \
openhive-network/hive
docker logs -f hived-full
docker logs -f hived # follow along
## CLI Wallet
......@@ -89,7 +77,7 @@ on how to use lcov to check code test coverage.
## Config File
Run `hived` once to generate a data directory and config file. The default location is `witness_node_data_dir`. Kill `hived`. It won't do anything without seed nodes. If you want to modify the config to your liking, we have two example configs used in the docker images. ( [consensus node](contrib/config-for-docker.ini), [full node](contrib/fullnode.config.ini) ) All options will be present in the default config file and there may be more options needing to be changed from the docker configs (some of the options actually used in images are configured via command line).
Run `hived` once to generate a data directory and config file. The default data directory location is `~/.hived`. Kill `hived`. If you want to modify the config to your liking, we have [example config](contrib/config-for-docker.ini) used in the docker image. All options will be present in the default config file and there may be more options needing to be changed from the docker configs (some of the options actually used in images are configured via command line).
## Seed Nodes
......@@ -100,39 +88,10 @@ This same file is baked into the docker images and can be overridden by
setting `HIVED_SEED_NODES` in the container environment at `docker run`
time to a whitespace delimited list of seed nodes (with port).
## Environment variables
There are quite a few environment variables that can be set to run hived in different ways:
* `USE_WAY_TOO_MUCH_RAM` - if set to true, hived starts a 'full node'
* `USE_FULL_WEB_NODE` - if set to true, a default config file will be used that enables a full set of API's and associated plugins.
* `USE_NGINX_FRONTEND` - if set to true, this will enable an NGINX reverse proxy in front of hived that proxies WebSocket requests to hived. This will also enable a custom healthcheck at the path '/health' that lists how many seconds away from current blockchain time your node is. It will return a '200' if it's less than 60 seconds away from being synced.
* `USE_MULTICORE_READONLY` - if set to true, this will enable hived in multiple reader mode to take advantage of multiple cores (if available). Read requests are handled by the read-only nodes and write requests are forwarded back to the single 'writer' node automatically. NGINX load balances all requests to the reader nodes, 4 per available core. This setting is still considered experimental and may have trouble with some API calls until further development is completed.
* `HOME` - set this to the path where you want hived to store it's data files (block log, shared memory, config file, etc). By default `/var/lib/hived` is used and exists inside the docker container. If you want to use a different mount point (like a ramdisk, or a different drive) then you may want to set this variable to map the volume to your docker container.
## PaaS mode
Hived now supports a PaaS mode (platform as a service) that currently works with Amazon's Elastic Beanstalk service. It can be launched using the following environment variables:
* `USE_PAAS` - if set to true, hived will launch in a format that works with AWS EB. Containers will exit upon failure so that they can be relaunched automatically by ECS. This mode assumes `USE_WAY_TOO_MUCH_RAM` and `USE_FULL_WEB_NODE`, they do not need to be also set.
* `S3_BUCKET` - set this to the name of the S3 bucket where you will store shared memory files for hived in Amazon S3. They will be stored compressed in bz2 format with the file name `blockchain-$VERSION-latest.tar.bz2`, where $VERSION is the release number followed by the git short commit hash stored in each docker image at `/etc/hivedversion`.
* `SYNC_TO_S3` - if set to true, the node will function to only generate shared memory files and upload them to the specified S3 bucket. This makes fast deployments and autoscaling for hived possible.