algorand / sandbox

Algorand node sandbox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker compose setup /node/algod error

algorithmical opened this issue · comments

Subject of the issue

I'm following https://developer.algorand.org/docs/sdks/go/
with sudo docker-compose up, and I get an error no such file /node/algod

Your environment

Ubuntu 20.04

Steps to reproduce

  1. Follow the tutorial

Expected behaviour

  • algorand dev testnet installs

Actual behaviour

BINDIR=/usr/bin/algod sudo docker-compose up
WARNING: The ALGOD_CHANNEL variable is not set. Defaulting to a blank string.
WARNING: The ALGOD_URL variable is not set. Defaulting to a blank string.
WARNING: The ALGOD_BRANCH variable is not set. Defaulting to a blank string.
WARNING: The ALGOD_SHA variable is not set. Defaulting to a blank string.
WARNING: The NETWORK_BOOTSTRAP_URL variable is not set. Defaulting to a blank string.
WARNING: The NETWORK_GENESIS_FILE variable is not set. Defaulting to a blank string.
WARNING: The INDEXER_URL variable is not set. Defaulting to a blank string.
WARNING: The INDEXER_BRANCH variable is not set. Defaulting to a blank string.
WARNING: The INDEXER_SHA variable is not set. Defaulting to a blank string.
WARNING: The INDEXER_DISABLED variable is not set. Defaulting to a blank string.
Building algod
Step 1/24 : ARG GO_VERSION=1.17.5
Step 2/24 : FROM golang:$GO_VERSION
 ---> 276895edf967
Step 3/24 : ARG CHANNEL=nightly
 ---> Using cache
 ---> 3adefabf56da
Step 4/24 : ARG URL=
 ---> Using cache
 ---> 0a5c2b16cdc0
Step 5/24 : ARG BRANCH=
 ---> Using cache
 ---> 27a9a183f9c0
Step 6/24 : ARG SHA=
 ---> Using cache
 ---> 3ac173148fb8
Step 7/24 : ARG GENESIS_FILE=""
 ---> Using cache
 ---> d6d5d7d41284
Step 8/24 : ARG BOOTSTRAP_URL=""
 ---> Using cache
 ---> 5e027cbef45c
Step 9/24 : ARG ALGOD_PORT=""
 ---> Using cache
 ---> d266c2a0480d
Step 10/24 : ARG KMD_PORT=""
 ---> Using cache
 ---> 4700f8133eeb
Step 11/24 : ARG TOKEN=""
 ---> Using cache
 ---> eadc6a1ccb3c
Step 12/24 : ARG TEMPLATE=""
 ---> Using cache
 ---> 1e58a4c38bb7
Step 13/24 : RUN echo "Installing from source. {URL} --URL−−{BRANCH}"
 ---> Using cache
 ---> 3a668828181a
Step 14/24 : ENV BIN_DIR="$HOME/node"
 ---> Using cache
 ---> 0847a59cbc2b
Step 15/24 : ENV ALGORAND_DATA="/opt/data"
 ---> Using cache
 ---> 2276de1ccac5
Step 16/24 : ENV HOME /opt
 ---> Using cache
 ---> 1b1d27ac10db
Step 17/24 : ENV DEBIAN_FRONTEND noninteractive
 ---> Using cache
 ---> 381f0a92b49b
Step 18/24 : RUN apt-get update && apt-get install -y apt-utils curl git git-core bsdmainutils python3
 ---> Using cache
 ---> 882797db409f
Step 19/24 : COPY . /tmp
 ---> Using cache
 ---> da596d3cb53c
Step 20/24 : RUN /tmp/images/algod/install.sh     -d "{BIN_DIR}"     -c "BIN 
D
​
 IR"−c"{CHANNEL}"     -u "{URL}"     -b "URL"−b"{BRANCH}"     -s "${SHA}"
 ---> Running in a1c679e22621
/tmp/images/algod /go
Installing algod with options:
  BINDIR = /node
  CHANNEL = 
  URL = 
  BRANCH = 
  SHA = 
/tmp/images/algod/install.sh: line 75: /node/algod: No such file or directory
ERROR: Service 'algod' failed to build: The command '/bin/sh -c /tmp/images/algod/install.sh     -d "{BIN_DIR}"     -c "BIN 
D
​
 IR"−c"{CHANNEL}"     -u "{URL}"     -b "URL"−b"{BRANCH}"     -s "${SHA}"' returned a non-zero code: 127
export BINDIR=/usr/bin/algod sudo docker-compose up
-bash: export: `docker-compose': not a valid identifier
^Cport BINDIR=/usr/bin/algod sudo docker-compose up
^C
^C
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

It would be amazing if we could get an officially published docker container or sandbox. It would avoid these kind of issues and allow it to be used in CI/CD pipelines let alone locally much more easily (via docker compose) let alone much faster. This is a big limitation to the dev experience right now.

Yeah. I have experience in other blockchain dev environments and I'd love to learn algorand.
However it is very uncompelling to attempt to follow the documentation and get errors immediately.
IMO the documentation published should be 100% reproducible on a fresh machine. I'd love too try algorand coding but I would need the team too have a working build and develop process without the developer having to debug the build process.

@algorithmical what version of docker are you on? there have been some noted with the most recent docker version solved by downgrading to a slightly older version.

@algorithmical what version of docker are you on? there have been some noted with the most recent docker version solved by downgrading to a slightly older version.

Docker version 20.10.7, build 20.10.7-0ubuntu5~20.04.2

The sandbox is broken. I can also reproduce this same error message.

docker compose up --build

Ends with:

 => ERROR [sandbox_algod 5/7] RUN /tmp/images/algod/install.sh     -d "/node"     -c ""     -u ""     -b ""     -s ""                                                                                       0.7s
------
 > [sandbox_algod 5/7] RUN /tmp/images/algod/install.sh     -d "/node"     -c ""     -u ""     -b ""     -s "":
#12 0.600 /tmp/images/algod /go
#12 0.601 Installing algod with options:
#12 0.601   BINDIR = /node
#12 0.601   CHANNEL =
#12 0.601   URL =
#12 0.601   BRANCH =
#12 0.601   SHA =
#12 0.602 /tmp/images/algod/install.sh: line 75: /node/algod: No such file or directory
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c /tmp/images/algod/install.sh     -d "${BIN_DIR}"     -c "${CHANNEL}"     -u "${URL}"     -b "${BRANCH}"     -s "${SHA}"]: exit code: 127

Using Docker version 20.10.10, build b485636 on Windows 11 with WSL2.

@algorithmical @ashleydavis I just realized you're both trying to start the sandbox docker containers directly, there are env vars in the config.xxx files that should be set for the scripts to figure out what algod/indexer to pull down. The sandbox shell script should do that for you when you run ./sandbox up dev or similar but you might be able to do it with the docker-compose command directly if you source the config.xxx file before hand

FYI my team has open sourced some code that we use to create performant dev sandbox environments via docker-compose and some images we publish to DockerHub: https://github.com/MakerXStudio/algorand-sandbox-dev#algorand-sandbox-dev.

closing based on @barnjamin 's comment.

You should really put some good defaults in there so that docker compose up --build works.

What many devs do when they see a docker_compose.yaml is just assume that docker compose up --build will work.

Just be aware that new devs coming into the eco system will see this as broken and it's not a great first experience when starting development on Algorand.

Also please be aware that shell scripts don't work on Windows.

So any developer who works on Windows (like me!) is going to try and start this using docker compose up --build, so again not a great first experience with Algorand for anyone who works on Windows.