Skip to content

Commit b7195ce

Browse files
emmanuelbernardyrodiere
authored andcommitted
[ogm/hiking] Add Docker's Mongo and order creation scripts
1 parent 749aefd commit b7195ce

File tree

5 files changed

+70
-0
lines changed

5 files changed

+70
-0
lines changed

hibernate-ogm/hiking-demo/src/demo/beanvalidation2-script.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ Based on the following http://redhat.slides.com/ebernard/bean-validation-2?token
77

88
== Installation
99

10+
[NOTE]
11+
====
12+
All bash scripts are in `./src/script`.
13+
They must be run from their hosting directory.
14+
====
15+
1016
* run `mvn clean install`
1117
* copy `./target/wildfly-*` in `./wildfly-*` (for manual run)
1218

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
# Released under ASL 2.0, see project root
3+
4+
# Assumes the script is run from its home dir
5+
# assumes HTTPie is present
6+
echo "http POST http://localhost:8080/hibernate-ogm-hiking-demo-1.0-SNAPSHOT/hiking-manager/orders/ < orderCreation.json"
7+
echo "\n"
8+
cat orderCreation.json
9+
http POST http://localhost:8080/hibernate-ogm-hiking-demo-1.0-SNAPSHOT/hiking-manager/orders/ < orderCreation.json
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
function help {
4+
echo "Usage:"
5+
echo "./$TOOL start"
6+
echo "./$TOOL stop"
7+
echo "internal usage is docker_service {start|stop} docker_image <arg like -p 1234:1234 -e ABC=DEF> <comamnd to run from the docker container>"
8+
exit -1
9+
}
10+
11+
function docker_service {
12+
if [[ $# -eq 4 ]]; then
13+
OP=$1
14+
TOOL=$2
15+
ARGS=$3
16+
COMMAND=$4
17+
18+
SANITIZED_TOOL=$TOOL
19+
#strip org name
20+
if [[ $SANITIZED_TOOL == *"/"* ]]; then
21+
SANITIZED_TOOL=$(echo $SANITIZED_TOOL | cut -d "/" -f2)
22+
fi
23+
#Remplace : with - if a tag is used
24+
if [[ $SANITIZED_TOOL == *":"* ]]; then
25+
NAME=$(echo $SANITIZED_TOOL | cut -d ":" -f1)
26+
TAG=$(echo $SANITIZED_TOOL | cut -d ":" -f2)
27+
SANITIZED_TOOL="$NAME-$TAG"
28+
fi
29+
case $OP in
30+
"start")
31+
docker stop $SANITIZED_TOOL
32+
docker rm $SANITIZED_TOOL
33+
docker run --name $SANITIZED_TOOL $ARGS -d $TOOL $COMMAND
34+
docker logs -f $SANITIZED_TOOL
35+
;;
36+
"stop")
37+
docker stop $SANITIZED_TOOL
38+
;;
39+
"logs")
40+
docker logs -f $SANITIZED_TOOL
41+
;;
42+
*)
43+
help $TOOL
44+
;;
45+
esac
46+
else
47+
help
48+
fi
49+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
source docker-service.sh
4+
ARGS="-p 27017:27017"
5+
6+
docker_service $1 mongo "$ARGS" ""

0 commit comments

Comments
 (0)