algorand / algorand/go-algorand
goal node catchup should return an error if it is unable to start.
- 主要言語
- Go
- スター
- 1.4k
- フォーク
- 537
- 平均マージ
- 1日 6時間
- マージ済み PR(30日)
- 17
説明
If `goal node catchup` fails to initialize the catchup, it should report an error and exit with an error code.
** Original Issue Report Below**
### Subject of the issue
running `goal node catchup ` is inconsistent when executed from a container start script
### Your environment
> software version:
```sh
algod -v
12885032963
3.2.3.stable [rel/stable] (commit #d2289a52)
go-algorand is licensed with AGPLv3.0
source code available at https://github.com/algorand/go-algorand
```
> OS
- running in Docker container
```sh
cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
```
```sh
uname -a
Linux 4ee248bd293c 5.10.76-linuxkit #1 SMP PREEMPT Mon Nov 8 11:22:26 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
```
> Dockerfile
```dockerfile
FROM ubuntu:20.04
ENV ALGORAND_DATA=/var/lib/algorand
ENV ALGORAND_NETWORK=testnet
RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get upgrade -y \
&& apt-get -y install \
wget curl
RUN groupadd algorand \
&& useradd -g algorand -s /usr/bin/bash -m algorand
RUN mkdir -p ${ALGORAND_DATA} \
&& chown algorand:algorand ${ALGORAND_DATA}
USER algorand:algorand
WORKDIR /home/algorand/node
RUN wget \
https://raw.githubusercontent.com/algorand/go-algorand-doc/master/downloads/installers/update.sh
RUN bash update.sh -i -c stable -p ~/node -d ${ALGORAND_DATA} -n
COPY ./scripts /home/algorand/scripts
COPY ./algod_config.json ${ALGORAND_DATA}/config.json
RUN mv genesisfiles/${ALGORAND_NETWORK}/genesis.json ${ALGORAND_DATA}/genesis.json
VOLUME [ "${ALGORAND_DATA}" ]
ENTRYPOINT [ "/usr/bin/bash", "/home/algorand/scripts/entrypoint.sh" ]
CMD ["/usr/bin/bash", "/home/algorand/scripts/start.sh"]
```
> algod_config.json
```json
{
"EndpointAddress": "0.0.0.0:4001"
}
```
> scripts/entrypoint
```sh
#!/usr/bin/env bash
KMD_DATA="$ALGORAND_DATA/kmd-v0.5"
cat >"/home/algorand/.bashrc" < scripts/start
- my solution is to include a `while` loop to get it to work because the first call to catchup does nothing
```sh
#!/usr/bin/env bash
set -e
source /home/algorand/.bashrc
echo 'starting node'
goal node start
ALGORAND_CATCHPOINT="$(curl -s https://algorand-catchpoints.s3.us-east-2.amazonaws.com/channel/$ALGORAND_NETWORK/latest.catchpoint)"
echo "starting fast catchup to catchpoint: $ALGORAND_CATCHPOINT"
goal node catchup "$ALGORAND_CATCHPOINT"
goal node status
# sometimes catchup just wont work...
# https://discord.com/channels/491256308461207573/807825288666939482/943255051592405092
while [[ -z "$(goal node status | grep Catchpoint | cut -d' ' -f3)" ]]; do
echo -e '\nnot using catchpoint, trying again...\n'
goal node catchup "$ALGORAND_CATCHPOINT"
sleep 5s
done
while [ true ]; do
echo -e '\nChecking status again in 20s\n'
sleep 20s
goal node status
done
exit 0
```
### Steps to reproduce
1. build and run the container without this `while` loop then view container logs to confirm catchpoint is not being used
```sh
while [[ -z "$(goal node status | grep Catchpoint | cut -d' ' -f3)" ]]; do
echo -e '\nnot using catchpoint, trying again...\n'
goal node catchup "$ALGORAND_CATCHPOINT"
sleep 5s
done
```
2. add the `while` loop back and see that it works after first attempt
### Expected behaviour
- `goal node catchup` works
- (opinion) add a report from this command to diagnose behavior
### Actual behaviour
- `goal note catchup` does not work when called
コントリビューションガイド
評価
この issue はまだ評価されていません。