-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into ci-goreleaser
- Loading branch information
Showing
14 changed files
with
551 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
FROM golang:1.19-alpine | ||
|
||
ENV GOPATH /go | ||
ENV GOOS=linux | ||
ENV CGO_ENABLED=1 | ||
|
||
ARG old_version | ||
ARG new_version | ||
|
||
RUN apk --no-cache add git make build-base jq openssh libusb-dev linux-headers bash curl tmux | ||
RUN ssh-keygen -b 2048 -t rsa -f /root/.ssh/localtest.pem -q -N "" | ||
|
||
WORKDIR /go/delivery/zeta-node | ||
|
||
RUN mkdir -p $GOPATH/bin/old | ||
RUN mkdir -p $GOPATH/bin/new | ||
|
||
ENV NEW_VERSION=${new_version} | ||
|
||
# Checkout and build new binary | ||
RUN git clone https://github.com/zeta-chain/node.git | ||
RUN cd node && git fetch | ||
RUN cd node && git checkout ${new_version} | ||
RUN cd node && make install | ||
RUN cd node && make install-smoketest | ||
RUN cp $GOPATH/bin/zetacored $GOPATH/bin/new/ | ||
RUN cp $GOPATH/bin/zetaclientd $GOPATH/bin/new/ | ||
RUN cp $GOPATH/bin/smoketest $GOPATH/bin/new/ | ||
|
||
# Checkout and build old binary | ||
RUN cd node && git checkout ${old_version} | ||
RUN cd node && git pull | ||
RUN cd node && make install | ||
RUN cd node && make install-smoketest | ||
RUN cp $GOPATH/bin/zetacored $GOPATH/bin/old/ | ||
RUN cp $GOPATH/bin/zetaclientd $GOPATH/bin/old/ | ||
RUN cp $GOPATH/bin/smoketest $GOPATH/bin/old/ | ||
|
||
RUN git clone https://github.com/zeta-chain/cosmos-sdk.git | ||
RUN cd cosmos-sdk && git checkout zetavisor-v0.1.5 | ||
RUN cd cosmos-sdk/cosmovisor && make zetavisor | ||
# | ||
#FROM golang:1.19-alpine | ||
|
||
#RUN apk --no-cache add openssh jq tmux vim curl bash | ||
RUN ssh-keygen -A | ||
WORKDIR /root | ||
|
||
RUN cp /root/.ssh/localtest.pem.pub /root/.ssh/authorized_keys | ||
|
||
RUN cp /go/bin/zetaclientd /usr/local/bin | ||
RUN cp /go/bin/zetacored /usr/local/bin | ||
RUN cp /go/bin/smoketest /usr/local/bin | ||
RUN cp /go/bin/zetavisor /usr/local/bin | ||
|
||
COPY contrib/localnet/scripts /root | ||
COPY contrib/localnet/preparams /root/preparams | ||
COPY contrib/localnet/ssh_config /root/.ssh/config | ||
COPY contrib/localnet/zetacored /root/zetacored | ||
COPY contrib/localnet/tss /root/tss | ||
|
||
RUN chmod 755 /root/*.sh | ||
RUN chmod 700 /root/.ssh | ||
RUN chmod 600 /root/.ssh/* | ||
|
||
WORKDIR /usr/local/bin | ||
ENV SHELL /bin/sh | ||
EXPOSE 22 | ||
|
||
ENTRYPOINT ["/usr/sbin/sshd", "-D"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
version: "3" | ||
|
||
networks: | ||
mynetwork: | ||
ipam: | ||
config: | ||
- subnet: 172.20.0.0/24 | ||
|
||
|
||
services: | ||
zetacore0: | ||
image: zetanode:latest | ||
container_name: zetacore0 | ||
build: | ||
context: ../../. | ||
dockerfile: Dockerfile | ||
hostname: zetacore0 | ||
ports: | ||
- "1317:1317" | ||
- "9545:8545" | ||
- "9546:8546" | ||
networks: | ||
mynetwork: | ||
ipv4_address: 172.20.0.11 | ||
entrypoint: ["/root/genesis-stateful.sh", "2"] # Need to specify that there are 2 nodes | ||
|
||
|
||
zetacore1: | ||
image: zetanode:latest | ||
container_name: zetacore1 | ||
build: | ||
context: ../../. | ||
dockerfile: Dockerfile | ||
hostname: zetacore1 | ||
networks: | ||
mynetwork: | ||
ipv4_address: 172.20.0.12 | ||
entrypoint: ["/root/genesis-stateful.sh", "2"] | ||
|
||
zetaclient0: | ||
image: zetanode:latest | ||
container_name: zetaclient0 | ||
build: | ||
context: ../../. | ||
dockerfile: Dockerfile | ||
hostname: zetaclient0 | ||
networks: | ||
mynetwork: | ||
ipv4_address: 172.20.0.21 | ||
entrypoint: /root/start-zetaclientd-background.sh | ||
environment: | ||
- ETHDEV_ENDPOINT=http://eth:8545 | ||
|
||
zetaclient1: | ||
image: zetanode:latest | ||
container_name: zetaclient1 | ||
build: | ||
context: ../../. | ||
dockerfile: Dockerfile | ||
hostname: zetaclient1 | ||
networks: | ||
mynetwork: | ||
ipv4_address: 172.20.0.22 | ||
entrypoint: /root/start-zetaclientd-background.sh | ||
environment: | ||
- ETHDEV_ENDPOINT=http://eth:8545 | ||
|
||
bitcoin: | ||
image: ruimarinho/bitcoin-core:22 # version 23 is not working with btcd 0.22.0 due to change in createwallet rpc | ||
container_name: bitcoin | ||
hostname: bitcoin | ||
networks: | ||
mynetwork: | ||
ipv4_address: 172.20.0.101 | ||
ports: | ||
- "18443:18443" | ||
command: | ||
-printtoconsole | ||
-regtest=1 | ||
-rpcallowip=172.20.0.0/16 | ||
-rpcbind=0.0.0.0 | ||
-rpcauth=smoketest:63acf9b8dccecce914d85ff8c044b78b$$5892f9bbc84f4364e79f0970039f88bdd823f168d4acc76099ab97b14a766a99 | ||
-txindex=1 | ||
|
||
eth: | ||
image: ethereum/client-go:v1.10.26 | ||
container_name: eth | ||
hostname: eth | ||
ports: | ||
- "8545:8545" | ||
networks: | ||
mynetwork: | ||
ipv4_address: 172.20.0.100 | ||
entrypoint: [ "geth", "--dev", "--http", "--http.addr", "172.20.0.100", "--http.vhosts", "*", "--http.api", "eth,web3,net", "--http.corsdomain", "https://remix.ethereum.org", "--dev.period", "2" ] | ||
|
||
orchestrator: | ||
image: orchestrator:latest | ||
container_name: orchestrator | ||
build: | ||
context: ../../. | ||
dockerfile: contrib/localnet/orchestrator/Dockerfile | ||
depends_on: | ||
- zetacore0 | ||
- eth | ||
hostname: orchestrator | ||
networks: | ||
mynetwork: | ||
ipv4_address: 172.20.0.2 | ||
entrypoint: [ "/work/start-upgrade.sh", "local"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
contrib/localnet/orchestrator/Dockerfile-upgrade.fastbuild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM zetanode:latest as zeta | ||
FROM ethereum/client-go:v1.10.26 as geth | ||
FROM golang:1.20-alpine as orchestrator | ||
|
||
RUN apk --no-cache add jq curl bash make git build-base openssh | ||
|
||
COPY --from=zeta /usr/local/bin/zetacored /usr/local/bin/ | ||
COPY --from=zeta /usr/local/bin/zetaclientd /usr/local/bin/ | ||
COPY --from=geth /usr/local/bin/geth /usr/local/bin/ | ||
|
||
COPY --from=zeta /root/.ssh/localtest.pem.pub /root/.ssh/authorized_keys | ||
COPY --from=zeta /root/.ssh/localtest.pem /root/.ssh/localtest.pem | ||
|
||
COPY contrib/localnet/orchestrator/start.sh /work/ | ||
COPY contrib/localnet/orchestrator/start-upgrade.sh /work/ | ||
COPY contrib/localnet/orchestrator/restart-zetaclientd.sh /work/ | ||
RUN chmod +x /work/*.sh | ||
|
||
|
||
COPY --from=zeta /go/bin/old/smoketest /usr/local/bin/smoketest-old | ||
COPY --from=zeta /go/bin/new/smoketest /usr/local/bin/smoketest-new | ||
RUN chmod +x /usr/local/bin/smoketest-* | ||
|
||
WORKDIR /work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
clibuilder() | ||
{ | ||
echo "" | ||
echo "Usage: $0 -u UPGRADE_HEIGHT" | ||
echo -e "\t-u Height of upgrade, should match governance proposal" | ||
echo -e "\t-n Number of clients in the network" | ||
exit 1 # Exit script after printing help | ||
} | ||
|
||
while getopts "u:n:" opt | ||
do | ||
case "$opt" in | ||
u ) UPGRADE_HEIGHT="$OPTARG" ;; | ||
n ) NUM_OF_NODES="$OPTARG" ;; | ||
? ) clibuilder ;; # Print cliBuilder in case parameter is non-existent | ||
esac | ||
done | ||
|
||
# generate client list | ||
START=0 | ||
END=$((NUM_OF_NODES-1)) | ||
CLIENT_LIST=() | ||
for i in $(eval echo "{$START..$END}") | ||
do | ||
CLIENT_LIST+=("zetaclient$i") | ||
done | ||
|
||
echo "$UPGRADE_HEIGHT" | ||
|
||
CURRENT_HEIGHT=0 | ||
|
||
while [[ $CURRENT_HEIGHT -lt $UPGRADE_HEIGHT ]] | ||
do | ||
CURRENT_HEIGHT=$(curl zetacore0:26657/status | jq '.result.sync_info.latest_block_height' | tr -d '"') | ||
sleep 5 | ||
done | ||
|
||
echo current height is "$CURRENT_HEIGHT", restarting zetaclients | ||
for NODE in "${CLIENT_LIST[@]}"; do | ||
ssh -o "StrictHostKeyChecking no" "$NODE" -i ~/.ssh/localtest.pem killall zetaclientd | ||
ssh -o "StrictHostKeyChecking no" "$NODE" -i ~/.ssh/localtest.pem "$GOPATH/bin/new/zetaclientd start < /dev/null > $HOME/zetaclient.log 2>&1 &" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.