Skip to content

Automate EC2 based staging environment for StrataSTOR #1

@raamsri

Description

@raamsri

Issue

Objective

Provision a staging environment on AWS EC2 to test StrataSTOR, ensuring compatibility with ZFS and related dependencies. The setup should be automated and validated through Go tests for ZFS operations.

Clearly, there may be other IaC choices including AWS Cloud Formation templates but not limited to Terraform. To prevent the analysis-paralysis, let's choose Terraform favoring faster initial iteration and scalable future development.

Assumptions

  1. AWS Resources

    • Existing VPC, subnets, NAT, and Internet Gateways (if private subnet is used).
    • Existing EC2 keypair for SSH access.
    • The user has necessary AWS permissions to create and manage required resources.
  2. Terraform State Management

    • A pre-configured S3 bucket and DynamoDB table are available for state storage and locking.
  3. Validation Criteria

    • The environment is valid if the following command executes successfully:
      cd rodent/pkg/zfs/dataset/ && sudo go test -v -run TestDatasetOperations

Tasks

1. Provisioning

  • Use Terraform to:
    • Create an EC2 instance with a base Ubuntu 24 LTS image.
    • Configure instance details (e.g., instance type, keypair, disk size) via variables.
    • Accommodate ZFS version and build type(source or Canonical/Distribution package) as variables as well.
    • Attach a security group allowing:
      • SSH (port 22) for administrative access.
    • Install and configure the following using user-data shell scripts:
      • ZFS 2.3.0-rc5 (built from source). Consider the variable config value.
      • Go 1.23.4.
      • Docker with Docker Compose
      • Latest version of NFS and Samba
      • Required utilities: ssh, git, setfacl, jq and other development utils as necessary

2. Validation

  • Run the following command to validate the setup:
    cd rodent/pkg/zfs/dataset/ && sudo go test -v -run TestDatasetOperations
    This test suite may be an over kill. A particular Test function within this would be sufficient. For instance, TestDatasetOperations/Filesystems/Create should be okay. It creates necessary loopback devices, creates a pool with those devices, creates a file system and then destroys the pool and attached devices. Spares us from additional manual work.
  • Output validation logs for debugging.

3. Cleanup

  • Ensure Terraform provides a clean destroy operation to remove all resources created during provisioning.
  • Confirm idempotency for apply/destroy cycles.

Deliverables

  • Terraform configuration for automating the EC2-based staging environment.
  • User-data scripts for software installation and configuration.
  • Documentation on deploying, validating, and tearing down the environment.

Additional Considerations

  • Use modular patterns in Terraform for reusability.

Parallel issue on a similar requirement for Rodent CI: stratastor/rodent#44

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs FixThe issue is understood and ready for code to be written.good first issueGood for newcomers

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions