-
Notifications
You must be signed in to change notification settings - Fork 5
/
docker-deploy-hdp30.sh
executable file
·68 lines (54 loc) · 2.08 KB
/
docker-deploy-hdp30.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
#!/usr/bin/env bash
#This script downloads HDP sandbox along with their proxy docker container
set -x
# CAN EDIT THESE VALUES
registry="hortonworks"
name="sandbox-hdp"
version="3.0.1"
proxyName="sandbox-proxy"
proxyVersion="1.0"
flavor="hdp"
# NO EDITS BEYOND THIS LINE
# housekeeping
echo $flavor > sandbox-flavor
# create necessary folders for nginx and copy over our rule generation script there
mkdir -p sandbox/proxy/conf.d
mkdir -p sandbox/proxy/conf.stream.d
# pull and tag the sandbox and the proxy container
docker pull "$registry/$name:$version"
docker pull "$registry/$proxyName:$proxyVersion"
# start the docker container and proxy
if [ "$flavor" = "hdf" ]; then
hostname="sandbox-hdf.hortonworks.com"
elif [ "$flavor" = "hdp" ]; then
hostname="sandbox-hdp.hortonworks.com"
fi
version=$(docker images | grep $registry/$name | awk '{print $2}');
# Create cda docker network
docker network create cda 2>/dev/null
# Deploy the sandbox into the cda docker network
docker run -d \
--name $name \
-h $hostname \
--network=cda \
--network-alias=$hostname \
--security-opt apparmor:unconfined \
--cap-add SYS_ADMIN \
--mount type=bind,source=${XDG_RUNTIME_DIR}/bus,target=${XDG_RUNTIME_DIR}/bus \
--mount type=bind,source=/run/dbus/system_bus_socket,target=/run/dbus/system_bus_socket \
--env=DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS \
"$registry/$name:$version"
echo " Remove existing postgres run files. Please wait"
sleep 2
docker exec -t "$name" sh -c "rm -rf /var/run/postgresql/*; systemctl restart postgresql-9.6.service;"
#Deploy the proxy container.
sed 's/sandbox-hdp-security/sandbox-hdp/g' assets/generate-proxy-deploy-script.sh > assets/generate-proxy-deploy-script.sh.new
mv -f assets/generate-proxy-deploy-script.sh.new assets/generate-proxy-deploy-script.sh
chmod +x assets/generate-proxy-deploy-script.sh
assets/generate-proxy-deploy-script.sh 2>/dev/null
#check to see if it's windows
if uname | grep MINGW; then
sed -i -e 's/\( \/[a-z]\)/\U\1:/g' sandbox/proxy/proxy-deploy.sh
fi
chmod +x sandbox/proxy/proxy-deploy.sh 2>/dev/null
sandbox/proxy/proxy-deploy.sh