-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat(localnet): Add --no-explorer flag and reduce size #653
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,8 @@ | |
|
||
rm -f /CONTAINER_READY | ||
|
||
export OASIS_DOCKER_START_EXPLORER=${OASIS_DOCKER_START_EXPLORER:-yes} | ||
|
||
export OASIS_DOCKER_NO_GATEWAY=${OASIS_DOCKER_NO_GATEWAY:-no} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we change this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also I just remembered that enabling nexus/explorer while gateway is disabled wont work, so let's maybe catch that and error out (or alternative, if gateway is disabled also automatically disable nexus/explorer). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, I'll fix that :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I've kept this as-is for compatibility, but we can do a separate PR to change this in the future. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait sorry, I was really stupid or something 😭 Nexus and Explorer will work just ok without web3-gateway? Can you please just revert this part where gateway automatically disables nexus/explrer, and then also at the end move if [[ "${OASIS_DOCKER_START_EXPLORER}" == "yes" ]]; then
notice "Nexus API listening on ${CYAN}http://localhost:8547${OFF}.\n"
notice "Localnet Explorer available at ${CYAN}http://localhost:${EXPLORER_PORT}${OFF}.\n"
fi out of the nested IF. This case where you don't have gateway and do have nexus is probably not really useful since there likely wont be any Sapphire transactions, but one might still use it if it's interested only in the cosnseus part or something. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No worries, fixed! :) |
||
|
||
export OASIS_NODE_LOG_LEVEL=${OASIS_NODE_LOG_LEVEL:-warn} | ||
|
@@ -148,6 +150,16 @@ while [[ $# -gt 0 ]]; do | |
shift | ||
shift | ||
;; | ||
--no-explorer) | ||
abukosek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Don't start explorer and indexer. | ||
OASIS_DOCKER_START_EXPLORER="no" | ||
shift | ||
;; | ||
--no-gateway) | ||
# Don't start web3 gateway. | ||
OASIS_DOCKER_NO_GATEWAY="yes" | ||
shift | ||
;; | ||
*) | ||
echo "Unknown argument: $1" | ||
exit 1; | ||
|
@@ -351,8 +363,8 @@ else | |
sleep 10 | ||
fi | ||
|
||
# Once everything is initialized and setup, start Nexus and Explorer. | ||
if [ ! -z "${OASIS_NEXUS_BINARY:-}" ]; then | ||
# Once everything is initialized and setup, start Nexus and Explorer if enabled. | ||
if [[ "${OASIS_DOCKER_START_EXPLORER}" == "yes" ]]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also please update the notices at the end of initialization so that Web3 Gateway, Explorer and Nexus addresses are not displayed when they are not enabled? We currently always display the addresses. Other than that, the rest looks good to me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! Fixed :) |
||
notice "Creating database 'nexus'\n" | ||
su -c "createdb -h 127.0.0.1 -p 5432 -U postgres nexus" postgres | ||
|
||
|
@@ -369,9 +381,7 @@ if [ ! -z "${OASIS_NEXUS_BINARY:-}" ]; then | |
# Wait for Oasis Nexus to start. | ||
while ! curl -s http://localhost:8547/ 2>1 &>/dev/null; do echo -n .; sleep 1; done | ||
echo | ||
fi | ||
|
||
if [ ! -z "${OASIS_EXPLORER_DIR:-}" ]; then | ||
notice "Waiting for Explorer to start" | ||
cd ${OASIS_EXPLORER_DIR} | ||
serve -s ${OASIS_EXPLORER_DIR} -l ${EXPLORER_PORT} > /var/log/explorer.log 2>&1 & | ||
|
@@ -441,9 +451,15 @@ T_END="$(date +%s)" | |
echo | ||
printf "${YELLOW}WARNING: The chain is running in ephemeral mode. State will be lost after restart!${OFF}\n\n" | ||
notice "GRPC listening on ${CYAN}http://localhost:8544${OFF}.\n" | ||
notice "Web3 RPC listening on ${CYAN}http://localhost:8545${OFF} and ${CYAN}ws://localhost:8546${OFF}. Chain ID: ${GATEWAY__CHAIN_ID}.\n" | ||
notice "Nexus API listening on ${CYAN}http://localhost:8547${OFF}.\n" | ||
notice "Localnet Explorer available at ${CYAN}http://localhost:${EXPLORER_PORT}${OFF}.\n" | ||
|
||
if [[ "${OASIS_DOCKER_NO_GATEWAY}" == "no" ]]; then | ||
notice "Web3 RPC listening on ${CYAN}http://localhost:8545${OFF} and ${CYAN}ws://localhost:8546${OFF}. Chain ID: ${GATEWAY__CHAIN_ID}.\n" | ||
fi | ||
if [[ "${OASIS_DOCKER_START_EXPLORER}" == "yes" ]]; then | ||
notice "Nexus API listening on ${CYAN}http://localhost:8547${OFF}.\n" | ||
notice "Localnet Explorer available at ${CYAN}http://localhost:${EXPLORER_PORT}${OFF}.\n" | ||
fi | ||
|
||
notice "Container start-up took ${CYAN}$((T_END-T_START))${OFF} seconds, node log level is set to ${CYAN}${OASIS_NODE_LOG_LEVEL}${OFF}.\n" | ||
|
||
touch /CONTAINER_READY | ||
|
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.
Don't forget to describe the usage in the Sapphire Localnet chapter: https://github.com/oasisprotocol/docs/blob/main/docs/dapp/tools/localnet.mdx
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.
PR opened in docs: oasisprotocol/docs#1032