Skip to content

Commit 4f90961

Browse files
committed
Change OrbStack to use SWiPE ID
1 parent a89c2ad commit 4f90961

File tree

5 files changed

+51
-169
lines changed

5 files changed

+51
-169
lines changed

.gitignore

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ package-lock.json
2828
.hugo_build.lock
2929
/resources
3030
!*/resources/
31-
workshop/Lambda/Java/MobileShop/target/*
32-
workshop/Lambda/Java/MobileShop/.classpath
33-
workshop/Lambda/Java/MobileShop/.factorypath
34-
workshop/Lambda/Java/MobileShop/.project
35-
workshop/Lambda/Java/MobileShop/.settings/*
3631
workshop/aws/ec2/terraform.tfvars.eu0.1.base.tfvars
3732
workshop/aws/ec2/terraform.tfvars.eu0.1.pre.tfvars
3833
workshop/aws/ec2/pre-eu.sh
@@ -50,9 +45,6 @@ workshop/aws/ec2/*.conf
5045
workshop/aws/ec2/*.key
5146
workshop/aws/ec2/*.csv
5247
.idea/
53-
workshop/demo-client/venv/*
54-
workshop/demo-server/venv/*
55-
local-hosting/orbstack/start.sh
5648
local-hosting/multipass/terraform.tfvars
5749
local-hosting/multipass/ubuntu-cloudinit.yml
5850
workshop/aws/ec2/terraform.tfvars copy.template

content/en/resources/local-hosting/orbstack.md

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,12 @@ weight: 2
44
description: Learn how to create a local hosting environment with OrbStack - Mac (Apple Silicon)
55
---
66

7-
Install Orbstack:
7+
Install Orbstack and jq:
88

99
``` bash
10-
brew install orbstack
10+
brew install orbstack jq
1111
```
1212

13-
Log Observer Connect:
14-
15-
If you plan to use your own Splunk Observability Cloud Suite Org and or Splunk instance, you may need to create a new **Log Observer Connect** connection:
16-
Follow the instructions found in the [documentation](https://docs.splunk.com/observability/en/logs/lo-connect-landing.html) for [Splunk Cloud](https://docs.splunk.com/observability/en/logs/scp.html#logs-scp) or [Splunk Enterprize](https://docs.splunk.com/observability/en/logs/set-up-logconnect.html).
17-
18-
Additional requirements for running your own **Log Observer Connect** connection are:
19-
Create an index called **splunk4rookies-workshop**
20-
Make sure the Service account user used in the **Log observer Connect** Connection has access to the **splunk4rookies-workshop** index. (You can remove all other indexes, as all workshop log data should go to this index)
21-
2213
Clone workshop repository:
2314

2415
``` bash
@@ -31,20 +22,10 @@ Change into Orbstack directory:
3122
cd observability-workshop/local-hosting/orbstack
3223
```
3324

34-
Copy the `start.sh.example` to `start.sh` and edit the file to set the following required variables
35-
Make sure that you do not use a Raw Endpoint, but use an Event Endpoint instead as this will process the logs correctly
36-
37-
- `ACCESS_TOKEN`
38-
- `REALM`
39-
- `API_TOKEN`
40-
- `RUM_TOKEN`
41-
- `HEC_TOKEN`
42-
- `HEC_URL`
43-
44-
Run the script and provide and instance name e.g.:
25+
Run the script and provide and instance name and [SWiPE ID](https://swipe.splunk.show) e.g.:
4526

4627
``` bash
47-
./start.sh my-instance
28+
./start.sh my-instance 12345678
4829
```
4930

5031
Once the instance has been successfully created (this can take several minutes), you will automatically be logged into the instance. If you exit you can SSH back in using the following command (replace `<my_instance>` with the name of your instance):

local-hosting/orbstack/README.md

Lines changed: 0 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,3 @@
11
# Preparing an Orbstack instance
22

33
Click [**here**](https://splunk.github.io/observability-workshop/latest/en/resources/local-hosting/orbstack/index.html) for instructions on how to prepare an OrbStack instance.
4-
5-
<!--
6-
**NOTE:** Please disable any VPNs or proxies before running the commands below e.g:
7-
8-
- ZScaler
9-
- Cisco AnyConnect
10-
11-
These tools **will** prevent the instance from being created properly.
12-
13-
## 1. Pre-requisites
14-
15-
Install Orbstack:
16-
17-
``` bash
18-
brew install orbstack
19-
```
20-
21-
If you plan to use your own Splunk Observability Cloud Suite Org, you may need to create a **Log Observer Connect** connection:
22-
Follow the instructions found in the [documentation](https://docs.splunk.com/observability/en/logs/lo-connect-landing.html) for [Splunk Cloud](https://docs.splunk.com/observability/en/logs/scp.html#logs-scp) or [Splunk Enterprize](https://docs.splunk.com/observability/en/logs/set-up-logconnect.html).
23-
24-
Additional requirements for running your own **Log Observer Connect** connection are:
25-
Create an index called **splunk4rookies-workshop**
26-
Make sure the Service account user has access to the **splunk4rookies-workshop** index. (You can remove all other indexes, as all log data should go to this index)
27-
28-
29-
## 2. Clone workshop repository
30-
31-
``` bash
32-
git clone https://github.com/splunk/observability-workshop
33-
```
34-
35-
## 3. Change into Orbstack directory
36-
37-
```bash
38-
cd observability-workshop/orbstack
39-
```
40-
41-
## 4. Create start.sh script
42-
43-
Copy the `start.sh.example` to `start.sh` and edit the file to set the required variables:
44-
45-
- ACCESS_TOKEN
46-
- REALM
47-
- HEC_TOKEN
48-
- HEC_URL
49-
50-
``` bash
51-
52-
#!/bin/bash
53-
echo "Building: $1";
54-
55-
# Change these values below to match your environment and safe this file as start.sh
56-
export ACCESS_TOKEN="<redacted>"
57-
export REALM="eu0"
58-
export RUM_TOKEN="<redacted>"
59-
export HEC_TOKEN="<redacted>"
60-
#export HEC_URL="https://http-inputs-o11y-workshop-eu0.splunkcloud.com:443/services/collector/event"
61-
export HEC_URL="https://http-inputs-o11y-workshop-us1.splunkcloud.com:443/services/collector/event"
62-
export INSTANCE=$1
63-
64-
# Do not change anything below this line
65-
orb create -c cloud-init.yaml -a arm64 ubuntu:jammy $INSTANCE
66-
sleep 2
67-
ORBENV=ACCESS_TOKEN:REALM:RUM_TOKEN:HEC_TOKEN:HEC_URL:INSTANCE orb -m $INSTANCE -u splunk ansible-playbook /home/splunk/orbstack.yml
68-
echo "ssh splunk@$INSTANCE@orb"
69-
ssh splunk@$INSTANCE@orb
70-
71-
```
72-
73-
Make sure your HEC_URL ends in https://[url]:[port]**/services/collector/event** as the raw endpoint does not process the logs as required.
74-
75-
Run the script and provide an instance name e.g.: `./start.sh my-instance`.
76-
77-
Once the instance has been successfully created (this can take several minutes), you will automatically be logged into the instance. If you exit you can SSH back in using the following command:
78-
79-
```bash
80-
ssh splunk@<my_instance>@orb
81-
```
82-
83-
## 5. Validate instance
84-
85-
Once in the shell, you can validate that the instance is ready by running the following command:
86-
87-
```bash
88-
kubectl version --output=yaml
89-
```
90-
91-
To get the IP address of the instance, run the following command:
92-
93-
```bash
94-
ifconfig eth0
95-
```
96-
97-
If you get an error please check that you have disabled any VPNs or proxies and try again e.g. ZScaler, Cisco AnyConnect.
98-
99-
To start again, delete the instance and re-run `start.sh my-instance`:
100-
101-
```bash
102-
orb delete my-instance
103-
```
104-
105-
You can use Vscode with your new orb/container.
106-
Make sure you have installed the remote ssh extension in vscode
107-
108-
here is a sample config for you ssh_config
109-
110-
```text
111-
Host conf
112-
Hostname 127.0.0.1
113-
Port 32222
114-
User splunk@orb-1
115-
# replace or symlink ~/.orbstack/ssh/id_ed25519 file to change the key
116-
IdentityFile ~/.orbstack/ssh/id_ed25519
117-
# only use this key
118-
IdentitiesOnly yes
119-
ProxyCommand '/Applications/OrbStack.app/Contents/MacOS/../Frameworks/OrbStack Helper.app/Contents/MacOS/OrbStack Helper' ssh-proxy-fdpass 501
120-
ProxyUseFdpass yes
121-
```
122-
-->

