-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
call the check deploy scripts with params
- Loading branch information
1 parent
6a2e15f
commit 5570631
Showing
2 changed files
with
50 additions
and
42 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
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,49 @@ | ||
#!/bin/bash | ||
# Copyright (c) RoochNetwork | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if [ "$#" -lt 2 ]; then | ||
echo "Usage: $0 <param1> [param2 ...]" | ||
exit 1 | ||
fi | ||
|
||
KEYWORD="rooch" | ||
IMAGE_TAG="$1" | ||
DEV_MNEMONIC_PHRASE="$2" | ||
|
||
# get the container id | ||
CONTAINER_ID=$(docker ps -a | grep $KEYWORD | awk \'{print $1}\') | ||
|
||
if [ -z "$CONTAINER_ID" ]; then | ||
echo "No container found related to the keyword $KEYWORD" | ||
exit 1 | ||
fi | ||
|
||
sleep 30 | ||
|
||
# get container status | ||
STATUS=$(docker inspect --format "{{.State.Status}}" $CONTAINER_ID) | ||
|
||
if [ "$STATUS" != "running" ]; then | ||
echo "Container $CONTAINER_ID is not running, trying to clean data and restart" | ||
echo "Start cleaning the data with image_tag: $IMAGE_TAG" | ||
docker run --rm -v "/root:/root" ghcr.io/rooch-network/rooch:$IMAGE_TAG server clean -n dev | ||
rm -rf ~/.rooch | ||
docker run --rm -v "/root:/root" ghcr.io/rooch-network/rooch:$IMAGE_TAG init -m "$(echo $DEV_MNEMONIC_PHRASE)" --skip-password | ||
docker start $CONTAINER_ID | ||
if [ $? -eq 0 ]; then | ||
echo "Container $CONTAINER_ID Successfully restarted." | ||
echo "Redeploy the examples" | ||
for dir in /root/rooch/examples/*/; do | ||
dir=${dir%*/} | ||
name_addr=$(basename $dir) | ||
echo $name_addr | ||
docker run --rm -v "/root:/root" ghcr.io/rooch-network/rooch:$IMAGE_TAG move build -p "$dir" --named-addresses rooch_examples=default,$name_addr=default | ||
docker run --rm -v "/root:/root" ghcr.io/rooch-network/rooch:$IMAGE_TAG move publish -p "$dir" --named-addresses rooch_examples=default,$name_addr=default | ||
done | ||
else | ||
echo "Container $CONTAINER_ID Startup failed, please check the reason." | ||
fi | ||
else | ||
echo "Container $CONTAINER_ID is running" | ||
fi |