Hi everyone,
Do you know if there is a way to deploy an app twice on the IC to use those canisters as a staging environment ?
You could create a custom network
config in dfx.json
named staging
that points to ic0.app
. When you do a dfx deploy --network staging
, it will get a new canisterId on the IC, letting you differentiate the two targets
"staging": {
"providers": [
"https://ic0.app"
],
"type": "persistent"
},
dfx deploy --network=staging
Creating a wallet canister on the staging network.
The replica returned an HTTP Error: Http Error: status 404 Not Found, content type "text/html", content: <html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.19.10</center>
</body>
</html>
Do you have another provider url to try ?
anyone managed to do deploy a staging env ?
Looking for this as well
could you provide an example dfx.json
and clarify if there are any corresponding changes required in our build script file? like webpack.config
or vite.config
I could come up an example for this, but to be clear, both the “staging” and “production” canisters would be live on the IC mainnet, as there isn’t a staging environment. The distinction between the two would be artificial, and you’d probably want a pencil banner on the staging website to make sure that users don’t get confused
absolutely. the use case for me in this case is i’m developing a project where i have separate git branches for staging and production. Staging is where I test features with an internal team before merging those changes to the production branch for use by real users.
Yes I have the same need even if it’s on mainnet it could be useful.
@saikatdas0790 @anthonymq Here ya go GitHub - krpeacock/dfx-staging-env-example: example for how to configure a staging environment
@anthonymq did you figure out the error message? It was because there’s no wallet configured for “staging”. I added a note to the Readme just now that explains a quick command you can use to configure your new network to use the same wallet as IC.
dfx identity --network staging set-wallet $(dfx identity --network ic get-wallet)```
@kpeacock
When I run dfx deploy --network staging <canister name>
, I get error:
Deploying: canister
All canisters have already been created.
Building canisters...
Installing canisters...
Creating UI canister on the staging network.
The replica returned an HTTP Error: Http Error: status 404 Not Found, content type "text/html", content: <html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.21.3</center>
</body>
</html>
I see it’s trying to deploy the candid UI canister even if I specify my canister. Do you know what might be going wrong? I’m pretty sure my dfx.json is correct and all according to the github.
If I look at it on Canlista: Internet Computer Content Validation Bootstrap, nothing shows up in the interface.
@kevinli
Is there some way work out?
@kpeacock i’m running into the same problem, do you have a fix for this?
this doesn’t help, i can deploy locally and to the --network ic
. running dfx canister install
doesnt work either
i uninstalled the cache, deleted .dfx
, ran dfx start --clean
. nothing helps
I truly don’t know what the issue is there - we can always update DFX to only try to deploy a wallet on local
, but it’s bizarre that I can’t reproduce the bug you’re experiencing.
Here are two other options:
- Add another canister named “staging” to dfx.json pointing to the same entry point
- Manually re-write the
canister_ids.json
entry with the different canisters you want to point to on the IC
thanks for the workarounds. it would be indeed helpful to stop dfx from trying to install the UI canister when setting up another network. i installed dfx 0.8.5
and the same error occured:
❯ dfx deploy --network staging
Deploying all canisters.
Creating canisters...
Creating canister "staging"...
"staging" canister created on network "staging" with canister id: "pyygt-sqaaa-aaaae-qaa2q-cai"
Creating canister "staging_assets"...
"staging_assets" canister created on network "staging" with canister id: "pr3np-eyaaa-aaaae-qaa3a-cai"
Building canisters...
Building frontend...
Installing canisters...
Creating UI canister on the staging network.
The replica returned an HTTP Error: Http Error: status 404 Not Found, content type "text/html", content: <html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.21.3</center>
</body>
</html>
Sounds like this will require a ticket then. I think my pattern is okay enough to be worth supporting, and we can easily update the check for deploying wallets and the Candid UI canister
Did you ever get this working? In 9.3 I’m setting the wallet to my principal(maybe this is my error), but when I finally get to deploying I get:
Installing code for canister your_canister, with canister_id xxxxx-iqaaa-aaaaj-xxxxx-cai
Error: No such file or directory (os error 2)