Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/Production Flavours DFX #689

Open
7flash opened this issue Jun 16, 2022 · 8 comments
Open

Dev/Production Flavours DFX #689

7flash opened this issue Jun 16, 2022 · 8 comments

Comments

@7flash
Copy link

7flash commented Jun 16, 2022

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
}
@nmattia
Copy link
Collaborator

nmattia commented Jun 17, 2022

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?

@dennyweiss
Copy link

@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:

  1. inside development-project start your local replica e.g. dfx start --background --clean
  2. cd ../local-internet-identity && dfx deploy --no-wallet --argument '(null)' && cd -
  3. note the Internet Identity Canister ID (only once required) and add it to your development-project
  4. dfx deploy
  5. optional start your frontend dev tooling or so
  6. stopping just dfx stop inside development-project

@bitdivine
Copy link
Member

bitdivine commented Jun 20, 2022

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 start once, then deploy all three projects to the same testnet. In this case, download the II project, deploy that, then deploy your own project.

@ericswanson-dfinity
Copy link
Member

The use of "remote canisters" might be a good fit here: https://github.com/dfinity/sdk/blob/master/CHANGELOG.adoc#feat-remote-canister-support

@nmattia
Copy link
Collaborator

nmattia commented Jun 21, 2022

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

@nmattia
Copy link
Collaborator

nmattia commented Sep 29, 2022

@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?

@ericswanson-dfinity
Copy link
Member

@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.

@dennyweiss
Copy link

Found a nice writeup from David on https://papy.rs/

Deploy Internet Identity locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@7flash @dennyweiss @bitdivine @nmattia @ericswanson-dfinity and others