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

add mainnet subql #375

Merged
merged 1 commit into from
Nov 6, 2024
Merged

add mainnet subql #375

merged 1 commit into from
Nov 6, 2024

Conversation

DaMandal0rian
Copy link
Contributor

@DaMandal0rian DaMandal0rian commented Nov 6, 2024

PR Type

enhancement, configuration changes


Description

  • Added Terraform configuration files for deploying subql on AWS mainnet.
  • Configured subql module with specific node settings for blue and green deployments.
  • Defined output variables for node IPv4 addresses and DNS records.
  • Added variable definitions with sensitive information for mainnet deployment.
  • Updated docker tags in taurus deployment configuration.
  • Provided an example Terraform variables file for mainnet setup.

Changes walkthrough 📝

Relevant files
Configuration changes
backend.tf
Add Terraform cloud configuration for mainnet                       

explorer/terraform/aws/mainnet/backend.tf

  • Added Terraform cloud configuration for mainnet.
  • Set organization to subspace-sre.
  • Defined workspace name as subql-mainnet-aws.
  • +9/-0     
    variables.tf
    Add variable definitions for mainnet configuration             

    explorer/terraform/aws/mainnet/variables.tf

  • Added variable definitions for mainnet deployment.
  • Included sensitive variables for security.
  • Set default values for several variables.
  • +112/-0 
    main.tf
    Update docker tags for taurus deployment                                 

    explorer/terraform/aws/taurus/main.tf

    • Updated docker tags for subql node configurations.
    +4/-4     
    terraform.tfvars.example
    Provide example Terraform variables for mainnet                   

    explorer/terraform/aws/mainnet/terraform.tfvars.example

  • Added example Terraform variables file for mainnet.
  • Included placeholders for AWS credentials and other configurations.
  • +21/-0   
    Enhancement
    main.tf
    Configure subql module for mainnet with node settings       

    explorer/terraform/aws/mainnet/main.tf

  • Added module configuration for subql with specific node
    configurations.
  • Defined configurations for blue and green deployments.
  • Included configurations for nova subql nodes.
  • Set various environment variables and secrets.
  • +75/-0   
    outputs.tf
    Define output variables for mainnet deployment                     

    explorer/terraform/aws/mainnet/outputs.tf

  • Defined output variables for node IPv4 addresses.
  • Added output for DNS records.
  • +24/-0   

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    github-actions bot commented Nov 6, 2024

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 Security concerns

    Sensitive Information Exposure:
    The PR includes sensitive information such as API keys and passwords in the Terraform configuration files. This should be managed using a secure secret management system to avoid exposure.

    ⚡ Recommended focus areas for review

    Sensitive Information Exposure
    The PR includes hard-coded sensitive information such as API tokens, passwords, and secret keys. This poses a security risk and should be managed through secure secrets management practices.

    Hard-coded Values
    The PR contains hard-coded values for deployment configurations such as VPC IDs and subnet CIDRs. These should be parameterized to enhance flexibility and reusability of the Terraform modules.

    Copy link

    github-actions bot commented Nov 6, 2024

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible bug
    Avoid hardcoding instance counts to zero to ensure proper deployment configurations

    Ensure that the instance-count-blue and instance-count-green values are not
    hardcoded to zero in the nova-blue-subql-node-config and
    nova-green-subql-node-config blocks. This could prevent the deployment of any
    instances for these configurations.

    explorer/terraform/aws/mainnet/main.tf [43-57]

    -instance-count-blue = 0 #var.instance_count_blue
    -instance-count-green = 0 #var.instance_count_green
    +instance-count-blue = var.instance_count_blue
    +instance-count-green = var.instance_count_green
    Suggestion importance[1-10]: 8

    Why: The suggestion correctly identifies a potential issue where instance counts are hardcoded to zero, which could prevent deployment. Fixing this is crucial for the functionality of the deployment configurations.

    8
    Enhancement
    Implement checks to ensure all critical configuration variables are valid before deployment

    Consider adding error handling or conditions to check the validity of critical
    variables like cloudflare_api_token, cloudflare_email, nr_api_key, access_key, and
    secret_key to prevent deployment failures.

    explorer/terraform/aws/mainnet/main.tf [63-68]

    -cloudflare_api_token = var.cloudflare_api_token
    -cloudflare_email = var.cloudflare_email
    +cloudflare_api_token = var.cloudflare_api_token != "" ? var.cloudflare_api_token : error("Cloudflare API token is required")
    +cloudflare_email = var.cloudflare_email != "" ? var.cloudflare_email : error("Cloudflare email is required")
     ...
    Suggestion importance[1-10]: 7

    Why: Adding validation for critical variables is a significant enhancement for preventing deployment failures. This suggestion improves the robustness of the deployment process.

    7
    Best practice
    Use consistent and convention-compliant variable naming

    Replace the hyphenated variable names like blue-subql-node-config with underscored
    versions (blue_subql_node_config) to maintain consistency with Terraform naming
    conventions and avoid potential issues with variable interpretation.

    explorer/terraform/aws/mainnet/main.tf [7-19]

    -blue-subql-node-config = {
    +blue_subql_node_config = {
       ...
     }
    Suggestion importance[1-10]: 6

    Why: Adhering to Terraform naming conventions improves code readability and maintainability. This suggestion correctly targets a best practice improvement.

    6
    Possible issue
    Ensure region settings are correctly configured to match expected types

    Verify the regions field in the node configuration blocks to ensure it matches the
    expected type and values, especially since aws_region is defined as a list of
    strings. This might cause unexpected behavior if not handled correctly.

    explorer/terraform/aws/mainnet/main.tf [14-28]

    -regions = var.aws_region
    +regions = var.aws_region[0] # or adjust according to expected input
    Suggestion importance[1-10]: 5

    Why: This suggestion is relevant as it addresses potential issues with type mismatches in region configurations. However, the impact is moderate since it mainly involves verification rather than a critical bug fix.

    5

    @DaMandal0rian DaMandal0rian merged commit 316ff1f into main Nov 6, 2024
    2 checks passed
    @DaMandal0rian DaMandal0rian deleted the feat/mainnet-subql branch November 6, 2024 15:43
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants