Skip to content

Commit

Permalink
Updated prepare-tendermint
Browse files Browse the repository at this point in the history
  • Loading branch information
Olshansk committed Mar 29, 2023
1 parent 38d9302 commit 70369dd
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 19 deletions.
4 changes: 3 additions & 1 deletion docker/pokt-net/dev-tm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ RUN mkdir -p /home/app/.pocket/config
RUN chown -R app /home/app/.pocket
RUN chown -R app /go

# Build the pocket main binary using the mainline dependencies
RUN cd ${POCKET_PATH} \
&& go build -tags cleveldb -o ${GOPATH}/bin/pocket app/cmd/pocket_core/main.go

# Overwrite go.mod files for local development.
# Overwrite go.mod files for local development
COPY ${POCKET_E2E_STACK_RELATIVE_PATH}/go.mod.local $POCKET_ROOT/go.mod.core
RUN chmod 654 $POCKET_ROOT/go.mod.core

# Overwrite go.mod files for local development
COPY ${POCKET_E2E_STACK_RELATIVE_PATH}/go.mod.tendermint $POCKET_ROOT/go.mod.tendermint
RUN chmod 654 $POCKET_ROOT/go.mod.tendermint

Expand Down
9 changes: 4 additions & 5 deletions docker/pokt-net/dev-tm/entrypoint-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ set -e

mkdir -p /home/app/.pocket/config

if [ -n "${POCKET_CORE_GENESIS}" ] ; then
echo "${POCKET_CORE_GENESIS}" > /home/app/.pocket/config/genesis.json
if [ -n "${POCKET_CORE_GENESIS}" ]; then
echo "${POCKET_CORE_GENESIS}" >/home/app/.pocket/config/genesis.json
fi

# NOTE: The default `chains.json` does not support all the chains in Pocket mainnet.
if [ -n "${POCKET_CORE_CHAINS}" ] ; then
echo "${POCKET_CORE_CHAINS}" > /home/app/.pocket/config/chains.json
if [ -n "${POCKET_CORE_CHAINS}" ]; then
echo "${POCKET_CORE_CHAINS}" >/home/app/.pocket/config/chains.json
fi


/usr/bin/expect /home/app/command.sh $@
26 changes: 17 additions & 9 deletions docker/pokt-net/dev-tm/prepare-tendermint.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
#!/bin/sh

if [[ -f "$POCKET_ROOT/go.mod.tendermint" ]]; then
echo "Called prepare-tendermint.sh"

# if [[ -f "$POCKET_ROOT/go.mod.tendermint" ]]; then
if [[ -f "/dev/tendermint.built" ]]; then
touch "/dev/tendermint.built"
echo "Installing dependencies for tendermint..."
# Doing a `cp` here errors; concurrency issue
mv $POCKET_ROOT/go.mod.tendermint $TENDERMINT_PATH/go.mod
cp -f $POCKET_ROOT/go.mod.tendermint $TENDERMINT_PATH/go.mod
cd $TENDERMINT_PATH
echo "Installing dependencies for tendermint..."
# go mod vendor
# Need to update vendor/module.txt to the local dev paths
go mod tidy && go mod vendor
# Need to get the dependencies in the docker container
go mod download
fi

cd $TENDERMINT_PATH
go build cmd/tendermint/main.go

if [[ -f "$POCKET_ROOT/go.mod.core" ]]; then
if [[ -f "/dev/core.built" ]]; then
touch "/dev/core.built"
echo "Installing dependencies for core..."
# Doing a `mv` here errors; can't preserve ownershi
cp $POCKET_ROOT/go.mod.core $POCKET_PATH/go.mod
cp -f $POCKET_ROOT/go.mod.core $POCKET_PATH/go.mod
cd $POCKET_PATH
echo "Installing dependencies for core..."
# go mod vendor
# Need to update vendor/module.txt to the local dev paths
go mod tidy && go mod vendor
# Need to get the dependencies in the docker container
go mod download
fi

