Skip to content

Commit ab9c64b

Browse files
committed
Add test environment setup
1 parent 1ede611 commit ab9c64b

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed

docker-compose.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
version: "3.7"
2+
networks:
3+
splunknet:
4+
driver: bridge
5+
attachable: true
6+
7+
services:
8+
splunk_sh:
9+
networks:
10+
splunknet:
11+
aliases:
12+
- splunk_sh
13+
hostname: splunk_sh
14+
container_name: splunk_sh
15+
image: splunk/splunk:latest
16+
ports:
17+
- 8003:8000
18+
- 8089
19+
environment:
20+
- SPLUNK_PASSWORD=g8nGXBQBF
21+
- SPLUNK_START_ARGS=--accept-license
22+
- SPLUNK_STANDALONE_URL=splunk_sh
23+
volumes:
24+
- ./bin:/opt/splunk/etc/apps/SplunkVersionControl/bin
25+
- ./default:/opt/splunk/etc/apps/SplunkVersionControl/default
26+
- ./lib:/opt/splunk/etc/apps/SplunkVersionControl/lib
27+
- ./lookups:/opt/splunk/etc/apps/SplunkVersionControl/lookups
28+
- ./metadata:/opt/splunk/etc/apps/SplunkVersionControl/metadata
29+
- ./README:/opt/splunk/etc/apps/SplunkVersionControl/README
30+
- ./static:/opt/splunk/etc/apps/SplunkVersionControl/static
31+
32+
splunk_moc:
33+
networks:
34+
splunknet:
35+
aliases:
36+
- splunk_moc
37+
hostname: splunk_moc
38+
container_name: splunk_moc
39+
image: splunk/splunk:latest
40+
entrypoint:
41+
- /bin/sh
42+
- /usr/sbin/custom_init.sh
43+
ports:
44+
- 8004:8000
45+
- 8089
46+
environment:
47+
- SPLUNK_PASSWORD=g8nGXBQBF
48+
- SPLUNK_START_ARGS=--accept-license
49+
- SPLUNK_STANDALONE_URL=splunk_sh
50+
- SPLUNK_ROLE=splunk_monitor
51+
- DEBUG=true
52+
53+
volumes:
54+
- ./bin:/opt/splunk/etc/apps/SplunkVersionControl/bin
55+
- ./default:/opt/splunk/etc/apps/SplunkVersionControl/default
56+
- ./lib:/opt/splunk/etc/apps/SplunkVersionControl/lib
57+
- ./lookups:/opt/splunk/etc/apps/SplunkVersionControl/lookups
58+
- ./metadata:/opt/splunk/etc/apps/SplunkVersionControl/metadata
59+
- ./README:/opt/splunk/etc/apps/SplunkVersionControl/README
60+
- ./static:/opt/splunk/etc/apps/SplunkVersionControl/static
61+
- ./test/bkp_default.yml:/tmp/defaults/default.yml
62+
- ./test/install_git.yml:/tmp/install_git.yml
63+
- ./test/custom_init.sh:/usr/sbin/custom_init.sh

test/bkp_default.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
#ansible_post_tasks: file:///tmp/install_git.yml
3+
splunk:
4+
conf:
5+
- key: inputs
6+
value:
7+
directory: /opt/splunk/etc/apps/SplunkVersionControl/local
8+
content:
9+
splunkversioncontrol_backup://SH:
10+
srcURL: https://splunk_sh:8089
11+
srcUsername: admin
12+
srcPassword: password:SH
13+
gitTempDir: /opt/splunk/vcs/git_tmp_backup
14+
gitRepoURL: file:///opt/splunk/vcs/backup.git
15+
# sslVerify: /opt/splunk/etc/apps/SplunkVersionControl/auth/ca.pem
16+
debugMode: true
17+
useLocalAuth: false
18+
interval: 60
19+
splunkversioncontrol_restore://SH:
20+
destURL: https://splunk_sh:8089
21+
destUsername: admin
22+
destPassword: password:SH
23+
gitTempDir: /opt/splunk/vcs/git_tmp_restore
24+
gitRepoURL: file:///opt/splunk/vcs/backup.git
25+
# sslVerify: /opt/splunk/etc/apps/SplunkVersionControl/auth/ca.pem
26+
debugMode: true
27+
useLocalAuth: false
28+
auditLogsLookupBackTime: -2h
29+
timewait: 30

test/custom_init.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
set -e
2+
sudo microdnf install git
3+
sudo -u splunk mkdir -p /opt/splunk/vcs/{git_tmp_backup,git_tmp_restore}
4+
sudo -u splunk mkdir -p /opt/splunk/vcs/backup.git
5+
echo "dirs"
6+
sudo -u splunk sh -c "cd /opt/splunk/vcs/backup.git && git init --bare --shared"
7+
echo "init"
8+
sudo -u splunk sh -c "cd /opt/splunk/vcs/ && git clone backup.git"
9+
sudo -u splunk sh -c "git config --global user.email '[email protected]'"
10+
sudo -u splunk sh -c "git config --global user.name 'BackupUser'"
11+
echo "clone"
12+
sudo -u splunk sh -c 'cd /opt/splunk/vcs/backup && touch test && git add test && git commit -a -m "init" && git push'
13+
echo "file"
14+
15+
/usr/sbin/entrypoint.sh start

test/sh_default.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
#ansible_post_tasks: file:///tmp/install_git.yml
3+
splunk:
4+
conf:
5+
- key: macros
6+
value:
7+
directory: /opt/splunk/etc/apps/SplunkVersionControl/local
8+
content:
9+
splunk_vc_name:
10+
definition: SH
11+
splunk_vc_url:
12+
definition: https://splunk_moc:8089
13+
sslVerify:
14+
definiton: false
15+
# definition: /opt/splunk/etc/apps/SplunkVersionControl/auth/ca.pem

0 commit comments

Comments
 (0)