This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart.sh
executable file
·92 lines (72 loc) · 2.3 KB
/
start.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
# script used to allow start the PoC setup.
#
# Can use specific tags:
#
# Official:
# node:latest
# node:14.16.1-stretch
#
# Bash based.
os_node=${1:-'node:14-buster'} # stick to 14 for lockfileVersion stability
# for the current branch - make sure name and S3 are setup to dev.
echo_section() {
echo ""
echo "$1"
echo "****************"
echo ""
}
cleanup() {
# remove artifacts left locally by previous npm install
rm -rf appoptics-w3c/node_modules
rm -rf otel/node_modules
rm -rf appoptics-legacy/node_modules
rm -rf solarwinds/node_modules
rm -rf appoptics-w3c/package-lock.json
rm -rf appoptics-legacy/package-lock.json
rm -rf otel/package-lock.json
rm -rf solarwinds/package-lock.json
docker stop "$container_id"
docker rm "$container_id"
}
set -e
trap cleanup EXIT
echo_section "Zipkin Setup"
if [ "$(docker inspect -f '{{.State.Running}}' zipkin 2>/dev/null)" = "true" ]; then
echo "Zipkin is running."
else
echo "Starting Zipkin."
docker run --rm -d -p 9411:9411 --name zipkin openzipkin/zipkin;
fi
echo_section "Container Setup"
# pull a standard image
docker pull "$os_node"
# open a shell in detached mode
container_id=$(docker run -itd \
-h "${os_node}" \
-w /usr/src/work \
-v "$(pwd)":/usr/src/work \
-p 3000:3000 \
-p 3100:3100 \
-p 3200:3200 \
-p 3300:3300 \
-e NODE_ENV=production \
--env-file .env \
"$os_node" bash)
echo_section "NPM install"
docker exec "$container_id" bash -c "cd appoptics-legacy && npm install"
docker exec "$container_id" bash -c "cd otel && npm install"
docker exec "$container_id" bash -c "cd appoptics-w3c && npm install"
docker exec "$container_id" bash -c "cd solarwinds && npm install"
echo_section "Start Servers"
docker exec "$container_id" bash -c "npm run --prefix appoptics-legacy start &"
docker exec "$container_id" bash -c "npm run --prefix otel start &"
docker exec "$container_id" bash -c "npm run --prefix appoptics-w3c start &"
docker exec "$container_id" bash -c "npm run --prefix solarwinds start &"
echo_section "System info"
echo "Container Id is ""$container_id"""
docker exec "$container_id" printenv
docker exec "$container_id" node --version
docker exec "$container_id" npm --version
# ready for work
docker attach "$container_id"