Skip to content

Commit

Permalink
Fix/demoscripts (#69)
Browse files Browse the repository at this point in the history
* Fixes #68
  • Loading branch information
Ryan Faircloth authored and GitHub committed Aug 31, 2019
1 parent f02ec26 commit c294fcb
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SPLUNK_HEC_URL=https://splunk:8088/services/collector/event
SPLUNK_HEC_STATSURL=https://splunk:8088/services/collector/event
SPLUNK_CONNECT_METHOD=hec
SPLUNK_DEFAULT_INDEX=main
SPLUNK_METRICS_INDEX=metrics
SPLUNK_METRICS_INDEX=em_metrics
SPLUNK_APPS_URL=https://splunkbase.splunk.com/app/2757/release/6.1.1/download,https://splunkbase.splunk.com/app/3245/release/1.0/download,https://splunkbase.splunk.com/app/1620/release/3.4.0/download,https://splunkbase.splunk.com/app/1467/release/2.5.8/download,https://splunkbase.splunk.com/app/2846/release/1.6.0/download,https://splunkbase.splunk.com/app/2847/release/1.2.0/download
SPLUNKBASE_USERNAME=username
SPLUNKBASE_PASSWORD=password
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ cd splunk-connect-for-syslog
cp .env.template .env
```

- Update the splunkbase username and password in .env this allows the splunk container to install required add-ons for the demo

- Start the demo environment

```bash
Expand Down
32 changes: 24 additions & 8 deletions demo-with-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,35 @@
#Use of this source code is governed by a BSD-2-clause-style
#license that can be found in the LICENSE-BSD2 file or at
#https://opensource.org/licenses/BSD-2-Clause

WAITON=${1:-test}
compose=${2:-docker-compose-demo.yml}
echo $WAITON $compose
mkdir test-results
docker volume create sc4s-tests
docker-compose down
docker volume rm sc4s-results
docker volume rm splunk-etc

docker volume create sc4s-results
docker volume create splunk-etc

docker container create --name dummy \
-v sc4s-tests:/work/tests \
-v sc4s-results:/work/test-results \
-v splunk-etc:/work/splunk-etc \
registry.access.redhat.com/ubi7/ubi
docker cp tests/ dummy:/work/tests/
docker cp ./splunk/etc/* dummy:/work/splunk-etc/
docker rm dummy

docker-compose pull
docker-compose up

EXIT=$0
docker-compose -f $compose pull
docker-compose -f $compose up -d splunk
docker-compose -f $compose up -d sc4s
sleep 60
docker-compose -f $compose build
docker-compose -f $compose up

docker container create --name dummy \
-v sc4s-results:/work/test-results \
registry.access.redhat.com/ubi7/ubi

docker cp dummy:/work/test-results/functional test-results
docker rm dummy
EXIT=$0
19 changes: 0 additions & 19 deletions docker-compose-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ services:
- splunk
- sc4s
volumes:
- sc4s-tests:/work/tests
- sc4s-results:/work/test-results
environment:
- SPLUNK_PASSWORD=${SPLUNK_PASSWORD}
Expand Down Expand Up @@ -56,14 +55,6 @@ services:
- SPLUNK_DEFAULT_INDEX=${SPLUNK_DEFAULT_INDEX}
- SPLUNK_METRICS_INDEX=${SPLUNK_DEFAULT_INDEX}
- SYSLOG_PRESUME_FILTER=juniper_netscreen
# logging:
# driver: splunk
# options:
# splunk-token: a778f63a-5dff-4e3c-a72c-a03183659e94
# splunk-url: https://splunk:8088/services/collector/event
# splunk-index: main
# splunk-insecureskipverify: true
# splunk-verify-connection: false
splunk:
image: splunk/splunk:latest
hostname: splunk
Expand All @@ -80,17 +71,7 @@ services:
- SPLUNKBASE_PASSWORD=${SPLUNKBASE_PASSWORD}
volumes:
- splunk-etc:/opt/splunk/etc
# logging:
# driver: splunk
# options:
# splunk-token: a778f63a-5dff-4e3c-a72c-a03183659e94
# splunk-url: https://splunk:8088/services/collector/event
# splunk-index: main
# splunk-insecureskipverify: true
# splunk-verify-connection: false
volumes:
sc4s-tests:
external: true
sc4s-results:
external: true
splunk-etc:
Expand Down
83 changes: 83 additions & 0 deletions docker-compose-demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#Splunk Connect for Syslog (SC4S) by Splunk, Inc.
#
#To the extent possible under law, the person who associated CC0 with
#Splunk Connect for Syslog (SC4S) has waived all copyright and related or neighboring rights
#to Splunk Connect for Syslog (SC4S).
#
#You should have received a copy of the CC0 legalcode along with this
#work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
version: "3.2"
services:
test:
build: ./tests
links:
- splunk
- sc4s
- sc4s-juniper
volumes:
- sc4s-tests:/work/tests
- sc4s-results:/work/test-results
environment:
- SPLUNK_PASSWORD=${SPLUNK_PASSWORD}

sc4s:
image: splunk/scs:latest
hostname: sc4s
ports:
- "514"
- "601"
- "514/udp"
- "5514"
- "5514/udp"
stdin_open: true
tty: true
links:
- splunk
environment:
- SPLUNK_HEC_URL=${SPLUNK_HEC_URL}
- SPLUNK_HEC_STATSURL=${SPLUNK_HEC_STATSURL}
- SPLUNK_HEC_TOKEN=${SPLUNK_HEC_TOKEN}
- SPLUNK_CONNECT_METHOD=${SPLUNK_CONNECT_METHOD}
- SPLUNK_DEFAULT_INDEX=${SPLUNK_DEFAULT_INDEX}
- SPLUNK_METRICS_INDEX=${SPLUNK_DEFAULT_INDEX}
sc4s-juniper:
image: splunk/scs:latest
hostname: sc4s-juniper
ports:
- "514"
stdin_open: true
tty: true
links:
- splunk
environment:
- SPLUNK_HEC_URL=${SPLUNK_HEC_URL}
- SPLUNK_HEC_STATSURL=${SPLUNK_HEC_STATSURL}
- SPLUNK_HEC_TOKEN=${SPLUNK_HEC_TOKEN}
- SPLUNK_CONNECT_METHOD=${SPLUNK_CONNECT_METHOD}
- SPLUNK_DEFAULT_INDEX=${SPLUNK_DEFAULT_INDEX}
- SPLUNK_METRICS_INDEX=${SPLUNK_DEFAULT_INDEX}
- SYSLOG_PRESUME_FILTER=juniper_netscreen
splunk:
image: splunk/splunk:latest
hostname: splunk
ports:
- "8000:8000"
- "8088:8088"
- "8089:8089"
environment:
- SPLUNK_HEC_TOKEN=${SPLUNK_HEC_TOKEN}
- SPLUNK_PASSWORD=${SPLUNK_PASSWORD}
- SPLUNK_START_ARGS=${SPLUNK_START_ARGS}
- SPLUNK_APPS_URL=${SPLUNK_APPS_URL}
- SPLUNKBASE_USERNAME=${SPLUNKBASE_USERNAME}
- SPLUNKBASE_PASSWORD=${SPLUNKBASE_PASSWORD}
volumes:
- splunk-etc:/opt/splunk/etc

volumes:
sc4s-tests:
external: true
sc4s-results:
external: true
splunk-etc:
external: true
23 changes: 0 additions & 23 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ services:
- sc4s
- sc4s-juniper
volumes:
- sc4s-tests:/work/tests
- sc4s-results:/work/test-results
environment:
- SPLUNK_PASSWORD=${SPLUNK_PASSWORD}
Expand Down Expand Up @@ -49,10 +48,6 @@ services:
image: splunk/scs:latest
build:
context: ./package
# cache_from:
# - registry.access.redhat.com/ubi7/ubi
# - registry.access.redhat.com/rhel7/rhel
# - rfaircloth/scs:edge
args:
RH_ORG: ${RH_ORG}
RH_ACTIVATION: ${RH_ACTIVATION}
Expand All @@ -71,14 +66,6 @@ services:
- SPLUNK_DEFAULT_INDEX=${SPLUNK_DEFAULT_INDEX}
- SPLUNK_METRICS_INDEX=${SPLUNK_DEFAULT_INDEX}
- SYSLOG_PRESUME_FILTER=juniper_netscreen
# logging:
# driver: splunk
# options:
# splunk-token: a778f63a-5dff-4e3c-a72c-a03183659e94
# splunk-url: https://splunk:8088/services/collector/event
# splunk-index: main
# splunk-insecureskipverify: true
# splunk-verify-connection: false
splunk:
image: splunk/splunk:latest
hostname: splunk
Expand All @@ -95,17 +82,7 @@ services:
- SPLUNKBASE_PASSWORD=${SPLUNKBASE_PASSWORD}
volumes:
- splunk-etc:/opt/splunk/etc
# logging:
# driver: splunk
# options:
# splunk-token: a778f63a-5dff-4e3c-a72c-a03183659e94
# splunk-url: https://splunk:8088/services/collector/event
# splunk-index: main
# splunk-insecureskipverify: true
# splunk-verify-connection: false
volumes:
sc4s-tests:
external: true
sc4s-results:
external: true
splunk-etc:
Expand Down
20 changes: 13 additions & 7 deletions test-with-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,32 @@
#Use of this source code is governed by a BSD-2-clause-style
#license that can be found in the LICENSE-BSD2 file or at
#https://opensource.org/licenses/BSD-2-Clause

WAITON=${1:-test}
compose=${2:-docker-compose.yml}
echo $WAITON $compose
mkdir test-results
docker volume create sc4s-tests
docker-compose down
docker volume rm sc4s-results
docker volume rm splunk-etc

docker volume create sc4s-results
docker volume create splunk-etc

docker container create --name dummy \
-v sc4s-tests:/work/tests \
-v sc4s-results:/work/test-results \
-v splunk-etc:/work/splunk-etc \
registry.access.redhat.com/ubi7/ubi
docker cp tests/ dummy:/work/tests/
docker cp ./splunk/etc/* dummy:/work/splunk-etc/
docker rm dummy

docker-compose build
docker-compose up --abort-on-container-exit --exit-code-from test
docker-compose -f $compose pull
docker-compose -f $compose up -d splunk
docker-compose -f $compose up -d sc4s
sleep 60
docker-compose -f $compose build
docker-compose -f $compose up --abort-on-container-exit --exit-code-from $WAITON

docker container create --name dummy \
-v sc4s-tests:/work/tests \
-v sc4s-results:/work/test-results \
registry.access.redhat.com/ubi7/ubi

Expand Down
2 changes: 2 additions & 0 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ RUN mkdir -p /work/tests
RUN mkdir -p /work/test-results/functional
COPY entrypoint.sh /
COPY wait-for /bin/
COPY ./* /work/tests/
COPY ./data /work/tests/data
#WORKDIR /work
CMD /entrypoint.sh

0 comments on commit c294fcb

Please sign in to comment.