Expand Down
16 changes: 16 additions & 0 deletions stacks/pokt-net/dev-tm/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ services:
- ${CWD}/stacks/pokt-net/shared/chains.local.json:/home/app/.pocket/config/chains.json
- ${CWD}/stacks/pokt-net/shared/genesis.json:/home/app/.pocket/config/genesis.json
- "${POCKET_CORE_REPO_PATH}:/go/src/github.com/pokt-network/pocket-core"
- "/dev/null:/go/src/github.com/pokt-network/pocket-core/go.mod"
- "/dev/null:/go/src/github.com/pokt-network/pocket-core/vendor"
- "${POCKET_NETWORK_TENDERMINT_PATH}:/go/src/github.com/pokt-network/tendermint"
- "/dev/null:/go/src/github.com/pokt-network/tendermint/go.mod"
- "/dev/null:/go/src/github.com/pokt-network/tendermint/vendor"
networks:
- poktnet

Expand Down Expand Up @@ -69,7 +73,11 @@ services:
- ${CWD}/stacks/pokt-net/shared/chains.local.json:/home/app/.pocket/config/chains.json
- ${CWD}/stacks/pokt-net/shared/genesis.json:/home/app/.pocket/config/genesis.json
- "${POCKET_CORE_REPO_PATH}:/go/src/github.com/pokt-network/pocket-core"
- "/dev/null:/go/src/github.com/pokt-network/pocket-core/go.mod"
- "/dev/null:/go/src/github.com/pokt-network/pocket-core/vendor"
- "${POCKET_NETWORK_TENDERMINT_PATH}:/go/src/github.com/pokt-network/tendermint"
- "/dev/null:/go/src/github.com/pokt-network/tendermint/go.mod"
- "/dev/null:/go/src/github.com/pokt-network/tendermint/vendor"
networks:
- poktnet

Expand Down Expand Up @@ -105,7 +113,11 @@ services:
- ${CWD}/stacks/pokt-net/shared/chains.local.json:/home/app/.pocket/config/chains.json
- ${CWD}/stacks/pokt-net/shared/genesis.json:/home/app/.pocket/config/genesis.json
- "${POCKET_CORE_REPO_PATH}:/go/src/github.com/pokt-network/pocket-core"
- "/dev/null:/go/src/github.com/pokt-network/pocket-core/go.mod"
- "/dev/null:/go/src/github.com/pokt-network/pocket-core/vendor"
- "${POCKET_NETWORK_TENDERMINT_PATH}:/go/src/github.com/pokt-network/tendermint"
- "/dev/null:/go/src/github.com/pokt-network/tendermint/go.mod"
- "/dev/null:/go/src/github.com/pokt-network/tendermint/vendor"
networks:
- poktnet

Expand Down Expand Up @@ -141,7 +153,11 @@ services:
- ${CWD}/stacks/pokt-net/shared/chains.local.json:/home/app/.pocket/config/chains.json
- ${CWD}/stacks/pokt-net/shared/genesis.json:/home/app/.pocket/config/genesis.json
- "${POCKET_CORE_REPO_PATH}:/go/src/github.com/pokt-network/pocket-core"
- "/dev/null:/go/src/github.com/pokt-network/pocket-core/go.mod"
- "/dev/null:/go/src/github.com/pokt-network/pocket-core/vendor"
- "${POCKET_NETWORK_TENDERMINT_PATH}:/go/src/github.com/pokt-network/tendermint"
- "/dev/null:/go/src/github.com/pokt-network/tendermint/go.mod"
- "/dev/null:/go/src/github.com/pokt-network/tendermint/vendor"
networks:
- poktnet

Expand Down
7 changes: 3 additions & 4 deletions stacks/pokt-net/dev-tm/up.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/env bash

if [ -z $CWD ];
then
echo "Expected CWD env var, nothing was exported";
exit 1;
if [ -z $CWD ]; then
echo "Expected CWD env var, nothing was exported"
exit 1
fi

export POCKET_CORE_REPOS_PATH=$POCKET_CORE_REPOS_PATH
Expand Down

0 comments on commit 70369dd

Please sign in to comment.