diff --git a/scripts/canisters/local_deploy/install_all_canisters.sh b/scripts/canisters/local_deploy/install_all_canisters.sh index 08ce0447..17b20e86 100755 --- a/scripts/canisters/local_deploy/install_all_canisters.sh +++ b/scripts/canisters/local_deploy/install_all_canisters.sh @@ -43,6 +43,11 @@ then cargo test fi + +dfx canister install platform_orchestrator --argument "(record { + version = \"v1.0.0\" +})" + dfx canister install post_cache --argument "(record { known_principal_ids = opt vec { record { @@ -67,6 +72,10 @@ dfx canister install post_cache --argument "(record { dfx canister install user_index --argument "(record { known_principal_ids = opt vec { + record { + variant { CanisterIdPlatformOrchestrator }; + principal \"$(dfx canister id platform_orchestrator)\"; + }; record { variant { UserIdGlobalSuperAdmin }; principal \"$(dfx identity get-principal)\"; @@ -92,5 +101,9 @@ dfx canister install user_index --argument "(record { }; version= \"v1.0.0\" })" - scripts/canisters/local_deploy/create_pool_of_individual_canister_user_index.sh + + dfx canister update-settings user_index --set-controller $(dfx canister id platform_orchestrator) --yes + dfx canister call platform_orchestrator register_new_subnet_orchestrator "(principal \"$(dfx canister id user_index)\", true)" + + diff --git a/scripts/canisters/local_deploy/start_upgrades.sh b/scripts/canisters/local_deploy/start_upgrades_for_individual_canisters.sh similarity index 76% rename from scripts/canisters/local_deploy/start_upgrades.sh rename to scripts/canisters/local_deploy/start_upgrades_for_individual_canisters.sh index 06904c41..b3bc0afe 100755 --- a/scripts/canisters/local_deploy/start_upgrades.sh +++ b/scripts/canisters/local_deploy/start_upgrades_for_individual_canisters.sh @@ -25,5 +25,5 @@ char=$(hexdump -ve '1/1 "%.2x"' "$wasm") char_escaped=$(printf "%s" "$char" | sed 's/../\\&/g') # Create a shell script with the escaped hexadecimal string -printf "(\"v2.2.0\", blob \"%s\")" "$char_escaped" > argument -dfx canister call user_index start_upgrades_for_individual_canisters --argument-file argument +printf "(record {version = \"v2.2.0\"; canister = variant {IndividualUserWasm}; wasm_blob = blob \"%s\"})" "$char_escaped" > argument +dfx canister call platform_orchestrator upgrade_canisters_in_network --argument-file argument diff --git a/scripts/canisters/local_deploy/upgrade_all_canisters.sh b/scripts/canisters/local_deploy/upgrade_all_canisters.sh index d2245adb..a5d009df 100755 --- a/scripts/canisters/local_deploy/upgrade_all_canisters.sh +++ b/scripts/canisters/local_deploy/upgrade_all_canisters.sh @@ -21,10 +21,6 @@ while getopts "sh" arg; do esac done -dfx build individual_user_template -gzip -f -1 ./target/wasm32-unknown-unknown/release/individual_user_template.wasm -dfx build user_index -gzip -f -1 ./target/wasm32-unknown-unknown/release/user_index.wasm dfx build post_cache gzip -f -1 ./target/wasm32-unknown-unknown/release/post_cache.wasm dfx build platform_orchestrator @@ -35,11 +31,16 @@ then cargo test fi +dfx canister install platform_orchestrator --mode upgrade --argument "(record { + version= \"v2.2.0\" +})" + dfx canister install post_cache --mode upgrade --argument "(record { version= \"v1.1.0\" })" -dfx canister install user_index --mode upgrade --argument "(record { - version= \"v1.1.0\" -})" -scripts/canisters/local_deploy/start_upgrades.sh +scripts/canisters/local_deploy/upgrade_subnet_orchestrator.sh + +sleep 2 + +scripts/canisters/local_deploy/start_upgrades_for_individual_canisters.sh diff --git a/scripts/canisters/local_deploy/upgrade_subnet_orchestrator.sh b/scripts/canisters/local_deploy/upgrade_subnet_orchestrator.sh new file mode 100755 index 00000000..02937b62 --- /dev/null +++ b/scripts/canisters/local_deploy/upgrade_subnet_orchestrator.sh @@ -0,0 +1,19 @@ +# !/bin/bash + + +dfx build user_index + +# Specify the path to your Wasm.gz file +wasm=".dfx/local/canisters/user_index/user_index.wasm.gz" + + + +# Use xxd to convert the file content to a hexadecimal string +char=$(hexdump -ve '1/1 "%.2x"' "$wasm") + +# Escape special characters in the hexadecimal string +char_escaped=$(printf "%s" "$char" | sed 's/../\\&/g') + +# Create a shell script with the escaped hexadecimal string +printf "(record {version = \"v2.2.0\"; canister = variant {SubnetOrchestratorWasm}; wasm_blob = blob \"%s\"})" "$char_escaped" > argument +dfx canister call platform_orchestrator upgrade_canisters_in_network --argument-file argument \ No newline at end of file