-
Notifications
You must be signed in to change notification settings - Fork 6
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
Making start-docker
Contract-Agnostic
#93
base: main
Are you sure you want to change the base?
Conversation
start-docker
Contract-Agnostic --WIP--
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
Instead of running a container within a container (which further reduces the resources available to the child container), why don't we run two parallel docker containers and use a network bridge to communicate between them?
make_ports_public.sh
Outdated
@@ -0,0 +1,19 @@ | |||
#!/bin/bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there code related to codespaces here? That should be in a different PR to make sure that we have a shorter PR to review here.
ec15741
to
1b21a98
Compare
start-docker
Contract-Agnostic --WIP--start-docker
Contract-Agnostic
Asking users to install |
I am removing myself from the review. I think @Jovonni or @mujahidkay are best suited to review and help make progress in this area. |
d984d0c
to
0e73e6a
Compare
I feel this is at a reasonable shape now and we can invite reviews. Instead of the complex multi-step approach I started with above, I have now settled for a much simpler idea that disturbs least amount of artifacts to achieve the same IMO. To summarize, we
@dckc WDYT? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm particularly curious how this works with yarn create @agoric/dapp demo
.
contract/scripts/run-chain.sh
Outdated
# Check if container exists but is stopped | ||
if [ "$(docker ps -aq -f status=exited -f name=agdc)" ]; then | ||
echo "Found stopped container 'agdc'. Removing it before starting a new one..." | ||
docker rm agdc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing a container is irreversible, right? So if somebody happened to have a container named agdc
running when trying out our stuff, this would remove it, yes? That doesn't seem fail-safe; it seems to violate the principle of least surprise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Fixed this by double-checking with the dev/user as well as using an env variable for container name.
: ${DAPP_ED_CERT_PATH:="$(pwd)/../dapp-ed-cert"} | ||
: ${DAPP_CHAIN_TIMER_PATH:="$(pwd)/../dapp-chain-timer"} | ||
: ${SECOND_INVITE_PATH:="$(pwd)/../dapp-second-invite"} | ||
: ${DAPP_OFFER_UP_PATH:="$(pwd)/../dapp-offer-up"} | ||
: ${DAPP_AGORIC_BASICS_PATH:="$(pwd)/../dapp-agoric-basics"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should dapp-offer-up know about these other dapps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work if somebody clones dapp-offer-up
but uses something like demo
as the directory name?
Does yarn create @agoric/dapp demo
(from getting started) work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, any script executed by yarn start:docker
is not officially dapp-offer-up
. That we keep it in the same repo is a privacy-priced convenience. We can ask dev to either only load dapp-offer-up
or all the dapps in the parent directory or keep a flag up top with default to only dapp-offer-up
. I need a suggestion here.
As long as DAPP_OFFER_UP_PATH is set correctly this should work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm struggling to understand what you're saying about yarn create @agoric/dapp demo
.
contract/scripts/run-chain.sh
Outdated
# bring back chain process to foreground | ||
wait | ||
# Start new container with the chain startup commands | ||
docker run -d \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docker-compose.yml
syntax sure looked more straightforward.
What would you think of refactoring it to something like...
agd_image=...
linux_only=...
ports=...
...
docker run -d --name agdc $linux_only $ports $env $volumes $agd_image $start_agd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Fixed.
Do you plan to squash all the commits into 1? |
@dckc yes. |
20aa0be
to
30ffba1
Compare
This is a twin of a PR in dapp-agoric-basics repo.
Goal of this PR is to (maybe partially) close #92. Currently running of
agoriclocal
chain and deploying and starting contract are intertwined in this dapp. This is somewhat unnatural as chain should not depend on the files of any specific contract - apart from the ones that designated essential for its running.Further, running a chain independent of a specific contract will allow testing of multiple dapp simultaneously running and interacting with each other which may unlock several scenarios that a developer may want to test for.
As per discussion with @toliaqat, here is a plan:
run-chain.sh
) that necessary tasks for running of chain independently.yarn start:contract
should handle most of the heavy work including:ws-offer-up
here)copy tools needed for building, i.e.,Makefile
copy scripts and tools needed for required for makinginstall-bundle
,submit-proposal
,vote
etc. calls.create contract bundles on host machine, and then copy them to the workspace in docker container.build-proposal
,install-bundle
,submit-proposal
,vote
etc. calls needed to deploy and run the contract using scripts as before.update relevant docs. In particular, add guides to installagoric
andagd
CLI.Link to IBIS document.