-
Notifications
You must be signed in to change notification settings - Fork 59
/
prod-run-env.sh
executable file
·41 lines (34 loc) · 1020 Bytes
/
prod-run-env.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
#!/bin/bash
set -euo pipefail
cd ${0%/*}/coffee-shop
docker stop coffee-shop coffee-shop-db barista &> /dev/null || true
docker run -d --rm \
--name coffee-shop-db \
--network dkrnet \
-p 5432:5432 \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-v $(pwd)/src/main/resources/scripts:/scripts:ro \
postgres:15.2
docker run -d --rm \
--name barista \
--network dkrnet \
-p 8002:8080 \
sdaschner/barista:quarkus-testing-1
echo 'waiting for db startup'
until docker exec coffee-shop-db pg_isready -h localhost > /dev/null; do
sleep 0.5
done;
echo 'creating schema'
docker exec coffee-shop-db psql -U postgres -f /scripts/schema.sql
echo 'loading data into database'
docker exec coffee-shop-db psql -U postgres -f /scripts/load-data.sql
echo 'starting coffee-shop'
docker run -d --rm \
--name coffee-shop \
--network dkrnet \
-p 8001:8080 \
coffee-shop
until [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8001/q/health)" == "200" ]]; do
sleep 0.5
done;