forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ add workflows for deploying full node and validator (#10)
* ♻️ add workflows for deploying full node and validator with version control * 🔧 add `clean_db` option to deployment workflows
- Loading branch information
Showing
5 changed files
with
116 additions
and
2 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,30 @@ | ||
name: Deploy Full Node | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version tag or commit hash' | ||
required: true | ||
clean_db: | ||
description: 'Clean validator DB' | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/[email protected] | ||
with: | ||
credentials_json: ${{ secrets.GCP_CREDENTIALS }} | ||
|
||
- name: Setup GCloud | ||
uses: google-github-actions/setup-gcloud@v2 | ||
|
||
- name: Deploy | ||
run: | | ||
gcloud compute ssh --zone "${{ secrets.GCP_ZONE }}" "${{ secrets.FULLNODE_NAME }}" \ | ||
--tunnel-through-iap \ | ||
--project "${{ secrets.GCP_PROJECT }}" \ | ||
--command "sudo /home/pui/scripts/update/update_fullnode.sh ${{ github.event.inputs.version }} ${{ github.event.inputs.clean_db }}" |
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,30 @@ | ||
name: Deploy Validator | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version tag or commit hash' | ||
required: true | ||
clean_db: | ||
description: 'Clean validator DB' | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/[email protected] | ||
with: | ||
credentials_json: ${{ secrets.GCP_CREDENTIALS }} | ||
|
||
- name: Setup GCloud | ||
uses: google-github-actions/setup-gcloud@v2 | ||
|
||
- name: Deploy | ||
run: | | ||
gcloud compute ssh --zone "${{ secrets.GCP_ZONE }}" "${{ secrets.VALIDATOR_NAME }}" \ | ||
--tunnel-through-iap \ | ||
--project "${{ secrets.GCP_PROJECT }}" \ | ||
--command "sudo /home/pui/scripts/update/update_validator.sh ${{ github.event.inputs.version }} ${{ github.event.inputs.clean_db }}" |
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,25 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
VERSION=$1 | ||
CLEAN_DB=$2 | ||
|
||
# Access the Home directory where we have the PUI Folder | ||
cd /home/pui | ||
|
||
# Update the PUI Node | ||
sudo git fetch | ||
sudo git checkout $VERSION | ||
|
||
# Build the PUI Node | ||
sudo cargo build --release --bin sui-node | ||
|
||
# Stop the PUI Node | ||
sudo systemctl stop sui-node | ||
|
||
if [ "$CLEAN_DB" = "true" ]; then | ||
sudo rm -rf /home/sui-db/ | ||
fi | ||
|
||
# Start the PUI Node | ||
sudo systemctl start sui-node |
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,28 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
VERSION=$1 | ||
CLEAN_DB=$2 | ||
|
||
# Access the Home directory where we have the PUI Folder | ||
cd /home/pui | ||
|
||
# Update the PUI Node | ||
sudo git fetch | ||
sudo git checkout $VERSION | ||
|
||
# Build the PUI Node | ||
sudo cargo build --release --bin sui-node | ||
|
||
# Stop the PUI Node | ||
sudo systemctl stop sui-node | ||
|
||
if [ "$CLEAN_DB" = "true" ]; then | ||
sudo rm -rf /opt/sui/db/authorities_db /opt/sui/db/consensus_db | ||
fi | ||
|
||
# Copy the new binary to the target directory | ||
sudo mv ./target/release/sui-node /opt/sui/bin/ | ||
|
||
# Start the PUI Node | ||
sudo systemctl start sui-node |