-
Notifications
You must be signed in to change notification settings - Fork 0
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
add another node to e2e test setup #43
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# e2e test setup | ||
|
||
For the most accurate reflection of real-world use cases, this repo includes an end-to-end test | ||
setup that includes a kava node running with multiple validators. | ||
|
||
This directory contains the configuration and startup files necessary for that setup. | ||
|
||
From the repo root, the following make commands work with these files: | ||
* `make up` - starts the service. if it has never been started before, setup will be performed | ||
* `make down` - stops & destroys the nodes & network | ||
* `make reset` - destroys & recreates the nodes & network. setup will be performed | ||
* `make ready` - blocks the process until the network is producing blocks | ||
|
||
`make e2e-test` and `make test` (which runs unit & e2e tests) both rely on the network being running and ready. | ||
|
||
The following does not affect the network: | ||
* `make refresh` - destroys and recreates only the proxy service. useful for picking up new proxy env variables. | ||
|
||
|
||
## how it works | ||
|
||
There is a network running with a single validator. The config and entrypoint for this node is in [kava-validator](./kava-validator/). | ||
|
||
The `shared/` directory is shared between all nodes and is used to share necessary details from the validator to the other nodes in the network. | ||
|
||
The validator has an [entrypoint](./kava-validator/kava-validator-entrypoint.sh) that does the following on first startup: | ||
* `init`s a new kava home directory | ||
* creates a gentx and initializes the network genesis file | ||
* writes its node id to `shared/VALIDATOR_NODE_ID` so peers can connect to it | ||
* copies the genesis file to `shared/genesis` so other peers can use it to connect | ||
* starts the network | ||
|
||
Meanwhile, any peer node in the network (configured in [docker-compose.yml](../docker-compose.yml)) has an [entrypoint](./shared/kava-entrypoint.sh) | ||
that does the following: | ||
* `init`s a new kava home directory | ||
* waits for the validator to share the genesis file | ||
* copies over the validator | ||
* reads the validator's node id from `shared/VALIDATOR_NODE_ID` | ||
* starts the network with the validator as a peer | ||
|
||
## add more nodes | ||
|
||
We'll want more shards in the future!! This setup supports this. To add another api-enabled node to the network: | ||
1. Add a configuration in the [docker-compose.yml](../docker-compose.yml) | ||
```yml | ||
# peer node with api running validator's network | ||
nodename: | ||
image: kava/kava:${KAVA_CONTAINER_TAG} | ||
entrypoint: /docker/shared/kava-entrypoint.sh | ||
env_file: .env | ||
volumes: | ||
- ./docker/shared:/docker/shared | ||
# expose ports for other services to be able to connect to within | ||
# the default docker-compose network | ||
expose: | ||
- "${KAVA_CONTAINER_COSMOS_RPC_PORT}" | ||
- "${KAVA_CONTAINER_EVM_RPC_PORT}" | ||
# optional: bind host ports to access outside docker network | ||
ports: | ||
- "${EXPOSED_RPC_PORT}:${KAVA_CONTAINER_COSMOS_RPC_PORT}" | ||
- "${EXPOSED_EVM_JSON_RPC_PORT}:${KAVA_CONTAINER_EVM_RPC_PORT}" | ||
``` | ||
Note that `nodename` should be replaced with whatever you call your new node. | ||
|
||
The `ports` bindings are only necessary if you want to directly query the node from outside the docker network. | ||
If so, replace and create new env variables for | ||
* `EXPOSED_RPC_PORT` - the host (outside docker network) port for the rpc api | ||
* `EXPOSED_EVM_JSON_RPC_PORT` - the host (outside docker network) port for the evm json rpc api | ||
|
||
2. Add the new node to the proxy backend host map config: `localhost:${PROXY_PORT_FOR_NEW_HOST}>http://nodename:8545` | ||
|
||
3. Make sure the proxy port routes to the proxy service. Configure this in the docker-compose `ports` | ||
of `proxy`: `- "${PROXY_PORT_FOR_NEW_HOST}:${PROXY_CONTAINER_PORT}"` | ||
|
||
4. Run `make reset` and the new node should be running & connected to the network. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit:
kava-pruning
?