updates for cross-chain bootnodes (#486)

This commit is contained in:
Dmitry Holodov
2023-06-19 14:47:27 -05:00
committed by GitHub
parent 8941163c00
commit 7619b9a6af
50 changed files with 359 additions and 355 deletions

View File

@@ -4,25 +4,18 @@ set -e
cmd="$(basename "${1}")"
#
# If we are running swapd and SWAPD_ENV is set, so this script
# knows where swapd will be writing data, we ensure that the
# atomic user that runs swapd has access the directories where
# the data is written.
# If we are running the bootnode, we ensure that the atomic user that runs swapd
# has access the directories where the data is written.
#
if [[ "${cmd}" == 'bootnode' ]] && [[ -n "${SWAPD_ENV}" ]]; then
if ! [[ "${SWAPD_ENV}" =~ ^dev|stagenet|mainnet$ ]]; then
echo "invalid SWAPD_ENV value"
exit 1
fi
if [[ "${cmd}" == 'bootnode' ]]; then
if [[ "${*}:1}" =~ '--data-dir' ]]; then
echo "Setting --data-dir is not recommended for dockerized bootnode."
echo "If required, unset SWAPD_ENV or override the entrypoint."
echo "Dockerized bootnodes should not set the --data-dir flag."
echo "Adjust where your container mounts /data instead."
exit 1
fi
data_dir="/data/${SWAPD_ENV}"
data_dir="/data/bootnode"
# create the directory if it does not exist
if [[ ! -d "${data_dir}" ]]; then

View File

@@ -14,8 +14,8 @@ VERSION="$(git describe --abbrev=0 --tags)" # image tag
# Pre-create the mounted directory, or docker will create it with root as the
# owner. We mount one directory above what swapd considers its "data-dir". Data
# files will be created in ${DATA_MOUNT_DIR}/${SWAPD_ENV}.
DATA_MOUNT_DIR="${HOME}/.atomicswap/bootnode/docker"
# files will be created in ${DATA_MOUNT_DIR}/bootnode.
DATA_MOUNT_DIR="${HOME}/.atomicswap/docker"
env_args=()
@@ -30,7 +30,6 @@ add_env_arg() {
fi
}
add_env_arg SWAPD_ENV
add_env_arg SWAPD_RPC_PORT
add_env_arg SWAPD_LIBP2P_PORT
add_env_arg SWAPD_BOOTNODES