Docker: update docker configuration and fix wallet names

This commit is contained in:
Vincent Botbol 2018-06-18 16:50:23 +02:00 committed by Grégoire Henry
parent 4c65317681
commit cf36510431
7 changed files with 28 additions and 21 deletions

View File

@ -59,6 +59,7 @@ services:
links: links:
- node - node
volumes: volumes:
- node_data:/var/run/tezos/node:ro
- client_data:/var/run/tezos/client - client_data:/var/run/tezos/client
restart: on-failure restart: on-failure

View File

@ -33,7 +33,8 @@ cp -a "$build_dir"/hidapi-$hidapi_version-r0.apk \
mkdir -p "$tmp_dir"/bin mkdir -p "$tmp_dir"/bin
mkdir -p "$tmp_dir"/scripts mkdir -p "$tmp_dir"/scripts
container=$(docker create $build_image_name) container=$(docker create $build_image_name)
for bin in tezos-client tezos-admin-client tezos-node; do for bin in tezos-client tezos-admin-client tezos-node \
tezos-alpha-baker tezos-alpha-endorser tezos-alpha-accuser; do
docker cp -L $container:/home/opam/tezos/$bin "$tmp_dir"/bin docker cp -L $container:/home/opam/tezos/$bin "$tmp_dir"/bin
done done
cp -a "$script_dir"/docker/entrypoint.sh "$tmp_dir"/bin/ cp -a "$script_dir"/docker/entrypoint.sh "$tmp_dir"/bin/

View File

@ -43,18 +43,18 @@ wait_for_the_node_to_be_bootstraped() {
launch_node() { launch_node() {
mkdir -p "$node_dir" mkdir -p "$node_data_dir"
if [ ! -f "$node_dir/config.json" ]; then if [ ! -f "$node_data_dir/config.json" ]; then
echo "Configuring the node..." echo "Configuring the node..."
"$node" config init \ "$node" config init \
--data-dir "$node_dir" \ --data-dir "$node_data_dir" \
--rpc-addr ":$NODE_RPC_PORT" \ --rpc-addr ":$NODE_RPC_PORT" \
"$@" "$@"
else else
echo "Updating the node configuration..." echo "Updating the node configuration..."
"$node" config update \ "$node" config update \
--data-dir "$node_dir" \ --data-dir "$node_data_dir" \
--rpc-addr ":$NODE_RPC_PORT" \ --rpc-addr ":$NODE_RPC_PORT" \
"$@" "$@"
fi fi
@ -76,16 +76,15 @@ launch_node() {
fi fi
if [ "$local_data_version" != "$image_version" ]; then if [ "$local_data_version" != "$image_version" ]; then
echo "Removing outdated chain data..." echo "Removing outdated chain data..."
if [ -f "$node_dir/identities.json" ]; then \ if [ -f "$node_data_dir/identities.json" ]; then \
mv "$node_dir/identities.json" /tmp mv "$node_data_dir/identities.json" /tmp
fi fi
rm -rf "$node_dir"/* rm -rf "$node_dir"/*
rm -rf "$client_dir/blockss" rm -rf "$client_dir/baking"
rm -rf "$client_dir/noncess" rm -rf "$client_dir/nonces"
rm -rf "$client_dir/endorsementss" rm -rf "$client_dir/endorsements"
rm -rf "$client_dir/endorsed_levels"
if [ -f "/tmp/identities.json" ]; then \ if [ -f "/tmp/identities.json" ]; then \
mv /tmp/identities.json "$node_dir/" mv /tmp/identities.json "$node_data_dir/"
fi fi
cp "/usr/local/share/tezos/alphanet_version" \ cp "/usr/local/share/tezos/alphanet_version" \
"$node_dir/alphanet_version" "$node_dir/alphanet_version"
@ -94,28 +93,32 @@ launch_node() {
# Generate a new identity if not present # Generate a new identity if not present
if [ ! -f "$node_dir/identity.json" ]; then if [ ! -f "$node_data_dir/identity.json" ]; then
echo "Generating a new node identity..." echo "Generating a new node identity..."
"$node" identity generate 24. \ "$node" identity generate 24. \
--data-dir "$node_dir" --data-dir "$node_data_dir"
fi fi
configure_client configure_client
# Launching the node # Launching the node
exec "$node" run --data-dir "$node_dir" exec "$node" run --data-dir "$node_data_dir"
} }
launch_baker() { launch_baker() {
configure_client configure_client
wait_for_the_node_to_be_bootstraped wait_for_the_node_to_be_bootstraped
exec "$client" launch daemon --baking "$@" exec "$baker" --base-dir "$client_dir" \
--addr "$NODE_HOST" --port "$NODE_RPC_PORT" \
launch with context "$node_data_dir/context/"
} }
launch_endorser() { launch_endorser() {
configure_client configure_client
wait_for_the_node_to_be_bootstraped wait_for_the_node_to_be_bootstraped
exec "$client" launch daemon --endorsement "$@" exec "$endorser" --base-dir "$client_dir" \
--addr "$NODE_HOST" --port "$NODE_RPC_PORT" \
launch
} }

View File

@ -12,9 +12,12 @@ bin_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")"
node="/usr/local/bin/tezos-node" node="/usr/local/bin/tezos-node"
client="/usr/local/bin/tezos-client" client="/usr/local/bin/tezos-client"
admin_client="/usr/local/bin/tezos-admin-client" admin_client="/usr/local/bin/tezos-admin-client"
baker="/usr/local/bin/tezos-alpha-baker"
endorser="/usr/local/bin/tezos-alpha-endorser"
client_dir="$DATA_DIR/client" client_dir="$DATA_DIR/client"
node_dir="$DATA_DIR/node" node_dir="$DATA_DIR/node"
node_data_dir="$node_dir/data"
. "$bin_dir/entrypoint.inc.sh" . "$bin_dir/entrypoint.inc.sh"
@ -49,4 +52,3 @@ Available commands:
EOF EOF
;; ;;
esac esac

View File

@ -12,7 +12,7 @@ open Alpha_context
include Logging.Make(struct let name = "client.endorsement" end) include Logging.Make(struct let name = "client.endorsement" end)
module State = Daemon_state.Make(struct let name = "endorsements" end) module State = Daemon_state.Make(struct let name = "endorsement" end)
let get_signing_slots cctxt ?(chain = `Main) block delegate level = let get_signing_slots cctxt ?(chain = `Main) block delegate level =
Alpha_services.Delegate.Endorsing_rights.get cctxt Alpha_services.Delegate.Endorsing_rights.get cctxt

View File

@ -348,7 +348,7 @@ let forge_block cctxt ?(chain = `Main) block
(** Worker *) (** Worker *)
module State = Daemon_state.Make(struct let name = "baking" end) module State = Daemon_state.Make(struct let name = "block" end)
let previously_baked_level cctxt pkh new_lvl = let previously_baked_level cctxt pkh new_lvl =
State.get cctxt pkh >>=? function State.get cctxt pkh >>=? function

View File

@ -21,7 +21,7 @@ let encoding : t Data_encoding.t =
(req "block" Block_hash.encoding) (req "block" Block_hash.encoding)
(req "nonce" Nonce.encoding)) (req "nonce" Nonce.encoding))
let name = "nonces" let name = "nonce"
let load (wallet : #Client_context.wallet) = let load (wallet : #Client_context.wallet) =
wallet#load ~default:[] name encoding wallet#load ~default:[] name encoding