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 ansible run to the deploy
command
#3
Merged
Conversation
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
Right now this only provisions the genesis node. We need to implement the retrieval of the genesis IP and peer ID before we can run against the remaining nodes. It uses a very similar pattern to Terraform, with an interface, so that we can do behaviour-based unit testing.
There were over 700 lines of tests and setup code inside a single `test` module, which was becoming unwieldy to work were. This splits the setup code into one module, then a module for each function on `TestnetDeploy` that is under test. With the use of modules, the function name was removed from the test case names.
The smaller functions are easier to test and don't require as much mocking setup.
The multiaddr of the genesis node is composed by running `ansible-inventory` to get its IP address, by running the rpc client to get its peer ID. After we have that, we can then run against the remaining nodes. Those two functions were separated for easier test setup and admin.
It's possible that before we run Ansible, the SSH service is not yet running on the genesis node. This is something we seen happen occasionally, so we added in a little loop to sit and wait for it to become available. We only check this for the genesis run because the remaining nodes are provisioned after genesis, by which point the SSH service should be available.
This will control how many node processes run on each VM. The default is 20.
If the `--branch` and `--repo-owner` arguments are used, the build machine will be spun up to build a custom binary, which will then be uploaded to S3. Then when the nodes are being provisioned, this binary will be pulled in.
This creates the `.env` file by gathering input from the user, trying to assist them with which values should be provided. We are leaving it to the user to setup Terraform and Ansible on their OS.
This still needs to be extended with some information on how to obtain the IP addresses of each VM.
This will produce a list of all the VMs participating in the testnet, along with the SSH user for the cloud provider.
Addresses two issues that were noted during review: * Provide more helpful error message when inventory list is empty * Set other environment variables for Digital Ocean based on the `DO_PAT` variable For the first issue, there are a few different ways in which it might be possible for the environment to be non-existent. These were documented with comments in the code, which you can see in the diff. In addition, license headers were applied where they were missing.
RolandSherwin
approved these changes
Aug 17, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
8cede34 feat: add ansible run to the
deploy
commandRight now this only provisions the genesis node. We need to implement the retrieval of the genesis
IP and peer ID before we can run against the remaining nodes.
It uses a very similar pattern to Terraform, with an interface, so that we can do behaviour-based
unit testing.
7d86f8b tests: reorganise unit tests
There were over 700 lines of tests and setup code inside a single
test
module, which was becomingunwieldy to work were.
This splits the setup code into one module, then a module for each function on
TestnetDeploy
thatis under test. With the use of modules, the function name was removed from the test case names.
8741d35 refactor: split
deploy
into smaller functionsThe smaller functions are easier to test and don't require as much mocking setup.
f9ff92c feat: run ansible against remaining nodes
The multiaddr of the genesis node is composed by running
ansible-inventory
to get its IP address,by running the rpc client to get its peer ID.
After we have that, we can then run against the remaining nodes.
Those two functions were separated for easier test setup and admin.
81dd653 feat: ssh availability check
It's possible that before we run Ansible, the SSH service is not yet running on the genesis node.
This is something we seen happen occasionally, so we added in a little loop to sit and wait for it
to become available.
We only check this for the genesis run because the remaining nodes are provisioned after genesis, by
which point the SSH service should be available.
f2fe39e feat: provide
--node-count
arg fordeploy
cmdThis will control how many node processes run on each VM. The default is 20.
18b26be feat: run
deploy
with custom binaryIf the
--branch
and--repo-owner
arguments are used, the build machine will be spun up to builda custom binary, which will then be uploaded to S3. Then when the nodes are being provisioned, this
binary will be pulled in.
ce8129d feat: provide
setup
commandThis creates the
.env
file by gathering input from the user, trying to assist them with whichvalues should be provided.
We are leaving it to the user to setup Terraform and Ansible on their OS.
36106c5 docs: provide setup and usage instructions
This still needs to be extended with some information on how to obtain the IP addresses of each
VM.
58ce76d feat: provide
inventory
commandThis will produce a list of all the VMs participating in the testnet, along with the SSH user for
the cloud provider.
a31ee5b chore: respond to feedback
Addresses two issues that were noted during review:
DO_PAT
variableFor the first issue, there are a few different ways in which it might be possible for the
environment to be non-existent. These were documented with comments in the code, which you can see
in the diff.