-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
entrypoint.sh
executable file
·64 lines (57 loc) · 1.85 KB
/
entrypoint.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
#!/bin/bash
set -e
set -o pipefail
# shellcheck source=assets/runtime/functions.sh
FUNCTIONS_FILE="${SALT_RUNTIME_DIR}/functions.sh"
source "${FUNCTIONS_FILE}"
[[ "${DEBUG,,}" == true ]] && set -o xtrace
case "${1}" in
app:start|app:gen-signed-keys)
initialize_system
case "${1}" in
app:start)
salt-master --versions
log_info "Starting supervisord ..."
exec /usr/bin/supervisord -nc /etc/supervisor/supervisord.conf
;;
app:gen-signed-keys)
shift 1
new_keys_dir="$(gen_signed_keys "${1}")"
log_info "Generated keys are available inside the keys directory at: ${new_keys_dir##"${SALT_KEYS_DIR}"/}"
;;
*)
log_error "Unknown command: ${1}"
exit 1
;;
esac
;;
app:restart)
shift 1
case "${1}" in
salt-master|salt-api)
log_info "Restarting ${1} service ..."
exec supervisorctl restart "${1}"
;;
*)
log_error "Unable to restart ${1} service. Service is unknown"
exit 1
;;
esac
;;
app:reload-3rd-formulas)
configure_salt_formulas
exec "$0" app:restart salt-master
;;
app:help)
echo "Available options:"
echo " app:start - Start configured services. (default)"
echo " app:restart - Restart the specified service on a running container. Choices: salt-master, salt-api"
echo " app:reload-3rd-formulas - Update master.yml with available 3rd-formulas and restart salt-master service"
echo " app:gen-signed-keys <key_name> - Create a master_sign key pair and its signature inside ${SALT_KEYS_DIR}/generated/"
echo " app:help - Displays this help."
echo " [command] - Execute the specified command, eg. bash."
;;
*)
exec "$@"
;;
esac