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

ci: add only start with new binary flag to upgrade assure #472

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions scripts/upgrade-assure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ Execute the final upgrade command to complete the upgrade process:
go run ./scripts/upgrade-assure/... /tmp/snapshot.tar.lz4 /tmp/elysd-v0.30.0 ~/go/bin/elysd --skip-snapshot --skip-chain-init
```

### Step 9: Start the Nodes manually (optional)

If something went wrong while you were starting the node at step 8, you can start the nodes manually with the new binary by using the following command:

```bash
go run ./scripts/upgrade-assure/... /tmp/snapshot.tar.lz4 /tmp/elysd-v0.30.0 ~/go/bin/elysd --only-start-with-new-binary
```

## Testnet Snapshots Usage

**Snapshot Sources and Installation Procedures:**
Expand Down Expand Up @@ -140,3 +148,11 @@ go run ./scripts/upgrade-assure/... /tmp/snapshot.tar.lz4 /tmp/elysd-v0.30.0 ~/g
--timeout-wait-for-node=600 # Time in seconds
--timeout-next-block=15 # Time in minutes
```

**My nodes crashed after the upgrade. What should I do?**

Run the following command to start the nodes manually:

```bash
go run ./scripts/upgrade-assure/... /tmp/snapshot.tar.lz4 ~/go/bin/elysd ~/go/bin/elysd --only-start-with-new-binary
```
31 changes: 19 additions & 12 deletions scripts/upgrade-assure/get-flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ import (

const (
// global
flagSkipSnapshot = "skip-snapshot"
flagSkipChainInit = "skip-chain-init"
flagSkipNodeStart = "skip-node-start"
flagSkipProposal = "skip-proposal"
flagSkipBinary = "skip-binary"
flagChainId = "chain-id"
flagKeyringBackend = "keyring-backend"
flagGenesisFilePath = "genesis-file-path"
flagBroadcastMode = "broadcast-mode"
flagDbEngine = "db-engine"

//Timeout
flagOnlyStartWithNewBinary = "only-start-with-new-binary"
flagSkipSnapshot = "skip-snapshot"
flagSkipChainInit = "skip-chain-init"
flagSkipNodeStart = "skip-node-start"
flagSkipProposal = "skip-proposal"
flagSkipBinary = "skip-binary"
flagChainId = "chain-id"
flagKeyringBackend = "keyring-backend"
flagGenesisFilePath = "genesis-file-path"
flagBroadcastMode = "broadcast-mode"
flagDbEngine = "db-engine"

// timeout
flagTimeOutToWaitForService = "timeout-wait-for-node"
flagTimeOutNextBlock = "timeout-next-block"

Expand Down Expand Up @@ -51,6 +52,7 @@ const (

func getFlags(cmd *cobra.Command) (
// global
onlyStartWithNewBinaries bool,
skipSnapshot bool,
skipChainInit bool,
skipNodeStart bool,
Expand Down Expand Up @@ -91,6 +93,11 @@ func getFlags(cmd *cobra.Command) (
api2 string,
) {
// global
onlyStartWithNewBinaries, _ = cmd.Flags().GetBool(flagOnlyStartWithNewBinary)
if onlyStartWithNewBinaries {
log.Printf(ColorYellow + "only starting with new binaries, skipping all other steps")
}

skipSnapshot, _ = cmd.Flags().GetBool(flagSkipSnapshot)
if skipSnapshot {
log.Printf(ColorYellow + "skipping snapshot retrieval")
Expand Down
14 changes: 13 additions & 1 deletion scripts/upgrade-assure/upgrade-assure.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func main() {
Run: func(cmd *cobra.Command, args []string) {
snapshotUrl, oldBinaryUrl, newBinaryUrl := getArgs(args)
// global flags
skipSnapshot, skipChainInit, skipNodeStart, skipProposal, skipBinary, chainId, keyringBackend, genesisFilePath, broadcastMode, dbEngine,
onlyStartWithNewBinary, skipSnapshot, skipChainInit, skipNodeStart, skipProposal, skipBinary, chainId, keyringBackend, genesisFilePath, broadcastMode, dbEngine,
// timeouts
timeOutToWaitForService, timeOutToWaitForNextBlock,
// node 1 flags
Expand Down Expand Up @@ -48,6 +48,17 @@ func main() {
// print new binary path and version
log.Printf(ColorGreen+"New binary path: %v and version: %v", newBinaryPath, newVersion)

// only start with new binary, skip everything else
if onlyStartWithNewBinary {
// start new binary
newBinaryCmd := start(newBinaryPath, homePath, rpc, p2p, pprof, api, moniker, "\033[32m", "\033[31m")
newBinaryCmd2 := start(newBinaryPath, homePath2, rpc2, p2p2, pprof2, api2, moniker2, "\033[32m", "\033[31m")

// listen for signals
listenForSignals(newBinaryCmd, newBinaryCmd2)
return
}

if !skipSnapshot {
// remove home path
removeHome(homePath)
Expand Down Expand Up @@ -210,6 +221,7 @@ func main() {
homeEnv, _ := os.LookupEnv("HOME")

// global flags
rootCmd.PersistentFlags().Bool(flagOnlyStartWithNewBinary, false, "only start with new binary")
rootCmd.PersistentFlags().Bool(flagSkipSnapshot, false, "skip snapshot retrieval")
rootCmd.PersistentFlags().Bool(flagSkipChainInit, false, "skip chain init")
rootCmd.PersistentFlags().Bool(flagSkipNodeStart, false, "skip node start")
Expand Down
Loading