Skip to content

Commit 384ea93

Browse files
committed
Move local splunk to a dockerized setup (#97)
* Move local splunk to a dockerized setup * Address review comments
1 parent 78cfc2d commit 384ea93

File tree

24 files changed

+338
-602
lines changed

24 files changed

+338
-602
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ functional-temp
2121
splunktional-temp
2222

2323
output/
24+
logs/

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ clean:
3232
rm -rf venv
3333
rm -rf venv-tools
3434
rm -rf packages/flare/bin/vendor
35-
@unlink "/Applications/Splunk/etc/apps/flare" || true
3635
@find . -type d -name "node_modules" -exec rm -rf {} +
3736
rm -rf output/flare
3837
@rm -f output/flare.tar.gz
@@ -105,6 +104,5 @@ sl: splunk-local
105104

106105
.PHONY: splunk-local
107106
splunk-local: venv setup-web
108-
@echo "Create symlink from app to Splunk Enterprise and start watching files"
109-
SPLUNK_HOME="/Applications/Splunk" yarn run link
107+
docker compose up -d
110108
yarn run start

README.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,14 @@ managing and publishing multiple packages in the same repository.
1919

2020

2121
## Development
22+
We use an official splunk docker image for development, by binding the local folder to a folder in the container. In order for this to work, you need to have build the application before starting the docker.
2223

23-
If you have your own Splunk Enterprise installed locally, you can use
24-
25-
```
26-
make splunk-local
24+
```bash
25+
make build
2726
```
2827

29-
to download the required dependencies, watch the file changes to re-compile on the fly and generate a symlink between the Splunk app and the Splunk Enterprise applications folder.
28+
Then you can start the local docker and the frontend runner.
3029

31-
To be able to see your changes when refreshing, add this at the end of this file:
32-
```
33-
File: /Applications/Splunk/etc/system/local/web.conf
34-
35-
[settings]
36-
cacheEntriesLimit = 0
37-
cacheBytesLimit = 0
30+
```bash
31+
make splunk-local
3832
```
39-
Then restart your Splunk Enterprise instance.

compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
services:
2+
splunk:
3+
image: splunk/splunk:latest
4+
container_name: splunk
5+
platform: linux/amd64
6+
restart: unless-stopped
7+
ports:
8+
- "8000:8000"
9+
environment:
10+
- SPLUNK_START_ARGS=--accept-license
11+
- SPLUNK_PASSWORD=a_password
12+
volumes:
13+
- ./output/flare:/opt/splunk/etc/apps/flare
14+
- ./splunk/default.yml:/tmp/defaults/default.yml
15+
- ./logs:/opt/splunk/var/log/splunk

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
"lint": "lerna run lint --no-sort",
1010
"setup": "yarn && lerna run build",
1111
"start": "lerna run start --stream --no-sort --concurrency 100",
12-
"unlink": "cd packages/flare && node build.js unlink",
13-
"link": "cd packages/flare && node build.js unlink && node build.js link",
1412
"test": "cd packages/react-components && yarn run test",
1513
"test:ci": "cd packages/react-components && yarn run test:ci"
1614
},

packages/flare/bin/__init__.py

Whitespace-only changes.

packages/flare/bin/constants.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
HOST = "localhost"
77
SPLUNK_PORT = 8089
88
REALM = APP_NAME + "_realm"
9-
KV_COLLECTION_NAME = "event_ingestion_collection"
109
CRON_JOB_THRESHOLD_SINCE_LAST_FETCH = timedelta(minutes=10)
1110

1211

@@ -18,11 +17,11 @@ class PasswordKeys(Enum):
1817
SOURCE_TYPES_FILTER = "source_types_filter"
1918

2019

21-
class CollectionKeys(Enum):
20+
class DataStoreKeys(Enum):
2221
LAST_INGESTED_TENANT_ID = "last_ingested_tenant_id"
2322
START_DATE = "start_date"
2423
TIMESTAMP_LAST_FETCH = "timestamp_last_fetch"
2524

2625
@staticmethod
27-
def get_next_token(tenantId: int) -> str:
28-
return f"next_{tenantId}"
26+
def get_next_token(tenant_id: int) -> str:
27+
return f"next_{tenant_id}"

0 commit comments

Comments
 (0)