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

feat: add local dev setup script #1237

Merged
merged 9 commits into from
Nov 12, 2023

Conversation

zivkovicmilos
Copy link
Member

@zivkovicmilos zivkovicmilos commented Oct 11, 2023

Description

This PR introduces a bash script and simple Makefile to control local development.
It starts a node instance, along with the appropriate backup / restore processes.

Parent task: #1131

Docker equivalent: #1238

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests
  • Added new benchmarks to generated graphs, if any. More info here.

@zivkovicmilos zivkovicmilos self-assigned this Oct 11, 2023
misc/dev/dev.sh Outdated
# - start the backup service for transactions
(
echo "Starting Gno node..."
gnoland start
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note for later: add the --in-memory if it exists, or create a tempdir?

misc/dev/dev.sh Outdated
) &
(
# Sleep the restore until the node is fully loaded up
sleep $DELAY
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a fast method to check readiness would be convenient. Today, @gfanton informed me about an event checker created by @thehowl in a pull request. It would be great to have a CLI option to call this.

misc/dev/dev.sh Outdated
@@ -0,0 +1,77 @@
#!/usr/bin/env bash

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note for later: add a --watch option to automatically reload based on FS changes.

@moul
Copy link
Member

moul commented Oct 11, 2023

In relation to #1201, we're discussing the possibility of implementing a feature like git <subcommand>. This feature would search for the presence of git-subcommand in the $PATH. The goal is to create a set of helper tools that can be developed in bash, go, or any other suitable language.

@zivkovicmilos zivkovicmilos marked this pull request as ready for review November 1, 2023 16:42
@zivkovicmilos zivkovicmilos requested a review from a team as a code owner November 1, 2023 16:42
@zivkovicmilos
Copy link
Member Author

@moul

I've updated this PR to include heavy feedback from @gfanton.
The flow for the script is the following:

  • run the local node instance, save transactions that occurred into a backup file (that is wiped on every loop)
  • before the next loop, save the txs from the previous loop (to keep a historical reference)
  • on node start, feed in the historical transactions to the freshly created node

Please note there are no genesis transactions at play apart from the examples folder that is preloaded on every node directory creation, and the historical transactions that are being "replayed" as genesis transactions

Copy link
Member

@gfanton gfanton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just a minor comment

misc/loop/Makefile Outdated Show resolved Hide resolved

import (
_ "github.com/gnolang/gno/gno.land/cmd/gnoland"
_ "github.com/gnolang/tx-archive/cmd"
Copy link
Member

@moul moul Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the current status on considering to move tx-archive in this repo?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am completely fine with moving the archiver to the monorepo, along with our gnolang/faucet.

Do you want me to open a PR that migrates it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there good reasons to keep our repo by itself? We could try keeping the Dockerfile in a different repo and leave the main parts and libraries here.

If we make our 'gno' repo depend on another, and that one also depends on 'gno', it might cause problems with versions not matching up and make it harder to manage when we update things.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we lose anything by merging it into the monorepo - given that we keep the go.mod of the original repo that we migrate (just to keep imports separate, and not bloat the main gno go.mod), and retain some ability to do releases on this repo, which shouldn't be too tricky

What do you think @ajnavarro @gfanton ?

misc/loop/run_loop.sh Outdated Show resolved Hide resolved
zivkovicmilos and others added 3 commits November 7, 2023 15:34
Co-authored-by: Guilhem Fanton <8671905+gfanton@users.noreply.github.com>
@moul moul merged commit b1a53c0 into gnolang:master Nov 12, 2023
5 checks passed
@zivkovicmilos zivkovicmilos deleted the feat/add-local-script branch November 12, 2023 18:12
moul pushed a commit to moul/gno that referenced this pull request Nov 14, 2023
## Description

This PR introduces a bash script and simple Makefile to control local
development.
It starts a node instance, along with the appropriate backup / restore
processes.

Parent task: gnolang#1131 

Docker equivalent: gnolang#1238

<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [x] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [x] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [x] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>

---------

Co-authored-by: Guilhem Fanton <8671905+gfanton@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🚀 Needed for Launch
Status: Done
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants