{"id":29219800,"url":"https://github.com/protofire/genesis-ark-ansible","last_synced_at":"2025-07-03T02:07:34.748Z","repository":{"id":264192202,"uuid":"783767598","full_name":"protofire/genesis-ark-ansible","owner":"protofire","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-22T14:08:42.000Z","size":95,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-11-22T15:22:13.611Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/protofire.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-08T14:29:49.000Z","updated_at":"2024-11-22T14:08:45.000Z","dependencies_parsed_at":"2024-11-22T15:22:18.081Z","dependency_job_id":"e57f5085-4e38-471d-bb34-575257f676e5","html_url":"https://github.com/protofire/genesis-ark-ansible","commit_stats":null,"previous_names":["protofire/genesis-ark-ansible"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/protofire/genesis-ark-ansible","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protofire%2Fgenesis-ark-ansible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protofire%2Fgenesis-ark-ansible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protofire%2Fgenesis-ark-ansible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protofire%2Fgenesis-ark-ansible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/protofire","download_url":"https://codeload.github.com/protofire/genesis-ark-ansible/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protofire%2Fgenesis-ark-ansible/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263245316,"owners_count":23436515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-03T02:07:33.991Z","updated_at":"2025-07-03T02:07:34.716Z","avatar_url":"https://github.com/protofire.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n# IPC Subnet Creation Microservice\n\nThis microservice is designed to create an IPC subnet based on user-provided parameters. It uses Ansible as the underlying automation tool and is written in Python.\n\n\u003c!-- vscode-markdown-toc --\u003e\n* [Architecture](#Architecture)\n* [Usage](#Usage)\n\t* [Prerequisites](#Prerequisites)\n* [Available Commands](#AvailableCommands)\n* [Configuration](#Configuration)\n\t* [API Config](#APIConfig)\n\t* [Ansible Config](#AnsibleConfig)\n\t\t* [Validator Role](#ValidatorRole)\n\t* [Runner CLI](#RunnerCLI)\n\t\t* [User Parameters](#UserParameters)\n\t\t* [Infrastructure Config](#InfrastructureConfig)\n\t\t* [Hardcoded Values](#HardcodedValues)\n* [Requirements](#Requirements)\n* [Contributing](#Contributing)\n\n\u003c!-- vscode-markdown-toc-config\n\tnumbering=false\n\tautoSave=true\n\t/vscode-markdown-toc-config --\u003e\n\u003c!-- /vscode-markdown-toc --\u003e\n\n## \u003ca name='Architecture'\u003e\u003c/a\u003eArchitecture\n\nThe microservice consists of several components:\n\n- `cli/runner`: This module contains the Runner CLI - a command-line tool for interacting with the microservice API.\n- `ansible/roles`: This directory contains Ansible roles that define the tasks required to create an IPC subnet.\n- `app/v1`: This module contains Flask-based APIs for interacting with the microservice.\n\n## \u003ca name='Usage'\u003e\u003c/a\u003eUsage\n\nTo use this microservice, you'll need to complete the following prerequisites:\n\n### \u003ca name='Prerequisites'\u003e\u003c/a\u003ePrerequisites\n\n1. **Start MongoDB**: Make sure MongoDB is running on your system. You can use Docker Compose to start MongoDB in detached mode:\n\n```bash\ndocker-compose up mongo -d\n```\n\n2. **Start the API**: Start the Flask API:\n\n```bash\nflask --app app run --debug\n```\n\n3. **Install the Runner CLI**: Install the Runner CLI using pip:\n\n```bash\ncd cli\npip install --editable .\n```\n\nOnce you've completed these steps, you can use the Runner CLI to interact with the microservice.\n\n## \u003ca name='AvailableCommands'\u003e\u003c/a\u003eAvailable Commands\n\nThe following commands are available:\n\n- `runner subnets create`: Creates a new IPC subnet based on the provided parameters.\n- `runner subnets delete`: Deletes an existing IPC subnet.\n- `runner subnets install-blockscout`: Installs Blockscout on the created subnet.\n- `runner subnets reset-blockscout`: Resets Blockscout on the created subnet.\n- `runner subnets update-blockscout`: Updates Blockscout on the created subnet.\n\n## \u003ca name='Configuration'\u003e\u003c/a\u003eConfiguration\n\nThe microservice uses a combination of configuration files and environment variables to manage its settings.\n\n### \u003ca name='APIConfig'\u003e\u003c/a\u003eAPI Config\n\nFile location: [app/config.py](app/config.py)\n\n| Config Option | Description | Default Value |\n| --- | --- | --- |\n| DEBUG | Enable debug mode | False |\n| SECRET_KEY | Secret key for the application | os.environ.get(\"APP_SECRET_KEY\", \"dev\") |\n| INVENTORIES_DIR | Directory path for inventories | {project_root}/ansible/inventories |\n| PRIVATE_DATA_DIR | Directory path for private data | {project_root}/ansible/jobs |\n| PLAYBOOKS_DIR | Directory path for playbooks | {project_root}/ansible/playbooks |\n| MONGO_URI | MongoDB connection URI | mongodb://root:root@localhost/admin |\n| ROLES_PATH | Directory path for Ansible roles | {project_root}/ansible/roles |\n| MAINNET_RPC_URL | Mainnet RPC URL | https://api.node.glif.io/rpc/v1 |\n| CALIBNET_RPC_URL | Calibnet RPC URL | https://api.calibration.node.glif.io/rpc/v1 |\n| DEVELOPMENT | Enable development mode | False (only set to True in DevelopmentConfig) |\n\nNote that the `project_root` variable is used to construct the directory paths for inventories, private data, playbooks, and roles. The DEVELOPMENT config option is only set to True in the DevelopmentConfig class.\n\n### \u003ca name='AnsibleConfig'\u003e\u003c/a\u003eAnsible Config\n\n#### \u003ca name='ValidatorRole'\u003e\u003c/a\u003eValidator Role\n\nFile location: [ansible/roles/validator/defaults/main.yml](ansible/roles/validator/defaults/main.yml)\n\n| Config Option | Description | Default Value |\n| --- | --- | --- |\n| validator_fendermint_image_url | Pre-built image of fendermint | glif/lotus:fendermint-amd64 |\n| validator_fendermint_image_name | Name fendermint image shall be tagged with | fendermint:latest |\n| validator_bin_repo_url | URL of archive containing pre-compiled ipc and fendermint binaries | https://glif-ipc.s3.ap-northeast-1.amazonaws.com |\n| validator_nodejs_version | Version of nodejs required by contracts | 18 |\n| validator_private_key_path | Local path to the validator private key | /home/ubuntu/.ipc/validator_1 |\n| validator_parent_subnet_id | IPC parent subnet ID the validator subnet belongs to | r314159 |\n| validator_subnet_id | IPC subnet ID the validator has to be a part of | t410fug7q7fgzeehfgr6qlubzs45z2sjzcbw3nbhpiyi |\n| validator_cmt_p2p_host_port | Comet BFT P2P port | 26656 |\n| validator_cmt_rpc_host_port | Comet BFT RPC port | 26657 |\n| validator_ethapi_host_port | Fendermint Eth API port | 8545 |\n| validator_bootstraps | Node that validator will use as a bootstrap | \u003cPLEASE PUT COMETBFT NODE ID of VALIDATOR-1\u003e@validator-1-cometbft:26656 |\n| validator_resolver_bootstraps | Resolver bootstraps for the validator | /dns/validator-1-fendermint/tcp/26655/p2p/\u003cPLEASE PUT PEER_ID of VALIDATOR-1\u003e |\n| validator_default_address | Default address ipc-cli will use in the --from flag | 0xbc68608545c51873e1a3e864f7edfbcfe3d70ce7 |\n| validator_secrets | List of validator secrets | [] |\n| validator_supply_source_kind | Kind of supply source in the subnet | native |\n| validator_permission_mode | Permission mode of the subnet | collateral |\n| validator_ipc_repository_path | Local path to the ipc repository | /home/ubuntu/ipc |\n| validator_ipc_repository_url | URL of the ipc repository | https://github.com/consensus-shipyard/ipc.git |\n| validator_ipc_repository_version | Version of the ipc repository | main |\n| validator_min_validator_stake | Minimum validator stake | 1 |\n| validator_min_validators | Minimum number of validators | 4 |\n| validator_name | Name of the validator | validator-1 |\n| validator_package_dependencies_debian | Debian package dependencies for the validator | [\"git\", \"curl\", \"wget\", \"apt-transport-https\", \"ca-certificates\", \"software-properties-common\"] |\n| validator_parent_gateway | Parent gateway for the validator | 0x6d25fbFac9e6215E03C687E54F7c74f489949EaF |\n| validator_parent_registry | Parent registry for the validator | 0xc938B2B862d4Ef9896E641b3f1269DabFB2D2103 |\n| validator_resolver_host_port | Resolver host and port for the validator | 26655 |\n\nPlease note that some of these variables have placeholder values that need to be replaced with actual values.\n\nAlso note that the role does not build the IPC Stack but pulls it from the S3 repository managed by Glif. That allows for faster node launch.\n\n**IMPORTANT**: You have to deploy the registry and gateway contracts before you attempt to create a subnet using them.\n\n### \u003ca name='RunnerCLI'\u003e\u003c/a\u003eRunner CLI\n\nThis microservice is still a work in progress! To get started, you can manually specify user parameters and infra configuration in the [cli/runner/subnets/utils.py](cli/runner/subnets/utils.py) file.\n\n#### \u003ca name='UserParameters'\u003e\u003c/a\u003eUser Parameters\n\n##### Top-Level Fields\n\n| Field | Description |\n| --- | --- |\n| id | Unique identifier |\n| appChainName | Application chain name |\n| networkTypeFor | Network type for |\n| isPrivate | Whether the network is private |\n| networkType | Type of network (e.g. \"fvm\") |\n| minStake | Minimum stake required |\n| bottomUp | Bottom-up value |\n| topDown | Top-down value |\n| state | Current state (e.g. \"inProgress\") |\n| userId | User ID associated with the request |\n\n##### Nodes Array\n\n| Field | Description |\n| --- | --- |\n| id | Unique node identifier |\n| isArchive | Whether the node is archival |\n| name | Node name (e.g. \"validator_1\") |\n| cpu | CPU specification |\n| memory | Memory specification |\n| location | Geographic location (e.g. \"us-east-1\") |\n| cloud | Cloud provider (e.g. \"AWS\") |\n| createdAt | Timestamp when the node was created |\n| updatedAt | Timestamp when the node was last updated |\n| PrivateKey | Private key associated with the node |\n| stake | Stake value associated with the node |\n\n#### \u003ca name='InfrastructureConfig'\u003e\u003c/a\u003eInfrastructure Config\n\n##### Top-Level Fields\n\n| Field | Description |\n| --- | --- |\n| _id | Unique identifier |\n| project_id | Project ID associated with the request |\n| customer_id | Customer ID associated with the request |\n| infrastructurestatus | Current infrastructure status (e.g. \"CREATION_INITIALIZED\") |\n\n##### Instance Connections Array\n\n| Field | Description |\n| --- | --- |\n| nodeId | Unique node identifier |\n| ipAddress | IP address associated with the node |\n\n#### \u003ca name='HardcodedValues'\u003e\u003c/a\u003eHardcoded Values\n\nThis microservice is work in progress, so there's a bit of hardcoded values. Most of them are used while populating inventory. You can find them in the [cli/runner/subnets/models.py](cli/runner/subnets/models.py) file:\n\n**Configuratuin Values**:\n\n- `validator_parent_subnet_id`: r314159\n- `validator_parent_registry`: 0xC1E8E7EE4EFe6b35A5Ff1f20792C9eD99415DFCe\n- `validator_parent_gateway`: 0x528fd57079fC36028dA844440D508e56aD447c5B\n- `validator_min_validators`: 4\n- `validator_permission_mode`: collateral\n- `validator_supply_source_kind`: native\n\n***ATTENTION!***: You have to replace `validator_parent_registry` and `validator_parent_gateway` here and not in the [validator role configuration](#validator-role) in order for your values to be reflected in the inventory.\n\n**Security Values**:\n\n- `ansible_sudo_pass`: 12345\n- `ansible_ssh_private_key_file`: ~/.ssh/id_rsa\n\n## \u003ca name='Requirements'\u003e\u003c/a\u003eRequirements\nThe following dependencies are required to run this microservice:\n\n- flask\n- ansible-runner\n- jsonschema\n- toml\n- PyYAML\n- requests\n- pymongo[srv]\n- Flask-PyMongo\n- click\n- eth-keys\n- web3\n\nYou can install these dependencies using `pip` and the `requirements.txt` file.\n\n## \u003ca name='Contributing'\u003e\u003c/a\u003eContributing\n\nContributions to this microservice are welcome! If you'd like to contribute, please fork this repository and submit a pull request with your changes.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotofire%2Fgenesis-ark-ansible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprotofire%2Fgenesis-ark-ansible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotofire%2Fgenesis-ark-ansible/lists"}