Skip to content

Commit

Permalink
Simplify container builds (backport #2089) (#2095)
Browse files Browse the repository at this point in the history
Co-authored-by: roy-dydx <[email protected]>
  • Loading branch information
mergify[bot] and roy-dydx authored Aug 15, 2024
1 parent d4764bf commit 39e1921
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 20 deletions.
5 changes: 5 additions & 0 deletions protocol/testing/current_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CURRENT_VERSION="v6.0.0"

# Define the mapping from version to URL
declare -A version_to_url
version_to_url["v5.2.0"]="https://github.com/dydxprotocol/v4-chain/releases/download/protocol%2Fv5.2.0/dydxprotocold-v5.2.0-linux-amd64.tar.gz"
1 change: 1 addition & 0 deletions protocol/testing/mainnet/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM dydxprotocol-base
RUN apk add --no-cache bash jq aws-cli
RUN go install cosmossdk.io/tools/cosmovisor/cmd/[email protected]

COPY ./testing/current_version.sh /dydxprotocol/
COPY ./testing/mainnet/. /dydxprotocol/

ENV HOME /dydxprotocol
Expand Down
Binary file not shown.
10 changes: 1 addition & 9 deletions protocol/testing/mainnet/mainnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,13 @@ source "./vars.sh"

CHAIN_ID="dydx-mainnet-1"

# Define the mapping from version to URL
declare -A version_to_url
version_to_url["v5.2.0"]="https://github.com/dydxprotocol/v4-chain/releases/download/protocol%2Fv5.2.0/dydxprotocold-v5.2.0-linux-amd64.tar.gz"

# Define dependencies for this script.
# `jq` and `dasel` are used to manipulate json and yaml files respectively.
install_prerequisites() {
apk add dasel jq
}

set_cosmovisor_binary_permissions() {
# The genesis binary should always exist.
for f in $HOME/cosmovisor/genesis/bin/* ; do
chmod 755 $f
done
# Set up upgrade binaries.
for version in "${!version_to_url[@]}"; do
echo "Setting up version ${version}..."
Expand All @@ -39,7 +31,7 @@ set_cosmovisor_binary_permissions() {
chmod 755 "$version_dir/bin/dydxprotocold"
echo "Successfully set up $version_dir/bin/dydxprotocold"
done
current_version_path="$HOME/cosmovisor/upgrades/$CURRENT_VERSION_DIR/bin"
current_version_path="$HOME/cosmovisor/upgrades/$CURRENT_VERSION/bin"
mkdir -p $current_version_path
cp /bin/dydxprotocold $current_version_path
}
Expand Down
2 changes: 1 addition & 1 deletion protocol/testing/mainnet/vars.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -eo pipefail

CURRENT_VERSION_DIR="v6.0.0"
source "./current_version.sh"

# Full node home directories will be set up for indices 0 to LAST_FULL_NODE_INDEX
LAST_FULL_NODE_INDEX=5
1 change: 1 addition & 0 deletions protocol/testing/testnet/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM dydxprotocol-base
RUN apk add --no-cache bash jq aws-cli
RUN go install cosmossdk.io/tools/cosmovisor/cmd/[email protected]

COPY ./testing/current_version.sh /dydxprotocol/
COPY ./testing/testnet/. /dydxprotocol/

ENV HOME /dydxprotocol
Expand Down
Binary file not shown.
10 changes: 1 addition & 9 deletions protocol/testing/testnet/testnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,13 @@ source "./vars.sh"

CHAIN_ID="dydx-testnet-1"

# Define the mapping from version to URL
declare -A version_to_url
version_to_url["v5.2.0"]="https://github.com/dydxprotocol/v4-chain/releases/download/protocol%2Fv5.2.0/dydxprotocold-v5.2.0-linux-amd64.tar.gz"

# Define dependencies for this script.
# `jq` and `dasel` are used to manipulate json and yaml files respectively.
install_prerequisites() {
apk add dasel jq
}

set_cosmovisor_binary_permissions() {
# The genesis binary should always exist.
for f in $HOME/cosmovisor/genesis/bin/* ; do
chmod 755 $f
done
# Set up upgrade binaries.
for version in "${!version_to_url[@]}"; do
echo "Setting up version ${version}..."
Expand All @@ -40,7 +32,7 @@ set_cosmovisor_binary_permissions() {
chmod 755 "$version_dir/bin/dydxprotocold"
echo "Successfully set up $version_dir/bin/dydxprotocold"
done
current_version_path="$HOME/cosmovisor/upgrades/$CURRENT_VERSION_DIR/bin"
current_version_path="$HOME/cosmovisor/upgrades/$CURRENT_VERSION/bin"
mkdir -p $current_version_path
cp /bin/dydxprotocold $current_version_path
}
Expand Down
2 changes: 1 addition & 1 deletion protocol/testing/testnet/vars.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -eo pipefail

CURRENT_VERSION_DIR="v6.0.0"
source "./current_version.sh"

# Full node home directories will be set up for indices 0 to LAST_FULL_NODE_INDEX
LAST_FULL_NODE_INDEX=2
Expand Down

0 comments on commit 39e1921

Please sign in to comment.