-
Notifications
You must be signed in to change notification settings - Fork 4
/
run.sh
executable file
·65 lines (59 loc) · 3.26 KB
/
run.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
#!/bin/sh
args=("$@")
SERVER_MODE=${args[0]}
echo "running Speedgun.io in $SERVER_MODE mode"
pushd ./data/postgres > /dev/null
docker rm -f sg-postgres-name
# docker build -t sg-postgres .
docker pull wesleyhales/speedgun-postgres
docker run -d -P --restart=always -v /home/speedgun/postgres/data:/var/lib/postgresql/data -p 5432:5432 --name sg-postgres-name wesleyhales/speedgun-postgres sh -c "./docker-entrypoint.sh postgres"
#docker run -d -P --restart=always -v /Users/speedgun/postgres/data:/var/lib/postgresql/data -p 5432:5432 --name sg-postgres-name 549907d445d1 sh -c "./docker-entrypoint.sh postgres"
popd > /dev/null
if [ "$SERVER_MODE" = "dev" ]; then
docker rm -f sg-server-name
docker build -t sg-server -f server/Dockerfile-dev .
#todo you need to build to /Users/speedgun/server/target/speedgun
docker run -d -P --restart=always -v /Users/whales/dev/speedgun/core:/root/target/speedgun/jboss-as-7.1.1.Final-fluxui/speedgun/ -v /Users/whales/dev/speedgun/server/target/speedgun:/root/target/speedgun -v /Users/speedgun/logs:/root/jboss-as-7.1.1.Final-fluxui/standalone/log -p 8081:8080 --name sg-server-name --link sg-postgres-name:spn sg-server sh -c "./server-entrypoint.sh"
elif [ "$SERVER_MODE" = "build" ]; then
pushd ./server > /dev/null
cp -rf Dockerfile-prod Dockerfile &&
docker rm -f sg-server-name
docker build -t sg-server .
docker run -d -P --restart=always -v /home/speedgun/logs:/root/jboss-as-7.1.1.Final-fluxui/standalone/log -p 8081:8080 --name sg-server-name --link sg-postgres-name:spn sg-server sh -c "./server-entrypoint.sh"
popd > /dev/null
elif [ "$SERVER_MODE" = "buildprod" ]; then
pushd ./server > /dev/null
cp -rf Dockerfile-prod Dockerfile &&
docker rm -f sg-server-name
docker build -t sg-server .
docker run -d -P --restart=always -v /home/speedgun/logs:/root/jboss-as-7.1.1.Final-fluxui/standalone/log -p 80:8080 --name sg-server-name --link sg-postgres-name:spn sg-server sh -c "./server-entrypoint.sh"
popd > /dev/null
elif [ "$SERVER_MODE" = "pullprod" ]; then
pushd ./server > /dev/null
docker rm -f sg-server-name
docker pull wesleyhales/speedgun-server
docker run -d -P --restart=always -v /home/speedgun/logs:/root/jboss-as-7.1.1.Final-fluxui/standalone/log -p 80:8080 --name sg-server-name --link sg-postgres-name:spn wesleyhales/speedgun-server -c "./server-entrypoint.sh"
popd > /dev/null
else
#prod or local
pushd ./server > /dev/null
docker rm -f sg-server-name
docker pull wesleyhales/speedgun-server
docker run -d -P --restart=always -v /home/speedgun/logs:/root/jboss-as-7.1.1.Final-fluxui/standalone/log -p 8081:8080 --name sg-server-name --link sg-postgres-name:spn wesleyhales/speedgun-server sh -c "./server-entrypoint.sh"
popd > /dev/null
fi
#jump into running container
#docker exec -ti sg-server-name /bin/bash
#export to CSV from sg-server-name postgres client
#psql -h ${SPN_PORT_5432_TCP_ADDR} -p 5432 -U postgres
#\c speedgun
#\COPY timingdata to 'timingdata.csv' DELIMITER ',' CSV HEADER;
#or...
#select count(*) from timingdata; for total records
#or..
#fish out by copying to a shared dir i.e. jboss/standalone/log/
#
#if [[ "$OSTYPE" == "linux-gnu" ]]; then
# mint/mint.sh
#elif [[ "$OSTYPE" == "darwin"* ]]; then
# mint/mint-mac.sh