Dev/Production Flavours DFX
When I deploy my canisters locally with dfx deploy it's deploying II canister too.. but when I deploy to production I don't want to deploy II canister.. currently I have to either manually remove "internet_identity" field from dfx.json either deploy each canister manually "dfx deploy app_assets && dfx deploy app".. ideally I would be able to configure a specific canister to be ignored in production env
My current dfx.json
{
"canisters": {
"app": {
"main": "src/app/main.mo",
"type": "motoko"
},
"app_assets": {
"dependencies": [
"app"
],
"frontend": {
"entrypoint": "src/app_assets/src/index.html"
},
"source": [
"src/app_assets/assets",
"dist/app_assets/"
],
"type": "assets"
},
"internet_identity": {
"type": "custom",
"candid": "internet_identity.did",
"wasm": "internet_identity.wasm",
"build": "curl -sSL https://github.com/dfinity/internet-identity/releases/download/release-2022-06-07_2/internet_identity_dev.wasm -o internet_identity.wasm"
}
},
"defaults": {
"build": {
"args": "",
"packtool": ""
}
},
"dfx": "0.10.0",
"networks": {
"local": {
"bind": "127.0.0.1:8000",
"type": "ephemeral"
}
},
"version": 1
}
That makes total sense. This would be a great question for https://github.com/dfinity/sdk.
@ericswanson-dfinity thoughts on this?
@bitdivine the nns-dapp also includes internet identity in its dfx.json. How do you deal with the issue?
@7flash @nmattia I ran into the same problem. Just place a second project with Internet Identity outside your development project:
.
|- development-project // <-- here are you developing your code
|- local-internet-identity
The local development process looks like this:
- inside development-project start your local replica e.g.
dfx start --background --clean cd ../local-internet-identity && dfx deploy --no-wallet --argument '(null)' && cd -- note the Internet Identity Canister ID (only once required) and add it to your development-project
dfx deploy- optional start your frontend dev tooling or so
- stopping just
dfx stopinside development-project
How do you deal with the issue?
In nns-dapp we cannot deploy to mainnet, we have to make a proposal, so we don't have the issue.
That said, dfx.json should in theory list the canisters in a project, so my wish is to have a dfx.json that includes just the canisters in the project and a separate dfx.json with supporting canisters used for testing. This can be done as @dennyweiss suggested, or as follows:
- WARNING: This is relies on a feature still in design.
- In the main dfx.json, list the project backend and assets canisters but not II, at least not in the main section.
- As of dfx v 0.9.2, dfx.json has fields for third party canisters that the current project depends on; add II there.
- As of a future, unreleased dfx, it is possible to use several dfx.json with the same local testnet. This makes it possible to say git clone 3 different projects that rely on each other, run
dfx startonce, then deploy all three projects to the same testnet. In this case, download the II project, deploy that, then deploy your own project.
The use of "remote canisters" might be a good fit here: https://github.com/dfinity/sdk/blob/master/CHANGELOG.adoc#feat-remote-canister-support
The use of "remote canisters" might be a good fit here
Oh nice, didn't know this was live! @7flash that's definitely the correct solution
@bitdivine I think you recently did some work to deploy Internet identity from dfx, is that correct? @ericswanson-dfinity would that be the solution here?
@bitdivine I think you recently did some work to deploy Internet identity from dfx, is that correct? @ericswanson-dfinity would that be the solution here?
That work is pretty specific to some short-term needs for sns / nns local deployment. For other projects, I still recommend the remote canister configuration.