local-hosting/orbstack/start.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env bash
2+
export TERM=xterm-256color
3+
4+
# Script requires two arguments:
5+
# $1: Instance name - A name for your OrbStack instance (e.g. "splunk-workshop")
6+
# $2: SWiPE ID - A valid Splunk Workshop ID to retrieve configuration
7+
8+
# Check if both arguments are provided
9+
if [ $# -ne 2 ]; then
10+
echo "Error: This script requires two arguments."
11+
echo "Usage: $0 <instance_name> <swipe_id>"
12+
echo ""
13+
echo " <instance_name>: Name for your OrbStack instance (e.g. 'splunk-workshop')"
14+
echo " <swipe_id>: Valid Splunk Workshop ID to retrieve configuration"
15+
echo ""
16+
echo "Example: $0 splunk-workshop abc123"
17+
exit 1
18+
fi
19+
20+
echo "Building instance '$1' with SWiPE ID '$2'";
21+
22+
JSON_RESPONSE=$(curl -s https://swipe.splunk.show/api?id=$2)
23+
# Change these values below to match your environment and save this file as start.sh
24+
25+
# Check if Workshop ID not found
26+
if [[ "$JSON_RESPONSE" == '{"message":"Workshop ID not found"}' ]]; then
27+
echo -e "Error: SWiPE ID '$2' not found. Please verify your Workshop ID and try again.\n" && exit 1
28+
fi
29+
30+
# Parse the JSON response and extract values
31+
export ACCESS_TOKEN=$(echo ${JSON_RESPONSE} | jq -r '.INGEST')
32+
export API_TOKEN=$(echo ${JSON_RESPONSE} | jq -r '.API')
33+
export REALM=$(echo ${JSON_RESPONSE} | jq -r '.REALM')
34+
export RUM_TOKEN=$(echo ${JSON_RESPONSE} | jq -r '.RUM')
35+
export HEC_TOKEN=$(echo ${JSON_RESPONSE} | jq -r '.HEC_TOKEN')
36+
export HEC_URL=$(echo ${JSON_RESPONSE} | jq -r '.HEC_URL')
37+
export INSTANCE=$1
38+
39+
echo "Creating instance '$INSTANCE' with configuration from SWiPE ID '$2'..."
40+
41+
# Do not change anything below this line
42+
orb create -c cloud-init.yaml -a arm64 ubuntu:jammy "$INSTANCE"
43+
sleep 2
44+
ORBENV="ACCESS_TOKEN:REALM:API_TOKEN:RUM_TOKEN:HEC_TOKEN:HEC_URL:INSTANCE" orb -m "$INSTANCE" -u splunk ansible-playbook /home/splunk/orbstack.yml
45+
echo "Connect to your instance with:"
46+
echo "ssh -t splunk@$INSTANCE@orb ${SHELL} -l"
47+
ssh -t "splunk@$INSTANCE@orb" "${SHELL}" -l

local-hosting/orbstack/start.sh.example

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)