atsign-foundation / at_server

The software implementation of Atsign's core technology
https://docs.atsign.com
BSD 3-Clause "New" or "Revised" License
40 stars 12 forks source link

Hornet Delete secondary not working #516

Closed athandle closed 2 years ago

athandle commented 2 years ago

Describe the bug After deleting active atsign from registrar, secondary not deleting

To Reproduce Steps to reproduce the behavior: Use any secondary created before February. Delete the same Atsign is deleting from registrar but secondary is still active Expected behavior Delete secondary

kumarnarendra701 commented 2 years ago

@cpswan @gkc @cconstab @athandle - Earlier I pointed IP of swarm0001 in Node API shell script to create/delete secondaries and when we were trying to delete hornet secondaries it was trying to delete on swarm0001 that's why it was failing. So I modified the shell script to handle both hornet and swarm0001 secondaries creation/deletion.

Below scripts -

infrastructure-create-sec.sh

set +x
NAME=$1
PORT=$2
UUID=$3
DIR=$4
ATSECRET=$5
SWARM=$6

echo $NAME
echo $PORT
echo $UUID
echo $DIR
echo $ATSECRET
echo $SWARM

if [[ "$(echo "$SWARM")" == "hornet" ]]; then
    echo "Creating secondaries on hornet"
    ssh -i /home/swarm/.ssh/id_rsa -o "StrictHostKeyChecking=no" root@10.164.0.7 "cd /gluster/@/api && ./create_sec.sh $NAME $PORT $UUID $DIR $ATSECRET $SWARM"
elif [[ "$(echo "$SWARM")" == "swarm0001" ]]; then
    echo "Creating secondaries on swarm0001"
    ssh -i /home/swarm/.ssh/id_rsa -o "StrictHostKeyChecking=no" root@10.164.0.57 "cd /gluster/@/api && ./create_sec.sh $NAME $PORT $UUID $DIR $ATSECRET $SWARM"

else
    echo "Swarm Cluster doesn't exist"
fi

infrastructure-delshell.sh

set +x

NAME=$1
PORT=$2
UUID=$3
DIR=$4
ATSECRET=$5
SWARM=$6

echo $NAME
echo $PORT
echo $UUID
echo $DIR
echo $ATSECRET
echo $SWARM

if [[ "$(echo "$SWARM")" == 'hornet' ]]; then
    echo "Deleting secondaries on hornet"
    ssh -i /home/swarm/.ssh/id_rsa -o "StrictHostKeyChecking=no" root@10.164.0.7 "cd /gluster/@/api && ./delete $NAME $PORT $UUID $DIR $ATSECRET $SWARM"
elif [[ "$(echo "$SWARM")" == 'swarm0001' ]]; then
    echo "Deleting secondaries on swarm0001"
    ssh -i /home/swarm/.ssh/id_rsa -o "StrictHostKeyChecking=no" root@10.164.0.57 "cd /gluster/@/api && ./delete $NAME $PORT $UUID $DIR $ATSECRET $SWARM"
else
    echo "Swarm Cluster doesn't exist."
fi
gkc commented 2 years ago

Thanks Narendra

Which GitHub repo are these scripts in?

Cheers

Message ID: @.***>

cpswan commented 2 years ago

The delete script should be modified to make use of .env along similar lines to the other multi domain scripts.

It's then just a question of invoking the script on the correct host, which should probably be done by name rather than if ... elif .... In the migrate_secondary.sh script this just does:

# remove old service
gcloud compute ssh --zone "us-central1-a" --project "secondaries" "$SRC_DOMAIN"-01 \
  --command="${TURNDOWN_CMD}" -- -n
kumarnarendra701 commented 2 years ago

@cpswan - Made all changes and raised PR for review. Below changes -

PR- https://github.com/atsign-company/secondaries-scripts/pull/18

kumarnarendra701 commented 2 years ago

@cpswan - Deployed to prod and now we can close this.