This repository was archived by the owner on Apr 7, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathtezos-node-start
More file actions
executable file
·50 lines (43 loc) · 1.63 KB
/
tezos-node-start
File metadata and controls
executable file
·50 lines (43 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2021 Oxhead Alpha
# SPDX-License-Identifier: LicenseRef-MIT-OA
set -euo pipefail
# Note: the 'TEZOS_NODE_DIR' env var is expected and used by the node
node="/usr/bin/octez-node"
# default location of the config file
config_file="$TEZOS_NODE_DIR/config.json"
mkdir -p "$TEZOS_NODE_DIR"
# CUSTOM_NODE_CONFIG can be provided in the tezos-node-custom.service environment
if [[ -z "${CUSTOM_NODE_CONFIG:-}" ]]; then
if [[ ! -f "$config_file" ]]; then
echo "Configuring the node..."
"$node" config init \
--rpc-addr "$NODE_RPC_ADDR" \
${NETWORK:+"--network=$NETWORK"} \
"$@"
else
echo "Updating the node configuration..."
"$node" config update \
--rpc-addr "$NODE_RPC_ADDR" \
${NETWORK:+"--network=$NETWORK"} \
"$@"
fi
node_run_args=("--config-file" "$config_file")
else
echo "Run using custom node config file"
config_file="$CUSTOM_NODE_CONFIG"
node_run_args=("--config-file" "$config_file" --rpc-addr "$NODE_RPC_ADDR")
fi
if [[ -z "$CERT_PATH" || -z "$KEY_PATH" ]]; then
rpc_endpoint="http://$NODE_RPC_ADDR"
else
rpc_endpoint="https://$NODE_RPC_ADDR"
fi
# Marking service as active only once the node starts responding to RPC queries
(while ! curl -s "$rpc_endpoint/chains/main/blocks/head" &> /dev/null; do sleep 1; done; systemd-notify --ready) &
# Launching the node
if [[ -z "$CERT_PATH" || -z "$KEY_PATH" ]]; then
exec "$node" run "${node_run_args[@]}"
else
exec "$node" run "${node_run_args[@]}" --rpc-tls="$CERT_PATH","$KEY_PATH"
fi