Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ splunktional-temp
dist/
build/
venv-tools/
packages/flare/stage/
packages/flare_splunk_app/stage/

# OS files
desktop.ini
Expand All @@ -26,7 +26,7 @@ __pycache__/
local/
*local.meta
*.log
packages/flare/src/main/resources/splunk/bin/lib
packages/flare_splunk_app/src/main/resources/splunk/bin/lib

# Environment variables
.env
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ─── Variables ───────────────────────────────────────────────────────────────
PYTHON ?= python
STAGE := packages/flare/stage
STAGE := packages/flare_splunk_app/stage
DIST := dist
APP_BIN_LIB := packages/flare/src/main/resources/splunk/bin/lib
APP_BIN_LIB := packages/flare_splunk_app src/main/resources/splunk/bin/lib

# Splunk versions declared to Splunkbase on publish. Override per release:
# make publish SPLUNK_VERSIONS=9.3,...
Expand All @@ -26,7 +26,7 @@ venv-tools: requirements.tools.txt
venv-tools/bin/pip install -r requirements.tools.txt

# ─── Build & package ─────────────────────────────────────────────────────────
# Compile the frontend into packages/flare/stage (webpack also copies the
# Compile the frontend into packages/flare_splunk_app/stage (webpack also copies the
# Splunk app skeleton from src/main/resources/splunk into stage).
.PHONY: build
build: node_modules
Expand All @@ -44,9 +44,9 @@ publish:
if [ -z "$$pkg" ]; then echo "No package found in $(DIST)/. Run 'make package' first."; exit 1; fi; \
echo "Publishing $$pkg to Splunkbase..."; \
curl -u $$SPLUNKBASE_CREDS --request POST \
https://splunkbase.splunk.com/api/v1/app/7602/new_release/ \
https://splunkbase.splunk.com/api/v1/app/9219/new_release/ \
-F "files[]=@$$pkg" \
-F "filename=flare.tgz" \
-F "filename=flare_splunk_app.tgz" \
-F "splunk_versions=$(SPLUNK_VERSIONS)" \
-F "visibility=true"

Expand Down Expand Up @@ -86,7 +86,7 @@ lint: node_modules venv-tools mypy format-check

.PHONY: mypy
mypy: venv-tools
venv-tools/bin/mypy --config-file mypy.ini packages/flare
venv-tools/bin/mypy --config-file mypy.ini packages/flare_splunk_app

.PHONY: format
format: venv-tools node_modules
Expand All @@ -101,7 +101,7 @@ format-check: venv-tools node_modules
sl: splunk-local

# Assemble a runnable app in stage/ (frontend + vendored Python), then run it in
# a local Splunk container (compose mounts packages/flare/stage) with a watcher.
# a local Splunk container (compose mounts packages/flare_splunk_app/stage) with a watcher.
.PHONY: splunk-local
splunk-local: build
SKIP_TARBALL=1 ./package.sh
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ $ pnpm run setup
You’ll have two main directories, one for the created React page and one for the created Splunk app.

- `packages/configuration`
- `packages/flare`
- `packages/flare_splunk_app`

## Splunk demo

Splunk demo will allow you to view your new app inside your local Splunk instance:

