Skip to content

Commit

Permalink
chore: updating deployment scripts and dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
hacheigriega committed Jun 24, 2024
1 parent 5e1f655 commit 94e8550
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -369,4 +369,4 @@ docker-static-build-alpine:
--build-arg GIT_COMMIT=$(COMMIT) \
-f $(CURDIR)/dockerfiles/Dockerfile.static .

.PHONY: docker-static-build docker-static-build-alpine
.PHONY: docker-static-build docker-static-build-alpine
12 changes: 6 additions & 6 deletions dockerfiles/Dockerfile.build-static
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ RUN ARCH=x86_64 && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | sed
sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$ARCH | cut -d ' ' -f 1)

# Download SEDA Wasm VM static library for amd64
RUN ARCH=x86_64 && \
wget https://github.com/sedaprotocol/seda-wasm-vm/releases/download/v1.0.0/libseda_tally_vm_muslc.$ARCH.a \
RUN ARCH=x86_64 && TALLYVM_VERSION=$(go list -m github.com/sedaprotocol/seda-wasm-vm/tallyvm | sed 's/.* //') && \
wget https://github.com/sedaprotocol/seda-wasm-vm/releases/download/$TALLYVM_VERSION/libseda_tally_vm_muslc.$ARCH.a \
-O /lib/libseda_tally_vm_muslc.a

# Build sedad binary for amd64
Expand Down Expand Up @@ -62,8 +62,8 @@ RUN ARCH=aarch64 && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | sed
sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$ARCH | cut -d ' ' -f 1)

# Download SEDA Wasm VM static library for aarch64
RUN ARCH=aarch64 && \
wget https://github.com/sedaprotocol/seda-wasm-vm/releases/download/v1.0.0/libseda_tally_vm_muslc.$ARCH.a \
RUN ARCH=aarch64 && TALLYVM_VERSION=$(go list -m github.com/sedaprotocol/seda-wasm-vm/tallyvm | sed 's/.* //') && \
wget https://github.com/sedaprotocol/seda-wasm-vm/releases/download/$TALLYVM_VERSION/libseda_tally_vm_muslc.$ARCH.a \
-O /lib/libseda_tally_vm_muslc.a

RUN wget https://musl.cc/aarch64-linux-musl-cross.tgz && \
Expand All @@ -90,10 +90,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
-trimpath \
-o /seda-chain/build/sedad-arm64 \
/seda-chain/cmd/sedad/main.go

# --------------------------------------------------------
# Output
# --------------------------------------------------------

FROM alpine
COPY --from=builder /seda-chain/build/sedad-amd64 /build/sedad-amd64
COPY --from=builder /seda-chain/build/sedad-arm64 /build/sedad-arm64
COPY --from=builder /seda-chain/build/sedad-arm64 /build/sedad-arm64
6 changes: 1 addition & 5 deletions dockerfiles/Dockerfile.node
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ RUN go mod download

COPY . .


RUN make install


Expand All @@ -15,16 +14,13 @@ EXPOSE 26656 26657 1317 9090
CMD ["sedad", "start"]
STOPSIGNAL SIGTERM


RUN apt-get update && apt-get install ca-certificates git jq -y \
&& groupadd seda && useradd -g seda -m seda



COPY --from=builder /go/bin/sedad /usr/local/bin/
COPY --from=builder /go/pkg/mod/github.com/\!cosm\!wasm/wasmvm\@v*/internal/api/libwasmvm.*.so /usr/lib/

COPY scripts/validator_setup/validator_setup.sh /usr/local/bin/validator_setup.sh
RUN chmod +x /usr/local/bin/validator_setup.sh

ENTRYPOINT ["validator_setup.sh"]
ENTRYPOINT ["validator_setup.sh"]
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ EXPOSE 1317
EXPOSE 9090

ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["cosmovisor", "run", "start"]
CMD ["cosmovisor", "run", "start"]
6 changes: 5 additions & 1 deletion dockerfiles/Dockerfile.static
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ RUN ARCH=$(uname -m) && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm |
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \
sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$ARCH | cut -d ' ' -f 1)

# Download SEDA Wasm VM static library for aarch64
RUN ARCH=$(uname -m) && TALLYVM_VERSION=$(go list -m github.com/sedaprotocol/seda-wasm-vm/tallyvm | sed 's/.* //') && \
wget https://github.com/sedaprotocol/seda-wasm-vm/releases/download/$TALLYVM_VERSION/libseda_tally_vm_muslc.$ARCH.a \
-O /lib/libseda_tally_vm_muslc.a

# Copy the remaining files
COPY . .

Expand All @@ -55,7 +60,6 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
# --------------------------------------------------------
# Runner
# --------------------------------------------------------

FROM ${RUNNER_IMAGE}

COPY --from=builder /seda-chain/build/sedad /bin/sedad
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ require (
github.com/hashicorp/go-plugin v1.6.0
github.com/ory/dockertest/v3 v3.10.0
github.com/pkg/errors v0.9.1
github.com/sedaprotocol/seda-wasm-vm/tallyvm v0.0.0-20240620100633-41fba11c7d64
github.com/sedaprotocol/seda-wasm-vm/tallyvm v1.0.0
github.com/sedaprotocol/vrf-go v0.0.0-20231211075603-e5a17bb0b87c
github.com/spf13/cast v1.6.0
github.com/spf13/cobra v1.8.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1009,8 +1009,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
github.com/sedaprotocol/rosetta-seda v0.0.0-20240427181737-e1d7563b2529 h1:VbJcd022MkoohRyAfktHnN99Brt/4eJr01mdLqPhGaE=
github.com/sedaprotocol/rosetta-seda v0.0.0-20240427181737-e1d7563b2529/go.mod h1:GdlDqGJN2g55PHiwYJs2bQMlL0rdlQQbauK4dcrOI6w=
github.com/sedaprotocol/seda-wasm-vm/tallyvm v0.0.0-20240620100633-41fba11c7d64 h1:JSQSrK8WEzso8aCI6rJgZ78H961DkAq2Ex+zQc7tzWU=
github.com/sedaprotocol/seda-wasm-vm/tallyvm v0.0.0-20240620100633-41fba11c7d64/go.mod h1:AaX9uRy6qD2q+o1SapTRnGUe9HHZWTmBN2BVNAptq3U=
github.com/sedaprotocol/seda-wasm-vm/tallyvm v1.0.0 h1:2J0Sw62KG77DjVJkS7b7AFHrHTj6Z7dRPDEnjAwaEVg=
github.com/sedaprotocol/seda-wasm-vm/tallyvm v1.0.0/go.mod h1:AaX9uRy6qD2q+o1SapTRnGUe9HHZWTmBN2BVNAptq3U=
github.com/sedaprotocol/vrf-go v0.0.0-20231211075603-e5a17bb0b87c h1:PbSn7HpWeox6lqBu6Ba6YZS3On3euwn1BPz/egsnEgA=
github.com/sedaprotocol/vrf-go v0.0.0-20231211075603-e5a17bb0b87c/go.mod h1:DEIXHk41VUzOMVbZnIApssPXtZ+2zrETDP7kJjGc1RM=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ sleep 2;
INSTANTIATE_TX_OUTPUT=$(sedad query tx $INSTANTIATE_TX_HASH --output json)
CONTRACT_ADDRESS=$(echo $INSTANTIATE_TX_OUTPUT | jq -r '.events[] | select(.type | contains("instantiate")).attributes[] | select(.key | contains("_contract_address")).value')

echo $CONTRACT_ADDRESS;
echo $CONTRACT_ADDRESS;
9 changes: 4 additions & 5 deletions scripts/testnet/config_example.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
CHAIN_ID=seda-1-devnet
GENESIS_TIME="2024-04-24T16:00:00.000000Z"
CHAIN_VERSION=v0.1.3
WASMVM_VERSION=v1.5.2

WASM_PERMISSION_EVERYONE=true # true for everyone and false for mainnet configuration
SHORT_VOTING_PERIOD=true # true for 180s voting period or false for mainnet configuration

# If DOWNLOAD_FROM_RELEASE is set to false, specify RUN_NO and ARTIFACT_NO so the script
# can download the artifact.
DOWNLOAD_FROM_RELEASE=false
RUN_NO=0123
ARTIFACT_NO=0123
DOWNLOAD_FROM_RELEASE=true
# RUN_NO=0123
# ARTIFACT_NO=0123

LOCAL_BIN=$(git rev-parse --show-toplevel)/build/sedad # chain binary executable on your machine
HOME_DIR=$HOME/.sedad # chain directory
Expand Down Expand Up @@ -70,7 +69,7 @@ GROUP_OOA_POLICY=./group_ooa_policy.json
GROUP_SECURITY_POLICY=./group_security_policy.json
GROUP_TREASURY_POLICY=./group_treasury_policy.json

ADMIN_SEED="mushroom energy ..." # used for creating groups - overwritten by group policy addresses anyways
ADMIN_SEED="mushroom energy ..." # seed for one of the genesis accounts - used for creating groups

#######################################
############### GITHUB ################
Expand Down
18 changes: 4 additions & 14 deletions scripts/testnet/setup_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
set -e

#
# This script is run on a node to configure cosmovisor, shared library,
# and systemctl service.
# This script is run on a node to configure cosmovisor and systemctl
# service for SEDA chain.
#
# NOTE: Assumes ami-0a1ab4a3fcf997a9d
WASMVM_VERSION=$1

ARCH=$(uname -m)
if [ $ARCH != "aarch64" ]; then
Expand All @@ -17,12 +16,11 @@ COSMOVISOR_URL=https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor
if [ $ARCH = "aarch64" ]; then
COSMOVISOR_URL=https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2Fv1.3.0/cosmovisor-v1.3.0-linux-arm64.tar.gz
fi
LIBWASMVM_URL=https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm.$ARCH.so

COSMOS_LDS=$HOME/COSMOS_LDS
SYSFILE=/etc/systemd/system/seda-node.service

# set up cosmovisor if necessary
# Set up cosmovisor if it has not been installed yet.
if ! which cosmovisor >/dev/null; then
printf "\n\n\nSETTING UP COSMOVISOR\n\n\n\n"

Expand All @@ -47,14 +45,8 @@ if ! which cosmovisor >/dev/null; then
source $HOME/.bashrc
fi

# set up shared libraries (overwrite if already exists to ensure desired version)
printf "\n\n\nSETTING UP SHARED LIBRARY\n\n\n\n"
mkdir -p $COSMOS_LDS
curl -LO $LIBWASMVM_URL
mv $(basename $LIBWASMVM_URL) $COSMOS_LDS
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/COSMOS_LDS' >> $HOME/.bashrc

# create systemctl service file if necessary
# Create systemctl service file if it does not exist.
if [ ! -f $SYSFILE ]; then
printf "\n\n\nSETTING UP SYSTEMCTL\n\n\n\n"

Expand All @@ -77,8 +69,6 @@ Environment="DAEMON_RESTART_DELAY=30s"
Environment="DAEMON_LOG_BUFFER_SIZE=512"
Environment="DAEMON_PREUPGRADE_MAX_RETRIES=0"
Environment=LD_LIBRARY_PATH=/home/ec2-user/COSMOS_LDS
User=$USER
ExecStart=$(which cosmovisor) run start
Restart=always
Expand Down
7 changes: 4 additions & 3 deletions scripts/testnet/upload_and_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ else
set -x

unzip artifact.zip
mv sedad-amd64 $NODE_DIR
mv sedad-arm64 $NODE_DIR
fi

mv sedad-amd64 $NODE_DIR
mv sedad-arm64 $NODE_DIR


################################################
############# Set up for new nodes #############
Expand All @@ -60,7 +61,7 @@ fi
# upload setup script and run it
for i in ${!IPS[@]}; do
scp -i $SSH_KEY -o StrictHostKeyChecking=no -r ./setup_node.sh ec2-user@${IPS[$i]}:/home/ec2-user
ssh -i $SSH_KEY -t ec2-user@${IPS[$i]} "/home/ec2-user/setup_node.sh $WASMVM_VERSION"
ssh -i $SSH_KEY -t ec2-user@${IPS[$i]} '/home/ec2-user/setup_node.sh'
ssh -i $SSH_KEY -t ec2-user@${IPS[$i]} 'rm /home/ec2-user/setup_node.sh'
done

Expand Down

0 comments on commit 94e8550

Please sign in to comment.