To deploy canisters locally using dfx follow these steps.
Start dfx server
dfx start --background
Run the install script to build and deploy canisters. you can skip the test run by passing -s
flag
scripts/canisters/local_deploy/install_all_canisters.sh [-s]
NOTE: This will only deploy one subnet-orchestrator (also called user-index in codebase) and will not deploy platform-orchsetrator. Platform-orchestrator needs to be deployed and tested separetly
To upgrade locally deployed canisters. Run the following commands
Run the candid generator script to auto generate the candid files for the canisters.
scripts/candid_generator.sh
Build and upgrade the canisters deployed. You can pass -s
flag to skip the tests
scripts/canisters/local_deploy/upgrade_all_canisters.sh [-s]
Before pushing changes to canisters on mainnet we make sure the upgrade will run successfully. Right now there is no automated way to do it. To test it locally follow the steps.
Run clean dfx
dfx start --clean --background
Checkout to last git tag
git checkout vx.y.z
Run install script to install last upgrade that ran successfully on mainnet
scripts/canisters/local_deploy/install_all_canisters.sh [-s]
Checkout to the head of main branch that we need to deploy
git checkout main
Run upgrade script to upgrade canistesr locally
scripts/canisters/local_deploy/upgrade_all_canisters.sh [-s]
Check version for any of the individual canisters deployed locally. If version is greater than v1.0.0
then the upgrades were successful.
dfx canister call <individual-canister-id> get_version
These checks are important and should be strictly performed before raising any Pull request and ensure everything passes.
- checkout to the latest tag before the current build.
- deploy the canisters locally.
- Run the ic repl tests:
ic_repl_tests/all_tests.sh
(this would create some users locally and will add some posts for testing.) - checkout to your branch
- run the upgrade process described above without skipping the tests.
- check if all the user canisters upgrade successfully and the posts are retained which were added by repl tests.
The process of deploying to the mainnet is as follows:
- merge the Pull requests to the main branch
- create a semver tag for the release and push it.
- A github action would be triggered and raise the necessary proposals to upgrade the canisters
To get the hash for canisters:
-
Get the canister IDs from
canister_ids.json
. -
Get hash using the DFX SDK by running:
dfx canister info <canister-id> --network=ic
. -
The output of the above command should contain
Module hash
followed up with the hash value. Example output:$ > dfx canister info vyatz-hqaaa-aaaam-qauea-cai --network=ic Controllers: 7gaq2-4kttl-vtbt4-oo47w-igteo-cpk2k-57h3p-yioqe-wkawi-wz45g-jae wwyo5-vrahh-jwa74-3m6kj-jqbia-jbebm-7vtyd-uvqem-wk3zw-djpci-vqe Module hash: 0x98863747bb8b1366ae5e3c5721bfe08ce6b7480fe4c3864d4fec3d9827255480
To get the hash for canister deployment:
- Go to Github actions deployment runs
- Open the latest succesful run. (Click to see an example run)
- Go to any of the
Deploy all canisters
jobs. (Click to see an example job) - Open one of the
Deploy <canister_name> canister
steps. You should find theModule hash
in this step. This value should match the value you got locally. (Click to see an example step)
To check the status of the deployment
- check if the platform orchestrator performed the step to upgrade subnet canister with appropriate version: Platform Orchestrator function
- check the status of upgrade for individual canisters in subnet orchestrators and verify the version. Example for one of the subnet orchesrator: Subnet Orchestrator function