-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdtbook-to-pef.sh
executable file
·75 lines (66 loc) · 1.73 KB
/
dtbook-to-pef.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
set -x
set -e
# FIXME: this script could share some code with it/sbs-benchmark/run.sh and
# assembly/src/test/resources/test-docker-image.sh
DTBOOK=$1
shift
ARGS=$@
IMAGE=sbsdev/pipeline
# Pulls the image that was built on docker hub.
# In order to test local changes, you can instead run `make dist-docker-image` and then
# use the daisyorg/pipeline-assembly image.
docker pull $IMAGE:latest
CLIENTKEY=clientid
CLIENTSECRET=sekret
docker run \
--name server \
--detach \
-e PIPELINE2_WS_HOST=0.0.0.0 \
-e PIPELINE2_WS_AUTHENTICATION=true \
-e PIPELINE2_WS_AUTHENTICATION_KEY=$CLIENTKEY \
-e PIPELINE2_WS_AUTHENTICATION_SECRET=$CLIENTSECRET \
-p 8181:8181 \
$IMAGE
# wait for the server to start
sleep 5
tries=10
while ! curl localhost:8181/ws/alive >/dev/null 2>/dev/null; do
if [[ $tries > 0 ]]; then
echo "Waiting for web service to be up..." >&2
sleep 2
(( tries-- ))
else
exit 1
fi
done
TEMP_DIR=$(mktemp -d $(pwd)/dtbook-to-pef_XXXXX)
cp $DTBOOK $TEMP_DIR
cd $TEMP_DIR
zip data.zip $(basename $DTBOOK)
if docker run \
--name cli \
--rm \
-it \
--link server \
--entrypoint /opt/daisy-pipeline2/cli/dp2 \
--volume="$(pwd):/mnt:rw" \
$IMAGE \
--host http://server \
--starting false \
--client_key $CLIENTKEY \
--client_secret $CLIENTSECRET \
sbs:dtbook-to-pef \
--source $(basename $DTBOOK) \
$ARGS \
--output /mnt \
--data /mnt/data.zip \
--persistent
then
:
else
docker logs server > server.log 2> server.log
fi
open .
docker stop server
docker rm server