-
Notifications
You must be signed in to change notification settings - Fork 607
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: local dev environment #1554
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1554 +/- ##
=======================================
Coverage 19.47% 19.47%
=======================================
Files 242 242
Lines 32258 32258
=======================================
Hits 6282 6282
Misses 24822 24822
Partials 1154 1154 Continue to review full report at Codecov.
|
&& apk add jq \ | ||
&& rm -rf /var/cache/apk/* | ||
RUN chmod +x /setup.sh | ||
RUN /setup.sh |
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.
One little improvement could be not to run this script during the docker build
phase but running as an entrypoint script of the docker container.
In this way we can avoid rebuilding the image if we want to modify a parameter of the genesis.
Building takes 1-2 mins while running the script should be in the order of seconds
The way to do that would be to modifying the Dockerfile like this:
...
WORKDIR $HOME
RUN apk update \
&& apk add jq \
&& rm -rf /var/cache/apk/*
RUN chmod +x /setup.sh
# Remove the RUN /setup
EXPOSE 26656
EXPOSE 26657
EXPOSE 1317
ENTRYPOINT ["/setup.sh"]
CMD ["osmosisd", "start"]
And in the setup.sh
:
#!/usr/bin/env sh
set -eu
<STANDARD CONTENT>
exec "$@"
The exec
part will execute the CMD
part of the Dockerfile after is has executed the script
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 only problem with this is the user would be recreating the genesis process on every start right? This process should only be done once at compilation time I think, and if the user wanted to modify a genesis param, they are probably better off recompiling anyway right?
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.
LGTM! Nice stuff! It's going to be very useful!
I added some improvements here and there.
As always, take what you like.
I'm approving the PR as it's working as it is.
@nikever @p0mvn thanks so much for the review, both had awesome suggestions that I ended up implementing |
* localosmosis * extract docker runs to script * change ubuntu to alpine * nicco suggestions * update changelog (cherry picked from commit f5472e0)
* localosmosis * extract docker runs to script * change ubuntu to alpine * nicco suggestions * update changelog (cherry picked from commit f5472e0) Co-authored-by: Adam Tucker <[email protected]>
* localosmosis * extract docker runs to script * change ubuntu to alpine * nicco suggestions * update changelog (cherry picked from commit f5472e0) # Conflicts: # CHANGELOG.md # Makefile
* localosmosis * extract docker runs to script * change ubuntu to alpine * nicco suggestions * update changelog
* feat: local dev environment (#1554) * localosmosis * extract docker runs to script * change ubuntu to alpine * nicco suggestions * update changelog (cherry picked from commit f5472e0) # Conflicts: # CHANGELOG.md # Makefile * feat: local dev environment (#1554) * localosmosis * extract docker runs to script * change ubuntu to alpine * nicco suggestions * update changelog * Update CHANGELOG.md Co-authored-by: Adam Tucker <[email protected]> Co-authored-by: Adam Tucker <[email protected]>
What is the purpose of the change
As it stands, it is not simple to quickly test a change in a local dev environment. This introduces a modified LocalOsmosis that is lightweight and makes it very easy to spin up a local net to test your changes. The docker image also creates a new genesis on build, preventing any issues that have arose in the past from hardcoded genesis files.
The basic process is as follows:
make localnet-build
make localnet-start
. Your local network has now started. Query it with your local daemon (i.eosmosisd status
)make localnet-keys
to add all 10 keys to your keyringmake localnet-remove
to remove all block dataTesting and Verifying
This code was tested locally in an arm64 environment
Documentation and Release Note
Unreleased
section inCHANGELOG.md
? yes