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

[sui-test-validator] update sui-test-validator options and dockerfile #14701

Closed
wants to merge 6 commits into from

Conversation

vladilen11
Copy link
Contributor

@vladilen11 vladilen11 commented Nov 7, 2023

Description

Give the address configuration to the developer allows for more flexibility in starting sui-test-validator.

Test Plan

How did you test the new or updated feature?


If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.

Type of Change (Check all that apply)

  • protocol change
  • user-visible impact
  • breaking change for a client SDKs
  • breaking change for FNs (FN binary must upgrade)
  • breaking change for validators or node operators (must upgrade binaries)
  • breaking change for on-chain data layout
  • necessitate either a data wipe or data migration

Release notes

sui-test-validator change

sui-test-validator cmd:

$ ./target/release/sui-test-validator --help
Start a Sui validator and fullnode for easy testing

Usage: sui-test-validator [OPTIONS]

Options:
  -c, --config-dir <CONFIG_DIR>                Config directory that will be used to store network config, node db, keystore sui genesis -f --with-faucet generates a genesis config that can be
                                               used to start this process. Example: sui-test-validator --config-dir ~/.sui/sui_config We can use any config dir that is generated by the sui genesis
      --fullnode-rpc-addr <FULLNODE_RPC_ADDR>  Address to start the Fullnode RPC server on [default: 127.0.0.1:9000]
      --faucet-addr <FAUCET_ADDR>              Address to start the Sui faucet on [default: 127.0.0.1:9123]
      --indexer-rpc-addr <INDEXER_RPC_ADDR>    Address to start the Indexer RPC server on [default: 127.0.0.1:9124]
      --pg-port <PG_PORT>                      Port for the Indexer Postgres DB 5432 is the default port for postgres on Mac [default: 5432]
      --pg-host <PG_HOST>                      Hostname for the Indexer Postgres DB [default: localhost]
      --epoch-duration-ms <EPOCH_DURATION_MS>  The duration for epochs (defaults to one minute) [default: 60000]
      --with-indexer                           if we should run indexer
      --use-indexer-experimental-methods       TODO(gegao): remove this after indexer migration is complete
  -h, --help                                   Print help
  -V, --version                                Print version
  1. start at 127.0.0.1
./target/release/sui-test-validator
  1. start at 0.0.0.0
./target/release/sui-test-validator --fullnode-rpc-addr "0.0.0.0:9000" --faucet-addr "0.0.0.0:9123"

Add sui-test-validator Dockerfile

Hopefully the mystenlabs team will maintain a docker image of sui-test-validator, which is really important for developers.

docker run -id -p 9000:9000 -p 9123:9123 vladilenaksana/sui-test-validator:0.0.2 sui-test-validator --fullnode-rpc-addr "0.0.0.0:9000" --faucet-addr "0.0.0.0:9123"

Copy link

vercel bot commented Nov 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mysten-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2024 3:00pm
sui-core ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2024 3:00pm
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2024 3:00pm
sui-typescript-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2024 3:00pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
explorer ⬜️ Ignored (Inspect) Visit Preview Jul 7, 2024 3:00pm
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Jul 7, 2024 3:00pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Jul 7, 2024 3:00pm

@vercel vercel bot temporarily deployed to Preview – mysten-ui November 7, 2023 15:48 Inactive
@vladilen11 vladilen11 changed the title update sui-test-validator options and dockerfile [sui-test-validator] update sui-test-validator options and dockerfile Nov 8, 2023
Copy link
Contributor

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jan 10, 2024
@vladilen11
Copy link
Contributor Author

Is anyone could help this pr? I think this dockerfile is very useful for developers. @patrickkuo

Copy link

vercel bot commented Jul 3, 2024

@vladilen11 is attempting to deploy a commit to the Mysten Labs Team on Vercel.

A member of the Team first needs to authorize it.

@stefan-mysten
Copy link
Contributor

Hi @vladilen11

Just to understand, what do you want to have in a Dockerfile, just a local network running?

Important to note, we are just about to deprecate sui-test-validator binary. Its functionality was integrated into sui start.
In a nutshell, you can replace the most basic usage of sui-test-validator with

  • sui start --with-faucet --force-regenesis.

Regarding the host and ports, I see the issue that you need to have the service listening on 0.0.0.0 for Docker to work properly.

@vladilen11
Copy link
Contributor Author

@stefan-mysten Yes, I want to be able to boot a localnet directly through docker, because sui-test-validator had a lot of people having problems(https://obelisk.build/engine/docs/quick-start/faq) with postgres before, so we want to start it through docker.

Our primary goal in doing this is to allow move contract developers to focus their efforts on contract development rather than tedious environment configuration.

You're right, the modification I gave to sui-test-validator was so that I could expose the faucet api and the rpc.


But since sui-test-validator will be deprecated, do you think there's still a need for my pr to be merged in?

Also I observed that I still can't specify the address of the faucet or fullnode in the sui start command, I guess I can recreate a pr to refine the details here.

      --with-faucet[=<FAUCET_PORT>]
          Start a faucet with default host and port: 127.0.0.1:9123, or on the port provided. When providing a specific value, please use the = sign between the flag and value:
          `--with-faucet=6123`

      --fullnode-rpc-port <FULLNODE_RPC_PORT>
          Port to start the Fullnode RPC server on. Default port is 9000

          [default: 9000]

@stefan-mysten
Copy link
Contributor

@vladilen11 I have not forgot about this. Just put up a PR #18607 that should enable this for sui start.

@stefan-mysten
Copy link
Contributor

@vladilen11 everything now starts on 0.0.0.0, so it should unblock you when using Docker. Let me know if you spot any issues.

tx-tomcat pushed a commit to tx-tomcat/sui-network that referenced this pull request Jul 29, 2024
## Description 

Make indexer, GraphQL, faucet hosts configurable. When using Docker, due
to the way it sets up a network interface for the container, the
services need to bind to 0.0.0.0 to be able to be accessed from outside
the container. This PR enables configurable hosts for these three
services via optional flags:
- `--indexer-host 0.0.0.0`
- `--faucet-host 0.0.0.0`
- `--graphql-host 0.0.0.0`

If no host flag is provided, it will use the default `0.0.0.0` one.

In addition, I found a bug where if the `default_value` is not provided,
calling `unwrap_or_default` will return value 0 (if that field is an
int). For example, if we call `--with-graphql`, the indexer port would
have been set to 0 because the `default_missing_value` is only set when
the flag is passed, but not when it is not passed, which is the case
here due `with-indexer` being implicit enabled.

This supersedes MystenLabs#14701 and should close MystenLabs#14701.

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [x] CLI: Changed `sui start` to allow configurable hosts for indexer
(`--indexer-host `), GraphQL (`--graphql-host `), and faucet
(`--faucet-host`) services. This will enable to use `sui start` from a
Docker container. By default, all services start with `0.0.0.0` host.
- [ ] Rust SDK:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants