Skip to content

Commit

Permalink
feat: deploy platform orchestrator locally (#477)
Browse files Browse the repository at this point in the history
  • Loading branch information
ravi-sawlani-yral authored Dec 4, 2024
1 parent 6a9ad40 commit 5e7d840
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 11 deletions.
15 changes: 14 additions & 1 deletion scripts/canisters/local_deploy/install_all_canisters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)\";
Expand All @@ -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)"


Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 9 additions & 8 deletions scripts/canisters/local_deploy/upgrade_all_canisters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
19 changes: 19 additions & 0 deletions scripts/canisters/local_deploy/upgrade_subnet_orchestrator.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5e7d840

Please sign in to comment.