-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_geode.sh
52 lines (42 loc) · 1.93 KB
/
setup_geode.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
#!/bin/bash
version="${1:-1.15.1}"
jmx_port="${2:-1099}"
rest_port="${3:-8080}"
pulse_port="${4:-7070}"
locator_port="${5:-10334}"
cache_server_port="${6:-40404}"
platform="${7:-linux/amd64}"
container_name="geode-$version-$(hostname)"
echo "Creating $container_name docker container."
IS_RUNNING=$(docker ps --filter name="${container_name}" --format '{{.ID}}')
if [ -n "${IS_RUNNING}" ]; then
echo "${container_name} is running. Stopping ${container_name} and removing container..."
docker container stop "${container_name}"
docker container rm "${container_name}"
else
IS_STOPPED=$(docker ps -a --filter name="${container_name}" --format '{{.ID}}')
if [ -n "${IS_STOPPED}" ]; then
echo "${container_name} is stopped. Removing container..."
docker container rm "${container_name}"
fi
fi
docker run \
--name "${container_name}" \
--privileged=true \
--platform "${platform}" \
-v "$(pwd)"/scripts:/geode/scripts \
-p "${jmx_port}":1099 \
-p "${rest_port}":8080 \
-p "${pulse_port}":7070 \
-p "${locator_port}":10334 \
-p "${cache_server_port}":40404 \
--entrypoint sh \
-d apachegeode/geode:"${version}" -c "/geode/scripts/forever"
sleep 5
mvn clean package
docker cp geode-cache.xml "${container_name}":cache.xml
docker cp target/Trades2Geode-1.0.jar "${container_name}":Trades2Geode-1.0.jar # deploy so we have access to the POJO on the server
docker cp jars/gemfire-initial-load-function-0.10.1.jar "${container_name}":gemfire-initial-load-function-0.10.1.jar
echo "Starting locator1, server1 and deploying client function for the load job.."
docker exec --user root "${container_name}" sh -c "gfsh -e 'start locator --name=locator1 --hostname-for-clients=localhost' -e 'deploy --jar=./Trades2Geode-1.0.jar' -e 'deploy --jar=./gemfire-initial-load-function-0.10.1.jar' -e 'start server --name=server1 --cache-xml-file=./cache.xml --hostname-for-clients=localhost' -e 'list functions'"
echo "done"