Deploying to new canister on mainnet

I have currently deployed a canister to mainnet. Is there a way to deploy a second canister with the same code base to mainnet and just choose which one I want to deploy to ad-hoc?

Check out this thread: Deploy an app twice on the IC (Staging env)

1 Like

I see, so if I specify --network staging, it will deploy to a different canister than if I specify --network ic?

Yep, as long as you configure it the way I demonstrate there

1 Like

dfx deploy --network staging gives and error:

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 saw this error on the other thread as well. Was this ever resolved?

1 Like

Ah, it’s failing because you don’t have a wallet configured for “staging”.

Run this:

dfx identity --network staging set-wallet $(dfx identity --network ic get-wallet)

I’ll add a note to the Readme

1 Like

Hmm, I’m still getting

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>

@kpeacock Do you know what might be causing the error? ^

1 Like

Maybe it’s trying to install the Candid UI canister? This didn’t happen when I ran it, so I’m not sure. Try specifying your canister short name with

dfx deploy --network staging <canister-name>

and definitely verify that the wallet is set up for staging correctly with

dfx identity --network staging get-wallet
1 Like

It seems to keep trying to install the UI canister, even with dfx deploy --network staging . Is there a way to disable this?

Specify the name of the canister in the command. It will only deploy the specific canister

1 Like

It seemed to deploy correctly (I see the canister id when i go to .raw.ic0.app/, but I tried to change the code and deploy changes with dfx deploy --network staging <canister name>, but it still returns the same error:

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>

even when specifying deploying a particular name

@kpeacock Sorry for bothering you again, but do you know what might be going wrong ^? I’m pretty sure my dfx.json and whatnot is the same as the github you shared