Skip to content

fix: support Compose v2, which is all modern Docker installs have - #338

Open
envestcc wants to merge 1 commit into
masterfrom
fix/compose-v2-support
Open

envestcc wants to merge 1 commit into
masterfrom
fix/compose-v2-support

Conversation

@envestcc

Copy link
Copy Markdown
Member

Problem

checkDockerCompose() requires the standalone docker-compose v1 binary:

docker-compose --version > /dev/null 2>&1
if [ $? -eq 127 ];then
    echo -e "$RED docker-compose command not found $NC"
    exit 1
fi

That binary is end-of-life. Current Docker packages ship Compose as a CLI plugin invoked as docker compose and do not install docker-compose at all. On any such host these scripts exit 1 before doing any work.

For setup_fullnode.sh this is the first thing main() does after the docker permission check, so it never reaches config download, image pull, or the snapshot code. A fresh gateway or delegate install is impossible without hand-installing a deprecated binary or dropping in a shim.

Verified on a host running Docker 29.5.3 with Compose v5.1.4 as a plugin and no docker-compose binary:

$ bash setup_fullnode.sh testnet --auto --home=/…
 docker-compose command not found
Please install it first
exit=1

Three of our own internal hosts are in this state.

Changes

Each script now detects what is available, preferring the plugin and falling back to the legacy binary:

if docker compose version > /dev/null 2>&1;then
    COMPOSE_CMD="docker compose"
elif docker-compose --version > /dev/null 2>&1;then
    COMPOSE_CMD="docker-compose"
else
    …exit 1 with an actionable message…
fi

Call sites invoke $COMPOSE_CMD, intentionally unquoted so docker compose splits into command plus subcommand.

All five scripts carried the same copied check:

Script Invocations rewritten
setup_fullnode.sh 5 (up -d --no-deps monitor, up -d --no-recreate, up -d iotex, ps, ps iotex)
update_silence.sh 3
setup_fullnode_marketplace.sh 2
stop_fullnode.sh 1 (stop)
setup_monitor_alert.sh 0 — see below

In setup_monitor_alert.sh the check is vestigial: that script never invokes Compose, so the gate could only ever produce a false failure. It is fixed rather than removed to keep the five scripts consistent, but removing it outright would also be reasonable.

Verification

On the same host, with the fixed scripts:

  • checkDockerCompose() passes and the script proceeds through config download and image pull.
  • $COMPOSE_CMD up -d iotex — Network monitor_default Created, Container iotex Created, Container iotex Started.
  • $COMPOSE_CMD ps iotex — reports the container.
  • stop_fullnode.sh's $COMPOSE_CMD stop — Container iotex Stopping / Stopped, container reaches Exited.
  • bash -n clean on all five.

The test node was started without --snapshot, so it then crash-looped syncing from genesis on an unrelated pre-existing problem — see below. That happens well after Compose has done its job; the container was created, started, queried and stopped through the plugin.

Unrelated issue found while testing (not fixed here)

A fresh install that syncs from genesis dies with:

fatal  Failed to start server.
error: failed to get tip height: 401 Unauthorized: account disabled

The Infura key baked into the shipped config_testnet.yaml (gravityChainAPIs) is disabled, and the committee needs the gravity chain to fetch legacy delegate election data. README "Optional 3" already tells operators to substitute their own key when syncing from height 0, so this is documented rather than new — but the dead default produces a restart loop with a stack trace instead of a clear message. Snapshot-based installs are unaffected: poll.db ships in the snapshot and the committee logs stop syncing without ever calling out to Ethereum.

Worth its own issue.

Relation to #337

Independent, no overlap in the touched hunks. They are complementary for the case that prompted #337 — an operator building a gateway node from a snapshot:

🤖 Generated with Claude Code

checkDockerCompose() required the standalone `docker-compose` v1 binary.
That binary is end-of-life and is not installed by current Docker
packages, which ship Compose as a CLI plugin invoked as `docker compose`.
On any such host every one of these scripts exits 1 before doing any
work — setup_fullnode.sh never reaches the snapshot download, so a fresh
gateway or delegate install is impossible without hand-installing a
deprecated binary or dropping in a shim.

Verified on a host with Docker 29.5.3 and no docker-compose v1: the
current master script dies with "docker-compose command not found"
(exit 1) before doing anything, and the patched script runs through to a
started container.

Each script now detects what is available, preferring the plugin and
falling back to the legacy binary, and invokes it through $COMPOSE_CMD.
The variable is intentionally unquoted at call sites so that
"docker compose" splits into command plus subcommand.

Covers all five scripts that carried the same copied check:
setup_fullnode.sh, setup_fullnode_marketplace.sh, stop_fullnode.sh,
update_silence.sh, and setup_monitor_alert.sh — where the check is
vestigial (that script never invokes Compose) and could only ever produce
a false failure.

Exercised end to end on the same host: `$COMPOSE_CMD up -d iotex` created
and started the container, `$COMPOSE_CMD ps iotex` reported it, and
stop_fullnode.sh's `$COMPOSE_CMD stop` stopped it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant