Docker altnets (#708)
* Updated to check the boost SHA256 when downloading * Fixed invalid shell option * Allow the user to request a minimal build of Boost * Ensure boost build script exits on error * Removed apparently unused "mkdir" * Updated Docker build for node to support altnets * Allow user-supplied arguments to "docker build" * Updated Docker auto deploy to build a live and beta image for each tag * Print the correct image name when building the docker image * Corrected typo for the test network
This commit is contained in:
parent
6051604c10
commit
34b07f4ea2
8 changed files with 233 additions and 31 deletions
|
|
@ -1,8 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
if [ "$#" -lt 2 ]; then
|
||||||
|
echo 'Usage: build-docker-image.sh <dockerFile> <dockerImageTag> [<dockerBuildArgs>...]' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
dockerFile="$1"
|
||||||
|
dockerTag="$2"
|
||||||
|
shift; shift
|
||||||
|
|
||||||
scripts="$(dirname "$0")"
|
scripts="$(dirname "$0")"
|
||||||
|
|
||||||
"$scripts"/custom-timeout.sh 20 docker pull "$2" || true
|
"$scripts"/custom-timeout.sh 20 docker pull "${dockerTag}" || true
|
||||||
echo "Building $2"
|
echo "Building $dockerTag"
|
||||||
"$scripts"/custom-timeout.sh 30 docker build -f "$1" -t "$2" --cache-from "$2" .
|
"$scripts"/custom-timeout.sh 30 docker build "$@" -f "${dockerFile}" -t "${dockerTag}" --cache-from "${dockerTag}" .
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,23 @@ elif [ -n "$TRAVIS_TAG" ]; then
|
||||||
tags+=("$TRAVIS_TAG" latest)
|
tags+=("$TRAVIS_TAG" latest)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ci/build-docker-image.sh docker/node/Dockerfile nanocurrency/nano
|
for network in live beta; do
|
||||||
|
if [ "${network}" = 'live' ]; then
|
||||||
|
network_tag_suffix=''
|
||||||
|
else
|
||||||
|
network_tag_suffix="-${network}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker_image_name="nanocurrency/nano${network_tag_suffix}"
|
||||||
|
|
||||||
|
ci/build-docker-image.sh docker/node/Dockerfile "$docker_image_name" --build-arg NETWORK="${network}"
|
||||||
for tag in "${tags[@]}"; do
|
for tag in "${tags[@]}"; do
|
||||||
# Sanitize docker tag
|
# Sanitize docker tag
|
||||||
# https://docs.docker.com/engine/reference/commandline/tag/
|
# https://docs.docker.com/engine/reference/commandline/tag/
|
||||||
tag="$(printf '%s' "$tag" | tr -c '[a-z][A-Z][0-9]_.-' -)"
|
tag="$(printf '%s' "$tag" | tr -c '[a-z][A-Z][0-9]_.-' -)"
|
||||||
if [ "$tag" != "latest" ]; then
|
if [ "$tag" != "latest" ]; then
|
||||||
docker tag nanocurrency/nano nanocurrency/nano:"$tag"
|
docker tag "$docker_image_name" "${docker_image_name}:$tag"
|
||||||
fi
|
fi
|
||||||
"$scripts"/custom-timeout.sh 30 docker push nanocurrency/nano:"$tag"
|
"$scripts"/custom-timeout.sh 30 docker push "${docker_image_name}:$tag"
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,31 @@
|
||||||
FROM ubuntu:16.04
|
FROM ubuntu:16.04
|
||||||
|
|
||||||
ENV BOOST_BASENAME=boost_1_66_0 \
|
ARG NETWORK=live
|
||||||
BOOST_ROOT=/tmp/boost_install \
|
|
||||||
BOOST_URL=https://netix.dl.sourceforge.net/project/boost/boost/1.66.0/boost_1_66_0.tar.gz
|
ENV BOOST_ROOT=/tmp/boost_install
|
||||||
|
|
||||||
|
ADD ci /tmp/ci
|
||||||
|
|
||||||
RUN apt-get update -qq && apt-get install -yqq \
|
RUN apt-get update -qq && apt-get install -yqq \
|
||||||
build-essential \
|
build-essential \
|
||||||
cmake \
|
cmake \
|
||||||
g++ \
|
g++ \
|
||||||
wget && \
|
wget && \
|
||||||
wget -qO ${BOOST_BASENAME}.tar.gz ${BOOST_URL} && \
|
/tmp/ci/bootstrap_boost.sh -m
|
||||||
tar xzf ${BOOST_BASENAME}.tar.gz && \
|
|
||||||
cd ${BOOST_BASENAME} && \
|
|
||||||
./bootstrap.sh && \
|
|
||||||
./b2 -d0 --prefix=${BOOST_ROOT} link=static install && \
|
|
||||||
rm -rf ${BOOST_BASENAME} && \
|
|
||||||
rm -f ${BOOST_BASENAME}.tar.gz && \
|
|
||||||
cd .. && \
|
|
||||||
mkdir /usr/share/raiblocks/
|
|
||||||
|
|
||||||
ADD ./ /tmp/src
|
ADD ./ /tmp/src
|
||||||
|
|
||||||
RUN mkdir /tmp/build && \
|
RUN mkdir /tmp/build && \
|
||||||
cd /tmp/build && \
|
cd /tmp/build && \
|
||||||
cmake /tmp/src -DBOOST_ROOT=${BOOST_ROOT} && \
|
cmake /tmp/src -DBOOST_ROOT=${BOOST_ROOT} -DACTIVE_NETWORK=rai_${NETWORK}_network && \
|
||||||
make rai_node && \
|
make rai_node && \
|
||||||
cd ..
|
cd .. && \
|
||||||
|
echo ${NETWORK} > /etc/nano-network
|
||||||
|
|
||||||
FROM ubuntu:16.04
|
FROM ubuntu:16.04
|
||||||
COPY --from=0 /tmp/build/rai_node /usr/bin
|
COPY --from=0 /tmp/build/rai_node /usr/bin
|
||||||
|
COPY --from=0 /etc/nano-network /etc
|
||||||
COPY docker/node/entry.sh /entry.sh
|
COPY docker/node/entry.sh /entry.sh
|
||||||
COPY docker/node/config.json /usr/share/raiblocks/config.json
|
COPY docker/node/config /usr/share/raiblocks/config
|
||||||
RUN chmod +x /entry.sh
|
RUN chmod +x /entry.sh
|
||||||
CMD ["/bin/bash", "/entry.sh"]
|
CMD ["/bin/bash", "/entry.sh"]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,42 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
network='live'
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
echo 'build.sh [-h] [-n {live|beta|test}]'
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts 'hn:' OPT; do
|
||||||
|
case "${OPT}" in
|
||||||
|
h)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
n)
|
||||||
|
network="${OPTARG}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
print_usage >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
case "${network}" in
|
||||||
|
live)
|
||||||
|
network_tag=''
|
||||||
|
;;
|
||||||
|
test|beta)
|
||||||
|
network_tag="-${network}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid network: ${network}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
REPO_ROOT=`git rev-parse --show-toplevel`
|
REPO_ROOT=`git rev-parse --show-toplevel`
|
||||||
COMMIT_SHA=`git rev-parse --short HEAD`
|
COMMIT_SHA=`git rev-parse --short HEAD`
|
||||||
pushd $REPO_ROOT
|
pushd $REPO_ROOT
|
||||||
docker build -f docker/node/Dockerfile -t raiblocks-node:latest .
|
docker build --build-arg NETWORK="${network}" -f docker/node/Dockerfile -t raiblocks-node${network_tag}:latest .
|
||||||
popd
|
popd
|
||||||
|
|
|
||||||
67
docker/node/config/beta.json
Normal file
67
docker/node/config/beta.json
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
{
|
||||||
|
"version": "2",
|
||||||
|
"rpc_enable": "true",
|
||||||
|
"rpc": {
|
||||||
|
"address": "::ffff:0.0.0.0",
|
||||||
|
"port": "7076",
|
||||||
|
"enable_control": "true",
|
||||||
|
"frontier_request_limit": "16384",
|
||||||
|
"chain_request_limit": "16384"
|
||||||
|
},
|
||||||
|
"node": {
|
||||||
|
"version": "8",
|
||||||
|
"peering_port": "7075",
|
||||||
|
"bootstrap_fraction_numerator": "1",
|
||||||
|
"receive_minimum": "1000000000000000000000000",
|
||||||
|
"logging": {
|
||||||
|
"version": "2",
|
||||||
|
"ledger": "false",
|
||||||
|
"ledger_duplicate": "false",
|
||||||
|
"vote": "false",
|
||||||
|
"network": "true",
|
||||||
|
"network_message": "false",
|
||||||
|
"network_publish": "false",
|
||||||
|
"network_packet": "false",
|
||||||
|
"network_keepalive": "false",
|
||||||
|
"node_lifetime_tracing": "false",
|
||||||
|
"insufficient_work": "true",
|
||||||
|
"log_rpc": "true",
|
||||||
|
"bulk_pull": "false",
|
||||||
|
"work_generation_time": "true",
|
||||||
|
"log_to_cerr": "false",
|
||||||
|
"max_size": "16777216",
|
||||||
|
"rotation_size": "4194304",
|
||||||
|
"flush": "false"
|
||||||
|
},
|
||||||
|
"work_peers": "",
|
||||||
|
"preconfigured_peers": [
|
||||||
|
"rai-beta.raiblocks.net"
|
||||||
|
],
|
||||||
|
"preconfigured_representatives": [
|
||||||
|
"xrb_3arg3asgtigae3xckabaaewkx3bzsh7nwz7jkmjos79ihyaxwphhm6qgjps4",
|
||||||
|
"xrb_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou",
|
||||||
|
"xrb_1q3hqecaw15cjt7thbtxu3pbzr1eihtzzpzxguoc37bj1wc5ffoh7w74gi6p",
|
||||||
|
"xrb_3dmtrrws3pocycmbqwawk6xs7446qxa36fcncush4s1pejk16ksbmakis78m",
|
||||||
|
"xrb_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
|
||||||
|
"xrb_1awsn43we17c1oshdru4azeqjz9wii41dy8npubm4rg11so7dx3jtqgoeahy",
|
||||||
|
"xrb_1anrzcuwe64rwxzcco8dkhpyxpi8kd7zsjc1oeimpc3ppca4mrjtwnqposrs",
|
||||||
|
"xrb_1hza3f7wiiqa7ig3jczyxj5yo86yegcmqk3criaz838j91sxcckpfhbhhra1"
|
||||||
|
],
|
||||||
|
"inactive_supply": "0",
|
||||||
|
"password_fanout": "1024",
|
||||||
|
"io_threads": "4",
|
||||||
|
"work_threads": "4",
|
||||||
|
"enable_voting": "true",
|
||||||
|
"bootstrap_connections": "16",
|
||||||
|
"callback_address": "",
|
||||||
|
"callback_port": "0",
|
||||||
|
"callback_target": "",
|
||||||
|
"lmdb_max_dbs": "128"
|
||||||
|
},
|
||||||
|
"opencl_enable": "false",
|
||||||
|
"opencl": {
|
||||||
|
"platform": "0",
|
||||||
|
"device": "0",
|
||||||
|
"threads": "1048576"
|
||||||
|
}
|
||||||
|
}
|
||||||
67
docker/node/config/test.json
Normal file
67
docker/node/config/test.json
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
{
|
||||||
|
"version": "2",
|
||||||
|
"rpc_enable": "true",
|
||||||
|
"rpc": {
|
||||||
|
"address": "::ffff:0.0.0.0",
|
||||||
|
"port": "7076",
|
||||||
|
"enable_control": "true",
|
||||||
|
"frontier_request_limit": "16384",
|
||||||
|
"chain_request_limit": "16384"
|
||||||
|
},
|
||||||
|
"node": {
|
||||||
|
"version": "8",
|
||||||
|
"peering_port": "7075",
|
||||||
|
"bootstrap_fraction_numerator": "1",
|
||||||
|
"receive_minimum": "1000000000000000000000000",
|
||||||
|
"logging": {
|
||||||
|
"version": "2",
|
||||||
|
"ledger": "false",
|
||||||
|
"ledger_duplicate": "false",
|
||||||
|
"vote": "false",
|
||||||
|
"network": "true",
|
||||||
|
"network_message": "false",
|
||||||
|
"network_publish": "false",
|
||||||
|
"network_packet": "false",
|
||||||
|
"network_keepalive": "false",
|
||||||
|
"node_lifetime_tracing": "false",
|
||||||
|
"insufficient_work": "true",
|
||||||
|
"log_rpc": "true",
|
||||||
|
"bulk_pull": "false",
|
||||||
|
"work_generation_time": "true",
|
||||||
|
"log_to_cerr": "false",
|
||||||
|
"max_size": "16777216",
|
||||||
|
"rotation_size": "4194304",
|
||||||
|
"flush": "false"
|
||||||
|
},
|
||||||
|
"work_peers": "",
|
||||||
|
"preconfigured_peers": [
|
||||||
|
"rai-test.raiblocks.net"
|
||||||
|
],
|
||||||
|
"preconfigured_representatives": [
|
||||||
|
"xrb_3arg3asgtigae3xckabaaewkx3bzsh7nwz7jkmjos79ihyaxwphhm6qgjps4",
|
||||||
|
"xrb_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou",
|
||||||
|
"xrb_1q3hqecaw15cjt7thbtxu3pbzr1eihtzzpzxguoc37bj1wc5ffoh7w74gi6p",
|
||||||
|
"xrb_3dmtrrws3pocycmbqwawk6xs7446qxa36fcncush4s1pejk16ksbmakis78m",
|
||||||
|
"xrb_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
|
||||||
|
"xrb_1awsn43we17c1oshdru4azeqjz9wii41dy8npubm4rg11so7dx3jtqgoeahy",
|
||||||
|
"xrb_1anrzcuwe64rwxzcco8dkhpyxpi8kd7zsjc1oeimpc3ppca4mrjtwnqposrs",
|
||||||
|
"xrb_1hza3f7wiiqa7ig3jczyxj5yo86yegcmqk3criaz838j91sxcckpfhbhhra1"
|
||||||
|
],
|
||||||
|
"inactive_supply": "0",
|
||||||
|
"password_fanout": "1024",
|
||||||
|
"io_threads": "4",
|
||||||
|
"work_threads": "4",
|
||||||
|
"enable_voting": "true",
|
||||||
|
"bootstrap_connections": "16",
|
||||||
|
"callback_address": "",
|
||||||
|
"callback_port": "0",
|
||||||
|
"callback_target": "",
|
||||||
|
"lmdb_max_dbs": "128"
|
||||||
|
},
|
||||||
|
"opencl_enable": "false",
|
||||||
|
"opencl": {
|
||||||
|
"platform": "0",
|
||||||
|
"device": "0",
|
||||||
|
"threads": "1048576"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,10 +1,27 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
mkdir -p ~/RaiBlocks
|
network="$(cat /etc/nano-network)"
|
||||||
if [ ! -f ~/RaiBlocks/config.json ]; then
|
case "${network}" in
|
||||||
|
live|'')
|
||||||
|
network='live'
|
||||||
|
dirSuffix=''
|
||||||
|
;;
|
||||||
|
beta)
|
||||||
|
dirSuffix='Beta'
|
||||||
|
;;
|
||||||
|
test)
|
||||||
|
dirSuffix='Test'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
nanodir="${HOME}/RaiBlocks${dirSuffix}"
|
||||||
|
mkdir -p "${nanodir}"
|
||||||
|
if [ ! -f "${nanodir}/config.json" ]; then
|
||||||
echo "Config File not found, adding default."
|
echo "Config File not found, adding default."
|
||||||
cp /usr/share/raiblocks/config.json ~/RaiBlocks/
|
cp "/usr/share/raiblocks/config/${network}.json" "${nanodir}/config.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
/usr/bin/rai_node --daemon
|
/usr/bin/rai_node --daemon
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue