Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

# UNRELEASED

### feat: specify canisters not to deploy

`"deploy": false` canister option makes it not to deploy, unless explicitly specified on the command line.

### feat: WASM memory soft-limit

Adds support for the `wasm_memory_limit` canister setting, which limits the canister's heap during most calls but does not affect queries. As with other canister settings, it can be set in `dfx canister create` or `dfx canister update-settings` via the `--wasm-memory-limit` flag, as well as in `dfx.json` under `canisters[].initialization_values.wasm_memory_limit`.
Expand Down
2 changes: 1 addition & 1 deletion docs/cli-reference/dfx-deploy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow";

<MarkdownChipRow labels={["Reference"]}/>

Use the `dfx deploy` command to register, build, and deploy a dapp on the local canister execution environment, on the IC or on a specified testnet. By default, all canisters defined in the project `dfx.json` configuration file are deployed.
Use the `dfx deploy` command to register, build, and deploy a dapp on the local canister execution environment, on the IC or on a specified testnet. By default, all canisters defined in the project `dfx.json` configuration file are deployed, except of the canisters with `"deploy": false` option.

This command simplifies the developer workflow by enabling you to run one command instead of running the following commands as separate steps:

Expand Down
6 changes: 6 additions & 0 deletions docs/dfx-json-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@
"type": "string"
}
},
"deploy": {
"title": "Deploy",
"description": "`false` value means not to deploy this canister unless it's explicitly specified in the command line (supposed use: canister that are created by other canisters).",
"default": true,
"type": "boolean"
},
"frontend": {
"title": "Force Frontend URL",
"description": "Mostly unused. If this value is not null, a frontend URL is displayed after deployment even if the canister type is not 'asset'.",
Expand Down
11 changes: 10 additions & 1 deletion src/dfx-core/src/config/model/dfinity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ pub struct ConfigCanistersCanister {
#[serde(default)]
pub dependencies: Vec<String>,

/// # Deploy
/// `false` value means not to deploy this canister unless it's explicitly specified in the command line (supposed use: canister that are created by other canisters).
#[serde(default = "default_true")]
pub deploy: bool,

/// # Force Frontend URL
/// Mostly unused.
/// If this value is not null, a frontend URL is displayed after deployment even if the canister type is not 'asset'.
Expand Down Expand Up @@ -327,6 +332,10 @@ pub struct ConfigCanistersCanister {
pub init_arg_file: Option<String>,
}

fn default_true() -> bool {
true
}

#[derive(Clone, Debug, Serialize, JsonSchema)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum CanisterTypeProperties {
Expand Down Expand Up @@ -965,7 +974,7 @@ impl ConfigInterface {
.wasm_memory_limit)
}

fn get_canister_config(
pub fn get_canister_config(
&self,
canister_name: &str,
) -> Result<&ConfigCanistersCanister, GetCanisterConfigError> {
Expand Down
8 changes: 7 additions & 1 deletion src/dfx/src/lib/operations/canister/deploy_canisters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ pub async fn deploy_canisters(
let canisters_to_install: Vec<String> = canisters_to_build
.clone()
.into_iter()
.filter(|canister_name| !pull_canisters_in_config.contains_key(canister_name))
.filter(|canister_name| {
!pull_canisters_in_config.contains_key(canister_name)
&& (some_canister == Some(canister_name) || // do deploy a canister that was explicitly specified
// TODO: This is a hack.
config.get_config().get_canister_config(canister_name).map_or(
true, |canister_config| canister_config.deploy))
})
.collect();

if some_canister.is_some() {
Expand Down