Skip to content

Commit

Permalink
lots of changes to get k8 working
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Hoop committed Jan 17, 2024
1 parent caa005f commit 3726947
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 22 deletions.
2 changes: 1 addition & 1 deletion docker/docker-compose-latest-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
l1-geth:
condition: service_healthy
healthcheck:
test: bash -c "[ -f /tmp/.sp_geth_started.sh.lock ]"
test: bash -c "[ -f /tmp/.start_sp_geth.sh.lock ]"
retries: 10
interval: 5s
start_period: 40s
Expand Down
4 changes: 2 additions & 2 deletions sbin/clean_sp_geth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ fi
echo "Removing sp-geth data dir $DATA_DIR"
rm -rf $DATA_DIR

if test -f .sp_geth_started.lock; then
if test -f .start_sp_geth.sh.lock; then

echo "Removing docker lock file"
L1_WAIT=$WAIT_DIR/.sp_geth_started.lock
L1_WAIT=$WAIT_DIR/.start_sp_geth.sh.lock
fi
30 changes: 27 additions & 3 deletions sbin/generate_secrets.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
optspec="djy"
optspec="djyw"
NUM_ACCOUNTS=0
AUTO_ACCEPT=false
while getopts "$optspec" optchar; do
Expand All @@ -13,11 +13,15 @@ while getopts "$optspec" optchar; do
j)
GEN_JWT=true
;;
w)
L1_WAIT=true
;;
*)
echo "usage: $0 [-d][-j][-y][-h]"
echo "usage: $0 [-d][-j][-y][-h][-w]"
echo "-d : generate deployer"
echo "-j : generate jwt secret"
echo "-y : auto accept prompts"
echo "-w : generate docker-compose wait for file"
exit
;;
esac
Expand All @@ -35,6 +39,21 @@ ROOT_DIR=$SBIN/..

reqdotenv "sp_magi" ".sp_magi.env"
reqdotenv "sidecar" ".sidecar.env"
reqdotenv "paths" ".paths.env"

# Generate waitfile for service init (docker/k8)
WAITFILE="/tmp/.${0##*/}.lock"

if [[ ! -z ${WAIT_DIR+x} ]]; then
WAITFILE=$WAIT_DIR/.${0##*/}.lock
fi

if [ "$L1_WAIT" = "true" ]; then
if test -f $WAITFILE; then
echo "Removing wait file for docker..."
rm $WAITFILE
fi
fi

CONTRACTS_ENV=".contracts.env"
guard_overwrite $CONTRACTS_ENV $AUTO_ACCEPT
Expand Down Expand Up @@ -67,5 +86,10 @@ fi

if [ "$GEN_JWT" = "true" ]; then
JWT=$(generate_jwt_secret)
echo $JWT >$"JWT_SECRET_PATH"
echo $JWT > "$JWT_SECRET_PATH"
fi

if [ "$L1_WAIT" = "true" ]; then
echo "Creating wait file for docker at $WAITFILE..."
touch $WAITFILE
fi
12 changes: 6 additions & 6 deletions sbin/start_l1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ SBIN="$(
. $SBIN/utils/utils.sh
ROOT_DIR=$SBIN/..

# Check that the all required dotenv files exists.
reqdotenv "paths" ".paths.env"
reqdotenv "genesis" ".genesis.env"
reqdotenv "contracts" ".contracts.env"

# Generate waitfile for service init (docker/k8)
WAITFILE="/tmp/.${0##*/}.lock"

if [[ ! -z ${WAIT_DIR+x} ]]; then
WAITFILE=$WAIT_DIR/.${0##*/}.lock
fi

echo $WAITFILE

# Check that the all required dotenv files exists.
reqdotenv "paths" ".paths.env"
reqdotenv "genesis" ".genesis.env"
reqdotenv "contracts" ".contracts.env"
echo "Using dir $WAIT_DIR for $WAITFILE"

AUTO_ACCEPT=false
AUTO_APPROVE=""
Expand Down
10 changes: 6 additions & 4 deletions sbin/start_sp_geth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ SBIN="$(
. $SBIN/utils/utils.sh
ROOT_DIR=$SBIN/..


# Check that the all required dotenv files exists.
reqdotenv "paths" ".paths.env"
reqdotenv "sp_geth" ".sp_geth.env"

# Generate waitfile for service init (docker/k8)
WAITFILE="/tmp/.${0##*/}.lock"

if [[ ! -z ${WAIT_DIR+x} ]]; then
WAITFILE=$WAIT_DIR/.${0##*/}.lock
fi

# Check that the all required dotenv files exists.
reqdotenv "paths" ".paths.env"
reqdotenv "sp_geth" ".sp_geth.env"

# Parse args.
optspec="chw"
while getopts "$optspec" optchar; do
Expand Down
10 changes: 5 additions & 5 deletions sbin/start_sp_magi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ SBIN="$(
. $SBIN/utils/utils.sh
ROOT_DIR=$SBIN/..

# Check that the all required dotenv files exists.
reqdotenv "paths" ".paths.env"
reqdotenv "sp_magi" ".sp_magi.env"

# Generate waitfile for service init (docker/k8)
WAITFILE="/tmp/.${0##*/}.lock"

if [[ ! -z ${WAIT_DIR+x} ]]; then
WAITFILE=$WAIT_DIR/.${0##*/}.lock
fi


# Check that the all required dotenv files exists.
reqdotenv "paths" ".paths.env"
reqdotenv "sp_magi" ".sp_magi.env"

# Set sync flags.
SYNC_FLAGS=""
if [ $SYNC_MODE = "checkpoint" ]; then
Expand Down
2 changes: 1 addition & 1 deletion sbin/utils/crypto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ generate_wallet() {
address=$(echo "$wallet" | awk '/Address/ { print $2 }')
priv_key=$(echo "$wallet" | awk '/Private key/ { print $3 }')
guard_overwrite $1
echo $priv_key | tr -d '\n' >$1
echo $priv_key | tr -d '\n' >"$1"
echo "$address"
}

Expand Down

0 comments on commit 3726947

Please sign in to comment.