Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Docker Entrypoint script #370

Draft
wants to merge 11 commits into
base: develop
Choose a base branch
from
Draft
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]-rc.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"

permissions:
contents: write
Expand Down
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ RUN apt-get update
RUN apt-get install ${PACKAGES} -y
RUN make install

# Setup the node
RUN bash ./scripts/docker-node/setup.sh

# Expose Ports
EXPOSE 26657 1317 9090 9091 26656

# Provide permission to the script
RUN chmod +x ./scripts/docker-node/entrypoint.sh

# Entry for containers
ENTRYPOINT [ "hid-noded" ]
ENTRYPOINT [ "/bin/sh", "-c", "echo N | ./scripts/docker-node/entrypoint.sh" ]

10 changes: 10 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,16 @@ func New(
return fromVM, nil
})

app.UpgradeKeeper.SetUpgradeHandler("v019", func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("v0.1.9 upgrade")
return fromVM, nil
})

app.UpgradeKeeper.SetUpgradeHandler("v0110", func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("v0.1.10 upgrade")
return fromVM, nil
})

// register the staking hooks
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
app.StakingKeeper = *stakingKeeper.SetHooks(
Expand Down
11 changes: 9 additions & 2 deletions scripts/docker-node/setup.sh → scripts/docker-node/entrypoint.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if [ ${RET_VAL} -ne 0 ]; then
fi

# Setting up config files
rm -rf /root/.hid-node/
# rm -rf /root/.hid-node/

# Make directories for hid-node config
mkdir /root/.hid-node
Expand All @@ -28,7 +28,11 @@ hid-noded init --chain-id=hidnode node1 --home=/root/.hid-node
hid-noded configure min-gas-prices 0uhid

# Create key for the node
hid-noded keys add node1 --keyring-backend=test --home=/root/.hid-node
if [ -n "$MNEMONIC" ]; then
echo "$MNEMONIC" | hid-noded keys add node1 --keyring-backend=test --recover --home=/root/.hid-node
else
hid-noded keys add node1 --keyring-backend=test --home=/root/.hid-node
fi

# change staking denom to uhid
cat /root/.hid-node/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="uhid"' > /root/.hid-node/config/tmp_genesis.json && mv /root/.hid-node/config/tmp_genesis.json /root/.hid-node/config/genesis.json
Expand Down Expand Up @@ -61,3 +65,6 @@ sed -i -E 's|tcp://127.0.0.1:26657|tcp://0.0.0.0:26657|g' /root/.hid-node/config
sed -i -E 's|allow_duplicate_ip = false|allow_duplicate_ip = true|g' /root/.hid-node/config/config.toml
sed -i -E 's|addr_book_strict = true|addr_book_strict = false|g' /root/.hid-node/config/config.toml
sed -i -E 's|cors_allowed_origins = \[\]|cors_allowed_origins = \[\"\*\"\]|g' /root/.hid-node/config/config.toml

# Run hid-node
hid-noded start
Loading