-
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
Open
amessbee
wants to merge
22
commits into
main
Choose a base branch
from
ms/creating-contract-agnostic-docker
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
14170dc
feat: only mount scripts in docker-compose.yml
amessbee 46b09a7
rebase main
amessbee a076ceb
feat: clean run-chain.sh
amessbee 76842a8
feat: add copy-bundle.sh script
amessbee 146a4db
chore: docker compose file update
amessbee 5ac6637
chore: makefile
amessbee 9e4f849
chore: fix package.json to do bundle on host machine
amessbee 7971c2f
chore: fix package.json to do bundle on host machine
amessbee 5ce8ab7
chore: fix package.json to do bundle on host machine
amessbee 07588e2
chore: dedicated workspace dir in a3p container
amessbee 38d1a55
chore: scripts are now copied after chain starts
amessbee 5896060
chore: use container name instead of service in docker commands
amessbee 8093abc
chore: simplify start:contract
amessbee e2e3f5f
fixup! no need for copy-bundle.sh atm
amessbee 8c09770
chore: separate script to start chain
amessbee 63bec30
fixup! add back `-C /ws-offerup/contract`
amessbee d02bd4f
chore: clean up with ENV variables
amessbee 722a4a4
fixup! accidental container removal and refatoring
amessbee 64a76ca
chore: container name as env var
amessbee 206d346
fixup! error handling for CI
amessbee 30ffba1
fixup! error in setting volumes
amessbee 2c2e526
fixup! Update devcontainer.json
amessbee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,62 @@ | ||
#!/bin/bash | ||
set -e # Exit on error | ||
|
||
. /usr/src/upgrade-test-scripts/env_setup.sh | ||
# Set default container name if not provided | ||
: ${AGDC_NAME:="agdc"} | ||
|
||
# Start the chain in the background | ||
/usr/src/upgrade-test-scripts/start_agd.sh & | ||
# Check if container already exists and is running | ||
if [ "$(docker ps -q -f name=$AGDC_NAME)" ]; then | ||
echo "Container '$AGDC_NAME' is already running. Please stop it first using 'docker stop $AGDC_NAME' if you want to start a new instance." | ||
exit 1 | ||
fi | ||
|
||
# wait for blocks to start being produced | ||
waitForBlock 1 | ||
# Check if container exists but is stopped | ||
if [ "$(docker ps -aq -f status=exited -f name=$AGDC_NAME)" ]; then | ||
echo "Found stopped container '$AGDC_NAME'. Do you want to remove it before starting a new one? (y/N)" | ||
read -r response | ||
if [[ "$response" =~ ^[Yy]$ ]]; then | ||
echo "Removing stopped container '$AGDC_NAME'..." | ||
docker rm $AGDC_NAME | ||
else | ||
echo "Aborting to preserve existing container. You can set/update AGDC_NAME environment variable to avoid any potential conflicts." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
make -C /workspace/contract mint100 | ||
# Set paths only if environment variables are not already set | ||
: ${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"} | ||
|
||
# bring back chain process to foreground | ||
wait | ||
# Set workspace names with default values | ||
: ${WS_EDCERT:="/ws-edcert"} | ||
: ${WS_CHAIN_TIMER:="/ws-chainTimer"} | ||
: ${WS_SECOND_INVITE:="/ws-secondInvite"} | ||
: ${WS_OFFER_UP:="/ws-offerup"} | ||
: ${WS_AGORIC_BASICS:="/ws-agoricBasics"} | ||
|
||
# Start new container with the chain startup commands | ||
# Define docker parameters | ||
agd_image="ghcr.io/agoric/agoric-3-proposals:latest" | ||
linux_only="--platform linux/amd64" | ||
ports="-p 26656:26656 -p 26657:26657 -p 1317:1317" | ||
env="-e DEST=1 -e DEBUG=\"SwingSet:ls,SwingSet:vat\"" | ||
volumes="" | ||
[ -d "$DAPP_ED_CERT_PATH" ] && volumes+=" -v $DAPP_ED_CERT_PATH:$WS_EDCERT" | ||
[ -d "$DAPP_CHAIN_TIMER_PATH" ] && volumes+=" -v $DAPP_CHAIN_TIMER_PATH:$WS_CHAIN_TIMER" | ||
[ -d "$SECOND_INVITE_PATH" ] && volumes+=" -v $SECOND_INVITE_PATH:$WS_SECOND_INVITE" | ||
[ -d "$DAPP_OFFER_UP_PATH" ] && volumes+=" -v $DAPP_OFFER_UP_PATH:$WS_OFFER_UP" | ||
[ -d "$DAPP_AGORIC_BASICS_PATH" ] && volumes+=" -v $DAPP_AGORIC_BASICS_PATH:$WS_AGORIC_BASICS" | ||
start_agd="bash -c '. /usr/src/upgrade-test-scripts/env_setup.sh && \ | ||
/usr/src/upgrade-test-scripts/start_agd.sh & \ | ||
waitForBlock 1 && \ | ||
wait'" | ||
|
||
docker run -d --name $AGDC_NAME $linux_only $ports $env $volumes $agd_image $start_agd || { | ||
echo "Failed to start docker container. Please check if Docker is running and you have necessary permissions." | ||
exit 1 | ||
} | ||
|
||
echo "Container '$AGDC_NAME' started successfully." |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 likedemo
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 officiallydapp-offer-up
. That we keep it in the same repo is a privacy-priced convenience. We can ask dev to either only loaddapp-offer-up
or all the dapps in the parent directory or keep a flag up top with default to onlydapp-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
.