### Setup Frontend and Start Dev Server (Bash) Source: https://github.com/scylladb/1m-ops-demo/blob/main/README.md Installs frontend dependencies using npm and starts the development server for the frontend application. This is a step for local development. ```bash cd frontend npm install npm run dev ``` -------------------------------- ### Setup Python Environment and Run Flask (Bash) Source: https://github.com/scylladb/1m-ops-demo/blob/main/README.md Sets up a Python virtual environment, installs dependencies from requirements.txt, and starts the Flask development server. This is part of the local development setup. ```bash virtualenv env && source env/bin/activate pip install -r reqiurements.txt python app.py ``` -------------------------------- ### Local Development Setup for ScyllaDB 1M Ops Demo Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Guides users through setting up the ScyllaDB 1M Ops Demo project for local development without Docker. Covers cloning the repository, setting up a Python virtual environment, installing dependencies, running the Flask backend, and configuring the frontend. ```bash # Clone and setup backend git clone https://github.com/scylladb/1m-ops-demo.git cd 1m-ops-demo # Create Python virtual environment virtualenv env && source env/bin/activate pip install -r requirements.txt # Start Flask backend python app.py # Output: Running on http://0.0.0.0:5000 # In a separate terminal, setup frontend cd frontend npm install npm run dev # Output: Local: http://localhost:5173/ # Update config.json for local development # Set "running_in_docker": false ``` -------------------------------- ### Clone Repository and Navigate Source: https://github.com/scylladb/1m-ops-demo/blob/main/docs/source/getting-started.md Clones the ScyllaDB 1M ops demo repository from GitHub and changes the current directory to the cloned repository. This is the initial step to set up the project. ```bash git clone https://github.com/scylladb/scylladb-1m-ops-demo.git cd scylladb-1m-ops-demo/ ``` -------------------------------- ### Clone ScyllaDB Enterprise Demo Repository Source: https://github.com/scylladb/1m-ops-demo/blob/main/docs/source/getting-started-enterprise.md Clones the ScyllaDB Enterprise 1M ops demo repository from GitHub and navigates into the ScyllaDB Enterprise directory. This is the first step to setting up the infrastructure. ```bash git clone https://github.com/scylladb/1m-ops-demo.git cd 1m-ops-demo/scylladb-enterprise/ ``` -------------------------------- ### Deploy ScyllaDB Enterprise Infrastructure with Terraform Source: https://github.com/scylladb/1m-ops-demo/blob/main/docs/source/getting-started-enterprise.md Initializes Terraform, creates an execution plan, and applies the configuration to deploy the ScyllaDB Enterprise infrastructure on AWS. Requires user confirmation ('yes') to proceed with the resource creation. ```bash terraform init terraform plan terraform apply Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yes [...] Apply complete! Resources: 20 added, 0 changed, 0 destroyed. Outputs: monitoring_url = "http://:3000" scylla_ips = "10.0.0.74,10.0.0.73,10.0.0.145" scylla_public_ips = "18.222.111.226,18.222.163.223,3.145.73.47" ``` -------------------------------- ### Ansible: Start Stress Test on Loader Nodes Source: https://context7.com/scylladb/1m-ops-demo/llms.txt This Ansible playbook is designed to start the cassandra-stress workload on designated loader nodes. It utilizes the `systemd_service` module to ensure the `cql-stress.service` is running. ```yaml # ansible/3_stress.yml --- - name: Start loader hosts: stress become: True tasks: - name: Start CQL Stress ansible.builtin.systemd_service: name: cql-stress.service state: started daemon_reload: True ``` ```bash # Run manually from within the demo directory cd scylladb-enterprise/ansible ansible-playbook 3_stress.yml # Output: # PLAY [Start loader] **************************** # TASK [Start CQL Stress] ************************ # changed: [18.222.111.226] # changed: [18.222.163.223] # changed: [3.145.73.47] # PLAY RECAP ************************************* # 3 changed ``` -------------------------------- ### Build and Run Docker Container for ScyllaDB Demo Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Shell script to build the Docker image for the ScyllaDB demo and start the application container. It mounts AWS credentials and exposes the application on port 5000. Includes commands to access and stop the container. ```bash # Ensure config.json exists with proper values ./build_and_run.sh # Output: # [+] Building 45.2s (18/18) FINISHED # Successfully built scylla-demo # Container started on port 5000 # Access the UI open http://localhost:5000 # Stop the container when done docker stop scylla-demo ``` -------------------------------- ### Preview Infrastructure Changes with Terraform Plan API Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Sends a GET request to the `/tf-plan` endpoint to preview the infrastructure changes Terraform will apply. The response indicates the plan completion, and detailed output is streamed via WebSocket. ```bash curl -X GET http://localhost:5000/tf-plan # Response: "Terraform plan finished", 200 # Console output streamed via WebSocket shows: # + aws_instance.instance[0] will be created # + scylladbcloud_cluster.scylladbcloud will be created # Plan: 23 to add, 0 to change, 0 to destroy. ``` -------------------------------- ### Clone ScyllaDB Demo Repository Source: https://github.com/scylladb/1m-ops-demo/blob/main/scylladb-cloud/README.md This bash command clones the ScyllaDB 1 million ops/sec demo repository from GitHub. After cloning, the user navigates into the project directory to begin the setup process. ```bash git clone https://github.com/scylladb/1m-ops-demo.git cd scylladb-open-source/ ``` -------------------------------- ### Install Packages in Container (Bash) Source: https://github.com/scylladb/1m-ops-demo/blob/main/README.md Installs packages within the Docker container using the Alpine Linux package manager, apk. This is useful for adding necessary tools or dependencies inside the container. ```bash apk add ``` -------------------------------- ### Configure Terraform Variables for ScyllaDB Cloud and AWS Source: https://github.com/scylladb/1m-ops-demo/blob/main/docs/source/getting-started.md Defines essential variables within the Terraform configuration for ScyllaDB Cloud and AWS. This includes the ScyllaDB Cloud API token, region, SSH private key path for EC2 instances, AWS key pair name, and the path to AWS credentials. ```terraform # # Set the following variables (mandatory) # # ScyllaDB Cloud API token variable "scylla_cloud_token" { description = "ScyllaDB Cloud API token" type = string default = "ADD-YOUR-API-TOKEN-HERE" } # ScyllaDB Cloud region variable "scylla_cloud_region" { description = "ScyllaDB Cloud region of the cluster" type = string default = "eu-north-1" } # SSH private key for EC2 instance access variable "ssh_private_key" { description = "SSH private key location for EC2 instance access" type = string default = "/home/user/Documents/your-private-key.pem" } variable "aws_key_pair" { description = "Key pair name in AWS" type = string default = "my-key-pair" } # AWS credentials file variable "aws_creds" { description = "AWS credentials location" type = string default = "/home/user/.aws/credentials" } ``` -------------------------------- ### Destroy ScyllaDB Enterprise Infrastructure with Terraform Source: https://github.com/scylladb/1m-ops-demo/blob/main/docs/source/getting-started-enterprise.md Removes all resources created by the Terraform configuration for the ScyllaDB Enterprise demo. This command should be run after finishing the demo to clean up AWS resources and avoid incurring further costs. ```bash terraform destroy ``` -------------------------------- ### Configure Terraform Variables for ScyllaDB Enterprise AWS Deployment Source: https://github.com/scylladb/1m-ops-demo/blob/main/docs/source/getting-started-enterprise.md Defines essential variables in Terraform for setting up ScyllaDB Enterprise on AWS. This includes AWS credentials, SSH keys, region, and specific AMI IDs for monitoring, ScyllaDB, and loader instances. ```terraform # Set the following variables (mandatory) # # AWS credentials file variable "path_to_aws_cred_file" { description = "AWS credentials location" type = string default = "/home/user/.aws/credentials" } # AWS credentials file variable "aws_creds_profile" { description = "AWS credentials profile" type = string default = "DeveloperAccessRole" } # SSH private key for EC2 instance access variable "ssh_private_key" { description = "SSH private key location for EC2 instance access" type = string default = "/home/user/Documents/key.pem" } variable "aws_key_pair_name" { description = "Key pair name in AWS" type = string default = "key-pair" } variable "aws_region" { description = "AWS region" type = string default = "us-east-2" } # Make sure the AMIs are available in your chosen region # Amazon Machine Image (AMI) ID variable "monitoring_ami_id" { description = "AMI ID for the EC2 instance" type = string default = "ami-068cf3d51efeb20d6" } # Scylla (AMI) ID variable "scylla_ami_id" { description = "AMI ID for the ScyllaDB EC2 instance" type = string default = "ami-0a4e6d1a9b982b961" } # Scylla (AMI) ID for Loader instance variable "loader_ami_id" { description = "AMI ID for the EC2 loader instance" type = string default = "ami-027fdd99203b5e063" } ``` -------------------------------- ### Tear Down Infrastructure with Terraform Destroy API Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Sends a GET request to the `/tf-destroy` endpoint to tear down all provisioned infrastructure, preventing ongoing AWS costs. The response indicates completion, and detailed output is streamed via WebSocket. ```bash curl -X GET http://localhost:5000/tf-destroy # Response: "Terraform destroy finished", 200 # Console output streamed via WebSocket shows: # - aws_instance.instance[0] will be destroyed # - scylladbcloud_cluster.scylladbcloud will be destroyed # Destroy complete! Resources: 23 destroyed. ``` -------------------------------- ### Clone Repository and Navigate - Bash Source: https://github.com/scylladb/1m-ops-demo/blob/main/docs/source/demo-ui.md This snippet demonstrates how to clone the project repository using Git and then navigate into the project directory. It's the initial step for setting up the demo. ```bash git clone https://github.com/scylladb/1m-ops-demo.git cd 1m-ops-demo/ ``` -------------------------------- ### Build and Run Web App - Bash Source: https://github.com/scylladb/1m-ops-demo/blob/main/docs/source/demo-ui.md This bash script initiates the build process for the demo UI's Docker container and then runs the web application. The application will be accessible on port 5000 by default. To stop the container, use `docker stop scylla-demo`. ```bash ./build_and_run.sh ``` -------------------------------- ### REST API: Choose Demo Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Select the demo scenario to run. This action initializes Terraform in the corresponding demo directory. ```APIDOC ## POST /choose-demo ### Description Select the demo scenario to run. This initializes Terraform in the selected demo directory. ### Method POST ### Endpoint /choose-demo ### Parameters #### Request Body - **demo** (string) - Required - The name of the demo scenario to select (e.g., "scylladb-cloud", "scylladb-enterprise", "tablets-scaling"). ### Request Example ```json { "demo": "scylladb-cloud" } ``` ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating the demo was selected and Terraform initialized. #### Response Example ```json "Demo selected and Terraform initialized" ``` ``` -------------------------------- ### Initialize, Plan, and Apply Terraform Infrastructure Source: https://github.com/scylladb/1m-ops-demo/blob/main/scylladb-cloud/README.md This sequence of bash commands is used to deploy the infrastructure defined in the Terraform configuration. `terraform init` initializes the working directory, `terraform plan` shows the execution plan, and `terraform apply` creates the resources. The user must confirm the apply action by typing 'yes'. ```bash terraform init terraform plan terraform apply Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yes [...] Apply complete! Resources: 23 added, 0 changed, 0 destroyed. ``` -------------------------------- ### Configure Demo Settings - Python Source: https://github.com/scylladb/1m-ops-demo/blob/main/docs/source/demo-ui.md This snippet shows the configuration file (`config.py`) for the demo UI. It specifies AWS credentials, region, ScyllaDB Cloud token, and Docker integration settings. Ensure these values are correctly set before running the application. ```json { "aws_creds_file": "/home/user/.aws/credentials", "region": "us-east-1", "scylla_cloud_token": "API-TOKEN", "running_in_docker": true } ``` -------------------------------- ### Provision Infrastructure with Terraform Apply API Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Sends a POST request to the `/tf-apply` endpoint with customizable cluster and workload settings. This provisions the infrastructure, and the response indicates completion. Outputs include monitoring URLs and cluster IPs. ```bash curl -X POST http://localhost:5000/tf-apply \ -H "Content-Type: application/json" \ -d '{ "scylla_instance_type": "i4i.4xlarge", "scylla_node_count": 3, "numberOfLoaders": 3, "readOps": 700000, "writeOps": 300000 }' # Response: "Terraform apply finished", 200 # Infrastructure provisioning takes 4-15+ minutes depending on demo type # Outputs include monitoring URLs and cluster IPs ``` -------------------------------- ### Apply Terraform Configuration (Bash) Source: https://github.com/scylladb/1m-ops-demo/blob/main/README.md Applies Terraform configurations from within the Docker container. It uses a specified variable file and auto-approves the changes, deploying the infrastructure. ```bash terraform apply -var-file=user.tfvars.json -auto-approve ``` -------------------------------- ### Choose ScyllaDB Demo Scenario via REST API Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Uses `curl` to send POST requests to the demo application's `/choose-demo` endpoint. This initializes Terraform for the selected demo scenario (ScyllaDB Cloud, Enterprise, or Tablets Scaling). ```bash # Select ScyllaDB Cloud demo curl -X POST http://localhost:5000/choose-demo \ -H "Content-Type: application/json" \ -d '{"demo": "scylladb-cloud"}' # Select ScyllaDB Enterprise demo curl -X POST http://localhost:5000/choose-demo \ -H "Content-Type: application/json" \ -d '{"demo": "scylladb-enterprise"}' # Select Tablets Scaling demo curl -X POST http://localhost:5000/choose-demo \ -H "Content-Type: application/json" \ -d '{"demo": "tablets-scaling"}' # Response: "Demo selected and Terraform initialized", 200 ``` -------------------------------- ### REST API: Terraform Apply Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Provision the infrastructure with customizable cluster and workload settings. This operation can take several minutes. ```APIDOC ## POST /tf-apply ### Description Provision the infrastructure with customizable cluster and workload settings. This operation can take 4-15+ minutes depending on the demo type. Outputs include monitoring URLs and cluster IPs. ### Method POST ### Endpoint /tf-apply ### Parameters #### Request Body - **scylla_instance_type** (string) - Optional - The EC2 instance type for ScyllaDB nodes (e.g., "i4i.4xlarge"). - **scylla_node_count** (integer) - Optional - The number of ScyllaDB nodes in the cluster. - **numberOfLoaders** (integer) - Optional - The number of loader instances to run. - **readOps** (integer) - Optional - The number of read operations per second for the workload. - **writeOps** (integer) - Optional - The number of write operations per second for the workload. ### Request Example ```json { "scylla_instance_type": "i4i.4xlarge", "scylla_node_count": 3, "numberOfLoaders": 3, "readOps": 700000, "writeOps": 300000 } ``` ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating that Terraform apply has finished. Detailed outputs are streamed via WebSocket. #### Response Example ```json "Terraform apply finished" ``` ``` -------------------------------- ### Terraform Commands for Infrastructure Deployment Source: https://github.com/scylladb/1m-ops-demo/blob/main/scylladb-enterprise/readme.md This sequence of bash commands initializes Terraform, generates an execution plan, and applies the plan to create the AWS infrastructure. It requires user confirmation ('yes') to proceed with the resource creation. ```bash terraform init terraform plan terraform apply Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yes [...] Apply complete! Resources: 20 added, 0 changed, 0 destroyed. Outputs: monitoring_url = "http://:3000" scylla_ips = "10.0.0.74,10.0.0.73,10.0.0.145" scylla_public_ips = "18.222.111.226,18.222.163.223,3.145.73.47" ``` -------------------------------- ### Configure Local Development Settings (JSON) Source: https://github.com/scylladb/1m-ops-demo/blob/main/README.md Configuration file for local development. It specifies AWS credentials, region, ScyllaDB Cloud token, and crucially sets `running_in_docker` to `false`. ```json { "aws_creds_file": "/home/user/.aws/credentials", "region": "us-east-1", "scylla_cloud_token": "API-TOKEN", "running_in_docker": false } ``` -------------------------------- ### REST API: Terraform Plan Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Preview the infrastructure changes that will be applied by Terraform before provisioning. ```APIDOC ## GET /tf-plan ### Description Preview the infrastructure changes that will be applied by Terraform. The output will be streamed via WebSocket. ### Method GET ### Endpoint /tf-plan ### Parameters None ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating that the Terraform plan has finished. Detailed output is streamed via WebSocket. #### Response Example ```json "Terraform plan finished" ``` ### Console Output Example (via WebSocket) ``` + aws_instance.instance[0] will be created + scylladbcloud_cluster.scylladbcloud will be created Plan: 23 to add, 0 to change, 0 to destroy. ``` ``` -------------------------------- ### Control ScyllaDB Demo Scenarios via WebSocket Events (JavaScript) Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Uses the `socket.io-client` library to connect to the demo application's WebSocket server. Allows control over demo scenarios like starting/stopping stress tests, scaling clusters, and managing sample data. ```javascript import { io } from "socket.io-client"; const socket = io("http://localhost:5000"); // Listen for playbook output socket.on("playbook_output", (data) => { console.log(data.output); }); // Start stress test workload socket.emit("start_stress"); // Stop stress test socket.emit("stop_stress"); // Scale out cluster (tablets-scaling demo) socket.emit("scale_out"); // Scale in cluster (tablets-scaling demo) socket.emit("scale_in"); // Restore sample data socket.emit("sample_data"); // Reset to original cluster socket.emit("original_cluster"); ``` -------------------------------- ### Manual Terraform Operations for ScyllaDB Enterprise Deployment Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Provides bash commands for manually interacting with Terraform within a Docker container to manage the ScyllaDB Enterprise deployment. Includes commands for initializing Terraform, planning, applying changes, destroying the infrastructure, and outputting cluster information. ```bash # Enter the container shell docker exec -it scylla-demo sh # Change to the demo directory cd scylladb-enterprise # Run Terraform commands manually terraform init terraform plan -var-file=user.tfvars.json terraform apply -var-file=user.tfvars.json -auto-approve terraform destroy -var-file=user.tfvars.json -auto-approve # Check cluster status terraform output scylla_ips # Output: "10.0.0.74,10.0.0.73,10.0.0.145" terraform output monitoring_url # Output: "http://18.222.111.226:3000" ``` -------------------------------- ### Configure ScyllaDB Demo Application Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Configuration file for the ScyllaDB demo application. It specifies AWS credentials and ScyllaDB Cloud API token. Ensure sensitive information like API tokens are handled securely. ```json { "aws_creds_file": "/home/user/.aws/credentials", "aws_creds_profile": "default", "region": "us-east-1", "scylla_cloud_token": "your-scylladb-cloud-api-token", "running_in_docker": true } ``` -------------------------------- ### WebSocket Events: Scenario Control Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Control demo scenarios and workloads via Socket.IO events. Connect to the WebSocket server to emit commands. ```APIDOC ## WebSocket Events ### Description Control demo scenarios and workloads via Socket.IO events. Connect to the WebSocket server (ws://localhost:5000) to emit commands and listen for playbook output. ### Connection ```javascript import { io } from "socket.io-client"; const socket = io("http://localhost:5000"); ``` ### Events #### `playbook_output` (Listener) Listens for output from Ansible playbooks. ```javascript socket.on("playbook_output", (data) => { console.log(data.output); }); ``` #### `start_stress` (Emitter) Starts the stress test workload. ```javascript socket.emit("start_stress"); ``` #### `stop_stress` (Emitter) Stops the stress test workload. ```javascript socket.emit("stop_stress"); ``` #### `scale_out` (Emitter) Scales out the cluster (used in the tablets-scaling demo). ```javascript socket.emit("scale_out"); ``` #### `scale_in` (Emitter) Scales in the cluster (used in the tablets-scaling demo). ```javascript socket.emit("scale_in"); ``` #### `sample_data` (Emitter) Restores sample data to the cluster. ```javascript socket.emit("sample_data"); ``` #### `original_cluster` (Emitter) Resets the cluster to its original state. ```javascript socket.emit("original_cluster"); ``` ``` -------------------------------- ### Configure Terraform Variables for ScyllaDB Cloud Demo Source: https://github.com/scylladb/1m-ops-demo/blob/main/scylladb-cloud/README.md This Terraform configuration defines mandatory variables for setting up the ScyllaDB Cloud demo environment. It includes placeholders for the ScyllaDB Cloud API token, region, SSH private key path, AWS key pair name, and AWS credentials file location. Users must update these variables with their specific details before applying the Terraform configuration. ```terraform # # Set the following variables (mandatory) # # ScyllaDB Cloud API token variable "scylla_cloud_token" { description = "ScyllaDB Cloud API token" type = string default = "ADD-YOUR-API-TOKEN-HERE" } # ScyllaDB Cloud region variable "scylla_cloud_region" { description = "ScyllaDB Cloud region of the cluster" type = string default = "eu-north-1" } # SSH private key for EC2 instance access variable "ssh_private_key" { description = "SSH private key location for EC2 instance access" type = string default = "/home/user/Documents/your-private-key.pem" } variable "aws_key_pair" { description = "Key pair name in AWS" type = string default = "my-key-pair" } # AWS credentials file variable "aws_creds" { description = "AWS credentials location" type = string default = "/home/user/.aws/credentials" } ``` -------------------------------- ### Cassandra Stress YAML Profile for IoT Data Workload Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Defines a custom workload pattern for the Cassandra stress tool using YAML format. It specifies keyspace and table definitions, column specifications for data generation (including types and distributions), and CQL queries for read and write operations. ```yaml # Keyspace and table definition keyspace: pet_store_iot keyspace_definition: | CREATE KEYSPACE pet_store_iot WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1}; table: sensor_data table_definition: | CREATE TABLE sensor_data ( device_id text, sensor_type text, bucket timestamp, timestamp timestamp, value double, PRIMARY KEY ((device_id, sensor_type, bucket), timestamp) ) WITH CLUSTERING ORDER BY (timestamp DESC) AND compaction = { 'class': 'TimeWindowCompactionStrategy', 'compaction_window_size': '1', 'compaction_window_unit': 'DAYS' }; # Column specifications for data generation columnspec: - name: device_id size: FIXED(10) population: uniform(1..10000) - name: sensor_type size: FIXED(10) population: uniform(1..10) - name: timestamp population: seq(1640995200..1683013974) - name: value population: gaussian(10..50) # Define CQL queries for the stress test queries: get_sensor_data: cql: SELECT * FROM sensor_data WHERE device_id = ? AND sensor_type = ? AND bucket = ? AND timestamp >= ? AND timestamp <= ? LIMIT 100; fields: samerow get_latest_sensor_data: cql: SELECT * FROM sensor_data WHERE device_id = ? AND sensor_type = ? AND bucket = ? LIMIT 1; fields: samerow add_sensor_data: cql: INSERT INTO sensor_data (device_id, sensor_type, bucket, timestamp, value) VALUES (?, ?, ?, ?, ?); fields: samerow ``` -------------------------------- ### Access Container Shell (Bash) Source: https://github.com/scylladb/1m-ops-demo/blob/main/README.md Provides a way to access the running Docker container's shell. This is useful for manually interacting with Terraform or other tools within the containerized environment. ```bash docker exec -it scylla-demo sh cd ``` -------------------------------- ### Terraform Variables for ScyllaDB Cloud Deployment Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Defines input variables for configuring a ScyllaDB Cloud deployment using Terraform. These variables control the number and type of ScyllaDB and loader instances, as well as load generation parameters like operations per second and read/write ratios. ```hcl variable "scylla_node_count" { description = "Number of ScyllaDB Cloud instances to create" type = string default = "3" } variable "scylla_node_type" { description = "Type of ScyllaDB Cloud instance" type = string default = "i4i.4xlarge" } # Loader configuration variable "loader_node_count" { description = "Number of Loader instances to create" type = string default = "3" } variable "loader_ops_per_sec" { description = "Throttling for the Cassandra stress tool (in ops/sec)" type = string default = "" } variable "loader_read_ratio" { description = "Read ratio" type = string default = "7" } variable "loader_write_ratio" { description = "Write ratio" type = string default = "3" } ``` -------------------------------- ### Terraform Configuration Variables for ScyllaDB Demo Source: https://github.com/scylladb/1m-ops-demo/blob/main/scylladb-enterprise/readme.md This Terraform code defines mandatory input variables for setting up the ScyllaDB Enterprise demo infrastructure. It includes placeholders for ScyllaDB Cloud API token, region, SSH private key path, AWS key pair name, and AWS credentials file location. ```terraform # # Set the following variables (mandatory) # # ScyllaDB Cloud API token variable "scylla_cloud_token" { description = "ScyllaDB Cloud API token" type = string default = "ADD-YOUR-API-TOKEN-HERE" } # ScyllaDB Cloud region variable "scylla_cloud_region" { description = "ScyllaDB Cloud region of the cluster" type = string default = "us-east-1" } # SSH private key for EC2 instance access variable "ssh_private_key" { description = "SSH private key location for EC2 instance access" type = string default = "/home/user/Documents/your-private-key.pem" } variable "aws_key_pair" { description = "Key pair name in AWS" type = string default = "my-key-pair" } # AWS credentials file variable "aws_creds" { description = "AWS credentials location" type = string default = "/home/user/.aws/credentials" } ``` -------------------------------- ### Destroy Terraform Infrastructure Source: https://github.com/scylladb/1m-ops-demo/blob/main/scylladb-cloud/README.md This bash command is used to tear down and remove all infrastructure resources that were created by Terraform. It's essential to run this command after finishing the demo to avoid incurring unnecessary costs. ```bash terraform destroy ``` -------------------------------- ### Destroy Terraform Infrastructure (Bash) Source: https://github.com/scylladb/1m-ops-demo/blob/main/README.md Destroys the infrastructure provisioned by Terraform from within the Docker container. It uses a specified variable file and auto-approves the destruction process. ```bash terraform destroy -var-file=user.tfvars.json -auto-auto-approve ``` -------------------------------- ### Terraform: Provision ScyllaDB Cloud Cluster with VPC Peering Source: https://context7.com/scylladb/1m-ops-demo/llms.txt This Terraform configuration defines a managed ScyllaDB Cloud cluster, including setting up VPC peering for enhanced connectivity. It requires the ScyllaDB Cloud provider and uses variables for authentication. ```hcl # Provider configuration terraform { required_providers { scylladbcloud = { source = "registry.terraform.io/scylladb/scylladbcloud" } } } provider "scylladbcloud" { token = var.scylla_cloud_token } # Create ScyllaDB Cloud cluster resource "scylladbcloud_cluster" "scylladbcloud" { name = "ScyllaDB-Cloud-Demo" region = "us-east-1" node_count = 3 node_type = "i4i.4xlarge" cidr_block = "172.31.0.0/16" cloud = "AWS" enable_vpc_peering = true enable_dns = true } # Setup VPC peering resource "scylladbcloud_vpc_peering" "scylladbcloud" { cluster_id = scylladbcloud_cluster.scylladbcloud.id datacenter = scylladbcloud_cluster.scylladbcloud.datacenter peer_vpc_id = aws_vpc.custom_vpc.id peer_cidr_blocks = ["10.0.0.0/16"] peer_region = "us-east-1" allow_cql = true } # Outputs output "cluster_id" { value = scylladbcloud_cluster.scylladbcloud.id } output "datacenter" { value = scylladbcloud_cluster.scylladbcloud.datacenter } ``` -------------------------------- ### REST API: Terraform Destroy Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Tear down all provisioned infrastructure to avoid ongoing AWS costs. This operation will destroy all resources created by Terraform. ```APIDOC ## GET /tf-destroy ### Description Tear down all provisioned infrastructure to avoid ongoing AWS costs. The output will be streamed via WebSocket. ### Method GET ### Endpoint /tf-destroy ### Parameters None ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating that Terraform destroy has finished. Detailed output is streamed via WebSocket. #### Response Example ```json "Terraform destroy finished" ``` ### Console Output Example (via WebSocket) ``` - aws_instance.instance[0] will be destroyed - scylladbcloud_cluster.scylladbcloud will be destroyed Destroy complete! Resources: 23 destroyed. ``` ``` -------------------------------- ### Terraform Variables for ScyllaDB Enterprise Deployment Source: https://context7.com/scylladb/1m-ops-demo/llms.txt Configures input variables for a self-hosted ScyllaDB Enterprise deployment using Terraform. This includes AWS credentials, region, ScyllaDB instance details (count, type, AMI), monitoring instance type, and loader configuration. ```hcl # Required variables variable "aws_creds_file" { description = "AWS credentials location" type = string default = "/app/.aws/credentials" } variable "region" { description = "Region of the cluster" type = string default = "us-east-1" } # ScyllaDB cluster configuration variable "scylla_node_count" { description = "Number of ScyllaDB instances to create" type = string default = "3" } variable "scylla_node_type" { description = "Type of the EC2 instance" type = string default = "i4i.4xlarge" } variable "scylla_ami_name" { description = "AMI name for the ScyllaDB EC2 instance" type = string default = "ScyllaDB Enterprise 2024.2*" } # Monitoring configuration variable "monitoring_instance_type" { description = "Type of the EC2 instance" type = string default = "m5.4xlarge" } # Loader configuration variable "loader_node_count" { description = "Number of loader instances to create" type = string default = "3" } variable "num_threads" { description = "Number of threads for the Cassandra stress tool" type = string default = "350" } ``` -------------------------------- ### Define ScyllaDB Cloud Terraform Variables Source: https://context7.com/scylladb/1m-ops-demo/llms.txt HCL code snippet defining required variables for ScyllaDB Cloud deployment within Terraform. Includes descriptions and default values for API token and region. ```hcl # Required variables variable "scylla_cloud_token" { description = "ScyllaDB Cloud API token" type = string default = "your-api-token" } variable "region" { description = "ScyllaDB Cloud region of the cluster" type = string default = "us-east-1" } ``` -------------------------------- ### Terraform: Provision ScyllaDB Enterprise EC2 Instances Source: https://context7.com/scylladb/1m-ops-demo/llms.txt This Terraform configuration provisions self-managed ScyllaDB Enterprise nodes on AWS EC2. It includes generating an SSH key pair, creating a seed node, and then provisioning additional non-seed nodes that connect to the seed. ```hcl # Generate SSH key pair resource "tls_private_key" "private_key" { algorithm = "RSA" rsa_bits = 4096 } resource "aws_key_pair" "generated_key" { key_name = "ScyllaDB-Enterprise-DEMO-key" public_key = tls_private_key.private_key.public_key_openssh } # Create seed node resource "aws_instance" "scylladb_seed" { count = 1 ami = data.aws_ami.scylla_ami.id instance_type = "i4i.4xlarge" key_name = aws_key_pair.generated_key.key_name subnet_id = aws_subnet.public_subnet[0].id security_groups = [aws_security_group.sg.id] tags = { Name = "ScyllaDB-Enterprise-Demo-Seed" Project = "ScyllaDB-Enterprise-Demo" Type = "Scylla" } user_data = jsonencode({ scylla_yaml = { cluster_name = "ScyllaDB-Enterprise-Demo" } start_scylla_on_first_boot = true }) } # Create non-seed nodes resource "aws_instance" "scylladb_nonseeds" { count = 2 ami = data.aws_ami.scylla_ami.id instance_type = "i4i.4xlarge" key_name = aws_key_pair.generated_key.key_name subnet_id = aws_subnet.public_subnet[0].id security_groups = [aws_security_group.sg.id] tags = { Name = "ScyllaDB-Enterprise-Demo-Node-${count.index}" Project = "ScyllaDB-Enterprise-Demo" } user_data = jsonencode({ scylla_yaml = { cluster_name = "ScyllaDB-Enterprise-Demo" seed_provider = [{ class_name = "org.apache.cassandra.locator.SimpleSeedProvider" parameters = [{ seeds = aws_instance.scylladb_seed[0].private_ip }] }] } start_scylla_on_first_boot = true }) depends_on = [aws_instance.scylladb_seed] } output "scylla_ips" { value = join(",", concat( aws_instance.scylladb_seed.*.private_ip, aws_instance.scylladb_nonseeds.*.private_ip )) } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.