-
Notifications
You must be signed in to change notification settings - Fork 0
/
qlik_data_movement_gateway_container.sh
93 lines (66 loc) · 2.82 KB
/
qlik_data_movement_gateway_container.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
93
#!/usr/bin/env bash
qlik_data_movement_gateway_script_path=$(readlink -e "${BASH_SOURCE[0]}")
qlik_data_movement_gateway_script_dir="${qlik_data_movement_gateway_script_path%/*}"
# shellcheck source=qlik_data_movement_gateway_config.sh
source "${qlik_data_movement_gateway_script_dir}/qlik_data_movement_gateway_config.sh"
qlik_data_movement_gateway_init() {
printf "init:\n"
if [ "${qlik_data_movement_gateway_host_replicate_port}" = "disabled" ]; then
local -r rport_map=""
elif [ "${qlik_data_movement_gateway_host_replicate_port}" = "dynamic" ]; then
local -r rport_map="-P"
else
local -r rport_map="-p ${qlik_data_movement_gateway_host_replicate_port}:3552/tcp"
fi
if [ ! "${qlik_data_movement_gateway_type}" = "service" ] \
&& [ ! "${qlik_data_movement_gateway_type}" = "instance" ] \
&& [ ! "${qlik_data_movement_gateway_type}" = "instance-rpm" ] \
&& [ ! "${qlik_data_movement_gateway_type}" = "instance-minimal" ] \
; then
printf " ERROR: Invalid gateway type. Gateway type must be one of [ instance | instance-rpm | instance-minimal | service ] but qlik_data_movement_gateway_type=%s\n" "${qlik_data_movement_gateway_type}"
return 1
fi
if [ ! "${qlik_data_movement_gateway_type}" = "service" ]; then
docker run -d --init ${rport_map} --network "${qlik_data_movement_gateway_network}" --name "${qlik_data_movement_gateway_container_name}" "${qlik_data_movement_gateway_image}:${qlik_data_movement_gateway_tag}"
else
docker run -d --privileged "${rport_map}" --network "${qlik_data_movement_gateway_network}" --name "${qlik_data_movement_gateway_container_name}" "${qlik_data_movement_gateway_image}:${qlik_data_movement_gateway_tag}"
# allow time so that registration and other exec commands will work against container
sleep 3
printf " DEBUG: executing init-start\n"
docker exec "${qlik_data_movement_gateway_container_name}" /bin/bash -c /root/init-start.sh
fi
sleep 1
# set the replicate web ui password
docker exec "${qlik_data_movement_gateway_container_name}" /opt/qlik/gateway/movement/bin/agentctl agent set_config -p "${qlik_data_movement_gateway_replicate_password}"
if [ $# -gt 0 ]; then
qlik_data_movement_gateway "${@}"
return $?
else
return 0
fi
}
qlik_data_movement_gateway_start() {
printf "start:\n"
docker start "${qlik_data_movement_gateway_container_name}"
if [ $# -gt 0 ]; then
qlik_data_movement_gateway "${@}"
return $?
else
return 0
fi
}
qlik_data_movement_gateway_stop() {
printf "stop:\n"
docker stop "${qlik_data_movement_gateway_container_name}"
if [ $# -gt 0 ]; then
qlik_data_movement_gateway "${@}"
return $?
else
return 0
fi
}
qlik_data_movement_gateway_shell() {
printf "shell:\n"
docker exec -it "${qlik_data_movement_gateway_container_name}" /bin/bash
return $?
}