diff --git a/multipass/README.md b/multipass/README.md index d3e2e49a92..e29e7e4200 100644 --- a/multipass/README.md +++ b/multipass/README.md @@ -57,6 +57,7 @@ commands will detect it and remind you to do so if necessary. - `splunk_realm`: Observability Realm - `splunk_presetup`: Provide a preconfigured instance (OTel Collector and Online Boutique deployed with RUM enabled) - `splunk_jdk`: Install OpenJDK and Maven on the instance (for PetClinic workshop or other Java based workshops) +- `otel_demo` : Install and configure the OpenTelemetry Telescope Shop Demo. This requires that `splunk_presetup` is set to FALSE. The default is FALSE ## 6. Create Terraform variables file @@ -76,6 +77,7 @@ splunk_rum_token = "1234xxxx5678yyyy" splunk_realm = "us1" splunk_presetup = true splunk_jdk = false +otel_demo = false ``` Then run `terraform plan` to see what will be created. Once happy run `terraform apply` to create the instances. diff --git a/multipass/terraform.tfvars.template b/multipass/terraform.tfvars.template index 9ec3bc5bd1..f901e88f7c 100644 --- a/multipass/terraform.tfvars.template +++ b/multipass/terraform.tfvars.template @@ -6,3 +6,4 @@ splunk_realm = "" # Optional splunk_presetup = false splunk_jdk = false +otel_demo = false diff --git a/workshop/aws/ec2/README.md b/workshop/aws/ec2/README.md index facf3761f9..5393ecf781 100644 --- a/workshop/aws/ec2/README.md +++ b/workshop/aws/ec2/README.md @@ -54,6 +54,7 @@ The following variables are available. Edit `terraform.tfvars` to reflect what y - `splunk_presetup`: Provide a preconfigured instance (OTel Collector and Online Boutique deployed with RUM enabled). The default is FALSE. - `splunk_jdk`: Install OpenJDK and Maven on the instance. The default is FALSE. +- `otel_demo` : Install and configure the OpenTelemetry Astronomy Shop Demo. This requires that `splunk_presetup` is set to FALSE. The default is FALSE ## 6. Create a Terraform plan diff --git a/workshop/aws/ec2/main.tf b/workshop/aws/ec2/main.tf index 20a91e8321..6ad4f92e69 100644 --- a/workshop/aws/ec2/main.tf +++ b/workshop/aws/ec2/main.tf @@ -183,6 +183,7 @@ locals { realm = var.splunk_realm presetup = var.splunk_presetup jdk = var.splunk_jdk + otel_demo = var.otel_demo instance_password = random_string.password.result } } @@ -219,5 +220,10 @@ resource "aws_instance" "observability-instance" { condition = var.splunk_presetup ? try(var.splunk_access_token, "") != "" && try(var.splunk_realm, "") != "" && try(var.splunk_rum_token, "") != "" : true error_message = "When requesting a pre-setup instance, splunk_realm, splunk_access_token and splunk_rum_token are required and cannot be null/empty" } + precondition { + # if otel_demo=true, tokens and realm cannot be empty. also presetup cannot also be true. + condition = var.otel_demo ? try(var.splunk_access_token, "") != "" && try(var.splunk_realm, "") != "" && try(var.splunk_rum_token, "") != "" && try(var.splunk_presetup, "") == false : true + error_message = "When requesting an otel_demo, splunk_realm, splunk_access_token and splunk_rum_token are required and cannot be null/empty. splunk_presetup variable must also be set to false. " + } } } diff --git a/workshop/aws/ec2/templates/userdata.yaml b/workshop/aws/ec2/templates/userdata.yaml index 16ff822ccf..5c2453805b 100644 --- a/workshop/aws/ec2/templates/userdata.yaml +++ b/workshop/aws/ec2/templates/userdata.yaml @@ -85,6 +85,21 @@ write_files: fi %{ endif ~} +%{ if otel_demo == true ~} + export RUM_TOKEN=${rum_token} + mkdir otel-demo && cd otel-demo + curl -s -OL https://raw.githubusercontent.com/splunk/observability-workshop/main/oteldemo/otel-demo-collector.yaml + curl -s -OL https://raw.githubusercontent.com/splunk/observability-workshop/main/oteldemo/otel-demo.yaml + if [ ! -f ~/.helmok ]; then + helm repo add splunk-otel-collector-chart https://signalfx.github.io/splunk-otel-collector-chart + helm repo update + helm install splunk-otel-collector --set="splunkObservability.realm=$REALM" --set="splunkObservability.accessToken=$ACCESS_TOKEN" --set="clusterName=$(hostname)-k3s-cluster" --set="splunkObservability.logsEnabled=true" --set="logsEngine=otel" --set="splunkObservability.profilingEnabled=true" --set="splunkObservability.infrastructureMonitoringEventsEnabled=true" --set="networkExplorer.enabled=true" --set="networkExplorer.podSecurityPolicy.enabled=false" --set="agent.enabled=true" --set="gateway.replicaCount=1" --set="gateway.resources.limits.cpu=500m" --set="gateway.resources.limits.memory=1Gi" --set="clusterReceiver.enabled=true" --set="environment=$(hostname)-apm-env" splunk-otel-collector-chart/splunk-otel-collector -f otel-demo-collector.yaml + helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts + helm install my-otel-demo open-telemetry/opentelemetry-demo --values otel-demo.yaml + cd /home/ubuntu + fi +%{ endif ~} + export KUBECONFIG=/home/ubuntu/.kube/config alias kc='kubectl' alias dc='docker-compose' diff --git a/workshop/aws/ec2/terraform.tfvars.template b/workshop/aws/ec2/terraform.tfvars.template index 30c96f50e0..595e8fe9d9 100644 --- a/workshop/aws/ec2/terraform.tfvars.template +++ b/workshop/aws/ec2/terraform.tfvars.template @@ -11,3 +11,4 @@ splunk_realm = "" # optional splunk_presetup = false splunk_jdk = false +otel_demo = false diff --git a/workshop/aws/ec2/variables.tf b/workshop/aws/ec2/variables.tf index 1b01e6c9b0..3bb4abdb84 100644 --- a/workshop/aws/ec2/variables.tf +++ b/workshop/aws/ec2/variables.tf @@ -16,6 +16,12 @@ variable "splunk_jdk" { default = false } +variable "otel_demo" { + description = "Spin up the OpenTelemetry Astronomy Shop Demo? (true/false)" + type = bool + default = false +} + variable "aws_instance_count" { description = "Instance Count (Usually 1)" nullable = false