```bash
# navigate to your app folder
$ cd packages/flare
$ cd packages/flare_splunk_app

# link the app to your local Splunk instance
$ pnpm run link:app
Expand Down Expand Up @@ -74,7 +74,7 @@ and locally. `package.sh` is the single packaging tool; `make` orchestrates it.
| Command | What it does |
| --------------- | -------------------------------------------------------------------------------------------- |
| `make ci` | Full pipeline (what CI runs): build → package → tooling → lint → validate → test. |
| `make build` | Compile the frontend into `packages/flare/stage/`. |
| `make build` | Compile the frontend into `packages/flare_splunk_app/stage/`. |
| `make package` | Vendor the Python runtime deps and produce the installable app at `dist/*.tgz`. |
| `make validate` | Run Splunk AppInspect against the packaged `dist/*.tgz`. |
| `make lint` | ESLint + Stylelint + mypy + Prettier check. |
Expand All @@ -91,8 +91,8 @@ Prerequisites for `make`: Node.js `>= 22`, `pnpm` `9.x`, Python `3.9`, and Docke
$ make splunk-local
```

This builds the app, vendors the Python dependencies into `packages/flare/stage`,
starts a Splunk container (compose mounts `packages/flare/stage` as the app), and
This builds the app, vendors the Python dependencies into `packages/flare_splunk_app/stage`,
starts a Splunk container (compose mounts `packages/flare_splunk_app/stage` as the app), and
runs the webpack watcher. Open `https://localhost:8000` to view the app. This is
an alternative to the `pnpm run link:app` symlink flow above and does not require
a local Splunk installation.
Expand Down
2 changes: 1 addition & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ services:
- SPLUNK_PASSWORD=a_password
- SPLUNK_GENERAL_TERMS=--accept-sgt-current-at-splunk-com
volumes:
- ./packages/flare/stage:/opt/splunk/etc/apps/flare_splunk_app
- ./packages/flare_splunk_app/stage:/opt/splunk/etc/apps/flare_splunk_app
- ./splunk/default.yml:/tmp/defaults/default.yml
- ./logs:/opt/splunk/var/log/splunk
10 changes: 6 additions & 4 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ mkdir -p $PACKAGE_DIR
# Identification
COMMIT_ID=$(git rev-parse --short=6 HEAD 2>/dev/null || echo "local")
APP_FOLDER="flare_splunk_app"
REAL_SRC_DIR=$SCRIPT_DIR/packages/flare/src/main/resources/splunk
SRC_DIR=$SCRIPT_DIR/packages/flare/stage
REAL_SRC_DIR=$SCRIPT_DIR/packages/flare_splunk_app/src/main/resources/splunk
SRC_DIR=$SCRIPT_DIR/packages/flare_splunk_app/stage
FULLAPP_DIR=$PACKAGE_DIR/$APP_FOLDER

echo "Building package for $APP_FOLDER (Commit: $COMMIT_ID)..."
Expand All @@ -31,8 +31,10 @@ mkdir -p $FULLAPP_DIR
# ─── SYNC src → stage ────────────────────────────────────────────────────────
# Always sync the real source into stage before packaging.
echo "Syncing src → stage..."
# Delete old backend folders to prevent stale files, but preserve appserver/ which holds compiled frontend assets
rm -rf "$SRC_DIR/bin" "$SRC_DIR/default" "$SRC_DIR/metadata" "$SRC_DIR/lookups"
# Delete folders that come from src to prevent stale files, but preserve
# appserver/static which holds the compiled frontend assets webpack emits.
rm -rf "$SRC_DIR/bin" "$SRC_DIR/default" "$SRC_DIR/metadata" "$SRC_DIR/lookups" \
"$SRC_DIR/appserver/templates" "$SRC_DIR/README"
cp -R "$REAL_SRC_DIR"/. "$SRC_DIR/"
# Remove Python bytecode artifacts that shouldn't be packaged
find "$SRC_DIR" -name '__pycache__' -type d -exec rm -rf {} + 2>/dev/null || true
Expand Down

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
__splunkd_partials__ = ${json_decode(splunkd)};
</script>

<% page_path = "/static/app/flare/pages/" + page + ".js" %>
<% page_path = "/static/app/flare_splunk_app/pages/" + page + ".js" %>

<script src="${make_url(page_path)}"></script>
</body>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<view template="flare_splunk_app:/templates/configuration.html" type="html">
<label>Configuration</label>
</view>
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ python.version = python3
python.required = 3.9
source = flare
sourcetype = flare_json
passAuth = splunk-system-user
passAuth = admin
File renamed without changes.
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading