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

Migrations on Devnet #1576

Closed
cipherzzz opened this issue Oct 4, 2024 · 6 comments
Closed

Migrations on Devnet #1576

cipherzzz opened this issue Oct 4, 2024 · 6 comments
Assignees

Comments

@cipherzzz
Copy link

Summary

I'd like to be able to have granular migrations similar to most tooling so that I can test out my migrations and have a well known migration path.

Setup

# create new project
clarinet new devnet-feature && cd devnet-feature && npm i

# create contracts
clarinet contract new contract-v1
clarinet contract new contract-v2

# generate deployments
clarinet deployment generate --devnet
 mv deployments/default.devnet-plan.yaml  ./deployments/initial.deploy.
yaml
# remove `contract-v2`  from the deployment file above

clarinet deployment generate --devnet
 mv deployments/default.devnet-plan.yaml  ./deployments/upgrade.deploy.
yaml
# remove `contract-v1`  from the deployment file above

# Run initial deployment
clarinet integrate --deployment-plan-path=./deployments/initial.deploy.yaml

Fails with

cipherz@cipherz-razer:~/projects/mechanism/devnet-feature$ clarinet integrate --deployment-plan-path=./deployments/initial.deploy.yaml
warn: This command is deprecated. Use 'clarinet devnet start' instead
Computing deployment plan
unexpected error: receiving on a closed channel
terminating devnet network: logs and chainstate available at location /home/cipherz/projects/mechanism/devnet-feature/./.cache/stacks-devnet-1728066203
error: unable to start bitcoind container: network devnet-feature.devnet is ambiguous (2 matches found on name)

I tried

docker network prune

It fails with the same error
What I'd like to be able to do is start the devnet with the specified file and then run

clarinet deployment apply --deployment-plan-path=./deployments/upgrade.deploy.yaml

@hugocaillard
Copy link
Collaborator

Hey @cipherzzz
Looks like deployment plans are not the issue here, it fails right from the beginning.

I'm able to make it work following your steps to reproduce (thanks for this beautifully written issue btw 🙏 ).
Including:

clarinet deployment apply --deployment-plan-path ./deployments/upgrade.deploy.yaml

error: unable to start bitcoind container: network devnet-feature.devnet is ambiguous (2 matches found on name)

That's the real issue. You could have an container or a volume that still use an volume. Or it could be something else.
If you don't want to spend too much time finding what's wrong docker system prune --all will prune all your docker and leave it ready to be used (but that's only if you're ok to loose all of your images, volumes, etc)

@cipherzzz
Copy link
Author

Hey @cipherzzz Looks like deployment plans are not the issue here, it fails right from the beginning.

I'm able to make it work following your steps to reproduce (thanks for this beautifully written issue btw 🙏 ). Including:

clarinet deployment apply --deployment-plan-path ./deployments/upgrade.deploy.yaml

error: unable to start bitcoind container: network devnet-feature.devnet is ambiguous (2 matches found on name)

That's the real issue. You could have an container or a volume that still use an volume. Or it could be something else. If you don't want to spend too much time finding what's wrong docker system prune --all will prune all your docker and leave it ready to be used (but that's only if you're ok to loose all of your images, volumes, etc)

Hey man! Yeah, I can do a docker network prune for that. The reason it's throwing that is that there is already an instance of clarinet running and the apply attempts to start another instance. It only starts an instance for devnet, whereas it simply applies to testnet and mainnet. I guess what I'd like is a way to apply changes to an already running devnet.

@hugocaillard
Copy link
Collaborator

I guess what I'd like is a way to apply changes to an already running devnet.

It is already the case. The workflow your a describing works and i was able to try and confirm it works

@cipherzzz
Copy link
Author

cipherzzz commented Oct 19, 2024 via email

@hugocaillard hugocaillard moved this from 🆕 New to 🏗 In Progress in DevTools Oct 21, 2024
@hugocaillard
Copy link
Collaborator

Did you have a chance to give it a try @cipherzzz

@cipherzzz
Copy link
Author

@hugocaillard - I haven't had a chance yet - but you can close it and I'll reopen if I find I still have a problem? Thanks!

@github-project-automation github-project-automation bot moved this from 🏗 In Progress to ✅ Done in DevTools Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants