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

docs: Move Localnet development to separate page #977

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aefhm
Copy link
Contributor

@aefhm aefhm commented Oct 8, 2024

Description

Close #959

Note. Configuring Docusaurus redirect is not possible from an URL with an anchor.

message: '"redirects[54].from[0]" (/dapp/emerald/writing-dapps-on-emerald#running-a-private-oasis-network-locally) is not a valid pathname. Pathname should start with slash and not contain any domain or query string.',

TODO

  • run broken link checker

PREVIEW

@aefhm aefhm added the documentation Improvements or additions to documentation label Oct 8, 2024
@aefhm aefhm self-assigned this Oct 8, 2024
Copy link

netlify bot commented Oct 8, 2024

Deploy Preview for oasisprotocol-docs ready!

Name Link
🔨 Latest commit 84e30a8
🔍 Latest deploy log https://app.netlify.com/sites/oasisprotocol-docs/deploys/670d0c961e7c9a0007a619fb
😎 Deploy Preview https://deploy-preview-977--oasisprotocol-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -79,91 +79,9 @@ ParaTime.
[Emerald Mainnet]: ./network.mdx
[Emerald Testnet]: ./network.mdx

## Running a Private Oasis Network Locally
#### For development and testing, you can run a local [instance][localnet]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#### For development and testing, you can run a local [instance][localnet]
## For development and testing, you can run a local [instance][localnet]

Probably 2 # too much
I think having the old header and card to the localnet could be also a good way

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. Yeah, ## is more consistent with "Testnet" etc. Let me try the text for now. I tend to think that the card takes the reader away from the flow of the document.

docs/dapp/tools/README.md Outdated Show resolved Hide resolved
docs/dapp/tools/localnet.md Outdated Show resolved Hide resolved
docs/dapp/tools/localnet.md Outdated Show resolved Hide resolved
docs/dapp/tools/localnet.md Outdated Show resolved Hide resolved
docs/dapp/tools/localnet.md Outdated Show resolved Hide resolved
docs/dapp/tools/localnet.md Outdated Show resolved Hide resolved
docs/dapp/tools/localnet.md Outdated Show resolved Hide resolved
docs/dapp/tools/localnet.md Outdated Show resolved Hide resolved
@matevz matevz changed the title docs: Move localnet development to separate page docs: Move Localnet development to separate page Oct 11, 2024
@aefhm aefhm force-pushed the xz/959-localnet-section branch 2 times, most recently from 42aa9cc to 2a0e8e7 Compare October 13, 2024 15:24
docs/dapp/tools/localnet.mdx Outdated Show resolved Hide resolved
After a while, running the `sapphire-localnet` will show you something like:

