Skip to content

Commit d5b9e9c

Browse files
authored
Merge pull request #6 from KILTprotocol/feature/ap_purge_mongodb_on_node_deploy
feature: enrich node start script with capability for purging user da…
2 parents 8c4af5f + 56244ee commit d5b9e9c

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

start-node.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ Usage:
4040
-c, --connect-to BOOT_NODE_NAME The name of the boot node to connect to ("alice" | "bob")
4141
-d, --dry-run Flag indicating to only show the resulting command instead of executing it
4242
-t, --telemetry Flag indicating whether or not to send data to the telemetry server
43+
-p, --purge-userdata Purges all chain-dependend user data in auxiliary services (ctypes, contacts, messages, ...)
4344
4445
Examples:
4546
46-
Start Alice (boot node):
47-
./start-node.sh -a Alice
47+
Start Alice (boot node) and purge all user data in services components:
48+
./start-node.sh -a Alice -p
4849
4950
Start Bob (boot node) that connects to Alice:
5051
./start-node.sh -a Bob -c Alice
@@ -61,6 +62,7 @@ bootnode=
6162
node_name=
6263
account_name=
6364
telemetry=0
65+
purge_userdata=0
6466
dry_run=0
6567

6668
while [[ "$1" != "" ]]; do
@@ -76,6 +78,8 @@ while [[ "$1" != "" ]]; do
7678
;;
7779
-t | --telemetry ) telemetry=1
7880
;;
81+
-p | --purge-userdata ) purge_userdata=1
82+
;;
7983
-d | --dry-run ) dry_run=1
8084
;;
8185
-h | --help ) usage
@@ -129,6 +133,13 @@ if [[ "$telemetry" = "1" ]]; then
129133
arg_telemetry=" --telemetry-url ${TELEMETRY_URL}"
130134
fi
131135

136+
if [[ "$purge_userdata" = "1" ]]; then
137+
echo "Purging user data in services..."
138+
curl -X DELETE http://services.kilt-prototype.tk:3000/ctype
139+
curl -X DELETE http://services.kilt-prototype.tk:3000/messaging
140+
curl -X DELETE http://services.kilt-prototype.tk:3000/contacts
141+
fi
142+
132143
command="./target/debug/node --chain ${CHAIN_NAME} --validator --port 30333 --ws-port 9944 --ws-external --rpc-external${arg_account_name}${arg_node_key}${arg_boot_node_connect}${arg_node_name}${arg_telemetry}"
133144

134145
if [[ "$dry_run" = "1" ]]; then

0 commit comments

Comments
 (0)