Skip to content

Commit

Permalink
Add a quick-start-lite.yaml docker-compose file (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
4eUeP authored Sep 8, 2023
1 parent 9633248 commit 9f0cc05
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2

- name: pull images
run: docker-compose -f assets/quick-start.yaml pull
run: docker-compose -f assets/quick-start-lite.yaml pull

- name: quick start a hstream cluster
run: ./tests/start_cluster.sh
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:

- name: Start cluster
run: |
docker compose -f ../../assets/quick-start.yaml up -d
docker compose -f ../../assets/quick-start-lite.yaml up -d
sleep 5
../../tests/wait_hserver.sh
sleep 5
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
- name: Start cluster
run: |
docker compose -f ../../assets/quick-start.yaml up -d
docker compose -f ../../assets/quick-start-lite.yaml up -d
sleep 5
../../tests/wait_hserver.sh
sleep 5
Expand All @@ -116,7 +116,7 @@ jobs:

- name: Start cluster
run: |
docker compose -f ./assets/quick-start.yaml up -d
docker compose -f ./assets/quick-start-lite.yaml up -d
sleep 5
./tests/wait_hserver.sh
sleep 5
Expand Down
77 changes: 77 additions & 0 deletions assets/quick-start-lite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
version: "3.5"

services:
hserver:
image: hstreamdb/hstream:latest
depends_on:
- zookeeper
- hstore
ports:
- "127.0.0.1:6570:6570"
expose:
- 6570
networks:
- hstream-quickstart
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /tmp:/tmp
- data_store:/data/store
command:
- bash
- "-c"
- |
set -e
/usr/local/script/wait-for-storage.sh hstore 6440 zookeeper 2181 600 \
/usr/local/bin/hstream-server \
--bind-address 0.0.0.0 --port 6570 \
--internal-port 6571 \
--server-id 100 \
--seed-nodes "$$(hostname -I | awk '{print $$1}'):6571" \
--advertised-address $$(hostname -I | awk '{print $$1}') \
--metastore-uri zk://zookeeper:2181 \
--store-config /data/store/logdevice.conf \
--store-admin-host hstore --store-admin-port 6440 \
--store-log-level warning \
--io-tasks-path /tmp/io/tasks \
--io-tasks-network hstream-quickstart
hstore:
image: hstreamdb/hstream:latest
networks:
- hstream-quickstart
volumes:
- data_store:/data/store
command:
- bash
- "-c"
- |
set -ex
# N.B. "enable-dscp-reflection=false" is required for linux kernel which
# doesn't support dscp reflection, e.g. centos7.
/usr/local/bin/ld-dev-cluster --root /data/store \
--use-tcp --tcp-host $$(hostname -I | awk '{print $$1}') \
--user-admin-port 6440 \
--param enable-dscp-reflection=false \
--no-interactive
zookeeper:
image: zookeeper:3.7
expose:
- 2181
networks:
- hstream-quickstart
volumes:
- data_zk_data:/data
- data_zk_datalog:/datalog

networks:
hstream-quickstart:
name: hstream-quickstart

volumes:
data_store:
name: quickstart_data_store
data_zk_data:
name: quickstart_data_zk_data
data_zk_datalog:
name: quickstart_data_zk_datalog
8 changes: 5 additions & 3 deletions tests/start_cluster.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/bash
set -e

docker-compose -f assets/quick-start.yaml up -d
COMPOSE_FILE=assets/quick-start-lite.yaml

docker-compose -f $COMPOSE_FILE up -d

export timeout=40
until ( \
docker-compose -f assets/quick-start.yaml run --no-deps --rm hserver \
docker-compose -f $COMPOSE_FILE run --no-deps --rm hserver \
bash -c 'set -e; \
hstream --host hserver --port 6570 node check-running -n 1 && \
hadmin server --host hserver --port 6570 status'
Expand All @@ -15,7 +17,7 @@ until ( \
timeout=$((timeout - 10))
if [ $timeout -le 0 ]; then
echo "Timeout!"
docker-compose -f assets/quick-start.yaml logs
docker-compose -f $COMPOSE_FILE logs
exit 1
fi
done
4 changes: 2 additions & 2 deletions tests/test_quick_start.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e

IMAGE=$(cat assets/quick-start.yaml | grep "image:.*hstreamdb/hstream" | head -n 1 | awk '{print $2}')
IMAGE=$(cat assets/quick-start-lite.yaml | grep "image:.*hstreamdb/hstream" | head -n 1 | awk '{print $2}')
# XXX: Github action seems hang up when read string from /dev/urandom
#STREAM_NAME="demo_$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)"
STREAM_NAME="demo_$RANDOM"
Expand Down Expand Up @@ -43,6 +43,6 @@ cat -e $OUTPUT

echo "-> compare results..."
cmp --silent $OUTPUT tests/quick_start_sql_001.txt || \
(docker-compose -f assets/quick-start.yaml logs ; cleanup ; exit 1)
(docker-compose -f assets/quick-start-lite.yaml logs ; cleanup ; exit 1)

cleanup

0 comments on commit 9f0cc05

Please sign in to comment.