```
sapphire-localnet 2024-05-28-git37b7166 (oasis-core: 24.0-gitfb49717, sapphire-paratime: 0.7.3-testnet, oasis-web3-gateway: 5.1.0)
Copy link
Contributor 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 devs need duplicated info for Emerald.

@aefhm aefhm requested review from matevz and rube-de October 14, 2024 12:20
Copy link
Member

@matevz matevz left a comment

Choose a reason for hiding this comment

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

Added some ideas.

Comment on lines +98 to +127
:::tip

If you prefer using the same mnemonics each time (e.g. for testing purposes)
or to populate just a single account, use `-to` flag and pass the mnemonics or
the wallet addresses. By passing the `-test-mnemonic` flag you can fund the
standard test accounts provided by the `hardhat node` commmand and that are
typically used for solidity unit tests.

<Tabs>
<TabItem value="Sapphire">

```sh
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/sapphire-localnet -to "bench remain brave curve frozen verify dream margin alarm world repair innocent" -n3
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/sapphire-localnet -to "0x75eCF0d4496C2f10e4e9aF3D4d174576Ee9010E2,0xbDA5747bFD65F08deb54cb465eB87D40e51B197E"
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/sapphire-localnet -test-mnemonic
```

</TabItem>
<TabItem value="Emerald">

```sh
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/emerald-localnet -to "bench remain brave curve frozen verify dream margin alarm world repair innocent" -n3
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/emerald-localnet -to "0x75eCF0d4496C2f10e4e9aF3D4d174576Ee9010E2,0xbDA5747bFD65F08deb54cb465eB87D40e51B197E"
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/emerald-localnet -test-mnemonic
```

</TabItem>
</Tabs>

:::
Copy link
Member

Choose a reason for hiding this comment

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

The -test-mnemonic is now default. Let's keep this outside of admonition not to bloat the chapter too much.

Suggested change
:::tip
If you prefer using the same mnemonics each time (e.g. for testing purposes)
or to populate just a single account, use `-to` flag and pass the mnemonics or
the wallet addresses. By passing the `-test-mnemonic` flag you can fund the
standard test accounts provided by the `hardhat node` commmand and that are
typically used for solidity unit tests.
<Tabs>
<TabItem value="Sapphire">
```sh
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/sapphire-localnet -to "bench remain brave curve frozen verify dream margin alarm world repair innocent" -n3
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/sapphire-localnet -to "0x75eCF0d4496C2f10e4e9aF3D4d174576Ee9010E2,0xbDA5747bFD65F08deb54cb465eB87D40e51B197E"
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/sapphire-localnet -test-mnemonic
```
</TabItem>
<TabItem value="Emerald">
```sh
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/emerald-localnet -to "bench remain brave curve frozen verify dream margin alarm world repair innocent" -n3
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/emerald-localnet -to "0x75eCF0d4496C2f10e4e9aF3D4d174576Ee9010E2,0xbDA5747bFD65F08deb54cb465eB87D40e51B197E"
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/emerald-localnet -test-mnemonic
```
</TabItem>
</Tabs>
:::
By default, the Localnet docker image will populate the first five accounts
derived from the standard test mnemonic, compatible with `hardhat node`.
These accounts are typically used for solidity unit tests. If you prefer
populating different accounts, use `-to` flag and pass the mnemonics or the
wallet addresses. Using the `-n` parameter defines the number of derived
addresses to fund.
<Tabs>
<TabItem value="Sapphire">
```sh
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/sapphire-localnet -to "bench remain brave curve frozen verify dream margin alarm world repair innocent" -n3
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/sapphire-localnet -to "0x75eCF0d4496C2f10e4e9aF3D4d174576Ee9010E2,0xbDA5747bFD65F08deb54cb465eB87D40e51B197E"
```
</TabItem>
<TabItem value="Emerald">
```sh
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/emerald-localnet -to "bench remain brave curve frozen verify dream margin alarm world repair innocent" -n3
docker run -it -p8544-8546:8544-8546 ghcr.io/oasisprotocol/emerald-localnet -to "0x75eCF0d4496C2f10e4e9aF3D4d174576Ee9010E2,0xbDA5747bFD65F08deb54cb465eB87D40e51B197E"
```
</TabItem>
</Tabs>


- `http://localhost:8545`
- `ws://localhost:8546`

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Additionally, the [Oasis GRPC](https://github.com/oasisprotocol/oasis-core/blob/master/docs/oasis-node/rpc.md) endpoint is exposed on:
- `http://localhost:8544`

@@ -16,7 +16,7 @@ import {AddEmeraldToMetaMask as E, AddEmeraldTestnetToMetaMask as ET} from '@sit
| Tools | | [Testing token Faucet][faucet] | [Local development Docker image][localnet]

[faucet]: https://faucet.testnet.oasis.io/
[localnet]: https://github.com/oasisprotocol/oasis-web3-gateway/tree/main/docker
[localnet]: /dapp/tools/localnet
Copy link
Member

Choose a reason for hiding this comment

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

Please use paths to the .md files instead.

Suggested change
[localnet]: /dapp/tools/localnet
[localnet]: ../tools/localnet.mdx

:::

[sapphire-localnet]: https://github.com/oasisprotocol/oasis-web3-gateway/pkgs/container/sapphire-localnet
[emerald-localnet]: https://github.com/oasisprotocol/oasis-web3-gateway/pkgs/container/emerald-localnet
Copy link
Member

Choose a reason for hiding this comment

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

Please also add a section on how to run Localnet with github actions. For example:

  jobs:
    services:
      sapphire-localnet-ci:
        image: ghcr.io/oasisprotocol/sapphire-localnet
        ports:
          - 8544:8544
          - 8545:8545
          - 8546:8546
        env:
          OASIS_DEPOSIT_BINARY: /oasis-deposit -n 2
        options: >-
          --rm
          --health-cmd="test -f /CONTAINER_READY"
          --health-start-period=90s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move the Localnet docker section into separate chapter
3 participants